# Maintainer: Samuel Holland pkgname=rust pkgver=1.74.1 _bootver=1.73.0-r0 _llvmver=16 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 ppc-libc-hugetlb.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="14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d rustc-1.74.1-src.tar.xz 0c284187d7862fb49cb027d0f52cbbbc80ce2ccf7f26c491de063101cc7a9c7dae6451068444a3c252fb6d1834dd78a0e632452647bcfdc0576e725843c80300 0001-Fix-LLVM-build.patch d885d1723d9dde01cad13ac87d93a0579779a09b98331f0799a4388afa3d1f7c6905522c0b152bc6af8071763df36b265045cba9e3dfe806d17cc251594e0d63 0002-Fix-linking-to-zlib-when-cross-compiling.patch fb0b40f085b9dee31985b1611394e23f41b7244b4d61031c0fe1db893dfa9ef10e18945ad211c4d3b501183942f2a6a9497b5dbe1ed39b9000a746f0b9e01d2a 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch c39324c283f16f8696d572e57c6bfe29692831a9601ce5eb122d310a4afb170b2f3f2db724044e4e0a3be6d6265e79a490984c767ab0e6d4107504bb95743d9e 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch 0382ec5c0ffe082a252fc8d5fb84e74ac1ab09146a22ac4a9ba37446c4010a32113e0b28b16032a0b6816a5eb4b5e7fc8612ab2abd5d9fc429021b63132dafe4 0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch 3cf4663242bfd6c67a644a2c6e9c49d26fb2dc93b8907daa86880adb9f57a3db222121a68004aae3f048da59d123ace301e28c63ea80a80f61f4b63f8089e497 0006-Link-libssp_nonshared.a-on-all-musl-targets.patch 5cf31dfaa0604bbc45ac85a78f0d2326c23a57f66e7c4fa1efe5b9f5967c8a3120dad921c70cdbcdf5e6038c22accf56cd34c0c15e576dda7691c2de3258d7cc 0007-test-failed-doctest-output-Fix-normalization.patch bd032bda35b5881e04ea3fe335818fee63087ca26f76f2c1e494c135d9186de021e77a8c36d47f60dffe4e85217ab24775601031d6608a08559d4b27f1ca6da8 0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch 390e3b3569054ee4719959c0fc9a4aa1b28bae9f4cb54abae28f0313caa7c9ee2393e0877d6ed49ca54673fa162ab8e29113d97ed8f758d0f541cf57aa55e9cb 0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch faa6f2c3c94140798b476a794d77a304c0f3891a65c1ffe99666606cfe822d5651af6b8c011265a7f1114ade355994761d71aac550b8dd8617f44d500435e8e9 0010-Ignore-broken-and-non-applicable-tests.patch 163cc96971559f0c62aa0da267afd0b63fea3225b7aae5d710d9a4ad4c9756e34fd08bd5d1efb5b1e50726205c51693bd329d1c8929a096ddf8d5d7732986149 0011-Link-stage-2-tools-dynamically-to-libstd.patch 8d7bff08fec8feb63330e120805c2bb2623f60b91fe0d6ef79591a984264937f0f93a68995ec40daefcdbedb5f1edcc738125c0f41f81442933359ae42ceafa2 0012-Move-debugger-scripts-to-usr-share-rust.patch 72ce26e6f720a652305ef9c39542773247d6bac1c30c5af1d655b6929b1169df74c46a5178349c95ef795624d0944f5cfe2dd4e810562614bd808cb486866ea5 0013-Add-foxkit-target-specs.patch 931a08d7714f28424506ea8d733c4d496810bc9992f11d6b3162e688ac36c3be3e25ece63b3d9ce26cf8858dc1231d826ab166ec992e61bc3649041b5d2d819b powerpc-atomics.patch d830cd718414cbfaf70f6714f74f3f78dca0ef26277a7ceb9067f192852656dab0903d2bfbae627ef1909b20bbc10c8563cee61e103927a424815383dae579a9 ppc-libc-hugetlb.patch"