Merge staging into closure-size

The most complex problems were from dealing with switches reverted in
the meantime (gcc5, gmp6, ncurses6).
It's likely that darwin is (still) broken nontrivially.
This commit is contained in:
Vladimír Čunát
2015-11-20 14:32:58 +01:00
1278 changed files with 105731 additions and 30012 deletions

View File

@@ -1,10 +1,11 @@
{ stdenv, callPackage }:
callPackage ./generic.nix {
shortVersion = "1.3.0";
shortVersion = "1.4.0";
isRelease = true;
forceBundledLLVM = false;
configureFlags = [ "--release-channel=stable" ];
srcSha = "14lhk40n9aslz8h8wj7fas5vsgyrb38b2r319q3hlvplgggdksg8";
srcSha = "13wpi9nb3h6wwck2mxhza85fahzcwgas00w8m25086v34dha4dp1";
/* Rust is bootstrapped from an earlier built version. We need
to fetch these earlier versions, which vary per platform.
@@ -14,14 +15,14 @@ callPackage ./generic.nix {
for the tagged release and not a snapshot in the current HEAD.
*/
snapshotHashLinux686 = "3459275cdf3896f678e225843fa56f0d9fdbabe8";
snapshotHashLinux64 = "e451e3bd6e5fcef71e41ae6f3da9fb1cf0e13a0c";
snapshotHashDarwin686 = "428944a7984c0988e77909d82ca2ef77d96a1fbd";
snapshotHashDarwin64 = "b0515bb7d2892b9a58282fc865fee11a885406d6";
snapshotDate = "2015-07-26";
snapshotRev = "a5c12f4";
snapshotHashLinux686 = "e2553bf399cd134a08ef3511a0a6ab0d7a667216";
snapshotHashLinux64 = "7df8ba9dec63ec77b857066109d4b6250f3d222f";
snapshotHashDarwin686 = "29750870c82a0347f8b8b735a4e2e0da26f5098d";
snapshotHashDarwin64 = "c9f2c588238b4c6998190c3abeb33fd6164099a2";
snapshotDate = "2015-08-11";
snapshotRev = "1af31d4";
# cc-ar-opts.patch should be removable in 1.4.0+
patches = [ ./patches/remove-uneeded-git.patch ./patches/cc-ar-opts.patch ]
patches = [ ./patches/remove-uneeded-git.patch ]
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
}

View File

@@ -2,6 +2,7 @@
, llvmPackages_37, jemalloc, ncurses, binutils
, shortVersion, isRelease
, forceBundledLLVM ? false
, srcSha, srcRev ? ""
, snapshotHashLinux686, snapshotHashLinux64
, snapshotHashDarwin686, snapshotHashDarwin64
@@ -76,7 +77,7 @@ let version = if isRelease then
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
in
stdenv.mkDerivation {
with stdenv.lib; stdenv.mkDerivation {
inherit name;
inherit version;
inherit meta;
@@ -106,7 +107,7 @@ stdenv.mkDerivation {
installPhase = ''
mkdir -p "$out"
cp -r bin "$out/bin"
'' + stdenv.lib.optionalString stdenv.isLinux ''
'' + optionalString stdenv.isLinux ''
patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
--set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \
"$out/bin/rustc"
@@ -115,9 +116,10 @@ stdenv.mkDerivation {
configureFlags = configureFlags
++ [ "--enable-local-rust" "--local-rust-root=$snapshot" "--enable-rpath" ]
++ [ "--llvm-root=${llvmPackages_37.llvm}" ] #"--jemalloc-root=${jemalloc}/lib" ]
# ++ [ "--jemalloc-root=${jemalloc}/lib"
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils}/bin/ar" ]
++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang";
++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
++ optional (!forceBundledLLVM) "--llvm-root=${llvmPackages_37.llvm}";
inherit patches;
@@ -132,7 +134,7 @@ stdenv.mkDerivation {
--replace "\$\$(subst /,//," "\$\$(subst /,/,"
# Fix dynamic linking against llvm
sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py
${optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
# Fix the configure script to not require curl as we won't use it
sed -i configure \
@@ -155,8 +157,9 @@ stdenv.mkDerivation {
# Procps is needed for one of the test cases
nativeBuildInputs = [ file python2 ]
++ stdenv.lib.optionals stdenv.isLinux [ procps ];
buildInputs = [ llvmPackages_37.llvm ncurses ];
++ optionals stdenv.isLinux [ procps ];
buildInputs = [ ncurses ]
++ optional (!forceBundledLLVM) llvmPackages_37.llvm;
enableParallelBuilding = true;

View File

@@ -2,10 +2,11 @@
{ stdenv, callPackage }:
callPackage ./generic.nix {
shortVersion = "2015-09-23";
shortVersion = "2015-11-01";
isRelease = false;
srcRev = "b2f379cdc23aec5c5d0d62acfcc5a4a18ebf0e30";
srcSha = "1z710f5vv9pbis1q96dc6kqvi0j7xgg95r5f5c3czbvndrxjwm03";
forceBundledLLVM = true;
srcRev = "1a2eaffb6";
srcSha = "17b8zgz8j5dmz489b4zs2q4igc9x2v4isgqg3i5nzhacghxjqfyy";
/* Rust is bootstrapped from an earlier built version. We need
to fetch these earlier versions, which vary per platform.

View File

@@ -1,57 +0,0 @@
From c97759699264c6b1fa0e88420cd3c720df25e594 Mon Sep 17 00:00:00 2001
From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Date: Tue, 11 Aug 2015 01:09:21 +0200
Subject: [PATCH] rustc_back: add configure options for default linker and ar
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
---
configure | 4 ++++
mk/target.mk | 4 ++++
src/librustc_back/target/mod.rs | 4 ++--
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 071788c..dc9d7d7 100755
--- a/configure
+++ b/configure
@@ -607,6 +607,10 @@ valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
valopt release-channel "dev" "the name of the release channel to build"
valopt musl-root "/usr/local" "MUSL root installation directory"
+# Used on systems where "cc" and "ar" are unavailable
+valopt default-linker "cc" "the default linker"
+valopt default-ar "ar" "the default ar"
+
# Many of these are saved below during the "writing configuration" step
# (others are conditionally saved).
opt_nosave manage-submodules 1 "let the build manage the git submodules"
diff --git a/mk/target.mk b/mk/target.mk
index aae66c4..408ab96 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -13,6 +13,10 @@
# this exists can be found on issue #2400
export CFG_COMPILER_HOST_TRIPLE
+# Used as defaults for the runtime ar and cc tools
+export CFG_DEFAULT_LINKER
+export CFG_DEFAULT_AR
+
# The standard libraries should be held up to a higher standard than any old
# code, make sure that these common warnings are denied by default. These can
# be overridden during development temporarily. For stage0, we allow warnings
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index d9cfdaa..542791a 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -185,8 +185,8 @@ impl Default for TargetOptions {
fn default() -> TargetOptions {
TargetOptions {
data_layout: String::new(),
- linker: "cc".to_string(),
- ar: "ar".to_string(),
+ linker: option_env!("CFG_DEFAULT_LINKER").unwrap_or("cc").to_string(),
+ ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(),
pre_link_args: Vec::new(),
post_link_args: Vec::new(),
cpu: "generic".to_string(),