Merge commit staging+systemd into closure-size

Many non-conflict problems weren't (fully) resolved in this commit yet.
This commit is contained in:
Vladimír Čunát
2015-10-03 13:33:13 +02:00
6304 changed files with 708456 additions and 130039 deletions

View File

@@ -1,16 +0,0 @@
{ stdenv, callPackage }:
callPackage ./makeRustcDerivation.nix {
shortVersion = "1.0.0-beta.2";
isRelease = true;
srcSha = "0wcpp6fg7cc75bj5b6dcz5dhgps6xw09n75qiapmd12qxjzj17wn";
snapshotHashLinux686 = "1ef82402ed16f5a6d2f87a9a62eaa83170e249ec";
snapshotHashLinux64 = "ef2154372e97a3cb687897d027fd51c8f2c5f349";
snapshotHashDarwin686 = "0310b1a970f2da7e61770fd14dbbbdca3b518234";
snapshotHashDarwin64 = "5f35d9c920b8083a7420ef8cf5b00d5ef3085dfa";
snapshotDate = "2015-03-27";
snapshotRev = "5520801";
patches = [
./patches/beta.patch
] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
configureFlags = [ "--release-channel=beta" ];
}

View File

@@ -0,0 +1,27 @@
{ stdenv, callPackage }:
callPackage ./generic.nix {
shortVersion = "1.3.0";
isRelease = true;
configureFlags = [ "--release-channel=stable" ];
srcSha = "14lhk40n9aslz8h8wj7fas5vsgyrb38b2r319q3hlvplgggdksg8";
/* Rust is bootstrapped from an earlier built version. We need
to fetch these earlier versions, which vary per platform.
The shapshot info you want can be found at
https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
with the set you want at the top. Make sure this is the latest snapshot
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";
# cc-ar-opts.patch should be removable in 1.4.0+
patches = [ ./patches/remove-uneeded-git.patch ./patches/cc-ar-opts.patch ]
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
}

View File

@@ -1,18 +1,27 @@
# Please make sure to check if rustfmt still builds when updating nightly
{ stdenv, callPackage }:
callPackage ./makeRustcDerivation.nix {
shortVersion = "1.0.0-dev";
callPackage ./generic.nix {
shortVersion = "2015-09-23";
isRelease = false;
# src rev for master on 2015/04/13
srcRev = "0cf99c3e06e84d20d68da649c888d63c72f33971";
srcSha = "0brnzsbxmidjnmvi36sz582k3kw6wk813y2y837zpmyxg9fjah0l";
snapshotHashLinux686 = "1ef82402ed16f5a6d2f87a9a62eaa83170e249ec";
snapshotHashLinux64 = "ef2154372e97a3cb687897d027fd51c8f2c5f349";
snapshotHashDarwin686 = "0310b1a970f2da7e61770fd14dbbbdca3b518234";
snapshotHashDarwin64 = "5f35d9c920b8083a7420ef8cf5b00d5ef3085dfa";
snapshotDate = "2015-03-27";
snapshotRev = "5520801";
patches = [
./patches/head.patch
] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
srcRev = "b2f379cdc23aec5c5d0d62acfcc5a4a18ebf0e30";
srcSha = "1z710f5vv9pbis1q96dc6kqvi0j7xgg95r5f5c3czbvndrxjwm03";
/* Rust is bootstrapped from an earlier built version. We need
to fetch these earlier versions, which vary per platform.
The shapshot info you want can be found at
https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
with the set you want at the top.
*/
snapshotHashLinux686 = "e2553bf399cd134a08ef3511a0a6ab0d7a667216";
snapshotHashLinux64 = "7df8ba9dec63ec77b857066109d4b6250f3d222f";
snapshotHashDarwin686 = "29750870c82a0347f8b8b735a4e2e0da26f5098d";
snapshotHashDarwin64 = "c9f2c588238b4c6998190c3abeb33fd6164099a2";
snapshotDate = "2015-08-11";
snapshotRev = "1af31d4";
patches = [ ./patches/remove-uneeded-git.patch ]
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec-head.patch;
}

View File

