aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2016-08-06 02:40:28 +0200
committerJakub Jirutka <jakub@jirutka.cz>2016-08-06 02:46:07 +0200
commit2a8472b921baf8c2ac35688df5188f034b526441 (patch)
treec1dd188efdfadc06ed3a5b518d27dc51f62f319b /testing
parente66941ed72d80c578ea9727851fb0cc2c65214e9 (diff)
downloadaports-2a8472b921baf8c2ac35688df5188f034b526441.tar.bz2
aports-2a8472b921baf8c2ac35688df5188f034b526441.tar.xz
testing/rust: new aport
http://www.rust-lang.org The Rust Programming Language
Diffstat (limited to 'testing')
-rw-r--r--testing/rust/APKBUILD192
-rw-r--r--testing/rust/dont-require-filecheck.patch19
-rw-r--r--testing/rust/link-musl-dynamically.patch76
-rw-r--r--testing/rust/llvm-with-ffi.patch19
-rw-r--r--testing/rust/move-py-scripts-to-share.patch22
5 files changed, 328 insertions, 0 deletions
diff --git a/testing/rust/APKBUILD b/testing/rust/APKBUILD
new file mode 100644
index 0000000000..5162179e76
--- /dev/null
+++ b/testing/rust/APKBUILD
@@ -0,0 +1,192 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=rust
+pkgver=1.10.0
+pkgrel=0
+pkgdesc="The Rust Programming Language (compiler)"
+url="http://www.rust-lang.org"
+arch="x86_64"
+license="ASL-2.0 BSD MIT"
+depends=""
+# 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
+ musl-dev python2 tar zlib-dev"
+subpackages="$pkgname-stdlib $pkgname-gdb $pkgname-lldb $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.
+# 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
+
+ dont-require-filecheck.patch
+ link-musl-dynamically.patch
+ llvm-with-ffi.patch
+ move-py-scripts-to-share.patch
+ "
+options="!strip"
+builddir="$srcdir/rustc-$pkgver"
+
+_sharedir="usr/share/rust"
+_stage0dir="$srcdir/stage0"
+_CTARGET="$CARCH-unknown-linux-musl"
+
+prepare() {
+ default_prepare || return 1
+
+ cd "$builddir"
+
+ # Remove some bundled dependencies.
+ rm -Rf src/llvm/ src/jemalloc/ || return 1
+
+ # These tests assume that alloc_jemalloc is present, disable them.
+ sed -i "1i // ignore-test jemalloc is disabled" \
+ src/test/compile-fail/allocator-dylib-is-system.rs \
+ src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
+ src/test/run-pass/allocator-default.rs
+
+ # Prepare our stage0 for bootstrapping.
+ mkdir -p "$_stage0dir"
+ cp -flr "$srcdir"/rustc-*$_CTARGET/rustc/* \
+ "$srcdir"/rust-std-*$_CTARGET/rust-std-*/* \
+ "$srcdir"/cargo-*$_CTARGET/cargo/* \
+ "$_stage0dir"/
+}
+
+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 \
+ --build="$_CTARGET" \
+ --host="$_CTARGET" \
+ --prefix="/usr" \
+ --enable-rustbuild \
+ --release-channel="stable" \
+ --musl-root="/usr" \
+ --llvm-root="/usr/lib/llvm-3.7" \
+ --disable-docs \
+ --disable-jemalloc \
+ --disable-rpath || return 1
+
+ # 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 || return 1
+
+ #msg "Running tests..."
+ #make check VERBOSE=1
+}
+
+# XXX: so libs doesn't have stable ABI, so they should not be registered as
+# provided dependencies. The problem is that abuild doesn't provide an option
+# to disable it without completely disabling dependencies tracking.
+package() {
+ cd "$builddir"
+
+ _install build/dist/rustc-$pkgver-$_CTARGET.tar.gz \
+ "$pkgdir"/usr || return 1
+
+ # 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/
+}
+
+stdlib() {
+ pkgdesc="The Rust Programming Language (stdlib)"
+ depends="$pkgname"
+
+ cd "$builddir"
+ _install build/dist/rust-std-$pkgver-$_CTARGET.tar.gz \
+ "$subpkgdir"/usr || return 1
+}
+
+gdb() {
+ pkgdesc="GDB pretty printers for Rust"
+ arch="noarch"
+ depends="$pkgname gdb"
+
+ mkdir -p "$subpkgdir"
+ cd "$subpkgdir"
+
+ _mv "$pkgdir"/usr/bin/rust-gdb usr/bin/ || return 1
+ _mv "$pkgdir"/$_sharedir/etc/gdb_*.py $_sharedir/etc/
+}
+
+lldb() {
+ pkgdesc="LLDB pretty printers for Rust"
+ arch="noarch"
+ depends="$pkgname lldb py-lldb"
+
+ mkdir -p "$subpkgdir"
+ cd "$subpkgdir"
+
+ _mv "$pkgdir"/usr/bin/rust-lldb usr/bin/ || return 1
+ _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
+19cc2725d68db3e359e0e3016028374e5818a97fdba24d0103f7d1706601c8b17c4dd95a3152e64f982f98e95ad3e949acddbea8a39ed0ba8dd4f702acc2704d move-py-scripts-to-share.patch"
diff --git a/testing/rust/dont-require-filecheck.patch b/testing/rust/dont-require-filecheck.patch
new file mode 100644
index 0000000000..430cc9320c
--- /dev/null
+++ b/testing/rust/dont-require-filecheck.patch
@@ -0,0 +1,19 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Thu, 04 Aug 2016 17:53:00 +0200
+Subject: [PATCH] Do not require FileCheck
+
+--- a/src/bootstrap/build/sanity.rs
++++ b/src/bootstrap/build/sanity.rs
+@@ -76,12 +76,6 @@
+ need_cmd(build.cxx(host).as_ref());
+ }
+
+- // Externally configured LLVM requires FileCheck to exist
+- let filecheck = build.llvm_filecheck(&build.config.build);
+- if !filecheck.starts_with(&build.out) && !filecheck.exists() {
+- panic!("filecheck executable {:?} does not exist", filecheck);
+- }
+-
+ for target in build.config.target.iter() {
+ // Either can't build or don't want to run jemalloc on these targets
+ if target.contains("rumprun") ||
diff --git a/testing/rust/link-musl-dynamically.patch b/testing/rust/link-musl-dynamically.patch
new file mode 100644
index 0000000000..d15eb91ded
--- /dev/null
+++ b/testing/rust/link-musl-dynamically.patch
@@ -0,0 +1,76 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Thu, 04 Aug 2016 17:53:00 +0200
+Subject: [PATCH] Do not link musl statically
+
+Static linking of rustc on Alpine doesn't work yet.
+
+This patch is ported from
+https://gist.github.com/japaric/52b8816a4c86f5a4699bcc50ebc3e020.
+
+--- a/src/bootstrap/build/sanity.rs
++++ b/src/bootstrap/build/sanity.rs
+@@ -97,26 +91,6 @@
+ panic!("the iOS target is only supported on OSX");
+ }
+
+- // Make sure musl-root is valid if specified
+- if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
+- match build.config.musl_root {
+- Some(ref root) => {
+- if fs::metadata(root.join("lib/libc.a")).is_err() {
+- panic!("couldn't find libc.a in musl dir: {}",
+- root.join("lib").display());
+- }
+- if fs::metadata(root.join("lib/libunwind.a")).is_err() {
+- panic!("couldn't find libunwind.a in musl dir: {}",
+- root.join("lib").display());
+- }
+- }
+- None => {
+- panic!("when targeting MUSL the build.musl-root option \
+- must be specified in config.toml")
+- }
+- }
+- }
+-
+ if target.contains("msvc") {
+ // There are three builds of cmake on windows: MSVC, MinGW, and
+ // Cygwin. The Cygwin build does not have generators for Visual
+--- a/src/liblibc/src/unix/mod.rs
++++ b/src/liblibc/src/unix/mod.rs
+@@ -187,11 +187,6 @@
+ } else if #[cfg(all(not(stdbuild), feature = "use_std"))] {
+ // cargo build, don't pull in anything extra as the libstd dep
+ // already pulls in all libs.
+- } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips")),
+- target_env = "musleabi",
+- target_env = "musleabihf"))] {
+- #[link(name = "c", kind = "static")]
+- extern {}
+ } else if #[cfg(target_os = "emscripten")] {
+ #[link(name = "c")]
+ extern {}
+--- a/src/librustc_back/target/x86_64_unknown_linux_musl.rs
++++ b/src/librustc_back/target/x86_64_unknown_linux_musl.rs
+@@ -11,7 +11,7 @@
+ use target::Target;
+
+ pub fn target() -> Target {
+- let mut base = super::linux_musl_base::opts();
++ let mut base = super::linux_base::opts();
+ base.cpu = "x86-64".to_string();
+ base.max_atomic_width = 64;
+ base.pre_link_args.push("-m64".to_string());
+--- a/src/libunwind/build.rs
++++ b/src/libunwind/build.rs
+@@ -16,9 +16,7 @@
+ let target = env::var("TARGET").unwrap();
+
+ if target.contains("linux") {
+- if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
+- println!("cargo:rustc-link-lib=static=unwind");
+- } else if !target.contains("android") {
++ if !target.contains("android") {
+ println!("cargo:rustc-link-lib=gcc_s");
+ }
+ } else if target.contains("freebsd") {
diff --git a/testing/rust/llvm-with-ffi.patch b/testing/rust/llvm-with-ffi.patch
new file mode 100644
index 0000000000..23504eac71
--- /dev/null
+++ b/testing/rust/llvm-with-ffi.patch
@@ -0,0 +1,19 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Thu, 04 Aug 2016 17:53:00 +0200
+Subject: [PATCH] Workaround for external LLVM built with LLVM_ENABLE_FFI
+
+Workaround for problem with LLVM_ENABLE_FFI described in
+https://github.com/rust-lang/rust/issues/34486.
+
+--- a/src/librustc_llvm/lib.rs
++++ b/src/librustc_llvm/lib.rs
+@@ -577,6 +577,9 @@
+ #[cfg(not(cargobuild))]
+ extern {}
+
++#[link(name = "ffi")]
++extern {}
++
+ #[linked_from = "rustllvm"] // not quite true but good enough
+ extern {
+ /* Create and destroy contexts. */
diff --git a/testing/rust/move-py-scripts-to-share.patch b/testing/rust/move-py-scripts-to-share.patch
new file mode 100644
index 0000000000..4afbb1f696
--- /dev/null
+++ b/testing/rust/move-py-scripts-to-share.patch
@@ -0,0 +1,22 @@
+--- a/src/etc/rust-gdb
++++ b/src/etc/rust-gdb
+@@ -14,7 +14,7 @@
+
+ # Find out where the pretty printer Python module is
+ RUSTC_SYSROOT=`rustc --print=sysroot`
+-GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
++GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust/etc"
+
+ # Run GDB with the additional arguments that load the pretty printers
+ PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" gdb \
+--- a/src/etc/rust-lldb
++++ b/src/etc/rust-lldb
+@@ -22,7 +22,7 @@
+ RUSTC_SYSROOT=`rustc --print sysroot`
+
+ # Write the LLDB script to the tempfile
+-echo "command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\"" >> $TMPFILE
++echo "command script import \"$RUSTC_SYSROOT/share/rust/etc/lldb_rust_formatters.py\"" >> $TMPFILE
+ echo "type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust" >> $TMPFILE
+ echo "type category enable Rust" >> $TMPFILE
+