summaryrefslogblamecommitdiff
path: root/user/rust/APKBUILD
blob: aa155ac3b5f6dc40e456230f036536f23427cb58 (plain) (tree)
1
2
3
4
5
6
7
8




                                                  
             
                    
               


































                                                                                 


                                                                                         



                                                                       

                                                                  

















                                                                       
                                  
                                       
                              








































































                                                                                  





























































































































































                                                                                  



                                                                                                                                                                                    























                                                                                                                                                                                                 
                                                                                                                                                            
                                                                                                                                                                 
                                                                                                                                                         
# 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.30.1
_bootcargover=0.30.0
_bootver=1.29.2
_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-Don-t-pass-CFLAGS-to-the-C-compiler.patch
	0002-Fix-LLVM-build.patch
	0003-Allow-rustdoc-to-work-when-cross-compiling-on-musl.patch
	0004-Require-static-native-libraries-when-linking-static-.patch
	0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
	0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
	0007-Add-powerpc-unknown-linux-musl-target.patch
	0008-Fix-powerpc64-ELFv2-big-endian-struct-passing-ABI.patch
	0009-Use-the-ELFv2-ABI-on-powerpc64-musl.patch
	0010-Add-powerpc64-unknown-linux-musl-target.patch
	0011-Add-missing-OpenSSL-configurations-for-musl-targets.patch
	0012-rustc_data_structures-use-libc-types-constants-in-fl.patch
	0013-runtest-Fix-proc-macro-tests-on-musl-hosts.patch
	0014-Fix-double_check-tests-on-big-endian-targets.patch
	0015-test-invalid_const_promotion-Accept-SIGTRAP-as-a-val.patch
	0016-test-linkage-visibility-Ensure-symbols-are-visible-t.patch
	0017-x.py-Use-python3-instead-of-python.patch
	0018-test-target-feature-gate-Only-run-on-relevant-target.patch
	0019-test-use-extern-for-plugins-Don-t-assume-multilib.patch
	0020-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
	0021-Ignore-broken-and-non-applicable-tests.patch
	0022-Link-stage-2-tools-dynamically-to-libstd.patch
	0023-Move-debugger-scripts-to-usr-share-rust.patch
	0024-Add-foxkit-target-specs.patch
	0030-liblibc-linkage.patch
	0031-liblibc-1b130d4c349d.patch
	0040-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/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="e466db81b9a82239670c48b876dc7390fcdda28c6390308691ddf2e0c12a39b57bd5ddb18322d1b4cd58165f69a666c7d83bee6573049da3b94e401657459bf5  rustc-1.30.1-src.tar.xz