@@ -1,142 +0,0 @@
{ stdenv, fetchurl, fetchgit, which, file, perl, curl, python27, makeWrapper
, tzdata, git, valgrind, procps, coreutils
, shortVersion, isRelease
, srcSha, srcRev ? ""
, snapshotHashLinux686, snapshotHashLinux64
, snapshotHashDarwin686, snapshotHashDarwin64
, snapshotDate, snapshotRev
, configureFlags ? []
, patches
}:
assert !stdenv.isFreeBSD;
/* Rust's build process has a few quirks :
- It requires some patched in llvm that haven't landed upstream, so it
compiles its own llvm. This might change in the future, so at some
point we may be able to switch to nix's llvm.
- The Rust compiler is written is Rust, so it requires a bootstrap
compiler, which is downloaded during the build. To make the build
pure, we download it ourself before and put it where it is
expected. Once the language is stable (1.0) , we might want to
switch it to use nix's packaged rust compiler.
NOTE : some derivation depend on rust. When updating this, please make
sure those derivations still compile. (racer, for example).
*/
assert (if isRelease then srcRev == "" else srcRev != "");
let version = if isRelease then
"${shortVersion}"
else
"${shortVersion}-g${builtins.substring 0 7 srcRev}";
name = "rustc-${version}";
platform = if stdenv.system == "i686-linux"
then "linux-i386"
else if stdenv.system == "x86_64-linux"
then "linux-x86_64"
else if stdenv.system == "i686-darwin"
then "macos-i386"
else if stdenv.system == "x86_64-darwin"
then "macos-x86_64"
else abort "no snapshot to bootstrap for this platform (missing platform url suffix)";
target = if stdenv.system == "i686-linux"
then "i686-unknown-linux-gnu"
else if stdenv.system == "x86_64-linux"
then "x86_64-unknown-linux-gnu"
else if stdenv.system == "i686-darwin"
then "i686-apple-darwin"
else if stdenv.system == "x86_64-darwin"
then "x86_64-apple-darwin"
else abort "no snapshot to bootstrap for this platform (missing target triple)";
meta = with stdenv.lib; {
homepage = http://www.rust-lang.org/;
description = "A safe, concurrent, practical language";
maintainers = with maintainers; [ madjar cstrahan wizeman globin ];
license = map (builtins.getAttr "shortName") [ licenses.mit licenses.asl20 ];
platforms = platforms.linux;
};
snapshotHash = if stdenv.system == "i686-linux"
then snapshotHashLinux686
else if stdenv.system == "x86_64-linux"
then snapshotHashLinux64
else if stdenv.system == "i686-darwin"
then snapshotHashDarwin686
else if stdenv.system == "x86_64-darwin"
then snapshotHashDarwin64
else abort "no snapshot for platform ${stdenv.system}";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
in
stdenv.mkDerivation {
inherit name;
inherit version;
inherit meta;
src = if isRelease then
fetchurl {
url = "http://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
sha256 = srcSha;
}
else
fetchgit {
url = https://github.com/rust-lang/rust;
rev = srcRev;
sha256 = srcSha;
};
# We need rust to build rust. If we don't provide it, configure will try to download it.
snapshot = stdenv.mkDerivation {
name = "rust-stage0";
src = fetchurl {
url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
sha1 = snapshotHash;
};
dontStrip = true;
installPhase = ''
mkdir -p "$out"
cp -r bin "$out/bin"
'' + (if stdenv.isLinux then ''
patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
--set-rpath "${stdenv.cc.cc}/lib/:${stdenv.cc.cc}/lib64/" \
"$out/bin/rustc"
'' else "");
};
configureFlags = configureFlags
++ [ "--enable-local-rust" "--local-rust-root=$snapshot" ]
++ stdenv.lib.optional (stdenv.cc ? clang) "--enable-clang";
inherit patches;
postPatch = ''
substituteInPlace src/librustc_trans/back/link.rs \
--subst-var-by "ccPath" "${stdenv.cc}/bin/cc"
substituteInPlace src/librustc_back/archive.rs \
--subst-var-by "arPath" "${stdenv.cc.binutils}/bin/ar"
substituteInPlace src/rust-installer/gen-install-script.sh \
--replace /bin/echo "${coreutils}/bin/echo"
substituteInPlace src/rust-installer/gen-installer.sh \
--replace /bin/echo "${coreutils}/bin/echo"
'';
buildInputs = [ which file perl curl python27 makeWrapper git valgrind procps ];
enableParallelBuilding = true;
preCheck = "export TZDIR=${tzdata}/share/zoneinfo";
doCheck = true;
}

