diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-06-22 00:35:14 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-06-22 00:46:11 +0200 |
commit | 02e78a59eeb97125e76ebccaa8f8c2a1d70866f8 (patch) | |
tree | 222a2bd8092de6a5ee68026bf2bb3bbe49d3c424 /community/rust | |
parent | 2e8f3c81a67cc98fab76d3c7d87c517cec8da100 (diff) | |
download | aports-02e78a59eeb97125e76ebccaa8f8c2a1d70866f8.tar.bz2 aports-02e78a59eeb97125e76ebccaa8f8c2a1d70866f8.tar.xz |
community/rust: build w/o external prebuilt rustc/cargo
Diffstat (limited to 'community/rust')
-rw-r--r-- | community/rust/APKBUILD | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/community/rust/APKBUILD b/community/rust/APKBUILD index 51eaf0fbf8..48ce4e7ffa 100644 --- a/community/rust/APKBUILD +++ b/community/rust/APKBUILD @@ -3,33 +3,29 @@ # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=rust pkgver=1.17.0 -# Git revision of prebuilt Cargo to use for bootstrapping, from src/stage0.txt. -_cargo_gitrev=6b05583d71f982bcad049b9fa094c637c062e751 _llvmver=3.9 _bootver=1.16.0 -pkgrel=2 +pkgrel=3 pkgdesc="The Rust Programming Language (compiler)" url="http://www.rust-lang.org" arch="x86_64" license="ASL-2.0 BSD ISC MIT" + # gcc is needed at runtime just for linking. Someday rustc might invoke # the linker directly, and then we'll only need binutils. # See: https://github.com/rust-lang/rust/issues/11937 depends="$pkgname-stdlib=$pkgver-r$pkgrel gcc llvm-libunwind-dev musl-dev" -# libffi-dev is needed just because we compile llvm with LLVM_ENABLE_FFI. -makedepends="cmake file libffi-dev llvm$_llvmver-dev python2 tar zlib-dev" + +# * Rust is self-hosted, so you need rustc (and cargo) to build rustc... +# The last revision of this abuild that does not depend on itself (uses +# prebuilt rustc and cargo) is 8cb3112594f10a8cee5b5412c28a846acb63167f. +# * libffi-dev is needed just because we compile llvm with LLVM_ENABLE_FFI. +makedepends="rust>=$_bootver cargo + cmake file libffi-dev llvm$_llvmver-dev python2 tar zlib-dev" + subpackages="$pkgname-dbg $pkgname-stdlib $pkgname-gdb::noarch $pkgname-lldb::noarch $pkgname-doc" - -# XXX: Rust is self-hosted, so you need rustc to build rustc... The problem is -# that Rust doesn't provide prebuilt rustc for musl yet. Thus we use binaries -# from VoidLinux for now. -# Follow https://github.com/rust-lang/rust/issues/31322. -_cbuild="$CARCH-unknown-linux-musl" source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz - https://repo.voidlinux.eu/distfiles/rustc-$_bootver-$_cbuild.tar.gz - https://repo.voidlinux.eu/distfiles/rust-std-$_bootver-$_cbuild.tar.gz - cargo-$_cargo_gitrev-$_cbuild.tar.gz::https://s3.amazonaws.com/rust-lang-ci/cargo-builds/$_cargo_gitrev/cargo-nightly-$_cbuild.tar.gz musl-support-dynamic-linking.patch musl-fix-static-linking.patch musl-fix-linux_musl_base.patch @@ -48,7 +44,6 @@ builddir="$srcdir/rustc-$pkgver-src" _rlibdir="usr/lib/rustlib/$CTARGET/lib" _sharedir="usr/share/rust" -_stage0dir="$srcdir/stage0" ldpath="/$_rlibdir" @@ -57,26 +52,10 @@ prepare() { cd "$builddir" - local stage0_cargo=$(sed -En 's/^cargo:\s*(\S+)$/\1/p' src/stage0.txt) - if [ "$_cargo_gitrev" != "$stage0_cargo" ]; then - error "Update Cargo revision to: $stage0_cargo"; return 1 - fi - - # Don't set wrong LD_LIBRARY_PATH, we will rather set it manually when - # invoking make. - sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py - # Remove bundled dependencies. rm -Rf src/llvm/ src/jemalloc/ - # Prepare our stage0 for bootstrapping. - mkdir -p "$_stage0dir" - cp -flr "$srcdir"/rustc-*$_cbuild/rustc/* \ - "$srcdir"/rust-std-*$_cbuild/rust-std-*/* \ - "$srcdir"/cargo-*$_cbuild/cargo/* \ - "$_stage0dir"/ - - # Make sure to use the bundled LLVM. + # Make sure to use the system LLVM. printf '[target.%s]\nllvm_config = "/usr/lib/llvm%s/bin/llvm-config"\n' \ "$CTARGET" "$_llvmver" > config.toml } @@ -88,13 +67,13 @@ build() { # binaries produced by rustc (stripped hello_world 186 kiB vs. 358 kiB) # for only tiny performance boost (even negative in some tests). ./configure \ - --build="$_cbuild" \ + --build="$CBUILD" \ --host="$CTARGET" \ --target="$CTARGET" \ --prefix="/usr" \ --release-channel="stable" \ --enable-local-rust \ - --local-rust-root="$_stage0dir" \ + --local-rust-root="/usr" \ --llvm-root="/usr/lib/llvm$_llvmver" \ --musl-root="/usr" \ --enable-vendor \ @@ -102,9 +81,7 @@ build() { --disable-jemalloc \ --disable-docs - # Set LD_LIBRARY_PATH, so rustc in stage0 can find correct libs. make \ - LD_LIBRARY_PATH="$_stage0dir/lib" \ RUST_BACKTRACE=1 \ RUST_CRT_STATIC="false" \ VERBOSE=1 @@ -126,7 +103,6 @@ package() { cd "$builddir" make dist \ - LD_LIBRARY_PATH="$_stage0dir/lib" \ RUST_BACKTRACE=1 \ RUST_CRT_STATIC="false" \ VERBOSE=1 @@ -194,9 +170,6 @@ _mv() { } sha512sums="781799b29d83b4f0f433814bd818df034526db8e7f88c2df51d3b814eacafe8098d4bbe47ace951e1943325b3267b244007cf04f1f11083645b25aeacd40ebb6 rustc-1.17.0-src.tar.gz -e9b10d58ae5b51b09dd31a1dbf7367917bd40a05ecb4ba3e0e7ac229a0352d3ceb77de80f7c0120f553bd7904644da6bf973dbc32850b12dc91f3974846d4164 rustc-1.16.0-x86_64-unknown-linux-musl.tar.gz -54467213b2824112dec6d5a132ab01d69617a5ccaa9db15e5c8fad55dea5eb31b1b7c9ca07878901d75edd45dc84c726913bf651f3435c480a79703c074b5d90 rust-std-1.16.0-x86_64-unknown-linux-musl.tar.gz -0994945aa3faa8106059a746b3a885b1a35bf604b4c1a09a006e1a66135ff94b828102864d1642744b06c60c34a7a3107661dd54413b81ccd7c56653c29e75a5 cargo-6b05583d71f982bcad049b9fa094c637c062e751-x86_64-unknown-linux-musl.tar.gz b0a8883e4469b60edd150c84486ab950396d757220f97bd271529576614c6c3b49456098507503832c20619d4bd74246dbc99c78116634a68a6df994793e9a94 musl-support-dynamic-linking.patch 292c1cb4f751d830f5f1300d7ef94f573f698ac51e18243d7ff0d5a47bb1729bb2cbe8fb456e7a479213df5e5fbf49e360c9439d0f5ad7126cb72d161c91566a musl-fix-static-linking.patch f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef musl-fix-linux_musl_base.patch |