summaryrefslogblamecommitdiff
path: root/user/rust/APKBUILD
blob: 6b0111f269da292e6d92225b70bd620a852624de (plain) (tree)










































                                                                                 


                                                                                         









































































































































































































































































































                                                                                                                                                                                                 
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Shiz <hi@shiz.me>
# Contributor: Jeizsm <jeizsm@gmail.com>
# Maintainer: Samuel Holland <samuel@sholland.org>
pkgname=rust
pkgver=1.29.0
_bootcargover=0.30.0
_bootver=1.29.0
_llvmver=6
pkgrel=0
pkgdesc="The Rust Programming Language"
url="https://www.rust-lang.org"
arch="all"
license="(Apache-2.0 OR MIT) AND (NCSA OR MIT) AND BSD-2-Clause AND BSD-3-Clause"
depends="$pkgname-stdlib=$pkgver-r$pkgrel gcc musl-dev"
makedepends="
	curl-dev
	libgit2-dev
	libssh2-dev
	llvm$_llvmver-dev
	llvm$_llvmver-test-utils
	openssl-dev
	python3
	zlib-dev
	"
subpackages="
	$pkgname-dbg
	$pkgname-stdlib
	$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
	rls
	rustfmt
	"
source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.xz
	https://distfiles.adelielinux.org/source/rust/cargo-$_bootcargover-$CBUILD.tar.xz
	https://distfiles.adelielinux.org/source/rust/rust-std-$_bootver-$CBUILD.tar.xz
	https://distfiles.adelielinux.org/source/rust/rustc-$_bootver-$CBUILD.tar.xz
	0001-Require-static-native-libraries-when-linking-static-.patch
	0002-Don-t-pass-CFLAGS-to-the-C-compiler.patch
	0003-Fix-LLVM-build.patch
	0004-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
	0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
	0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
	0007-runtest-Fix-proc-macro-tests-on-musl-hosts.patch
	0008-Allow-rustdoc-to-work-when-cross-compiling-on-musl.patch
	0009-Add-missing-OpenSSL-configurations-for-musl-targets.patch
	0010-test-linkage-visibility-dlsym-only-sees-exported-sym.patch
	0011-test-invalid_const_promotion-Accept-SIGTRAP-as-a-val.patch
	0012-Add-powerpc-unknown-linux-musl-target.patch
	0015-Use-ELFv2-ABI-on-powerpc64-musl-LLVM-half.patch
	0016-Use-ELFv2-ABI-on-powerpc64-musl-Rust-half.patch
	0017-Fix-powerpc64-ELFv2-big-endian-struct-passing-ABI.patch
	0018-Add-powerpc64-unknown-linux-musl-target.patch
	0019-run-pass-const-endianness-negate-before-to_le.patch
	0020-Fix-double_check-tests-on-big-endian-targets.patch
	0021-x.py-Use-python3-instead-of-python.patch
	0022-test-debuginfo-Update-for-GDB-output-format-changes.patch
	0023-test-target-feature-gate-Ignore-on-not-applicable-ta.patch
	0024-Ignore-broken-and-non-applicable-tests.patch
	0025-Move-debugger-scripts-to-usr-share-rust.patch
	0026-Add-foxkit-target-specs.patch
	0027-Add-foxkit-target-specs-for-OpenSSL.patch
	0028-Link-stage-2-tools-dynamically-to-libstd.patch
	0030-liblibc-linkage.patch
	0031-liblibc-dcff154781e4.patch
	0032-liblibc-90c01fa6b0f4.patch
	0033-liblibc-checksums.patch
	0034-rls-atomics.patch
	"
builddir="$srcdir/rustc-$pkgver-src"
_rlibdir="/usr/lib/rustlib/$CTARGET/lib"

prepare() {
	cd "$builddir"

	default_prepare

	$srcdir/cargo-$_bootcargover-$CBUILD/install.sh \
		--destdir=$srcdir/prebuilt \
		--prefix=/ \
		--disable-ldconfig
	$srcdir/rust-std-$_bootver-$CBUILD/install.sh \
		--destdir=$srcdir/prebuilt \
		--prefix=/ \
		--disable-ldconfig
	$srcdir/rustc-$_bootver-$CBUILD/install.sh \
		--destdir=$srcdir/prebuilt \
		--prefix=/ \
		--disable-ldconfig
}