View File

@@ -1,43 +0,0 @@
diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh
index ca59b1c..65ee7bf 100755
--- a/src/etc/local_stage0.sh
+++ b/src/etc/local_stage0.sh
@@ -50,11 +50,6 @@ if [ -z $TARG_DIR ]; then
fi
cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
-cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
# do not fail if one of the above fails, as all we need is a working rustc!
exit 0
diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs
index ed44bf8..2b84627 100644
--- a/src/librustc_back/archive.rs
+++ b/src/librustc_back/archive.rs
@@ -57,7 +57,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
paths: &[&Path]) -> Output {
let ar = match *maybe_ar_prog {
Some(ref ar) => &ar[..],
- None => "ar"
+ None => "@arPath@"
};
let mut cmd = Command::new(ar);
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 3087a8e..578448f 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -352,7 +352,7 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
pub fn get_cc_prog(sess: &Session) -> String {
match sess.opts.cg.linker {
- Some(ref linker) => return linker.to_string(),
- None => sess.target.target.options.linker.clone(),
+ Some(ref linker) => linker.to_string(),
+ None => "@ccPath@".to_string(),
}
}

View File

@@ -0,0 +1,57 @@
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(),

View File

@@ -0,0 +1,24 @@
diff --git a/src/test/run-make/relocation-model/Makefile b/src/test/run-make/relocation-model/Makefile
index b22f34f..c6489bd 100644
--- a/src/test/run-make/relocation-model/Makefile
+++ b/src/test/run-make/relocation-model/Makefile
@@ -2,9 +2,11 @@
all: others
$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
+ paxctl -czexm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=default foo.rs
+ paxctl -czexm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=default --crate-type=dylib foo.rs
@@ -16,6 +18,7 @@ others:
else
others:
$(RUSTC) -C relocation-model=static foo.rs
+ paxctl -czexm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=static --crate-type=dylib foo.rs
endif

View File

@@ -1,43 +0,0 @@
diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh
index ca59b1c..65ee7bf 100755
--- a/src/etc/local_stage0.sh
+++ b/src/etc/local_stage0.sh
@@ -50,11 +50,6 @@ if [ -z $TARG_DIR ]; then
fi
cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
-cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
# do not fail if one of the above fails, as all we need is a working rustc!
exit 0
diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs
index ed44bf8..2b84627 100644
--- a/src/librustc_back/archive.rs
+++ b/src/librustc_back/archive.rs
@@ -57,7 +57,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
paths: &[&Path]) -> Output {
let ar = match *maybe_ar_prog {
Some(ref ar) => &ar[..],
- None => "ar"
+ None => "@arPath@"
};
let mut cmd = Command::new(ar);
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 3087a8e..578448f 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -352,8 +352,8 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
pub fn get_cc_prog(sess: &Session) -> String {
match sess.opts.cg.linker {
- Some(ref linker) => return linker.to_string(),
- None => sess.target.target.options.linker.clone(),
+ Some(ref linker) => linker.to_string(),
+ None => "@ccPath@".to_string(),
}
}

View File

@@ -0,0 +1,19 @@
diff --git a/src/etc/tidy.py b/src/etc/tidy.py
index 9f5f919..a607180 100644
--- a/src/etc/tidy.py
+++ b/src/etc/tidy.py
@@ -66,13 +66,9 @@ def interesting_file(f):
return any(os.path.splitext(f)[1] == ext for ext in interesting_files)
-# Be careful to support Python 2.4, 2.6, and 3.x here!
-config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
- stdout=subprocess.PIPE)
-result = config_proc.communicate()[0]
true = "true".encode('utf8')
-autocrlf = result.strip() == true if result is not None else False
+autocrlf = False
current_name = ""
current_contents = ""