blob: a35db178f25996da58cc70fbadc0dc81dd8cabf1 (
plain) (
tree)
|
|
# Maintainer: Samuel Holland <samuel@sholland.org>
pkgname=rust
pkgver=1.78.0
_bootver=1.77.1-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"
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
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 = 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 --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="d2fb9881e28849d871fda71b1b51652be3839b3283f0d32163f258c5c707a9fb7b589da8dc03bca2fefee1abdd2b44a5f17e85d8c6df7bea119d1e8d22371941 rustc-1.78.0-src.tar.xz
8609718e2974369bca7dcd679439dc9bc047cf1a2afca165175299f31e859c02c85b452305dc7f620bf6cda2c5368a941c86a5a035783628db8c84f6d80ce40c 0001-Fix-LLVM-build.patch
1cb5b3eb10f9b3e05ab2ab30fa42a69009b30e7bd6a1ca81af6a5d4a7dfeebed2d5a3f2212ea72ec80b97ff374ffd0cbeba67de3265548ac3ac033dcaf5f7bc9 0002-Fix-linking-to-zlib-when-cross-compiling.patch
619a0150bdc59ef8d844e9eff907e51015003164d17012b38bcac642618efb65e25ea4b1ead06d4b023caf02d4eb8dbd481daa04b42d0002a9986f05854c0ca4 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch
171ca515116103b685e5e0334d64ac0ea7f07712cc8f517f9440eb9ae0c6749d6ec0f8f98705a6fa2fb2f98eff25a93addc027634f6d26d47efb809727bdc13b 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch
71ded0160fa310d7e4355f37c16fae6e1bacc7b9baaf7230f41f3edf48f2a8839de3b592494e3f9e2e1820451f8327c04ca4d772d83c0db3fd43757138c1c1ff 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
88b8f81d4bc9f80ed1ccc6dd95eb468414d62907fc6ca6049862709018c551604154f04bec69c96694657d1367a00c55d46c7170d030cdb41c377284b312a487 0009-Ignore-broken-and-non-applicable-tests.patch
c21908f7685f786e03b6772a10221b19d99eb1ea3f1f86b837f2aead821a4aa29a38d41a555d8a4efa067ac83be9987976f48a7113849baeabb66a0017b929ca 0010-Link-stage-2-tools-dynamically-to-libstd.patch
4c0d4353ab85354b22d09071020596846acb574f26f768667b96726a4bac2b59c868cff332dca188ad60ba34783cc4b7ba1677836307d63709b35ed9c92818bb 0011-Move-debugger-scripts-to-usr-share-rust.patch
ec5ce965504867bc208e57d99f4f6fadc1674066060fa59fe612ce64f78585759f0734c15dcd4bde9b4b69d062b2423825ff4dfa145ece7efa3e38a14f923833 0012-Add-foxkit-target-specs.patch
5ca20c4633e8fac10c5f4d25fd8ed334d2ec00112e0b51c9b73148e637beaefc42960fcd40a5713a175db8c1d91e87f0126f64c2a1dd2a54b7e95c98d6a17f51 powerpc-atomics.patch"
|