Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/xfsprogs/, sys-fs/xfsprogs/files/
Date: Fri, 03 Jun 2016 19:22:46
Message-Id: 1464981687.8806f22bf65d99348770bbb6207d199c74fd96c5.vapier@gentoo
1 commit: 8806f22bf65d99348770bbb6207d199c74fd96c5
2 Author: Gwendal Grignou <gwendal <AT> chromium <DOT> org>
3 AuthorDate: Fri Jun 3 19:21:18 2016 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 3 19:21:27 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8806f22b
7
8 sys-fs/xfsprogs: fix cross-compiling with build tools
9
10 .../files/xfsprogs-4.3.0-cross-compile.patch | 181 +++++++++++++++++++++
11 sys-fs/xfsprogs/xfsprogs-4.5.0.ebuild | 1 +
12 2 files changed, 182 insertions(+)
13
14 diff --git a/sys-fs/xfsprogs/files/xfsprogs-4.3.0-cross-compile.patch b/sys-fs/xfsprogs/files/xfsprogs-4.3.0-cross-compile.patch
15 new file mode 100644
16 index 0000000..c545664
17 --- /dev/null
18 +++ b/sys-fs/xfsprogs/files/xfsprogs-4.3.0-cross-compile.patch
19 @@ -0,0 +1,181 @@
20 +From 1a366eedc0eb4da46da48e9f6e2da27c7b5d2076 Mon Sep 17 00:00:00 2001
21 +From: Gwendal Grignou <gwendal@××××××××.org>
22 +Date: Fri, 3 Jun 2016 09:17:28 -0700
23 +Subject: [PATCH] Allow compiling xfsprogs in a cross compile environment.
24 +
25 +Without this patch, we are using the same compiler and options for the host
26 +compiler (BUILD_CC) and the target compiler (CC), and we would get error
27 +messages at compilation:
28 +x86_64-pc-linux-gnu-gcc -O2 -O2 -pipe -march=armv7-a -mtune=cortex-a15 ...
29 +x86_64-pc-linux-gnu-gcc.real: error: unrecognized command line option
30 +'-mfpu=neon'
31 +'-mfloat-abi=hard'
32 +'-clang-syntax'
33 +'-mfpu=neon'
34 +'-mfloat-abi=hard'
35 +'-clang-syntax'
36 +
37 +Add BUILD_CC and BUILD_CFLAGS as precious variables to allow setting it up
38 +from the ebuild.
39 +
40 +Signed-off-by: Gwendal Grignou <gwendal@××××××××.org>
41 +---
42 + configure | 26 +++++++++++++++++++++-----
43 + configure.ac | 20 +++++++++++++++-----
44 + include/builddefs.in | 6 ++++--
45 + libxfs/Makefile | 4 ++--
46 + 4 files changed, 42 insertions(+), 14 deletions(-)
47 +
48 +diff --git a/configure b/configure
49 +index 325081f..863a447 100755
50 +--- a/configure
51 ++++ b/configure
52 +@@ -700,6 +700,7 @@ libreadline
53 + enable_blkid
54 + enable_gettext
55 + enable_shared
56 ++BUILD_CFLAGS
57 + BUILD_CC
58 + CPP
59 + LT_SYS_LIBRARY_PATH
60 +@@ -806,7 +807,9 @@ LDFLAGS
61 + LIBS
62 + CPPFLAGS
63 + LT_SYS_LIBRARY_PATH
64 +-CPP'
65 ++CPP
66 ++BUILD_CC
67 ++BUILD_CFLAGS'
68 +
69 +
70 + # Initialize some variables set by options.
71 +@@ -1456,6 +1459,9 @@ Some influential environment variables:
72 + LT_SYS_LIBRARY_PATH
73 + User-defined run-time library search path.
74 + CPP C preprocessor
75 ++ BUILD_CC C compiler for build tools
76 ++ BUILD_CFLAGS
77 ++ C compiler flags for build tools
78 +
79 + Use these variables to override the choices made by `configure' or to help
80 + it to find libraries and programs with nonstandard names/locations.
81 +@@ -11957,11 +11963,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
82 + ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
83 + ac_compiler_gnu=$ac_cv_c_compiler_gnu
84 +
85 +-if test $cross_compiling = no; then
86 +- BUILD_CC="$CC"
87 +
88 +-else
89 +- for ac_prog in gcc cc
90 ++if test "${BUILD_CC+set}" != "set"; then
91 ++ if test $cross_compiling = no; then
92 ++ BUILD_CC="$CC"
93 ++ else
94 ++ for ac_prog in gcc cc
95 + do
96 + # Extract the first word of "$ac_prog", so it can be a program name with args.
97 + set dummy $ac_prog; ac_word=$2
98 +@@ -12003,6 +12010,15 @@ fi
99 + test -n "$BUILD_CC" && break
100 + done
101 +
102 ++ fi
103 ++fi
104 ++
105 ++if test "${BUILD_CFLAGS+set}" != "set"; then
106 ++ if test $cross_compiling = no; then
107 ++ BUILD_CFLAGS="$CFLAGS"
108 ++ else
109 ++ BUILD_CFLAGS="-g -O2"
110 ++ fi
111 + fi
112 +
113 + # Check whether --enable-shared was given.
114 +diff --git a/configure.ac b/configure.ac
115 +index d44438f..fc286b3 100644
116 +--- a/configure.ac
117 ++++ b/configure.ac
118 +@@ -9,11 +9,21 @@ AC_PREFIX_DEFAULT(/usr)
119 + AC_PROG_LIBTOOL
120 +
121 + AC_PROG_CC
122 +-if test $cross_compiling = no; then
123 +- BUILD_CC="$CC"
124 +- AC_SUBST(BUILD_CC)
125 +-else
126 +- AC_CHECK_PROGS(BUILD_CC, gcc cc)
127 ++AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
128 ++if test "${BUILD_CC+set}" != "set"; then
129 ++ if test $cross_compiling = no; then
130 ++ BUILD_CC="$CC"
131 ++ else
132 ++ AC_CHECK_PROGS(BUILD_CC, gcc cc)
133 ++ fi
134 ++fi
135 ++AC_ARG_VAR(BUILD_CFLAGS, [C compiler flags for build tools])
136 ++if test "${BUILD_CFLAGS+set}" != "set"; then
137 ++ if test $cross_compiling = no; then
138 ++ BUILD_CFLAGS="$CFLAGS"
139 ++ else
140 ++ BUILD_CFLAGS="-g -O2"
141 ++ fi
142 + fi
143 +
144 + AC_ARG_ENABLE(shared,
145 +diff --git a/include/builddefs.in b/include/builddefs.in
146 +index c2ca4cb..9ca57a6 100644
147 +--- a/include/builddefs.in
148 ++++ b/include/builddefs.in
149 +@@ -27,6 +27,7 @@ MALLOCLIB = @malloc_lib@
150 + LOADERFLAGS = @LDFLAGS@
151 + LTLDFLAGS = @LDFLAGS@
152 + CFLAGS = @CFLAGS@
153 ++BUILD_CFLAGS = @BUILD_CFLAGS@
154 +
155 + LIBRT = @librt@
156 + LIBUUID = @libuuid@
157 +@@ -150,7 +151,7 @@ PCFLAGS+= -DENABLE_BLKID
158 + endif
159 +
160 +
161 +-GCFLAGS = $(OPTIMIZER) $(DEBUG) \
162 ++GCFLAGS = $(DEBUG) \
163 + -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
164 + -DPACKAGE=\"$(PKG_NAME)\" -I$(TOPDIR)/include -I$(TOPDIR)/libxfs
165 +
166 +@@ -158,8 +159,9 @@ ifeq ($(ENABLE_GETTEXT),yes)
167 + GCFLAGS += -DENABLE_GETTEXT
168 + endif
169 +
170 ++BUILD_CFLAGS += $(GCFLAGS) $(PCFLAGS)
171 + # First, Global, Platform, Local CFLAGS
172 +-CFLAGS += $(FCFLAGS) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
173 ++CFLAGS += $(FCFLAGS) $(OPTIMIZER) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
174 +
175 + include $(TOPDIR)/include/buildmacros
176 +
177 +diff --git a/libxfs/Makefile b/libxfs/Makefile
178 +index 873d4ec..8d728c0 100644
179 +--- a/libxfs/Makefile
180 ++++ b/libxfs/Makefile
181 +@@ -111,7 +111,7 @@ default: crc32selftest ltdepend $(LTLIBRARY)
182 +
183 + crc32table.h: gen_crc32table.c
184 + @echo " [CC] gen_crc32table"
185 +- $(Q) $(BUILD_CC) $(CFLAGS) -o gen_crc32table $<
186 ++ $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -o gen_crc32table $<
187 + @echo " [GENERATE] $@"
188 + $(Q) ./gen_crc32table > crc32table.h
189 +
190 +@@ -122,7 +122,7 @@ crc32table.h: gen_crc32table.c
191 + # disk.
192 + crc32selftest: gen_crc32table.c crc32table.h crc32.c
193 + @echo " [TEST] CRC32"
194 +- $(Q) $(BUILD_CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
195 ++ $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
196 + $(Q) ./$@
197 +
198 + # set up include/xfs header directory
199 +--
200 +2.8.0.rc3.226.g39d4020
201
202 diff --git a/sys-fs/xfsprogs/xfsprogs-4.5.0.ebuild b/sys-fs/xfsprogs/xfsprogs-4.5.0.ebuild
203 index def69ae9..e462b06 100644
204 --- a/sys-fs/xfsprogs/xfsprogs-4.5.0.ebuild
205 +++ b/sys-fs/xfsprogs/xfsprogs-4.5.0.ebuild
206 @@ -32,6 +32,7 @@ DEPEND="${RDEPEND}
207 PATCHES=(
208 "${FILESDIR}"/${PN}-4.3.0-sharedlibs.patch
209 "${FILESDIR}"/${PN}-4.5.0-linguas.patch
210 + "${FILESDIR}"/${PN}-4.3.0-cross-compile.patch
211 )
212
213 pkg_setup() {