diff options
author | Georgy Yakovlev <gyakovlev@gentoo.org> | 2022-09-15 17:17:38 -0700 |
---|---|---|
committer | Georgy Yakovlev <gyakovlev@gentoo.org> | 2022-09-15 17:46:12 -0700 |
commit | 941cc3c5faae01bff0045d92e62da0a9689a0358 (patch) | |
tree | 9b4ee913b45701a843887317f3faaab5c20221af /dev-lang | |
parent | profiles/features/clang: add LLVM_USE_LIBCXX, CXXSTDLIB (diff) | |
download | gentoo-941cc3c5faae01bff0045d92e62da0a9689a0358.tar.gz gentoo-941cc3c5faae01bff0045d92e62da0a9689a0358.tar.bz2 gentoo-941cc3c5faae01bff0045d92e62da0a9689a0358.zip |
dev-lang/rust: fix bootstrap on musl systems without gcc_s
After extensive debug session we can bootstrap rust with
upstream tarball on clang-musl-no-gcc system
Thanks-to: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Thanks-to: Sam James <sam@gentoo.org>
Closes: https://bugs.gentoo.org/870280
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/rust/rust-1.63.0-r1.ebuild | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dev-lang/rust/rust-1.63.0-r1.ebuild b/dev-lang/rust/rust-1.63.0-r1.ebuild index 6031ffd57528..2fdf93de9880 100644 --- a/dev-lang/rust/rust-1.63.0-r1.ebuild +++ b/dev-lang/rust/rust-1.63.0-r1.ebuild @@ -253,8 +253,29 @@ pkg_setup() { fi } + +esetup_unwind_hack() { + # https://bugs.gentoo.org/870280 + # this is a hack needed to bootstrap with libgcc_s linked tarball on llvm-libunwind system + # it should trigger for internal bootstrap or system-bootstrap with rust-bin + # the whole idea is for stage0 to bootstrap with fake libgcc_s + # final stage will receive -L${T}/lib but not -lgcc_s args, producing clean compiler. + local fakelib="${T}/fakelib" + mkdir -p "${fakelib}" || die + # we need both symlinks, one for cargo runtime, other for linker. + ln -s "${ESYSROOT}/usr/lib/libunwind.so" "${fakelib}/libgcc_s.so.1" || die + ln -s "${ESYSROOT}/usr/lib/libunwind.so" "${fakelib}/libgcc_s.so" || die + export LD_LIBRARY_PATH="${fakelib}" + export RUSTFLAGS+=" -L${fakelib}" + # this is a literally magic variable that gets through cargo cache, without it some + # crates ignore RUSTFLAGS + # this variable can not contain leading space + export MAGIC_EXTRA_RUSTFLAGS+="${MAGIC_EXTRA_RUSTFLAGS:+ }-L${fakelib}" +} + src_prepare() { if ! use system-bootstrap; then + has_version sys-devel/gcc || esetup_unwind_hack local rust_stage0_root="${WORKDIR}"/rust-stage0 local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" @@ -551,6 +572,7 @@ src_configure() { echo RUSTFLAGS="${RUSTFLAGS:-}" echo RUSTFLAGS_BOOTSTRAP="${RUSTFLAGS_BOOTSTRAP:-}" echo RUSTFLAGS_NOT_BOOTSTRAP="${RUSTFLAGS_NOT_BOOTSTRAP:-}" + echo MAGIC_EXTRA_RUSTFLAGS="${MAGIC_EXTRA_RUSTFLAGS:-}" env | grep "CARGO_TARGET_.*_RUSTFLAGS=" cat "${S}"/config.env || die echo |