# Maintainer: Samuel Holland pkgname=rust pkgver=1.67.1 _bootver=1.66.1-r0 _llvmver=14 pkgrel=0 pkgdesc="The Rust Programming Language" url="https://www.rust-lang.org" arch="all" options="!check" # Failures on aarch64 and ppc64. license="(Apache-2.0 OR MIT) AND (NCSA OR MIT) AND BSD-2-Clause AND BSD-3-Clause" depends="$pkgname-std=$pkgver-r$pkgrel gcc musl-dev" makedepends=" curl-dev llvm$_llvmver-dev llvm$_llvmver-test-utils openssl-dev python3 cargo-bootstrap=$_bootver rust-bootstrap=$_bootver rustfmt-bootstrap=$_bootver zlib-dev " provides="$pkgname-bootstrap=$pkgver-r$pkgrel" subpackages=" $pkgname-dbg $pkgname-std $pkgname-analysis $pkgname-doc $pkgname-gdb::noarch $pkgname-lldb::noarch $pkgname-src::noarch cargo cargo-clippy:_cargo_clippy cargo-fmt:_cargo_fmt cargo-doc:_cargo_doc:noarch cargo-bash-completion:_cargo_bashcomp:noarch cargo-zsh-completion:_cargo_zshcomp:noarch rustfmt " source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.xz 0001-Fix-LLVM-build.patch 0002-Fix-linking-to-zlib-when-cross-compiling.patch 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch 0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch 0006-Link-libssp_nonshared.a-on-all-musl-targets.patch 0007-test-failed-doctest-output-Fix-normalization.patch 0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch 0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch 0010-Ignore-broken-and-non-applicable-tests.patch 0011-Link-stage-2-tools-dynamically-to-libstd.patch 0012-Move-debugger-scripts-to-usr-share-rust.patch 0013-Add-foxkit-target-specs.patch powerpc-atomics.patch " builddir="$srcdir/rustc-$pkgver-src" _rlibdir="/usr/lib/rustlib/$CTARGET/lib" build() { cat > config.toml <<- EOF changelog-seen = 2 [build] doc-stage = 2 build-stage = 2 test-stage = 2 build = "$CBUILD" host = [ "$CHOST" ] target = [ "$CTARGET" ] cargo = "/usr/bin/cargo" rustc = "/usr/bin/rustc" rustfmt = "/usr/bin/rustfmt" docs = true compiler-docs = false submodules = false python = "python3" locked-deps = true vendor = true extended = true tools = [ "analysis", "cargo", "clippy", "rustfmt", "src" ] verbose = 1 sanitizers = false profiler = false cargo-native-static = false [install] prefix = "/usr" [rust] optimize = true debug = false codegen-units = 1 debuginfo-level = 2 debuginfo-level-rustc = 0 debuginfo-level-tests = 0 backtrace = true incremental = false parallel-compiler = false channel = "stable" description = "Adelie ${pkgver}-r${pkgrel}" rpath = false verbose-tests = true optimize-tests = true codegen-tests = true dist-src = false lld = false use-lld = false llvm-tools = false backtrace-on-ice = true remap-debuginfo = false jemalloc = false llvm-libunwind = "no" new-symbol-mangling = true [target.$CTARGET] cc = "$CTARGET-gcc" cxx = "$CTARGET-g++" ar = "ar" ranlib = "ranlib" linker = "$CTARGET-gcc" llvm-config = "/usr/lib/llvm$_llvmver/bin/llvm-config" crt-static = false [dist] src-tarball = false compression-formats = [ "xz" ] EOF LLVM_LINK_SHARED=1 \ RUST_BACKTRACE=1 \ python3 x.py dist -j ${JOBS:-2} } check() { LLVM_LINK_SHARED=1 \ python3 x.py test -j ${JOBS:-2} --no-doc --no-fail-fast || true } package() { cd "$builddir"/build/dist tar xf rust-$pkgver-$CTARGET.tar.xz rust-$pkgver-$CTARGET/install.sh \ --destdir="$pkgdir" \ --prefix=/usr \ --sysconfdir="$pkgdir"/etc \ --disable-ldconfig tar xf rust-src-$pkgver.tar.xz rust-src-$pkgver/install.sh \ --destdir="$pkgdir" \ --prefix=/usr \ --disable-ldconfig rm "$pkgdir"/usr/lib/rustlib/components \ "$pkgdir"/usr/lib/rustlib/install.log \ "$pkgdir"/usr/lib/rustlib/manifest-* \ "$pkgdir"/usr/lib/rustlib/rust-installer-version \ "$pkgdir"/usr/lib/rustlib/uninstall.sh } std() { pkgdesc="Standard library for Rust" depends="musl-utils" _mv "$pkgdir"$_rlibdir/*.so "$subpkgdir"$_rlibdir mkdir -p "$subpkgdir"/etc/ld.so.conf.d echo "$_rlibdir" > "$subpkgdir"/etc/ld.so.conf.d/$pkgname.conf } analysis() { pkgdesc="Compiler analysis data for the Rust standard library" depends="$pkgname=$pkgver-r$pkgrel $pkgname-std=$pkgver-r$pkgrel" _mv "$pkgdir"${_rlibdir%/*}/analysis "$subpkgdir"${_rlibdir%/*} } gdb() { pkgdesc="GDB pretty printers for Rust" license="Apache-2.0 OR MIT" depends="$pkgname gdb" install_if="$pkgname=$pkgver-r$pkgrel gdb" _mv "$pkgdir"/usr/bin/rust-gdb "$subpkgdir"/usr/bin _mv "$pkgdir"/usr/bin/rust-gdbgui "$subpkgdir"/usr/bin _mv "$pkgdir"/usr/share/rust/gdb_*.py "$subpkgdir"/usr/share/rust } lldb() { pkgdesc="LLDB pretty printers for Rust" license="Apache-2.0 OR MIT" depends="$pkgname lldb py3-lldb" install_if="$pkgname=$pkgver-r$pkgrel lldb" _mv "$pkgdir"/usr/bin/rust-lldb "$subpkgdir"/usr/bin _mv "$pkgdir"/usr/share/rust/lldb_*.py "$subpkgdir"/usr/share/rust } src() { pkgdesc="$pkgdesc (source code)" depends="" _mv "$pkgdir"/usr/lib/rustlib/src/rust "$subpkgdir"/usr/src rmdir -p "$pkgdir"/usr/lib/rustlib/src 2>/dev/null || true mkdir -p "$subpkgdir"/usr/lib/rustlib/src ln -s ../../../src/rust "$subpkgdir"/usr/lib/rustlib/src/rust } cargo() { pkgdesc="The Rust package manager" provides="cargo-bootstrap=$pkgver-r$pkgrel" depends="$pkgname-std=$pkgver-r$pkgrel $pkgname" _mv "$pkgdir"/usr/bin/cargo "$subpkgdir"/usr/bin } _cargo_clippy() { pkgdesc="A collection of Rust lints (cargo plugin)" depends="$pkgname-std=$pkgver-r$pkgrel cargo" _mv "$pkgdir"/usr/bin/cargo-clippy \ "$pkgdir"/usr/bin/clippy-driver \ "$subpkgdir"/usr/bin } _cargo_fmt() { pkgdesc="Format Rust code (cargo plugin)" depends="$pkgname-std=$pkgver-r$pkgrel cargo rustfmt" install_if="cargo=$pkgver-r$pkgrel rustfmt=$pkgver-r$pkgrel" _mv "$pkgdir"/usr/bin/cargo-fmt "$subpkgdir"/usr/bin } _cargo_bashcomp() { pkgdesc="Bash completion for cargo" license="Apache-2.0 OR MIT" depends="" install_if="cargo=$pkgver-r$pkgrel bash-completion" _mv "$pkgdir"/etc/bash_completion.d/cargo \ "$subpkgdir"/usr/share/bash-completion/completions rmdir -p "$pkgdir"/etc/bash_completion.d 2>/dev/null || true } _cargo_zshcomp() { pkgdesc="ZSH completion for cargo" license="Apache-2.0 OR MIT" depends="" install_if="cargo=$pkgver-r$pkgrel zsh" _mv "$pkgdir"/usr/share/zsh/site-functions/_cargo \ "$subpkgdir"/usr/share/zsh/site-functions/_cargo rmdir -p "$pkgdir"/usr/share/zsh/site-functions 2>/dev/null || true } _cargo_doc() { pkgdesc="The Rust package manager (documentation)" license="Apache-2.0 OR MIT" depends="" install_if="cargo=$pkgver-r$pkgrel docs" # XXX: This is hackish! _mv "$pkgdir"/../$pkgname-doc/usr/share/man/man1/cargo* \ "$subpkgdir"/usr/share/man/man1 } rustfmt() { pkgdesc="Format Rust code" provides="rustfmt-bootstrap=$pkgver-r$pkgrel" depends="$pkgname-std=$pkgver-r$pkgrel" _mv "$pkgdir"/usr/bin/rustfmt "$subpkgdir"/usr/bin } _mv() { local dest; for dest; do true; done # get last argument mkdir -p "$dest" mv "$@" } sha512sums="42d77ee93b168ae139b026138fb48d925624ff436a836aa97ee235f870e61ea11643b0cf7ad20bcafda774c6cd3855a4bc10a2e2ed1c4d82c6f15158963b304d rustc-1.67.1-src.tar.xz c110792e3bcaf946b24459f1b87a09c059a7cff1de9e981da20565732fad7aab6186af006320bfa0e7f4f9b8aaa1af936783d5a813ea092641eab671914d79fb 0001-Fix-LLVM-build.patch 4388c90bc285db5689e31b81700df13e868703fa76613afe96858c0ca0bb8ab1b569c3b6580bdc0f7bb6bdb7201c901d78e86547458aa8700bd7fa5ebeff0453 0002-Fix-linking-to-zlib-when-cross-compiling.patch 887babf6ca5cb969fdf91e5930fa966aa7979246a4031c749233997f919df881f198ad8a22e8b260ee841b52ba46de83f080b99bdf2a44ba864854cf3bfdd437 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch 34121ba86eff8dcd6e8eaad3a1f0ebca1b01acfb040a31a542161db23838ceefc0bc3feb1ffba86ab6f4daee1e194e82170cdb78e64e7f248ac3a21bc7915449 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch 33c1d5b2f051f4ccfde4cdd9cfed4a97b23ccc50aac2eed300b989fff8e1ad55e0ab140c128d33fca25b5b54cfb33b948bc6a139f93d232661e07bf4eba1dc24 0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch 3cf4663242bfd6c67a644a2c6e9c49d26fb2dc93b8907daa86880adb9f57a3db222121a68004aae3f048da59d123ace301e28c63ea80a80f61f4b63f8089e497 0006-Link-libssp_nonshared.a-on-all-musl-targets.patch e92a24bc3ca76c28ce11fb21b1ffb83f47103f9b654f92259aed3bd442fc113bb67d9a1e9a1f92e31061fb47a9dd9776fff2db5f19fb92fbc457501eae4bff5f 0007-test-failed-doctest-output-Fix-normalization.patch 400e3c71a7927c576c9b7d9ef7cb31d9aeee0d232d55178f233534d7c0d55f32bfa706fe0a8c8cd96c001835c9955b0005e630b0b10c6b1c2857b42636ab79e9 0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch 9a14580e6653a88d39a0354088f527c439eb19932cb8bb091a4697b8cb62f313b5dea92e81ffe7068a5d87ff0b6179131a08ca96b2545588415a0eea20089324 0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch 382ddd4f9ca98f068a54eb3b565980e3d7b779f953be26e0fe043d96edcd68f4d523d9d685e69bd8caac0e829102b0c046d1ef918e0f44035917efc37bbb5ed0 0010-Ignore-broken-and-non-applicable-tests.patch e6a5289ff8cf4e30546873b98d774bd62e846b81c58cd8bf2331a2d4245b1bd63c0a233836fa57ac82e530b4cfb8e060cbbaa47ed971c2de481647e48122c0c0 0011-Link-stage-2-tools-dynamically-to-libstd.patch ab43c5738c65e1bf94d6c8a45306b222a1aa3422adeabf0524fb13c5cf2c16d4bc56592a675033d1c3eb38cf134438f170f45ea187c8dd49f3fc5392dd73e5d4 0012-Move-debugger-scripts-to-usr-share-rust.patch 1f8f8616f98953b7c280ca632e53a77366eb04ce5a0f5917ef930521c584ba2b8a97bf33b8432f449fcc94bae1c7eefa8232d827bdbf4c4ad9535e354368b499 0013-Add-foxkit-target-specs.patch 45b2f27b098ddbf1d618764b8feab161c6bd957278bc02589d2b81f76a04205edf31c6f1f059f58fcf72138307f07e742ecf3ddea67a2e6894e824f9659d84d8 powerpc-atomics.patch"