diff options
Diffstat (limited to 'testing/rust/APKBUILD')
-rw-r--r-- | testing/rust/APKBUILD | 148 |
1 files changed, 66 insertions, 82 deletions
diff --git a/testing/rust/APKBUILD b/testing/rust/APKBUILD index e7bbe856d9..a2af1143d7 100644 --- a/testing/rust/APKBUILD +++ b/testing/rust/APKBUILD @@ -1,39 +1,43 @@ # Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Contributor: Shiz <hi@shiz.me> # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=rust -pkgver=1.10.0 -pkgrel=1 +pkgver=1.16.0 +# Git revision of prebuilt cargo to use for bootstrapping. +_cargo_gitrev=f9e54817e53c7b9845cc7c1ede4c11e4d3e42e36 # 0.17.0 +pkgrel=0 pkgdesc="The Rust Programming Language (compiler)" url="http://www.rust-lang.org" arch="x86_64" -license="ASL-2.0 BSD MIT" +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 gcc" -# libffi-dev is needed just because we compile llvm3.7 with LLVM_ENABLE_FFI. -makedepends="cmake file libffi-dev llvm3.7 llvm3.7-dev llvm3.7-static +# libffi-dev is needed just because we compile llvm with LLVM_ENABLE_FFI. +makedepends="cmake file libffi-dev libunwind-dev llvm llvm-dev llvm-static musl-dev python2 tar zlib-dev" subpackages="$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 I cross-compiled -# rustc on glibc-based system and uploaded the built tarballs to my server. -# We're gonna replace them once Rust start providing prebuilt binaries for musl. +# 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. -# TODO: Implement some support for verifying crates fetched by cargo! source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz - https://alpine.geeknet.cz/distfiles/rustc-$pkgver-x86_64-unknown-linux-musl.tar.gz - https://alpine.geeknet.cz/distfiles/rust-std-$pkgver-x86_64-unknown-linux-musl.tar.gz - https://alpine.geeknet.cz/distfiles/cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz - + https://repo.voidlinux.eu/distfiles/rustc-$pkgver-x86_64-unknown-linux-musl.tar.gz + https://repo.voidlinux.eu/distfiles/rust-std-$pkgver-x86_64-unknown-linux-musl.tar.gz + cargo-$_cargo_gitrev-x86_64-unknown-linux-musl.tar.gz::https://s3.amazonaws.com/rust-lang-ci/cargo-builds/$_cargo_gitrev/cargo-nightly-x86_64-unknown-linux-musl.tar.gz dont-require-filecheck.patch - link-musl-dynamically.patch + support-dynamically-linked-musl.patch + allow-crt-static-on-stable.patch + static-pie.patch + fix-linux_musl_base.patch llvm-with-ffi.patch move-py-scripts-to-share.patch " -options="!check !strip" -builddir="$srcdir/rustc-$pkgver" +# TODO: strip gently (see Fedora pkg for inspiration) +options="!strip !check" +builddir="$srcdir/rustc-$pkgver-src" _ctarget="$CARCH-unknown-linux-musl" _sharedir="usr/share/rust" @@ -44,6 +48,10 @@ prepare() { cd "$builddir" + # 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 some bundled dependencies. rm -Rf src/llvm/ src/jemalloc/ @@ -64,50 +72,38 @@ prepare() { build() { cd "$builddir" - export CARGO_HOME="$builddir/.cargo" - - # XXX: Cheat Rust build system so we can build rustc using different - # version of (prebuilt) stable rustc than preconfigured. It's hack-ish, - # but since we're basically rebuilding rustc with the same version, - # it's actually safe. - # Note: --enable-local-rebuild from #33787 didn't work, don't know why. - local rustc_ver="$("$_stage0dir"/bin/rustc --version | cut -f2 -d ' ')" - local rustc_key="$(printf "$rustc_ver" | md5sum | cut -c1-8)" - sed -Ei \ - -e "s/^(rustc):.*/\1: $rustc_ver-1970-01-01/" \ - -e "s/^(rustc_key):.*/\1: $rustc_key/" \ - src/stage0.txt - - # Generate config for bootstrap.py to use our prebuilt rustc and cargo - # for bootstrapping instead of downloading snapshot from internet. - cat > config.toml <<-EOF - [build] - cargo = "$_stage0dir/bin/cargo" - rustc = "$_stage0dir/bin/rustc" - EOF - # Note: rustc doesn't work well with jemalloc on musl (yet) ./configure \ + --enable-rustbuild \ --build="$_ctarget" \ --host="$_ctarget" \ + --target="$_ctarget" \ --prefix="/usr" \ - --enable-rustbuild \ --release-channel="stable" \ + --enable-local-rust \ + --local-rust-root="$_stage0dir" \ + --llvm-root="/usr" \ --musl-root="/usr" \ - --llvm-root="/usr/lib/llvm-3.7" \ + --enable-vendor \ --disable-docs \ --disable-jemalloc \ --disable-rpath - # This is really stupid, but rustbuild doesn't provide "install" - # command yet, so we must create a dist tarball... - # https://github.com/rust-lang/rust/issues/34675 - make dist VERBOSE=1 + # 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 } check() { cd "$builddir" - make check VERBOSE=1 + + make check \ + LD_LIBRARY_PATH="$_stage0dir/lib" \ + RUST_BACKTRACE=1 \ + VERBOSE=1 } # XXX: so libs doesn't have stable ABI, so they should not be registered as @@ -116,21 +112,30 @@ check() { package() { cd "$builddir" - _install build/dist/rustc-$pkgver-$_ctarget.tar.gz \ - "$pkgdir"/usr + make install \ + LD_LIBRARY_PATH="$_stage0dir/lib" \ + DESTDIR="$pkgdir" + + cd "$pkgdir" + + # so libs should have executable flag. + chmod +x usr/lib/*.so # Python scripts are noarch, so move them to /usr/share. # Requires move-py-scripts-to-share.patch to be applied. - _mv "$pkgdir"/usr/lib/rustlib/etc/*.py "$pkgdir"/$_sharedir/etc/ + _mv usr/lib/rustlib/etc/*.py $_sharedir/etc/ + rmdir -p usr/lib/rustlib/etc || true + + # Remove some clutter. + cd usr/lib/rustlib + rm components install.log manifest-* rust-installer-version uninstall.sh } stdlib() { pkgdesc="The Rust Programming Language (stdlib)" depends="$pkgname" - cd "$builddir" - _install build/dist/rust-std-$pkgver-$_ctarget.tar.gz \ - "$subpkgdir"/usr + _mv "$pkgdir"/usr/lib/rustlib "$subpkgdir"/usr/lib/ } gdb() { @@ -155,41 +160,20 @@ lldb() { _mv "$pkgdir"/$_sharedir/etc/lldb_*.py $_sharedir/etc/ } -_install() { - local tarfile="$1" - local dest="$2" - - mkdir -p "$dest" - tar -xz -f "$tarfile" -C "$dest" --strip-components=2 --exclude=manifest.in -} - _mv() { local dest; for dest; do true; done # get last argument mkdir -p "$dest" mv $@ } -md5sums="a48fef30353fc9daa70b484b690ce5db rustc-1.10.0-src.tar.gz -7d6278b0898b3c9e05cd3c622d8c7491 rustc-1.10.0-x86_64-unknown-linux-musl.tar.gz -f5ebd54888bfd8698f629b168691a47b rust-std-1.10.0-x86_64-unknown-linux-musl.tar.gz -79f81ecfa861f4d97a3b9235e66ba594 cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz -c6fc2288df0b746f5317c866800a628b dont-require-filecheck.patch -4351eff471b20fbcf135fe311e5b0870 link-musl-dynamically.patch -27f12fb4ce42e18dcf19fd78be4c183e llvm-with-ffi.patch -9b951149e87a99a1934af4eb7e698902 move-py-scripts-to-share.patch" -sha256sums="a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869 rustc-1.10.0-src.tar.gz -a7d8baacfa2225c923de28ecef2c9550c1d82cef3b90f6a1b8431359da7e7e69 rustc-1.10.0-x86_64-unknown-linux-musl.tar.gz -335527615fc1a5f53d41c1d8556645bfe0b4f3a39f72ad859b392392066d9239 rust-std-1.10.0-x86_64-unknown-linux-musl.tar.gz -587172026c0565e839d96b0c1d4c68c000927817398241f96682dca47fa8c3b9 cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz -45ffc2e5626ce5e8e7dadecbd7cfdbf4db6bc1bba99dc54376a794011bb3919b dont-require-filecheck.patch -8aec85b958ab975164d1673b666be0aa88d4b51b5944fa7227024b4942f52ed8 link-musl-dynamically.patch -a7d533ac9542151234911d4a48815cc53f490b8011f5eab555cbc3a95fbde2b6 llvm-with-ffi.patch -176dfddeff62f0bac918f742df6041df6ab777d0ddbfd01a73d580180781cbee move-py-scripts-to-share.patch" -sha512sums="fdef0a4c458ce687ab2921fb879cf6f68ae7ec4d780e407fea80cb751d70d80e621fc37756358d8336383c24646d9e2869215b3591b2240904206df2e58a7e45 rustc-1.10.0-src.tar.gz -35e94c86a6abc579dcfe875ecc830522ecb8b1a0b96a03054b4020f21b1a2ee1ab2e61782dafbfaa3ce7b5b721f4b15f10e5dfac9c41b6f008152ed8b842ac67 rustc-1.10.0-x86_64-unknown-linux-musl.tar.gz -f6a89b4a1dc3d620cc1d783f62eb4f2e7a519f6b86b4d87877b854ea86ac740a0c8ea96c4ff11185bfb496861ade286ad08c3ab5e0bcc9592251406d7fb35f8a rust-std-1.10.0-x86_64-unknown-linux-musl.tar.gz -17838355ff6d87165aa0f61bd01f48c58a426c069bba7c3852d016e1836666bfafe2609c323a0409fc8530ad27fb3ad5989d8cee033633e38b07fefa670597d5 cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz -19f390e0d9cd2c23cbad26aa97f51a0978a3ed5170050d5635ee06e5115d8608f55884a61d98003fca91434c9be081bde735ace97f1e251450b70d63c3bffd42 dont-require-filecheck.patch -9ae2d8d9eff9fb6cf8fe8e902f0b87bc464cd84364734f105230785c4d8dc57ecf6872fc0532e15ac612ef11727e70ef25d08f7b084c4473017989b6c9a4593b link-musl-dynamically.patch -ab126eea4b960924b4a4d52f73709085a3b742329364db1a3543bcae94e4e6d8f94d30983e5e06069a489678b2d195e7535ff8e66be2c518dc8b2c54cb0c8804 llvm-with-ffi.patch +sha512sums="096b1b7406be9bc61161bb7cdd2061f2bc2174c161a31f4ed6ceecf7fc379f315fc2f7cb9f6c134ea4f8519c27bf6e5a3f712cf1e56d5785831d8c8374eb0ba5 rustc-1.16.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 +97698f6b9a1eae6e181dc480599095f0aa5fcf85cdc3dc6b5340a20e1e42f585188c06074c1e35cff4393a78c8502c81d8852fcf7da674e0a7313f88155feb56 cargo-f9e54817e53c7b9845cc7c1ede4c11e4d3e42e36-x86_64-unknown-linux-musl.tar.gz +2002faf08cca3be702f25618bc17453c5e76644a6ff6b0739b642c2c0f8536ec7f09c98182aff6b2dcc87c77b0929f2f8f732b8242a8f80d94b3824c8cd0d0fe dont-require-filecheck.patch +a87ffe129debcb9fa958c6d007ffa4a87927890030e0694ee5ab1929ea0c5a48dad86b4e8b71550dcfeda29b644dbb23d8b232bda62439f198a404cf658c68b0 support-dynamically-linked-musl.patch +57ea7651bc0b0fa5340b9c5de0492ddc8bfaf4f1003298bf27dea57ee562cdd0f3947e091b154388535ce511e001e052f12d48805f7ffece7f04178ad409623f allow-crt-static-on-stable.patch +541aac679dfdbe5383f884e0493462dd33908308c7b294170b24339d6b9c1e723088c80764125116f24707a67eeeedadceaa9628ca6d2b8c7d0ca9253bf62135 static-pie.patch +f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef fix-linux_musl_base.patch +37416e1fa0bc0c8651cd060a645d6245ff7e2082279ab5e13495c5ee412c71915469019cfbec95a0fd9a7fc144475079a3ad16f0eba7a2f5c8dd99e0002f3225 llvm-with-ffi.patch 19cc2725d68db3e359e0e3016028374e5818a97fdba24d0103f7d1706601c8b17c4dd95a3152e64f982f98e95ad3e949acddbea8a39ed0ba8dd4f702acc2704d move-py-scripts-to-share.patch" |