build() {
	cd "$builddir"

	cat > config.toml <<- EOF
		[build]
		build = "$CBUILD"
		host = [ "$CHOST" ]
		target = [ "$CTARGET" ]
		cargo = "$srcdir/prebuilt/bin/cargo"
		rustc = "$srcdir/prebuilt/bin/rustc"
		submodules = false
		python = "python3"
		locked-deps = true
		vendor = true
		extended = true
		tools = [ "analysis", "cargo", "clippy", "rls", "rustfmt", "src" ]
		[install]
		prefix = "/usr"
		[rust]
		codegen-units = 1
		debuginfo = true
		debuginfo-lines = true
		debuginfo-only-std = false
		debuginfo-tools = true
		use-jemalloc = false
		backtrace = true
		channel = "stable"
		rpath = false
		[target.$CTARGET]
		cc = "$CTARGET-gcc"
		cxx = "$CTARGET-g++"
		linker = "$CTARGET-gcc"
		llvm-config = "/usr/lib/llvm$_llvmver/bin/llvm-config"
		crt-static = false
	EOF

	LIBGIT2_SYS_USE_PKG_CONFIG=1 \
	LLVM_LINK_SHARED=1 \
	RUST_BACKTRACE=1 \
	./x.py build -j ${JOBS:-2}
}

check() {
	cd "$builddir"

	./x.py test -j ${JOBS:-2} --no-doc --no-fail-fast \
		src/test/codegen \
		src/test/codegen-units \
		src/test/compile-fail \
		src/test/compile-fail-fulldeps \
		src/test/debuginfo \
		src/test/incremental \
		src/test/incremental-fulldeps \
		src/test/mir-opt \
		src/test/parse-fail \
		src/test/pretty \
		src/test/run-fail \
		src/test/run-fail/pretty \
		src/test/run-fail-fulldeps \
		src/test/run-fail-fulldeps/pretty \
		src/test/run-make \
		src/test/run-make-fulldeps \
		src/test/run-pass \
		src/test/run-pass/pretty \
		src/test/run-pass-fulldeps \
		src/test/run-pass-fulldeps/pretty \
		src/test/ui \
		src/test/ui-fulldeps
}

