# Maintainer: Samuel Holland pkgname=rust pkgver=1.80.0 _bootver=1.79.0-r0 _llvmver=18 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" # debuginfo-gdb tests fail due to security settings # node makes Rust think it can do rustdoc-gui tests which require many NPM pkgs checkdepends="!gdb !node" 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-Ignore-broken-and-non-applicable-tests.patch 0010-Link-stage-2-tools-dynamically-to-libstd.patch 0011-Move-debugger-scripts-to-usr-share-rust.patch 0012-Add-foxkit-target-specs.patch mir-opt-tests-endianness.patch powerpc-atomics.patch ppc64-abi.patch stdarch-ppc.patch test-be.patch ui-test-strings.patch " builddir="$srcdir/rustc-$pkgver-src" _rlibdir="/usr/lib/rustlib/$CTARGET/lib" prepare() { default_prepare # These tests require Node and various NPM packages. rm -rf "$builddir"/tests/rustdoc-* # Tests depend on FP precision that can't be given on i586: #1259 rm -f "$builddir"/tests/ui/traits/object/print_vtable_sizes.rs rm -f "$builddir"/tests/ui/traits/object/print_vtable_sizes.stdout } build() { cat > config.toml <<- EOF [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 = 1 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 tests/ui } 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="548522599122bdff739472c1d120dcff8de171d6f4155c2fb73e47c7d80431694ceceb0439f36ef2a7bea23ac5a76de8e1f75fcade1f3ff2c3fca0ab21e6197a rustc-1.80.0-src.tar.xz b701f9ae32c4e62dde7ecaef40a9083f6253d83dcd3821c6ce86784fb439b11c5b908e42b4d9eff9ebe8860b3b4673c489ff8e6b4828e15df02756e4c8985c94 0001-Fix-LLVM-build.patch 1f976da43d99ff58b7d8716e594485e191c2df43ab4c75123a223ae0cfcca0c129281575d2bee5996faf10f9008357d30c48876a491b62bdd722c83c4f3d35d2 0002-Fix-linking-to-zlib-when-cross-compiling.patch 619a0150bdc59ef8d844e9eff907e51015003164d17012b38bcac642618efb65e25ea4b1ead06d4b023caf02d4eb8dbd481daa04b42d0002a9986f05854c0ca4 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch cfd8cfc1a8af2a8319ae9bd4ed14b1ef22d429e99da4237ea7d037d6fa556174db6b47e9268c8c258e08b7a71d8c2370cce8445c3dd994a07e4699705f2ae2de 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch 6868fe48b7424d39c94ea560037ab4154a0b8f20a027617433d912a5ec60cf0bf1a49da165009345b75f8aedf7d0f81dd23135f9bb28d3f5cd081b56aa74a986 0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch b34187a82cd3db02b8aac8f18147d653a7191b841e145460dfbff518a7747a6aa1c08721703929bfc7e446c9ed9512383a5eefaad2cb5c02d16e8f00d12627db 0006-Link-libssp_nonshared.a-on-all-musl-targets.patch e13020274290c1149b7fcf3a119cc34d7f6b64abaa69d6ac9a8780569c4f44041c40b915da6e9675cc7e0ee05d42b13e14608fbab6eac6d3547428bf21f4e9f2 0007-test-failed-doctest-output-Fix-normalization.patch 6850174cebb3dfb2f41e277b0b46db9cabe18c904f39a6775f8cd12dc6c237a7de820a5dc8c538f9b965c069b4197141f0613add096574a7df4ca2d1ae01ab4d 0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch f98ae741a9f33a0e3541c6c43a3eb86b653b202d70783435ea2cc1b35c1da8b6db796e9217e243050de05b9ea2520600c5e890481d2366a1da742aad3482fab2 0009-Ignore-broken-and-non-applicable-tests.patch 6b68d068d7653b81590f7a0bd5359868c0ce48fa3eda467cac9dbfcead7b566ab27489ee923b024e71294130a17b1f2efc1a06a8effc93ea4a4d5a43ec8d091d 0010-Link-stage-2-tools-dynamically-to-libstd.patch c6d94cbb80394d270302a2389c22b528583c4ad7298c7b3f657175912e0abd075b45ec847daa2c8e6e4eb38536a8a37461cd15d78c0f83771d816f11e1cf2e01 0011-Move-debugger-scripts-to-usr-share-rust.patch 690d12d2b983f82fadad1ff661887852227871787d8b4f5dff7de96ac94dbb7d64887e19258fa146e8cf1e6356cffa6e5954739e9e133165e8d2c970c6f47a84 0012-Add-foxkit-target-specs.patch e8561c9ceadf121239ad13496e4baeca6a93e29bb99bc2d37d9e1919caaf0e2456219a0e3d3cd88af281b2b9d23c735597f1ee05cc99daa690961397aa28efa6 mir-opt-tests-endianness.patch 5d57a7a18e0a7f8b7755de89255f97642e4fe585a02465de70227867ac99db84766cd25e702ae13c3a4488504bd4c84eb7e9ceb3a83fdf8f2df0eacf64cc16c1 powerpc-atomics.patch 4d21e0e04768e19f1d93ee54d787ed1c4c6fe1e7cab91c92413caa22765f96843f9d98ccb014210d893b3a6bb3246b6fba60b8d6d8a832fedbeff50803225b81 ppc64-abi.patch 63592425a6f68046b75148a25289ff1b8b6a7db02ca0aa7c97d35697f18267a6adeb8be3136c8fd930704352d5528e70b0d57f79bac39b9331953174f76d5919 stdarch-ppc.patch 07591c0b6731349093aee868723ab526391a6dda946e9dd442428d878e3d5f23223277778ea71860f0101cac23f47e7973f36d4fd88cf5d3e3ad95e9d6b07b27 test-be.patch c1cdcff68504e5b7b9d5f3081c83c8d8855d9523cc3539bd727f3dc78b7db70b4ce40c76852dd62fc50423128faf86ed8af1c65f7955134af85bc494dd376001 ui-test-strings.patch"