1 |
commit: 320e0789812c511e8ab31fc6bec9b3162a6416ae |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 5 20:31:55 2021 +0000 |
4 |
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 5 20:31:55 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=320e0789 |
7 |
|
8 |
sys-libs/glibc: some rework of 9999 ebuild, needs testing (e.g. crossdev) |
9 |
|
10 |
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> |
11 |
|
12 |
sys-libs/glibc/glibc-9999.ebuild | 175 +++++++++++++++++++++------------------ |
13 |
1 file changed, 96 insertions(+), 79 deletions(-) |
14 |
|
15 |
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild |
16 |
index 39b77e312fa5..ea87ec9994c8 100644 |
17 |
--- a/sys-libs/glibc/glibc-9999.ebuild |
18 |
+++ b/sys-libs/glibc/glibc-9999.ebuild |
19 |
@@ -401,6 +401,7 @@ setup_flags() { |
20 |
filter-flags '-O?' |
21 |
append-flags -O2 |
22 |
fi |
23 |
+ |
24 |
strip-unsupported-flags |
25 |
filter-flags -m32 -m64 '-mabi=*' |
26 |
|
27 |
@@ -515,14 +516,103 @@ setup_env() { |
28 |
einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
29 |
return 0 |
30 |
fi |
31 |
- local VAR=CFLAGS_${ABI} |
32 |
+ |
33 |
+ # Glibc does not work with gold (for various reasons) #269274. |
34 |
+ tc-ld-disable-gold |
35 |
+ |
36 |
+ if use doc ; then |
37 |
+ export MAKEINFO=makeinfo |
38 |
+ else |
39 |
+ export MAKEINFO=/dev/null |
40 |
+ fi |
41 |
+ |
42 |
+ # Reset CC to the value at start of emerge |
43 |
+ export CC=${__ORIG_CC:-${CC}} |
44 |
+ |
45 |
+ if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then |
46 |
+ |
47 |
+ # If we are running in an otherwise clang/llvm environment, we need to |
48 |
+ # recover the proper gcc and binutils settings here, at least until glibc |
49 |
+ # is finally building with clang. So let's override everything that is |
50 |
+ # set in the clang profiles. |
51 |
+ # Want to shoot yourself into the foot? Set USE=custom-cflags, that's always |
52 |
+ # a good start into that direction. |
53 |
+ # Also, if you're crosscompiling, let's assume you know what you are doing. |
54 |
+ # Hopefully. |
55 |
+ |
56 |
+ local current_binutils_path=$(binutils-config -B) |
57 |
+ local current_gcc_path=$(gcc-config -B) |
58 |
+ einfo "Overriding clang configuration, since it won't work here" |
59 |
+ |
60 |
+ export __ORIG_CC=${CC} |
61 |
+ |
62 |
+ export CC="${current_gcc_path}/gcc" |
63 |
+ export CXX="${current_gcc_path}/g++" |
64 |
+ export LD="${current_binutils_path}/ld.bfd" |
65 |
+ export AR="${current_binutils_path}/ar" |
66 |
+ export AS="${current_binutils_path}/as" |
67 |
+ export NM="${current_binutils_path}/nm" |
68 |
+ export STRIP="${current_binutils_path}/strip" |
69 |
+ export RANLIB="${current_binutils_path}/ranlib" |
70 |
+ export OBJCOPY="${current_binutils_path}/objcopy" |
71 |
+ export STRINGS="${current_binutils_path}/strings" |
72 |
+ export OBJDUMP="${current_binutils_path}/objdump" |
73 |
+ export READELF="${current_binutils_path}/readelf" |
74 |
+ export ADDR2LINE="${current_binutils_path}/addr2line" |
75 |
+ |
76 |
+ # do we need to also do flags munging here? yes! at least... |
77 |
+ filter-flags '-fuse-ld=*' |
78 |
+ filter-flags '-D_FORTIFY_SOURCE=*' |
79 |
+ |
80 |
+ else |
81 |
+ |
82 |
+ # this is the "normal" case |
83 |
+ |
84 |
+ export __ORIG_CC=${CC} |
85 |
+ |
86 |
+ export CC="$(tc-getCC ${CTARGET})" |
87 |
+ export CXX="$(tc-getCXX ${CTARGET})" |
88 |
+ |
89 |
+ # Always use tuple-prefixed toolchain. For non-native ABI glibc's configure |
90 |
+ # can't detect them automatically due to ${CHOST} mismatch and fallbacks |
91 |
+ # to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup(). |
92 |
+ export NM="$(tc-getNM ${CTARGET})" |
93 |
+ export READELF="$(tc-getREADELF ${CTARGET})" |
94 |
+ |
95 |
+ fi |
96 |
+ |
97 |
# We need to export CFLAGS with abi information in them because glibc's |
98 |
# configure script checks CFLAGS for some targets (like mips). Keep |
99 |
# around the original clean value to avoid appending multiple ABIs on |
100 |
- # top of each other. |
101 |
- : ${__GLIBC_CC:=$(tc-getCC ${CTARGET})} |
102 |
- export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
103 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
104 |
+ # top of each other. (Why does the comment talk about CFLAGS if the code |
105 |
+ # acts on CC?) |
106 |
+ export __GLIBC_CC=${CC} |
107 |
+ export __GLIBC_CXX=${CXX} |
108 |
+ |
109 |
+ export __abi_CFLAGS="$(get_abi_CFLAGS)" |
110 |
+ |
111 |
+ # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
112 |
+ # To build .S (assembly) files with the same ABI-specific flags |
113 |
+ # upstream currently recommends adding CFLAGS to CC/CXX: |
114 |
+ # https://sourceware.org/PR23273 |
115 |
+ # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
116 |
+ # and breaks multiarch support. See 659030#c3 for an example. |
117 |
+ # The glibc configure script doesn't properly use LDFLAGS all the time. |
118 |
+ export CC="${__GLIBC_CC} ${__abi_CFLAGS} ${LDFLAGS}" |
119 |
+ |
120 |
+ # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
121 |
+ export CXX="${__GLIBC_CXX} ${__abi_CFLAGS}" |
122 |
+ |
123 |
+ if is_crosscompile; then |
124 |
+ # Assume worst-case bootstrap: glibc is buil first time |
125 |
+ # when ${CTARGET}-g++ is not available yet. We avoid |
126 |
+ # building auxiliary programs that require C++: bug #683074 |
127 |
+ # It should not affect final result. |
128 |
+ export libc_cv_cxx_link_ok=no |
129 |
+ # The line above has the same effect. We set CXX explicitly |
130 |
+ # to make build logs less confusing. |
131 |
+ export CXX= |
132 |
+ fi |
133 |
} |
134 |
|
135 |
foreach_abi() { |
136 |
@@ -812,86 +902,13 @@ src_prepare() { |
137 |
} |
138 |
|
139 |
glibc_do_configure() { |
140 |
- # Glibc does not work with gold (for various reasons) #269274. |
141 |
- tc-ld-disable-gold |
142 |
- |
143 |
- # CXX isnt handled by the multilib system, so if we dont unset here |
144 |
- # we accumulate crap across abis |
145 |
- unset CXX |
146 |
- |
147 |
- # If we are running in an otherwise clang/llvm environment, we need to |
148 |
- # recover the proper gcc and binutils settings here, at least until glibc |
149 |
- # is finally building with clang. So let's override everything that is |
150 |
- # set in the clang profiles. |
151 |
- # Want to shoot yourself into the foot? Set USE=custom-cflags, that's always |
152 |
- # a good start into that direction. |
153 |
- if tc-is-clang && ! use custom-cflags ; then |
154 |
- local current_binutils_path=$(binutils-config -B) |
155 |
- local current_gcc_path=$(gcc-config -B) |
156 |
- einfo "Overriding clang configuration, since it won't work here" |
157 |
- |
158 |
- export CC="${current_gcc_path}/gcc" |
159 |
- export LD="${current_binutils_path}/ld.bfd" |
160 |
- export AR="${current_binutils_path}/ar" |
161 |
- export AS="${current_binutils_path}/as" |
162 |
- export NM="${current_binutils_path}/nm" |
163 |
- export STRIP="${current_binutils_path}/strip" |
164 |
- export RANLIB="${current_binutils_path}/ranlib" |
165 |
- export OBJCOPY="${current_binutils_path}/objcopy" |
166 |
- export STRINGS="${current_binutils_path}/strings" |
167 |
- export OBJDUMP="${current_binutils_path}/objdump" |
168 |
- export READELF="${current_binutils_path}/readelf" |
169 |
- export ADDR2LINE="${current_binutils_path}/addr2line" |
170 |
- |
171 |
- # do we need to also do flags munging here? |
172 |
- fi |
173 |
- |
174 |
- if use doc ; then |
175 |
- export MAKEINFO=makeinfo |
176 |
- else |
177 |
- export MAKEINFO=/dev/null |
178 |
- fi |
179 |
|
180 |
local v |
181 |
- for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do |
182 |
+ for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do |
183 |
einfo " $(printf '%15s' ${v}:) ${!v}" |
184 |
done |
185 |
|
186 |
- # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
187 |
- # To build .S (assembly) files with the same ABI-specific flags |
188 |
- # upstream currently recommends adding CFLAGS to CC/CXX: |
189 |
- # https://sourceware.org/PR23273 |
190 |
- # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
191 |
- # and breaks multiarch support. See 659030#c3 for an example. |
192 |
- # The glibc configure script doesn't properly use LDFLAGS all the time. |
193 |
- export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" |
194 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
195 |
- |
196 |
- # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
197 |
- export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" |
198 |
- |
199 |
- if is_crosscompile; then |
200 |
- # Assume worst-case bootstrap: glibc is buil first time |
201 |
- # when ${CTARGET}-g++ is not available yet. We avoid |
202 |
- # building auxiliary programs that require C++: bug #683074 |
203 |
- # It should not affect final result. |
204 |
- export libc_cv_cxx_link_ok=no |
205 |
- # The line above has the same effect. We set CXX explicitly |
206 |
- # to make build logs less confusing. |
207 |
- export CXX= |
208 |
- fi |
209 |
- einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
210 |
- |
211 |
- # Always use tuple-prefixed toolchain. For non-native ABI glibc's configure |
212 |
- # can't detect them automatically due to ${CHOST} mismatch and fallbacks |
213 |
- # to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup(). |
214 |
- export NM="$(tc-getNM ${CTARGET})" |
215 |
- export READELF="$(tc-getREADELF ${CTARGET})" |
216 |
- einfo " $(printf '%15s' 'Manual NM:') ${NM}" |
217 |
- einfo " $(printf '%15s' 'Manual READELF:') ${READELF}" |
218 |
- |
219 |
echo |
220 |
- |
221 |
local myconf=() |
222 |
|
223 |
case ${CTARGET} in |