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




                                                  


                    
          

































                                                                                 


                                                                                         



                                                                       

                                                                  
                                                             
                                                               





                                                                       
                                    
                               
                               
                              












































                                                                                  
                                         
                                      


                                  
                                










                                                                      
                                        




                      
                          
                                                                 


                                        
                                      
                                  


                                          












                                                   
                                              

































                                                                            
                                                              




































































































                                                                                  




















                                                                                                                                                                                                 
# 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.34.2
_bootcargover=0.34.0
_bootver=1.33.0
_llvmver=8
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-runtest-Fix-proc-macro-tests-on-musl-hosts.patch
	0008-Correct-minimum-system-LLVM-version-in-tests.patch
	0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch
	0010-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
	0011-Ignore-broken-and-non-applicable-tests.patch
	0012-Link-stage-2-tools-dynamically-to-libstd.patch
	0013-Move-debugger-scripts-to-usr-share-rust.patch
	0014-Add-foxkit-target-specs.patch
	0020-bootstrap-rustdoc.patch
	0030-libc-linkage.patch
	0031-typenum-pmmx.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 = true
		debuginfo-tools = true
		backtrace = true
		channel = "stable"
		rpath = false
		jemalloc = 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 \
	python3 x.py build -j ${JOBS:-2}
}

check() {
	cd "$builddir"

	RUST_BACKTRACE=1 \
	python3 x.py test -j ${JOBS:-2} --no-doc --no-fail-fast \
		src/test/codegen \
		src/test/codegen-units \
		src/test/compile-fail \
		src/test/incremental \
		src/test/mir-opt \
		src/test/pretty \
		src/test/run-fail \
		src/test/run-fail/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" python3 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/bin/rust-gdbgui "$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="f1bd2b226d90aae8a4657e6117b9a8451d4ce8129f79cc0fce0da7613a3b7800e690bc0ede8fec20a2f5f32c13fa8e22ac97d3838e0d36936793535a75d9c381  rustc-1.34.2-src.tar.xz
74e83fec744c8d11b4a6136b3fb5a17f7464b40488da03052646ac7ac4aa505a69c9f557c8f25ae0d7dce38d62ef759fc7f6bb77e7cb36e7e7d8baf893b55d1b  cargo-0.34.0-powerpc64-foxkit-linux-musl.tar.xz
a05f52932883ac7bd5637540ede6435c481d9f53921767b890589e5e562753afc0636a44847a2fc61939f3c89923d7e2361ec5d3d8b406c494c9be547a51b278  rust-std-1.33.0-powerpc64-foxkit-linux-musl.tar.xz
8654ac1c53e3220ed7dd350e57e2df563cf0849196c1cd63be61cd31666c5ac91b146740690b6b47451e34041bfd9109e9c0faec29ee7c7579503da3469979cd  rustc-1.33.0-powerpc64-foxkit-linux-musl.tar.xz
7d7bc8050be0eed5f5d99e13d0e20e28d49f4a04ce6b3ab8092498bb88e130d1331b09cf6a5c783b41c54b6a8003df91fd06788c02d5ae6a1f4d31e7ee40f1ca  0001-Don-t-pass-CFLAGS-to-the-C-compiler.patch
afb07e4cd986e83ad96e80b8d961b39a203d62275d21466014331953ae1ff48112138d3393a32e21da77b469f4cf91a91da770112588820585e8ba784efce2ab  0002-Fix-LLVM-build.patch
3346ae2b1c3918f95a9eda766ff7aa94afed4cc6219997d0ca2d2c711c81a6639f682bdc4be17b033dbebe2a95ccce58ce4975946d0eee8a66acef2634747f77  0003-Allow-rustdoc-to-work-when-cross-compiling-on-musl.patch
2ccb3991bde11a6b84363bdb838fb2c6b0bbffa7464e415abdd9a1786ef8fcbd6bc8da53cb5a3fc2a886ed0b91e661beb38fdc866aeed42f5fba2f8bb3c2f16f  0004-Require-static-native-libraries-when-linking-static-.patch
752d06412050839eeabd7cd39b818636474e927cce6de130527af9bf3b1015f89bf05a09e43cb26ed8aaf8f51219fdaf4d7d434e1c6fd567b9314d8c4e791700  0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
b588abcdf8adc220dc2f4d0719db67e24625ed7f67fd6de7249cc7ebea532b226a77309c8b9b7bc6678e3934056f0db75157b21185f8687113fc0b932af9c654  0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
c3ae8541c150506ea8321da4333e1ac070e64757065718b59aeb0b56f0d8633a1b82c7bde939809a38c2bd23ee504b0015a4b3be836f3602714d2317999c627b  0007-runtest-Fix-proc-macro-tests-on-musl-hosts.patch
4158215ba30307bebed8df251b593a1558b854951e43ada373f9c3a05c247aa9c2842da4e67c4ec715ea0533ea58843a563a932d61e150a16870856c66bb7a43  0008-Correct-minimum-system-LLVM-version-in-tests.patch
3d28550681e1e6a81fa132d34a0200f3d1802e3165c68b9dd0dd8e13f81d347c7c5a100b4ad7f539d456e3dab601f6983266047c8f7a1fe42d8c058151ff8ddd  0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch
0190a8b85ecf710c645f4bf8f6ae96cbafbcce26f6254596bde8a1ae2031ed4fdf5f36330464571a1131f8e174f856de0f3c16cc5b11d454219433e120bdb752  0010-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
7a8a371edae0b3af198d0b85a6fb13e4b68f55e756d3b2d8a60b9e244b377861116dfb9af1110e7669d4e338fa7e1ba608881708ee616336f4b4937c9424f827  0011-Ignore-broken-and-non-applicable-tests.patch
7c5ff39d875eee3f68d6c6c83af930962041139b4e4c3a6bc2bab754063b5ee5439dfb5d2777e902e70535c7863a8406d149e7330e9eb27ebe0d4d5eee2479a6  0012-Link-stage-2-tools-dynamically-to-libstd.patch
69ed8b4ba346fbd283abb06b7979a0c5b3597650ac68169d81a218e3e79e2dd872f5ed969fcf233aa989daf3af09197584cc9035d43b1fb3982a805235d88ac3  0013-Move-debugger-scripts-to-usr-share-rust.patch
dd988e59b8be1bbb297e4484fd98a0c6cbd61fa86fd3956c9dd55d5e21a59f790422744b534f95683b217ed30c32186701117d47e59af7417d51074fd3dac81c  0014-Add-foxkit-target-specs.patch
15a20249250aacc9792b7edc0bdcc9b49f25231b4e28070991c9af821b1a78debe2d4c27a1c60976abd137fa25ed010e0796b107ba162d190a48791adedab3bc  0020-bootstrap-rustdoc.patch
95b5f807cf5f0d47b6d329b34685a329dfb7f3b394aa4acc4147ecd3cd6b62299558df6526d661e1dfade76e147a4e9b00d2d9340268b89fdaabedf42c27e6d0  0030-libc-linkage.patch
e3ef894dfd77270f3ab34c5b694d96f43e91f2d01ccdf7a3685ee6d930a279dda378251422d432c25a30dc15a2e44356353e2c0cf952e8339ec8f82942fb6cbf  0040-rls-atomics.patch"