summaryrefslogblamecommitdiff
path: root/user/rust/APKBUILD
blob: 36715a07c8e043a60bdc5863ca58a14490349314 (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.36.0
_bootcargover=0.36.0
_bootver=1.35.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-test-use-extern-for-plugins-Don-t-assume-multilib.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
	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="1adbb3b67d599f926dc19258e2596cb3b990e152e75e71645637098526207aa5632d7915fd5b67c7a045f63860cc7be3d28be014ad6141a342adc16b2fe8a879  rustc-1.36.0-src.tar.xz
c42ee71cdfacd27d468a0349c5e5b14c5e9701b3f54f22361ec6d9c5255ed6d0eac49e2d64254e3d62e8eba1292427ed07be3cc22b7b784471d079c37a60f0ca  cargo-0.36.0-powerpc64-foxkit-linux-musl.tar.xz
772e58df18018dc32185181ffd4eebd5c83809d28bff849944573dbe05eee77c99d874f0a8d40222e6dc69679e8cb7d50230b81111dea6e05dce7e3ce5c7c8fa  rust-std-1.35.0-powerpc64-foxkit-linux-musl.tar.xz
ca5430f5c86a1df7f52058dc7ae53e557b0572a88b6288757a2702a979412971da78861c40ab11f4cf0cfa0406a9f19e1329dc2624f47b2b14dadfd094b0a745  rustc-1.35.0-powerpc64-foxkit-linux-musl.tar.xz
b9847c12db94e80879c382aa33dd3fc170536c901bac0cdc2ff507e4daa8a89116be9ff67139e130b990e8a46a0aa9db1a90b2aac34e73b7a45845974109cd3c  0001-Don-t-pass-CFLAGS-to-the-C-compiler.patch
2685cb1991de921731f4908265a2de91724ce7811c99ef9d81d018be1b4c320ff181f078b59ed170ab72234463cf3688b06d96ac158f57b4f923ee30255b304d  0002-Fix-LLVM-build.patch
d31ae4f2a2fa016907d0c141a14ba2e3e38f87155ad030249b7eec64cd5238784a5321aa0612c54e14ed746607aa6058acc275efddbb750e92008566858b3361  0003-Allow-rustdoc-to-work-when-cross-compiling-on-musl.patch
0836b0332013c2798fb1c4aecea61315dcbd62799ec37343f2b5aa9373347d3c50af83dc2a331ddcf4c2527851ca22cb58da0600fb5c593e02b0de72f05c7e34  0004-Require-static-native-libraries-when-linking-static-.patch
bb4180012c1e3156b1ead0fd3bacc1d2cb924eb362e3437b887ec19241e6576274649e218f958d474c132b9ad70567bc3b94d21c12062a6469d1f2236671a885  0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
712b8e8e0aa640bdf81a3a5f92cf06a7c2cebee472ab9f7da6347c0dc5cc2d7c39e49b5351c436d19371060459080c777ec95edcb4a0d3f7bea85fa2ec700f4b  0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
009632d5c0e783f58b4fe1f01846cad2a605da47ef29de7d728c6f08280db3532c0b7ac5a9ac0d356c795107638cd8c2c388a87969bab5e77ef7d8d71cd638d0  0007-test-use-extern-for-plugins-Don-t-assume-multilib.patch
1f04218ff5005d7ad35bb507baaf6d01f50941c809c1fbb6716ba2e35370fe9d5f50e56021cfbf036bb4336b0b1f7e98678e60e2f5fefa9d0078d7d9ffab63b8  0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
f67e238168a19564e7002fd24fc22a93a44f6d84d762324bbb9218bcb348d695df58ef6046c2dd7fcee68bf1f36ea2395d216ee73b4218dcdc075b0d815cd095  0009-Ignore-broken-and-non-applicable-tests.patch
90a9f6c25879a297b248ec8ee406382cd55ead4b7695635c3a0f5eb9e1d9145df0d727c4c644ebb053b64fa784e917fa56a9ec4d3c026d1ab3751ed4bed50ec5  0010-Link-stage-2-tools-dynamically-to-libstd.patch
0964cd36a14c252f24c9d896ad88f864394ebeca4cd03138c7ca82978dcbbd707b7306320c68afd799b6db153a0425e4f0d863c17ced482cfccbbaf99c836188  0011-Move-debugger-scripts-to-usr-share-rust.patch
333775512fd401acd27e5efe5e626e93193ef75986e51fca8987b0cc2b10e7ac41634305c7845410f333c93d5ac86af0f2763d221e8b2ab6061db5c792a3aa32  0012-Add-foxkit-target-specs.patch
7642e95d7f5e5d167a2f3e1300fc63f7bf34b6c0667b4e43e7c2378acd8c293f82d7c5651dfb75b03d717c0c5c369911f595dc641a629024e615d443244e6da1  0030-libc-linkage.patch
0cb12e9165d198c1e04b258454dbaf5459e192ad24d64c9fa132ebe0f1bcd5da3550eae8dfdaa792fa809b505af62964ecf0219dc4373420ee8ad3e111539a09  0031-typenum-pmmx.patch
ab35bacf45ef5e46be110a8d27867fd4d5deb23cd5cbe8dc7f1da2177469945f9254f2a7915ee4fc430468a4421623429f0a01eb9eba14e047384efe3d3ec152  0040-rls-atomics.patch"