package() {
	cd "$builddir"

	DESTDIR="$pkgdir" ./x.py install

	rm "$pkgdir"/usr/lib/*.so \
	   "$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 \
	   "$pkgdir"/usr/share/doc/rust/*.old
}

stdlib() {
	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-stdlib=$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/share/rust/gdb_*.py "$subpkgdir"/usr/share/rust || true
}

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 || true
}

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"
	depends="$pkgname-stdlib=$pkgver-r$pkgrel $pkgname"

	_mv "$pkgdir"/usr/bin/cargo "$subpkgdir"/usr/bin
}

_cargo_clippy() {
	pkgdesc="A collection of Rust lints (cargo plugin)"
	depends="$pkgname-stdlib=$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-stdlib=$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
}

rls() {
	pkgdesc="The Rust language server"
	license="Apache-2.0 OR MIT"
	depends="$pkgname-stdlib=$pkgver-r$pkgrel"

	_mv "$pkgdir"/usr/bin/rls "$subpkgdir"/usr/bin
}

rustfmt() {
	pkgdesc="Format Rust code"
	depends="$pkgname-stdlib=$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="87f416c76db2967c0ce2b39ee2d2c2fcad875bbe13cfa507f5483e170827c131f3af4400c11785ed836143b2732aaf32bc0291fcd93bbfb96b266a198c926a5b  rustc-1.29.0-src.tar.xz
1e67f3b28ca5d6e8ed06df36145abcfeecedb8c8b5370023e7de4a19b850b690efefdd583b42fc484c1167a5c301f6779745c12efb065475acf956d9934cb02b  cargo-0.30.0-powerpc64-foxkit-linux-musl.tar.xz
92f250086aa8cc1528359fbf9e9413bc86857acb6e9f0bb3a045a3a1770dd3a4eda5b499c1cd1946bb9f0937d402b73bf46c7e1de8d419efdd0ffbc278239a81  rust-std-1.29.0-powerpc64-foxkit-linux-musl.tar.xz
1fedd316a05f16947e8288f194cf55b9d9e29667096a50b4f2ecd9c2031e00fbf9a8c14c01968bb047e3f3aac18a036606092749de467b152169eb218360ecbe  rustc-1.29.0-powerpc64-foxkit-linux-musl.tar.xz
23540d67f2774f007ffea65e3475b0003193a28503f302dbbf7fa741c0e53dd14d110a3eb88374c2fc1a29b7c8add4c41300fe1c187b2d2ead8e35740cabaaa8  0001-Require-static-native-libraries-when-linking-static-.patch
3e10a597f35470b31da178dad3af956d395f4245470f7c2821a78f1e7411acd8758c13c686a342eb362850a736b2887293203847e38c89f40a61498282d29c69  0002-Don-t-pass-CFLAGS-to-the-C-compiler.patch
d6b293f13dccbe5bdbcc13c2b18e610c271ab49acc0eb5658489388b371431a522f454308af20d2fdb8c68ce99203cfa8455b7c36cc47c8d1f5722b739c3b3fc  0003-Fix-LLVM-build.patch
38f5380a3e7c8454de62ed75e807ad034f1ef3521a88706d3a24d4de09140147ff298c8e36de14d21f0b458d8c1bf82dd8e3924c7dcef0a16d8cd07ff49f06ea  0004-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
660283864cbd7a98246c3a6d5634b99032c90fcd98eab6f2477786ab49078505f59f2a88f2b87729850e0b07bef18dd5b93c458e947ae876aac3dca3742dff73  0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
75a7d5f67e315ef69f6c5114b80523858b528c6ef80ec10fba7d1f1afce97e6053670a8a7473c6948931d2f013e77646b7b30635f12f5b5f6dd12a29f6f4925e  0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
7256275df428ea13028731e91dccbba90f7e9f2a611ce9265447831cc60a9284b8d78573da50143b2e7fe4f3f6dc360eddf0be94a01de4b8745d7930144b2365  0007-runtest-Fix-proc-macro-tests-on-musl-hosts.patch
45c7342c9b901f3d96e293e189773b22e0c7f240e79ffd661e4010f798a6d622304ad16fab22ebb81e92e473c98f93f39505e79dbfb341ec7e29efbcd366594b  0008-Allow-rustdoc-to-work-when-cross-compiling-on-musl.patch
d48b2653265de8e331afe8fb8ec48b3170845d95eb54ea1fad77cc8ac617cab193b3e797c2753794addcb3f3edb5de99ebdd6de1ad31613a08485b4ad9a8878f  0009-Add-missing-OpenSSL-configurations-for-musl-targets.patch
abbefe8cbdb1b0cefe9cecfe5b5fad88b868d838617bf1fc1e0da782844ca9f28fb5edd8052115e9667ff21eca90e768caea1ce6c8bf23981162e1da93a70c59  0010-test-linkage-visibility-dlsym-only-sees-exported-sym.patch
e9c4c6d9029029abc806da48ba85fb3ce5ca2aa0dd748012f8cd89620b3a5646b06a3295b1d001c3e651ffebf7a23d16d074c7a146cc585b9347f16b2c147743  0011-test-invalid_const_promotion-Accept-SIGTRAP-as-a-val.patch
cf5cb5827a836f2fc155ba5f9caf24d2811e143fa178d64c2cd2c6cd0ba8c121dacd657be7a631f1d2532f3bd6f244c371361afddf65f057acf15f0de1d4b8bd  0012-Add-powerpc-unknown-linux-musl-target.patch
9e47df4cd5f9590e526be1617efa6c96b80cc9220f819a0b86a6b48a229786b860fff4c2dc5451f7098aa5f250e35285d65cfa0012c15110eab612d585a1f6d7  0015-Use-ELFv2-ABI-on-powerpc64-musl-LLVM-half.patch
36f07adaef870b90590a7513b1bde0f37793bbd6b773b41bf0cf2b791add51c0c8e22a55b5f8266a04e82f8c60f8a89eb0597cdb23b6f595e787a6a57cd869c0  0016-Use-ELFv2-ABI-on-powerpc64-musl-Rust-half.patch
63fb44a61ee59e916bbaf78dc95cdb73a77671671db10280e8a8fde08324604f1b2560a648f25b088558c3fd198f855a8056dcb14997c0747f05957c51643aba  0017-Fix-powerpc64-ELFv2-big-endian-struct-passing-ABI.patch
bd16a8c9d79c495677d1d59a5a806a46d807447ef9be85b20fb2d8150775f24a233d00dea4c5a3b505054b299982fe00d64d1a9a9da26c320e804a8f3840e48b  0018-Add-powerpc64-unknown-linux-musl-target.patch
41f272bc925d2800fde0f663d300572ab27d4de275b4802de7adb89c2d6582b1aec3cd456ae2c0d115f1104f9de97489da86df101eefbaead374c5d5b20c95d8  0019-run-pass-const-endianness-negate-before-to_le.patch
e146e9205f22f10fcdd6b8b77ee76a7b2cab0f38368a793cdd15a2dd5b1432c7e9d0ea9ae5cda55ff91edfbea20941fe49836707bb238c84b74ec0330490b4c8  0020-Fix-double_check-tests-on-big-endian-targets.patch
ed4f07e005a9ee7b117c48961c0285cb5a8f1bf5c1480343d617630af56837fb177cf8e5f564b0795ed063ede485d8478a44c7c257511aaa05d4abf4c316d898  0021-x.py-Use-python3-instead-of-python.patch
12e6f6dbeefaeee6190a8ed25336836bec23d92778a2b01921f1191e4ac9fb8259b7b99d6bebe52b9e390eb3b4dca40c61e9498cdc222d5019843ef31b82146e  0022-test-debuginfo-Update-for-GDB-output-format-changes.patch
d9b2234fdc3e2fac9462f0be8ce8988d50573d1149c496ef7b439596303a34e540824a5a6ab23cb15be1a6c1d15d857662d6dae740abd77084375b276b84f4dd  0023-test-target-feature-gate-Ignore-on-not-applicable-ta.patch
7cff0eb0f947e009326cbd96dae0d74d1f5fb9fbd1cd62544aa5b52c44fdc8f40094856d44dc5b4d55fd2c35308f37fa64656d614ae16d42d71e59a7a8cdb531  0024-Ignore-broken-and-non-applicable-tests.patch
de5c3b3ca532328957b550cf02cbdc851bacd7740bbdd4512e03d2eb4d916034d2bd026710f2f734d7a31ca67eda3f34e2577a0cd39a4901d0808a1815095064  0025-Move-debugger-scripts-to-usr-share-rust.patch
6a1c997e5e280b9575857d5dca5cff22ea17fc878389bb0d852139bb113fe64082dfd1298958a78e10d4a8faf58358bc8c221516e248c929c399d327559ef030  0026-Add-foxkit-target-specs.patch
6b1723c2e4672e394374419fcc136a851078b4a4c538c7c1d86847e6915c5fb3ddc1f81971ded1a73a3090766d103c3cc79c60b8e39999947be625e0e17e1249  0027-Add-foxkit-target-specs-for-OpenSSL.patch
74618287fe0bdcbedb23b2343e88885496d346c68a6b76109f613c5a13f7e09623ece11cb9c784f1ae6779005c9ec4def0351810718afd80285d1912c0040c9a  0028-Link-stage-2-tools-dynamically-to-libstd.patch
f94abe390798b968bccfba1c908ab5895220ed0d167314b790a9c28b10cac81fb2e3b08760b4e8551ad5a5d02cd052d3d0d647ad8f8634e97f4d3b0470a21c42  0030-liblibc-linkage.patch
48a2ea6beb5f333d646fcc7aa15405d24f52f48e82b8f9cd09737dbfef16df0679246b30a28871595d13414b44c316122e0c969e1ae555b7ab18b692057c0d67  0031-liblibc-dcff154781e4.patch
fcfdd6b2702b8b23d8fd339ceb23b75a6e9814a388f00d226c8101be46a0f29835c77b75ab665e36972fde14364d762816ea2dcf3c1d90dd1e574fb8f6c33c80  0032-liblibc-90c01fa6b0f4.patch
1e1e1f485abd8e3e283aa69b3b5c6f11901d0cc14527834a6490ed70c043512aa207ff4f9ef4bbdef884697120fab59d23ec1faf3b02b3d3d77a060789275cd4  0033-liblibc-checksums.patch
9182408b7a87fc2f01dc12a36440e43a721f7693da00310806f6306e711c04b34d43b6ab348ae523656937f61389adb6a5a2b8ff46dec5424ad20c29652d4edf  0034-rls-atomics.patch"