aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShiz <hi@shiz.me>2017-04-20 02:34:01 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-04-21 01:45:55 +0200
commit99199c93f79b25a673009a43b281b0c6ffbfd0a1 (patch)
tree1e61688b3e4f89c5a008ef996a785ea70c7d1583
parent06ef4afb639890920801ec034cffaa31ab25b98c (diff)
downloadaports-99199c93f79b25a673009a43b281b0c6ffbfd0a1.tar.bz2
aports-99199c93f79b25a673009a43b281b0c6ffbfd0a1.tar.xz
testing/rust: add Alpine-specific target, move our local differences there
This adds new Alpine targets to Rust, $arch-alpine-linux-musl that embed our toolchain and distribution differences. We also modify the APKBUILD to properly support (pseudo-)cross-compilation from the $arch-unknown-linux-musl bootstrap targets to this new target.
-rw-r--r--testing/rust/APKBUILD52
-rw-r--r--testing/rust/alpine-musl-dynamic-linking-by-default.patch16
-rw-r--r--testing/rust/alpine-need-rpath.patch11
-rw-r--r--testing/rust/alpine-target.patch154
4 files changed, 185 insertions, 48 deletions
diff --git a/testing/rust/APKBUILD b/testing/rust/APKBUILD
index c90428ed08..944e252837 100644
--- a/testing/rust/APKBUILD
+++ b/testing/rust/APKBUILD
@@ -6,7 +6,7 @@ pkgver=1.16.0
# Git revision of prebuilt Cargo to use for bootstrapping, from src/stage0.txt.
_cargo_gitrev=6e0c18cccc8b0c06fba8a8d76486f81a792fb420
_llvmver=3.9
-pkgrel=4
+pkgrel=5
pkgdesc="The Rust Programming Language (compiler)"
url="http://www.rust-lang.org"
arch="x86_64"
@@ -24,29 +24,28 @@ subpackages="$pkgname-dbg $pkgname-stdlib
# 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-$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
+ https://repo.voidlinux.eu/distfiles/rustc-$pkgver-$_cbuild.tar.gz
+ https://repo.voidlinux.eu/distfiles/rust-std-$pkgver-$_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
musl-fix-jemalloc.patch
- static-pie.patch
llvm-with-ffi.patch
- alpine-musl-dynamic-linking-by-default.patch
+ static-pie.patch
need-rpath.patch
minimize-rpath.patch
alpine-allow-crt-static.patch
alpine-move-py-scripts-to-share.patch
alpine-change-rpath-to-rustlib.patch
- alpine-need-rpath.patch
+ alpine-target.patch
check-rustc
"
builddir="$srcdir/rustc-$pkgver-src"
-_ctarget="$CARCH-unknown-linux-musl"
-_rlibdir="usr/lib/rustlib/$_ctarget/lib"
+_rlibdir="usr/lib/rustlib/$CTARGET/lib"
_sharedir="usr/share/rust"
_stage0dir="$srcdir/stage0"
@@ -71,10 +70,14 @@ prepare() {
# Prepare our stage0 for bootstrapping.
mkdir -p "$_stage0dir"
- cp -flr "$srcdir"/rustc-*$_ctarget/rustc/* \
- "$srcdir"/rust-std-*$_ctarget/rust-std-*/* \
- "$srcdir"/cargo-*$_ctarget/cargo/* \
+ cp -flr "$srcdir"/rustc-*$_cbuild/rustc/* \
+ "$srcdir"/rust-std-*$_cbuild/rust-std-*/* \
+ "$srcdir"/cargo-*$_cbuild/cargo/* \
"$_stage0dir"/
+
+ # Make sure to use the bundled LLVM.
+ printf '[target.%s]\nllvm_config = "/usr/lib/llvm%s/bin/llvm-config"\n' \
+ "$CTARGET" "$_llvmver" > config.toml
}
build() {
@@ -85,9 +88,9 @@ build() {
# for only tiny performance boost (even negative in some tests).
./configure \
--enable-rustbuild \
- --build="$_ctarget" \
- --host="$_ctarget" \
- --target="$_ctarget" \
+ --build="$_cbuild" \
+ --host="$CTARGET" \
+ --target="$CTARGET" \
--prefix="/usr" \
--release-channel="stable" \
--enable-local-rust \
@@ -108,22 +111,30 @@ build() {
}
check() {
- "$srcdir"/check-rustc "$builddir/build/$_ctarget/stage2/bin/rustc"
+ "$srcdir"/check-rustc "$builddir/build/$CTARGET/stage2/bin/rustc"
# XXX: There's some problem with these tests, we will figure it out later.
# cd "$builddir"
# make check \
# LD_LIBRARY_PATH="$_stage0dir/lib" \
# RUST_BACKTRACE=1 \
+# RUST_CRT_STATIC="false" \
# VERBOSE=1
}
package() {
cd "$builddir"
- make install \
+ make dist \
LD_LIBRARY_PATH="$_stage0dir/lib" \
- DESTDIR="$pkgdir"
+ RUST_BACKTRACE=1 \
+ RUST_CRT_STATIC="false" \
+ VERBOSE=1
+
+ local component; for component in rustc rust-std; do
+ tar -xf "build/dist/$component-$pkgver-$CTARGET.tar.gz"
+ ./"$component-$pkgver-$CTARGET"/install.sh --destdir="$pkgdir" --prefix=/usr --disable-ldconfig
+ done
cd "$pkgdir"
@@ -190,13 +201,12 @@ b0a8883e4469b60edd150c84486ab950396d757220f97bd271529576614c6c3b4945609850750383
b99b1576016a0173fa0fd83a7711b0cfbe31d18fbbaf7ed79531b706411b675a2689115727f171e72de1367863552e3cdbc1bef7c0d0250505dcce0ba0a973db musl-fix-static-linking.patch
f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef musl-fix-linux_musl_base.patch
c913d04ef419b2b6d8e453f72894070f263c9292abf97114a51884d475d03ce5b032053f1676ba9364800b4b35e394f707995058530ad5e4122c60f65ddd3db7 musl-fix-jemalloc.patch
-5881cb63c77a566aab80428084297fa278c04aeb5fe4e7a3a32655f2b97cdb5b0712fe859662392393dbbb4b2723be543a0207f6b75961a5fb79351c02c107a9 static-pie.patch
dc6432293bd060d5e3a73f25870867654fae61995dcd919e244a2dc686b6107556deed8c59ca6002182bfeff5ebc1ca2b89c4028ab0fbfb79e65defe47c9b4b0 llvm-with-ffi.patch
-44f3104f506531778fede64034ff5b86f782744d7fed26b393cd88590c22b7fd1df441e2c14bb44c660c54140a4093686aa35f53357f9cd795af6cfa6df1cec4 alpine-musl-dynamic-linking-by-default.patch
+5881cb63c77a566aab80428084297fa278c04aeb5fe4e7a3a32655f2b97cdb5b0712fe859662392393dbbb4b2723be543a0207f6b75961a5fb79351c02c107a9 static-pie.patch
ff633f2a46c683ad698d1c09c98c06ce9ee9b8d55fa5593cdd485b439ebca3273794d29b5ff32b887be8666f52913a23af6e133c782bd0c4e2c88e306dd3a494 need-rpath.patch
d352614e7c774e181decae210140e789de7fc090327ff371981ad28a11ce51c8c01b27c1101a24bb84d75ed2f706f67868f7dbc52196d4ccdf4ebd2d6d6b6b5e minimize-rpath.patch
b00997c65d1a451fafae8b547893c5cbf03f028d2d70f6971aa670f34c2d6fc82728c740ac4a9909fc1999925ff300e4525cfec745cb9c9521e564eb166872a2 alpine-allow-crt-static.patch
498f4649163974afc4f042c43cd0c15d36784031514201a2962061f288a9336c2bc9749f8d2308b8ce3656f8097b5fc5bef505f61e2a6ed422ef4153f5339d77 alpine-move-py-scripts-to-share.patch
8d6206f8c50856724cf7b4c1854ec82547f040358a1c7d44abeacc27a5c205a963b1fec51e58ec06c68d85bd2f68a9e6e27ebe457f39e8dd043de17758f5063f alpine-change-rpath-to-rustlib.patch
-816068be3ef92b3a67dedc3c4cf80b647f4a40743dc06a50801ba3a1bd3194f244bd7498f57db781f625a0c0da9605ef42e6dae6b781ad6c7f73ec5b45242e98 alpine-need-rpath.patch
+aaf359dbfb8f379bef42647890e99ada4b5326c29f726edb16c51b23a5033b5e00363d2fb6d74a4f11dfbb241b21b22c578e2ec269ecd77a87cf20d3620b29a5 alpine-target.patch
79549055dea81379c890b495c82456ab497a9179ec6702c59e11d0748bc668f47fc3d6a69c27a0545bb87c01318631dffc69260bf2d4badc75f53cbf7fad7528 check-rustc"
diff --git a/testing/rust/alpine-musl-dynamic-linking-by-default.patch b/testing/rust/alpine-musl-dynamic-linking-by-default.patch
deleted file mode 100644
index 225fc2df06..0000000000
--- a/testing/rust/alpine-musl-dynamic-linking-by-default.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-From: Jakub Jirutka <jakub@jirutka.cz>
-Date: Thu, 13 Apr 2017 15:57:00 +0200
-Subject: [PATCH] Use dynamic linking as default on musl
-
---- a/src/librustc_back/target/linux_musl_base.rs
-+++ b/src/librustc_back/target/linux_musl_base.rs
-@@ -19,9 +19,6 @@
- // argument is *not* necessary for normal builds, but it can't hurt!
- base.pre_link_args.push("-Wl,--eh-frame-hdr".to_string());
-
-- // Except for on MIPS, these targets statically link libc by default.
-- base.crt_static_default = true;
--
- // Static position-independent executables are supported.
- base.static_position_independent_executables = true;
-
diff --git a/testing/rust/alpine-need-rpath.patch b/testing/rust/alpine-need-rpath.patch
deleted file mode 100644
index 8710f0254b..0000000000
--- a/testing/rust/alpine-need-rpath.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/librustc_back/target/linux_musl_base.rs
-+++ b/src/librustc_back/target/linux_musl_base.rs
-@@ -22,5 +22,8 @@
- // Static position-independent executables are supported.
- base.static_position_independent_executables = true;
-
-+ // We need an RPATH.
-+ base.need_rpath = true;
-+
- base
- }
diff --git a/testing/rust/alpine-target.patch b/testing/rust/alpine-target.patch
new file mode 100644
index 0000000000..e013a6bc2e
--- /dev/null
+++ b/testing/rust/alpine-target.patch
@@ -0,0 +1,154 @@
+From: Shiz <hi@shiz.me>
+Date: Thu, 20 Aug 2017 01:52:36 +0200
+Subject: [PATCH] Add Alpine targets
+
+This adds `$arch-alpine-linux-musl` targets to Rust to encode our toolchain
+and distribution-specific quirks instead of polluting the main musl target of
+`$arch-unknown-linux-musl`.
+
+--- /dev/null
++++ b/src/librustc_back/target/i586_alpine_linux_musl.rs
+@@ -0,0 +1,32 @@
++// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
++// file at the top-level directory of this distribution and at
++// http://rust-lang.org/COPYRIGHT.
++//
++// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
++// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
++// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
++// option. This file may not be copied, modified, or distributed
++// except according to those terms.
++
++use target::{Target, TargetResult};
++
++pub fn target() -> TargetResult {
++ let mut base = super::linux_musl_base::opts();
++ base.cpu = "pentium4".to_string();
++ base.max_atomic_width = Some(64);
++ base.crt_static_default = false;
++ base.static_position_independent_executables = true;
++ base.need_rpath = true;
++
++ Ok(Target {
++ llvm_target: "i586-alpine-linux-musl".to_string(),
++ target_endian: "little".to_string(),
++ target_pointer_width: "32".to_string(),
++ data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
++ arch: "x86".to_string(),
++ target_os: "linux".to_string(),
++ target_env: "musl".to_string(),
++ target_vendor: "alpine".to_string(),
++ options: base,
++ })
++}
+--- a/src/librustc_back/target/mod.rs
++++ b/src/librustc_back/target/mod.rs
+@@ -214,6 +214,9 @@
+ ("thumbv7m-none-eabi", thumbv7m_none_eabi),
+ ("thumbv7em-none-eabi", thumbv7em_none_eabi),
+ ("thumbv7em-none-eabihf", thumbv7em_none_eabihf),
++
++ ("i586-alpine-linux-musl", i586_alpine_linux_musl),
++ ("x86_64-alpine-linux-musl", x86_64_alpine_linux_musl),
+ }
+
+ /// Everything `rustc` knows about how to compile for a specific target.
+--- /dev/null
++++ b/src/librustc_back/target/x86_64_alpine_linux_musl.rs
+@@ -0,0 +1,32 @@
++// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
++// file at the top-level directory of this distribution and at
++// http://rust-lang.org/COPYRIGHT.
++//
++// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
++// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
++// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
++// option. This file may not be copied, modified, or distributed
++// except according to those terms.
++
++use target::{Target, TargetResult};
++
++pub fn target() -> TargetResult {
++ let mut base = super::linux_musl_base::opts();
++ base.cpu = "x86-64".to_string();
++ base.max_atomic_width = Some(64);
++ base.crt_static_default = false;
++ base.static_position_independent_executables = true;
++ base.need_rpath = true;
++
++ Ok(Target {
++ llvm_target: "x86_64-alpine-linux-musl".to_string(),
++ target_endian: "little".to_string(),
++ target_pointer_width: "64".to_string(),
++ data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
++ arch: "x86_64".to_string(),
++ target_os: "linux".to_string(),
++ target_env: "musl".to_string(),
++ target_vendor: "alpine".to_string(),
++ options: base,
++ })
++}
+--- /dev/null
++++ b/mk/cfg/i586-alpine-linux-musl.mk
+@@ -0,0 +1,29 @@
++# i586-alpine-linux-musl configuration
++CC_i586-alpine-linux-musl=$(CC)
++CXX_i586-alpine-linux-musl=$(CXX)
++CPP_i586-alpine-linux-musl=$(CPP)
++AR_i586-alpine-linux-musl=$(AR)
++CFG_INSTALL_ONLY_RLIB_i586-alpine-linux-musl = 0
++CFG_LIB_NAME_i586-alpine-linux-musl=lib$(1).so
++CFG_STATIC_LIB_NAME_i586-alpine-linux-musl=lib$(1).a
++CFG_LIB_GLOB_i586-alpine-linux-musl=lib$(1)-*.so
++CFG_JEMALLOC_CFLAGS_i586-alpine-linux-musl :=
++CFG_GCCISH_CFLAGS_i586-alpine-linux-musl := -g -fPIC
++CFG_GCCISH_CXXFLAGS_i586-alpine-linux-musl :=
++CFG_GCCISH_LINK_FLAGS_i586-alpine-linux-musl :=
++CFG_GCCISH_DEF_FLAG_i586-alpine-linux-musl :=
++CFG_LLC_FLAGS_i586-alpine-linux-musl :=
++CFG_INSTALL_NAME_i586-alpine-linux-musl =
++CFG_EXE_SUFFIX_i586-alpine-linux-musl =
++CFG_WINDOWSY_i586-alpine-linux-musl :=
++CFG_UNIXY_i586-alpine-linux-musl := 1
++CFG_LDPATH_i586-alpine-linux-musl :=
++CFG_RUN_i586-alpine-linux-musl=$(2)
++CFG_RUN_TARG_i586-alpine-linux-musl=$(call CFG_RUN_i586-alpine-linux-musl,,$(2))
++CFG_GNU_TRIPLE_i586-alpine-linux-musl := i586-alpine-linux-musl
++CFG_THIRD_PARTY_OBJECTS_i586-alpine-linux-musl :=
++CFG_INSTALLED_OBJECTS_i586-alpine-linux-musl :=
++
++NATIVE_DEPS_libc_T_i586-alpine-linux-musl += libc.a
++NATIVE_DEPS_std_T_i586-alpine-linux-musl +=
++NATIVE_DEPS_unwind_T_i586-alpine-linux-musl += libunwind.a
+--- /dev/null
++++ b/mk/cfg/x86_64-alpine-linux-musl.mk
+@@ -0,0 +1,29 @@
++# x86_64-alpine-linux-musl configuration
++CC_x86_64-alpine-linux-musl=$(CC)
++CXX_x86_64-alpine-linux-musl=$(CXX)
++CPP_x86_64-alpine-linux-musl=$(CPP)
++AR_x86_64-alpine-linux-musl=$(AR)
++CFG_INSTALL_ONLY_RLIB_x86_64-alpine-linux-musl = 0
++CFG_LIB_NAME_x86_64-alpine-linux-musl=lib$(1).so
++CFG_STATIC_LIB_NAME_x86_64-alpine-linux-musl=lib$(1).a
++CFG_LIB_GLOB_x86_64-alpine-linux-musl=lib$(1)-*.so
++CFG_JEMALLOC_CFLAGS_x86_64-alpine-linux-musl :=
++CFG_GCCISH_CFLAGS_x86_64-alpine-linux-musl := -g -fPIC
++CFG_GCCISH_CXXFLAGS_x86_64-alpine-linux-musl :=
++CFG_GCCISH_LINK_FLAGS_x86_64-alpine-linux-musl :=
++CFG_GCCISH_DEF_FLAG_x86_64-alpine-linux-musl :=
++CFG_LLC_FLAGS_x86_64-alpine-linux-musl :=
++CFG_INSTALL_NAME_x86_64-alpine-linux-musl =
++CFG_EXE_SUFFIX_x86_64-alpine-linux-musl =
++CFG_WINDOWSY_x86_64-alpine-linux-musl :=
++CFG_UNIXY_x86_64-alpine-linux-musl := 1
++CFG_LDPATH_x86_64-alpine-linux-musl :=
++CFG_RUN_x86_64-alpine-linux-musl=$(2)
++CFG_RUN_TARG_x86_64-alpine-linux-musl=$(call CFG_RUN_x86_64-alpine-linux-musl,,$(2))
++CFG_GNU_TRIPLE_x86_64-alpine-linux-musl := x86_64-alpine-linux-musl
++CFG_THIRD_PARTY_OBJECTS_x86_64-alpine-linux-musl :=
++CFG_INSTALLED_OBJECTS_x86_64-alpine-linux-musl :=
++
++NATIVE_DEPS_libc_T_x86_64-alpine-linux-musl += libc.a
++NATIVE_DEPS_std_T_x86_64-alpine-linux-musl +=
++NATIVE_DEPS_unwind_T_x86_64-alpine-linux-musl += libunwind.a