0f7c92e69f15cb014a1a6c263df2d0675842db9a3789467aa0d8811130adb1ffb3e0a344cfb59c069f5aa0f99b1f2422536ec96064b71374a3077b3a2a02d0fa  cargo-0.30.0-powerpc64-foxkit-linux-musl.tar.xz
95f447bd698177732f4105ddcf4e60d5695a4345f6eb49d5d49ff2402de6d28199ca1aba1a630088beee40b8063477bed4dd47532c53cbb72de3ee5687a9c689  rust-std-1.29.2-powerpc64-foxkit-linux-musl.tar.xz
a140b9f524205a756192fed740492bbc01205ce77196dd44244752a99d8e6ede03cb9b8ef0d986e23ea882ebf24e773d6e426054c5840989379d81427ad37f07  rustc-1.29.2-powerpc64-foxkit-linux-musl.tar.xz
efab6cffae2569ea022f099a461629bdfc01604772baf0fc56a03b63954c0540f1f2039b364ed06bfac4e6a3a3e86e5bd6aadcbf90cac769c74f810f9a19cdd9  0001-Don-t-pass-CFLAGS-to-the-C-compiler.patch
92b3c418ae96e97049c3c9bf5aef0ba85f6d95bc82262f902ae48af25c02e2f06a5e270136dee3fc6c56ec4f80e44c2575d2ab61d626ab2cc460081458caecd2  0002-Fix-LLVM-build.patch
069bb3809eb3a5ff364e45ed0625cf70038f866ea24328b1d7f6b163ad02a00a23c9dad02799acff0b78ca79a68df7f59a49b68ad30df033741f482cd4141d83  0003-Allow-rustdoc-to-work-when-cross-compiling-on-musl.patch
1ac789ff4bc5f73d707fd36bcabf7c51077d31355ed1d4de2d1bbd6445fb2cfaeaf93aaf789493959df47faafdd04acc17d7212b2dd157e0865be9c55f919e37  0004-Require-static-native-libraries-when-linking-static-.patch
d14d322141964d3b80e29ad195e9df8ea62c88bc3890fc00dabea3ec7de4b4e4c796a7b1f1fc2014356724d6d5b631e92a72446a7c05c6b06a4e250be0f83b45  0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
21267b1d2408d08324864453f08d7bb26008f7799da08d24ed0dccbb02ae0d8f40a894bc77cc45bf8dee7fbc655aa3a8ee9bc7e5fcf1bdc3a9b46b363d6dfaa5  0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
a50fb08f4e52213fef4e8303a3978661b43cd58c36676ed35c79b05767c2b02a3ac9416f7a3229f14821c433d2a47b38bc03bf419d70ae597a4f5145de2ed20b  0007-Add-powerpc-unknown-linux-musl-target.patch
35e93fcc03d3afee55ab0c9a6c3b832e74ee0ff5e9e37f0d134ac934ed70afc2b485e141103715e661aff280b9513d02e1802ff4829d0c7283600e047306f4d8  0008-Fix-powerpc64-ELFv2-big-endian-struct-passing-ABI.patch
4bcef503d82b1f5676cd2d4f3deaac606abebd68002586e0e64b5c6c3c2846c473fa3f23a9227451ca42b971542dea2384b29d7c4e7543549e00fbc4d0039458  0009-Use-the-ELFv2-ABI-on-powerpc64-musl.patch
6ff6d6014a4e64486aef97239520239adf9b755f9e16309e4b529d6be5fab845ad9c9b943036db5c29125b4d58870911cf124d61b235f4e4ed81d9b182f9b5e9  0010-Add-powerpc64-unknown-linux-musl-target.patch
4f74438f47c42e205934c96d4e0920eacd9e3829c77d9253b7a12188c134de8c9ad79f6453c7bd49b71f5bfd3ce95864401b947275f8d73f0028374236694985  0011-Add-missing-OpenSSL-configurations-for-musl-targets.patch
352f77e0480a9762b7520fabbec9a0adea15783044ae16ec383cede1b714fb10594c7a6a26d3d59cea33980e1fd38836987eeb99828e33b1a26111274df7e84e  0012-rustc_data_structures-use-libc-types-constants-in-fl.patch
3da23479210496db34dae495b7b98c44aad24363650e35e887b97e9d3b90084f4d57dd2fc0ae0b69de2bd42dc920d6d2829b9b190b16f4c6acd072c8b7cb2988  0013-runtest-Fix-proc-macro-tests-on-musl-hosts.patch
a170e78757e3d31eb0d6869ca082bcd1b919bc192cb1b9c4940c12b09e4948956bf0c06e63261484c2f868320fbc69a9156f4477bf3ccefad334dab495ea758e  0014-Fix-double_check-tests-on-big-endian-targets.patch
7e4fdbe3d4c12dc1bdd1f2c9bae01999cc50949628a61f210599f146c2a29ea3450b242cac8fced0fef7334b825a1114da9b632b2e8020dbae085d8a1d2c5168  0015-test-invalid_const_promotion-Accept-SIGTRAP-as-a-val.patch
35abfcfc12781870b1b3d58afb4a40ba3ed4873a171defec6af170f9b671e46e0daefd258a29fa546aba8b62b80cbae4365d4b4ffc4864a90ec21eac0cca03fe  0016-test-linkage-visibility-Ensure-symbols-are-visible-t.patch
3efd92224b2bddd1c539b578fcc1f13d69f66bcfef678502f2b2f34a0b44307ac92a87854f136234af860e787048835047aab24428a867aefa16784c6b553673  0017-x.py-Use-python3-instead-of-python.patch
b19e6f892bc428c577b6bbaed8f764072e320fa03fcab509b2ac1c3e9284dcd0f62ac43fddb71b2fe756de47bbc158d815e37b735d55585071bcf0d6bce40c5f  0018-test-target-feature-gate-Only-run-on-relevant-target.patch
315a325ae6dbfbfefb237f17843c6dfbedb244378fb9118d441208d879ee6913d2c99e8fe519d3924485bd74f2d95d1b68804e290311eab58fcc50631d4e6f7a  0019-test-use-extern-for-plugins-Don-t-assume-multilib.patch
285220c4c2faace1abcbc5c4e96f18435fcd2203736240cffc107737f4b424132052b62a9ffa790de4c88323d4b20ccbf61607104d773a385cd3c83c0d2b056a  0020-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
05eb137c7f6fc00e40f55c24e8191fd42a0d39dc1758d40779624ba4c1654bf97383b6ababcc36f5850e1fe10dedb47cfad7a176b2ac4fd0b8659bf3cf969a58  0021-Ignore-broken-and-non-applicable-tests.patch
02a15f2ad61acbea8dbba54e78f4c4343bbc4f26fc3f48e522f19ef79287e83d3d45b338ae4820fd770677f6cd0f52b0d38050318c60d9d2d3d2e57b196379bf  0022-Link-stage-2-tools-dynamically-to-libstd.patch
9d6d1761b6348d2e6ec7773d14cce2a6b1bc579ba4f2689ff245017d399e24895128617376ed26f009ebe5e9a0ba1a79bb71bc95373c3565e88d4f1a78a47161  0023-Move-debugger-scripts-to-usr-share-rust.patch
4837e36aacffd82fcc5cb63e971b02de906087b5865331c6d61f5ab112bf728ec55d9481d328b5462a08142167e8fad2f5e7cbd24700948a04c4d8de9d281324  0024-Add-foxkit-target-specs.patch
f94abe390798b968bccfba1c908ab5895220ed0d167314b790a9c28b10cac81fb2e3b08760b4e8551ad5a5d02cd052d3d0d647ad8f8634e97f4d3b0470a21c42  0030-liblibc-linkage.patch
875f0b676c61c1ec67894fc7866233869ced8fc975960b8b99585bad370066f9a6bf591590a745c73a0bcc93b9f7fda74a703829c50d04b80846aecc92ae725a  0031-liblibc-1b130d4c349d.patch
41ab9d6f361ee2fba267c9836c1a382dc86101d1bfb59cd942be8e8fc526ad65d845c9395cba7f760808d345d107f32e75af9057d67c450b8fbdd8a73636fb2e  0040-rls-atomics.patch"