From 9141df9698753a29b78335b1c2070307797e1874 Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Thu, 11 Oct 2018 20:35:46 +0200 Subject: [PATCH] cross-profiles: set XBPS_CROSS_RUST_FLAGS&XBPS_CROSS_RUST_TARGET only added to platforms which support rust --- common/cross-profiles/aarch64-musl.sh | 2 ++ common/cross-profiles/aarch64.sh | 2 ++ common/cross-profiles/armv6l-musl.sh | 2 ++ common/cross-profiles/armv6l.sh | 2 ++ common/cross-profiles/armv7l-musl.sh | 2 ++ common/cross-profiles/armv7l.sh | 2 ++ common/cross-profiles/i686-musl.sh | 2 ++ common/cross-profiles/i686.sh | 2 ++ common/cross-profiles/x86_64-musl.sh | 2 ++ common/xbps-src/shutils/common.sh | 5 +++++ 10 files changed, 23 insertions(+) diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh index d17a09b5ad..9617f875a6 100644 --- a/common/cross-profiles/aarch64-musl.sh +++ b/common/cross-profiles/aarch64-musl.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="aarch64-linux-musl" XBPS_CROSS_CFLAGS="-march=armv8-a" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl" diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh index c4ab53f788..189cb60fbf 100644 --- a/common/cross-profiles/aarch64.sh +++ b/common/cross-profiles/aarch64.sh @@ -7,3 +7,5 @@ XBPS_CXXFLAGS="$XBPS_CFLAGS" XBPS_CROSS_CFLAGS="-march=armv8-a" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu" diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh index b03e7a8d54..fa1e550d9a 100644 --- a/common/cross-profiles/armv6l-musl.sh +++ b/common/cross-profiles/armv6l-musl.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="arm-linux-musleabihf" XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf" diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh index 8d52f97cd4..227b0b0805 100644 --- a/common/cross-profiles/armv6l.sh +++ b/common/cross-profiles/armv6l.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="arm-linux-gnueabihf" XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf" diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh index 3b88cd4bad..4f41a86ee7 100644 --- a/common/cross-profiles/armv7l-musl.sh +++ b/common/cross-profiles/armv7l-musl.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="armv7l-linux-musleabihf" XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf" diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh index 8e8a378f1f..ba2f7c5c68 100644 --- a/common/cross-profiles/armv7l.sh +++ b/common/cross-profiles/armv7l.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="armv7l-linux-gnueabihf" XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf" diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh index e658725283..7f40641799 100644 --- a/common/cross-profiles/i686-musl.sh +++ b/common/cross-profiles/i686-musl.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="i686-linux-musl" XBPS_CROSS_CFLAGS="-march=i686" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl" diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh index 9937694530..08139ef664 100644 --- a/common/cross-profiles/i686.sh +++ b/common/cross-profiles/i686.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="i686-pc-linux-gnu" XBPS_CROSS_CFLAGS="-march=i686" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu" diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh index 58df5faa29..e3f784d131 100644 --- a/common/cross-profiles/x86_64-musl.sh +++ b/common/cross-profiles/x86_64-musl.sh @@ -5,3 +5,5 @@ XBPS_CROSS_TRIPLET="x86_64-linux-musl" XBPS_CROSS_CFLAGS="-mtune=generic" XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="" +XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" +XBPS_CROSS_RUST_TARGET="${XBPS_CROSS_TRIPLET}" diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh index 486b8311cc..fee0136706 100644 --- a/common/xbps-src/shutils/common.sh +++ b/common/xbps-src/shutils/common.sh @@ -522,6 +522,10 @@ setup_pkg() { export CXXFLAGS_host="$XBPS_CXXFLAGS" export CPPFLAGS_host="$XBPS_CPPFLAGS" export LDFLAGS_host="$XBPS_LDFLAGS" + # Rust flags which are passed to rustc + export RUSTFLAGS="$XBPS_CROSS_RUSTFLAGS" + # Rust target, which differs from our triplets + export RUST_TARGET="$XBPS_CROSS_RUST_TARGET" else export CC="cc" export CXX="g++" @@ -537,6 +541,7 @@ setup_pkg() { export OBJCOPY="objcopy" export NM="nm" export READELF="readelf" + export RUST_TARGET="$XBPS_RUST_TARGET" # Unse cross evironment variables unset CC_target CXX_target CPP_target GCC_target FC_target LD_target AR_target AS_target unset RANLIB_target STRIP_target OBJDUMP_target OBJCOPY_target NM_target READELF_target