1 |
commit: 74c82761ee2b2145fc03019edb187869f6856a38 |
2 |
Author: Jacob Floyd <cognifloyd <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Dec 20 21:46:30 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 27 09:49:32 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74c82761 |
7 |
|
8 |
sys-libs/libcxx: fix prefix bootstrap |
9 |
|
10 |
When bootstrapping prefix on darwin, libcxx must be installed before |
11 |
llvm is built during stage2 (in EPREFIX/tmp) and during stage3 (in |
12 |
EPREFIX). llvm_pkg_setup, however, identifies the *installed* llvm to |
13 |
set environment variables with the correct path to llvm. Since llvm is |
14 |
not installed, we have to skip that step. But during bootstrap, we don't |
15 |
need those environment vars to be modified anyway because |
16 |
bootstrap-prefix.sh already sets them with the paths to the correct llvm |
17 |
(which is the host's llm during stage2 and the EPREFIX/tmp llvm during |
18 |
stage3). |
19 |
|
20 |
Once stage3 is complete, llvm is installed in EPREFIX, so the system |
21 |
rebuild (with `emerge -e system`) will successfully use llvm_pkg_setup. |
22 |
bootstrap-prefix.sh is no longer controlling the vars at that point, so |
23 |
it is important to allow llvm_pkg_setup to correctly modify the vars. |
24 |
|
25 |
Other required fixes include: |
26 |
- eprefrixify some dylib paths in CMakeLists.txt (dylib is only used |
27 |
on darwin, so this is not an issue when compiling on other platforms). |
28 |
- ensure want_gcc_s is OFF even if use=-libunwind on darwin |
29 |
- keyword with ~x64-macos |
30 |
|
31 |
Bug: https://bugs.gentoo.org/758167 |
32 |
Signed-off-by: Jacob Floyd <cognifloyd <AT> gmail.com> |
33 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
34 |
|
35 |
profiles/prefix/darwin/macos/package.use.force | 4 ++++ |
36 |
sys-libs/libcxx/libcxx-11.0.0.ebuild | 27 ++++++++++++++++++++++---- |
37 |
sys-libs/libcxx/libcxx-11.0.1.9999.ebuild | 25 +++++++++++++++++++++--- |
38 |
sys-libs/libcxx/libcxx-11.0.1_rc1.ebuild | 25 +++++++++++++++++++++--- |
39 |
sys-libs/libcxx/libcxx-11.0.1_rc2.ebuild | 25 +++++++++++++++++++++--- |
40 |
sys-libs/libcxx/libcxx-12.0.0.9999.ebuild | 25 +++++++++++++++++++++--- |
41 |
6 files changed, 115 insertions(+), 16 deletions(-) |
42 |
|
43 |
diff --git a/profiles/prefix/darwin/macos/package.use.force b/profiles/prefix/darwin/macos/package.use.force |
44 |
index 4b4798eb7ee..c1677ba9252 100644 |
45 |
--- a/profiles/prefix/darwin/macos/package.use.force |
46 |
+++ b/profiles/prefix/darwin/macos/package.use.force |
47 |
@@ -21,3 +21,7 @@ media-gfx/tachyon threads opengl |
48 |
# Elias Pipping <pipping@g.o> (2007-11-29) |
49 |
# won't compile without |
50 |
media-libs/libsdl opengl |
51 |
+ |
52 |
+# Jacob Floyd <cognifloyd@×××××.org> (2020-12-20) |
53 |
+# Make sure we always use libcxxabi on macos prefix |
54 |
+sys-libs/libcxx libcxxabi |
55 |
|
56 |
diff --git a/sys-libs/libcxx/libcxx-11.0.0.ebuild b/sys-libs/libcxx/libcxx-11.0.0.ebuild |
57 |
index d4ba5210700..cb077d76d64 100644 |
58 |
--- a/sys-libs/libcxx/libcxx-11.0.0.ebuild |
59 |
+++ b/sys-libs/libcxx/libcxx-11.0.0.ebuild |
60 |
@@ -14,7 +14,7 @@ llvm.org_set_globals |
61 |
|
62 |
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" |
63 |
SLOT="0" |
64 |
-KEYWORDS="amd64 arm arm64 ~riscv x86" |
65 |
+KEYWORDS="amd64 arm arm64 ~riscv x86 ~x64-macos" |
66 |
IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind +static-libs test" |
67 |
REQUIRED_USE="libunwind? ( libcxxabi )" |
68 |
RESTRICT="!test? ( test )" |
69 |
@@ -41,7 +41,11 @@ python_check_deps() { |
70 |
} |
71 |
|
72 |
pkg_setup() { |
73 |
- llvm_pkg_setup |
74 |
+ # darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix |
75 |
+ # to set the appropriate path vars to LLVM instead of using llvm_pkg_setup. |
76 |
+ if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then |
77 |
+ llvm_pkg_setup |
78 |
+ fi |
79 |
use test && python-any-r1_pkg_setup |
80 |
|
81 |
if ! use libcxxabi && ! tc-is-gcc ; then |
82 |
@@ -58,6 +62,10 @@ src_prepare() { |
83 |
eapply "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" |
84 |
|
85 |
llvm.org_src_prepare |
86 |
+ |
87 |
+ # eprefixify static path references to libc++abi for symbol re-export to |
88 |
+ # avoid linking against it twice in both /usr/lib and ${EPREFIX}/usr/lib |
89 |
+ sed -i -e "s^/usr/lib/libc++abi.dylib^${EPREFIX}&^g" lib/CMakeLists.txt || die |
90 |
} |
91 |
|
92 |
test_compiler() { |
93 |
@@ -99,6 +107,15 @@ multilib_src_configure() { |
94 |
extra_libs+=( "${compiler_rt}" ) |
95 |
fi |
96 |
fi |
97 |
+ elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then |
98 |
+ # clang-based darwin prefix disables libunwind useflag during |
99 |
+ # bootstrap, because libunwind is not in the prefix yet. |
100 |
+ # override the default, though, because clang based libcxx |
101 |
+ # should never use gcc_s on Darwin. |
102 |
+ want_gcc_s=OFF |
103 |
+ # compiler_rt is not available in EPREFIX during bootstrap, |
104 |
+ # so we cannot link to it yet anyway, so keep the defaults |
105 |
+ # of want_compiler_rt=OFF and extra_libs=() |
106 |
fi |
107 |
|
108 |
# bootstrap: cmake is unhappy if compiler can't link to stdlib |
109 |
@@ -188,8 +205,10 @@ gen_shared_ldscript() { |
110 |
|
111 |
multilib_src_install() { |
112 |
cmake_src_install |
113 |
- gen_shared_ldscript |
114 |
- use static-libs && gen_static_ldscript |
115 |
+ if [[ ${CHOST} != *-darwin* ]] ; then |
116 |
+ gen_shared_ldscript |
117 |
+ use static-libs && gen_static_ldscript |
118 |
+ fi |
119 |
} |
120 |
|
121 |
pkg_postinst() { |
122 |
|
123 |
diff --git a/sys-libs/libcxx/libcxx-11.0.1.9999.ebuild b/sys-libs/libcxx/libcxx-11.0.1.9999.ebuild |
124 |
index dd1a1a1f3a2..8d2f6ea8621 100644 |
125 |
--- a/sys-libs/libcxx/libcxx-11.0.1.9999.ebuild |
126 |
+++ b/sys-libs/libcxx/libcxx-11.0.1.9999.ebuild |
127 |
@@ -42,7 +42,11 @@ python_check_deps() { |
128 |
} |
129 |
|
130 |
pkg_setup() { |
131 |
- llvm_pkg_setup |
132 |
+ # darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix |
133 |
+ # to set the appropriate path vars to LLVM instead of using llvm_pkg_setup. |
134 |
+ if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then |
135 |
+ llvm_pkg_setup |
136 |
+ fi |
137 |
use test && python-any-r1_pkg_setup |
138 |
|
139 |
if ! use libcxxabi && ! tc-is-gcc ; then |
140 |
@@ -59,6 +63,10 @@ src_prepare() { |
141 |
eapply "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" |
142 |
|
143 |
llvm.org_src_prepare |
144 |
+ |
145 |
+ # eprefixify static path references to libc++abi for symbol re-export to |
146 |
+ # avoid linking against it twice in both /usr/lib and ${EPREFIX}/usr/lib |
147 |
+ sed -i -e "s^/usr/lib/libc++abi.dylib^${EPREFIX}&^g" lib/CMakeLists.txt || die |
148 |
} |
149 |
|
150 |
test_compiler() { |
151 |
@@ -100,6 +108,15 @@ multilib_src_configure() { |
152 |
extra_libs+=( "${compiler_rt}" ) |
153 |
fi |
154 |
fi |
155 |
+ elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then |
156 |
+ # clang-based darwin prefix disables libunwind useflag during |
157 |
+ # bootstrap, because libunwind is not in the prefix yet. |
158 |
+ # override the default, though, because clang based libcxx |
159 |
+ # should never use gcc_s on Darwin. |
160 |
+ want_gcc_s=OFF |
161 |
+ # compiler_rt is not available in EPREFIX during bootstrap, |
162 |
+ # so we cannot link to it yet anyway, so keep the defaults |
163 |
+ # of want_compiler_rt=OFF and extra_libs=() |
164 |
fi |
165 |
|
166 |
# bootstrap: cmake is unhappy if compiler can't link to stdlib |
167 |
@@ -189,8 +206,10 @@ gen_shared_ldscript() { |
168 |
|
169 |
multilib_src_install() { |
170 |
cmake_src_install |
171 |
- gen_shared_ldscript |
172 |
- use static-libs && gen_static_ldscript |
173 |
+ if [[ ${CHOST} != *-darwin* ]] ; then |
174 |
+ gen_shared_ldscript |
175 |
+ use static-libs && gen_static_ldscript |
176 |
+ fi |
177 |
} |
178 |
|
179 |
pkg_postinst() { |
180 |
|
181 |
diff --git a/sys-libs/libcxx/libcxx-11.0.1_rc1.ebuild b/sys-libs/libcxx/libcxx-11.0.1_rc1.ebuild |
182 |
index dd1a1a1f3a2..8d2f6ea8621 100644 |
183 |
--- a/sys-libs/libcxx/libcxx-11.0.1_rc1.ebuild |
184 |
+++ b/sys-libs/libcxx/libcxx-11.0.1_rc1.ebuild |
185 |
@@ -42,7 +42,11 @@ python_check_deps() { |
186 |
} |
187 |
|
188 |
pkg_setup() { |
189 |
- llvm_pkg_setup |
190 |
+ # darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix |
191 |
+ # to set the appropriate path vars to LLVM instead of using llvm_pkg_setup. |
192 |
+ if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then |
193 |
+ llvm_pkg_setup |
194 |
+ fi |
195 |
use test && python-any-r1_pkg_setup |
196 |
|
197 |
if ! use libcxxabi && ! tc-is-gcc ; then |
198 |
@@ -59,6 +63,10 @@ src_prepare() { |
199 |
eapply "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" |
200 |
|
201 |
llvm.org_src_prepare |
202 |
+ |
203 |
+ # eprefixify static path references to libc++abi for symbol re-export to |
204 |
+ # avoid linking against it twice in both /usr/lib and ${EPREFIX}/usr/lib |
205 |
+ sed -i -e "s^/usr/lib/libc++abi.dylib^${EPREFIX}&^g" lib/CMakeLists.txt || die |
206 |
} |
207 |
|
208 |
test_compiler() { |
209 |
@@ -100,6 +108,15 @@ multilib_src_configure() { |
210 |
extra_libs+=( "${compiler_rt}" ) |
211 |
fi |
212 |
fi |
213 |
+ elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then |
214 |
+ # clang-based darwin prefix disables libunwind useflag during |
215 |
+ # bootstrap, because libunwind is not in the prefix yet. |
216 |
+ # override the default, though, because clang based libcxx |
217 |
+ # should never use gcc_s on Darwin. |
218 |
+ want_gcc_s=OFF |
219 |
+ # compiler_rt is not available in EPREFIX during bootstrap, |
220 |
+ # so we cannot link to it yet anyway, so keep the defaults |
221 |
+ # of want_compiler_rt=OFF and extra_libs=() |
222 |
fi |
223 |
|
224 |
# bootstrap: cmake is unhappy if compiler can't link to stdlib |
225 |
@@ -189,8 +206,10 @@ gen_shared_ldscript() { |
226 |
|
227 |
multilib_src_install() { |
228 |
cmake_src_install |
229 |
- gen_shared_ldscript |
230 |
- use static-libs && gen_static_ldscript |
231 |
+ if [[ ${CHOST} != *-darwin* ]] ; then |
232 |
+ gen_shared_ldscript |
233 |
+ use static-libs && gen_static_ldscript |
234 |
+ fi |
235 |
} |
236 |
|
237 |
pkg_postinst() { |
238 |
|
239 |
diff --git a/sys-libs/libcxx/libcxx-11.0.1_rc2.ebuild b/sys-libs/libcxx/libcxx-11.0.1_rc2.ebuild |
240 |
index dd1a1a1f3a2..8d2f6ea8621 100644 |
241 |
--- a/sys-libs/libcxx/libcxx-11.0.1_rc2.ebuild |
242 |
+++ b/sys-libs/libcxx/libcxx-11.0.1_rc2.ebuild |
243 |
@@ -42,7 +42,11 @@ python_check_deps() { |
244 |
} |
245 |
|
246 |
pkg_setup() { |
247 |
- llvm_pkg_setup |
248 |
+ # darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix |
249 |
+ # to set the appropriate path vars to LLVM instead of using llvm_pkg_setup. |
250 |
+ if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then |
251 |
+ llvm_pkg_setup |
252 |
+ fi |
253 |
use test && python-any-r1_pkg_setup |
254 |
|
255 |
if ! use libcxxabi && ! tc-is-gcc ; then |
256 |
@@ -59,6 +63,10 @@ src_prepare() { |
257 |
eapply "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" |
258 |
|
259 |
llvm.org_src_prepare |
260 |
+ |
261 |
+ # eprefixify static path references to libc++abi for symbol re-export to |
262 |
+ # avoid linking against it twice in both /usr/lib and ${EPREFIX}/usr/lib |
263 |
+ sed -i -e "s^/usr/lib/libc++abi.dylib^${EPREFIX}&^g" lib/CMakeLists.txt || die |
264 |
} |
265 |
|
266 |
test_compiler() { |
267 |
@@ -100,6 +108,15 @@ multilib_src_configure() { |
268 |
extra_libs+=( "${compiler_rt}" ) |
269 |
fi |
270 |
fi |
271 |
+ elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then |
272 |
+ # clang-based darwin prefix disables libunwind useflag during |
273 |
+ # bootstrap, because libunwind is not in the prefix yet. |
274 |
+ # override the default, though, because clang based libcxx |
275 |
+ # should never use gcc_s on Darwin. |
276 |
+ want_gcc_s=OFF |
277 |
+ # compiler_rt is not available in EPREFIX during bootstrap, |
278 |
+ # so we cannot link to it yet anyway, so keep the defaults |
279 |
+ # of want_compiler_rt=OFF and extra_libs=() |
280 |
fi |
281 |
|
282 |
# bootstrap: cmake is unhappy if compiler can't link to stdlib |
283 |
@@ -189,8 +206,10 @@ gen_shared_ldscript() { |
284 |
|
285 |
multilib_src_install() { |
286 |
cmake_src_install |
287 |
- gen_shared_ldscript |
288 |
- use static-libs && gen_static_ldscript |
289 |
+ if [[ ${CHOST} != *-darwin* ]] ; then |
290 |
+ gen_shared_ldscript |
291 |
+ use static-libs && gen_static_ldscript |
292 |
+ fi |
293 |
} |
294 |
|
295 |
pkg_postinst() { |
296 |
|
297 |
diff --git a/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild b/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild |
298 |
index dd1a1a1f3a2..8d2f6ea8621 100644 |
299 |
--- a/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild |
300 |
+++ b/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild |
301 |
@@ -42,7 +42,11 @@ python_check_deps() { |
302 |
} |
303 |
|
304 |
pkg_setup() { |
305 |
- llvm_pkg_setup |
306 |
+ # darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix |
307 |
+ # to set the appropriate path vars to LLVM instead of using llvm_pkg_setup. |
308 |
+ if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then |
309 |
+ llvm_pkg_setup |
310 |
+ fi |
311 |
use test && python-any-r1_pkg_setup |
312 |
|
313 |
if ! use libcxxabi && ! tc-is-gcc ; then |
314 |
@@ -59,6 +63,10 @@ src_prepare() { |
315 |
eapply "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" |
316 |
|
317 |
llvm.org_src_prepare |
318 |
+ |
319 |
+ # eprefixify static path references to libc++abi for symbol re-export to |
320 |
+ # avoid linking against it twice in both /usr/lib and ${EPREFIX}/usr/lib |
321 |
+ sed -i -e "s^/usr/lib/libc++abi.dylib^${EPREFIX}&^g" lib/CMakeLists.txt || die |
322 |
} |
323 |
|
324 |
test_compiler() { |
325 |
@@ -100,6 +108,15 @@ multilib_src_configure() { |
326 |
extra_libs+=( "${compiler_rt}" ) |
327 |
fi |
328 |
fi |
329 |
+ elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then |
330 |
+ # clang-based darwin prefix disables libunwind useflag during |
331 |
+ # bootstrap, because libunwind is not in the prefix yet. |
332 |
+ # override the default, though, because clang based libcxx |
333 |
+ # should never use gcc_s on Darwin. |
334 |
+ want_gcc_s=OFF |
335 |
+ # compiler_rt is not available in EPREFIX during bootstrap, |
336 |
+ # so we cannot link to it yet anyway, so keep the defaults |
337 |
+ # of want_compiler_rt=OFF and extra_libs=() |
338 |
fi |
339 |
|
340 |
# bootstrap: cmake is unhappy if compiler can't link to stdlib |
341 |
@@ -189,8 +206,10 @@ gen_shared_ldscript() { |
342 |
|
343 |
multilib_src_install() { |
344 |
cmake_src_install |
345 |
- gen_shared_ldscript |
346 |
- use static-libs && gen_static_ldscript |
347 |
+ if [[ ${CHOST} != *-darwin* ]] ; then |
348 |
+ gen_shared_ldscript |
349 |
+ use static-libs && gen_static_ldscript |
350 |
+ fi |
351 |
} |
352 |
|
353 |
pkg_postinst() { |