mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-16 06:47:09 +03:00
rustc: Update both versions of the compiler
rustc: 1.2.0 -> 1.3.0 rustcMaster: 2015-09-05 -> 2015-09-21 This also removes the llvm bundling which reduced immediate the closure size by ~50MB. It also tries to reduce some of the superfluous dependencies to help reduce the number of potential rebuilds (namely removing git).
This commit is contained in:
parent
abb4088c6c
commit
de2906e670
@ -1,33 +1,27 @@
|
||||
{ stdenv, callPackage }:
|
||||
|
||||
callPackage ./generic.nix {
|
||||
shortVersion = "1.2.0";
|
||||
shortVersion = "1.3.0";
|
||||
isRelease = true;
|
||||
srcSha = "1zq2nhgaxkv1ghi3z2qgff6cylqirn33nphvkjiczlkjfi0pyw16";
|
||||
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.
|
||||
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.
|
||||
*/
|
||||
|
||||
# linux-i386
|
||||
snapshotHashLinux686 = "a6f22e481eabf098cc65bda97bf7e434a1fcc20b";
|
||||
snapshotHashLinux686 = "3459275cdf3896f678e225843fa56f0d9fdbabe8";
|
||||
snapshotHashLinux64 = "e451e3bd6e5fcef71e41ae6f3da9fb1cf0e13a0c";
|
||||
snapshotHashDarwin686 = "428944a7984c0988e77909d82ca2ef77d96a1fbd";
|
||||
snapshotHashDarwin64 = "b0515bb7d2892b9a58282fc865fee11a885406d6";
|
||||
snapshotDate = "2015-07-26";
|
||||
snapshotRev = "a5c12f4";
|
||||
|
||||
# linux-x86_64
|
||||
snapshotHashLinux64 = "5fd8698fdfe953e6c4d86cf4fa1d5f3a0053248c";
|
||||
|
||||
# macos-i386
|
||||
snapshotHashDarwin686 = "9a273324a6b63a40f67a553029c0a9fb692ffd1f";
|
||||
|
||||
# macos-x86_64
|
||||
snapshotHashDarwin64 = "e5b12cb7c179fc98fa905a3c84803645d946a6ae";
|
||||
|
||||
snapshotDate = "2015-05-24";
|
||||
snapshotRev = "ba0e1cd";
|
||||
|
||||
patches = [
|
||||
./patches/stable.patch
|
||||
] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
|
||||
configureFlags = [ "--release-channel=stable" ];
|
||||
# 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;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{ stdenv, fetchurl, fetchgit, fetchzip, which, file, perl, curl, python27
|
||||
, makeWrapper, tzdata, git, valgrind, procps, coreutils
|
||||
{ stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
|
||||
, llvmPackages_37, jemalloc, ncurses
|
||||
|
||||
, shortVersion, isRelease
|
||||
, srcSha, srcRev ? ""
|
||||
@ -15,15 +15,12 @@ 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.
|
||||
switch it to use nix's packaged rust compiler. This might not be possible
|
||||
as the compiler is highly coupled to the bootstrap.
|
||||
|
||||
NOTE : some derivation depend on rust. When updating this, please make
|
||||
sure those derivations still compile. (racer, for example).
|
||||
@ -62,7 +59,7 @@ let version = if isRelease then
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.rust-lang.org/;
|
||||
description = "A safe, concurrent, practical language";
|
||||
maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy ];
|
||||
maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington ];
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
@ -118,29 +115,43 @@ stdenv.mkDerivation {
|
||||
|
||||
configureFlags = configureFlags
|
||||
++ [ "--enable-local-rust" "--local-rust-root=$snapshot" "--enable-rpath" ]
|
||||
# TODO always include starting from 1.3.0, superseeding patch and substituteInPlace below
|
||||
++ stdenv.lib.optional (!isRelease) [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${stdenv.cc.binutils}/bin/ar" ]
|
||||
++ [ "--llvm-root=${llvmPackages_37.llvm}" "--jemalloc-root=${jemalloc}/lib" ]
|
||||
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${stdenv.cc.binutils}/bin/ar" ]
|
||||
++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang";
|
||||
|
||||
inherit patches;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/rust-installer/gen-install-script.sh \
|
||||
--replace /bin/echo "${coreutils}/bin/echo"
|
||||
--replace /bin/echo "$(type -P echo)"
|
||||
substituteInPlace src/rust-installer/gen-installer.sh \
|
||||
--replace /bin/echo "${coreutils}/bin/echo"
|
||||
--replace /bin/echo "$(type -P echo)"
|
||||
|
||||
# Workaround for NixOS/nixpkgs#8676
|
||||
substituteInPlace mk/rustllvm.mk \
|
||||
--replace "\$\$(subst /,//," "\$\$(subst /,/,"
|
||||
'' + stdenv.lib.optionalString (isRelease) ''
|
||||
substituteInPlace src/librustc_back/target/mod.rs \
|
||||
--subst-var-by "ccPath" "${stdenv.cc}/bin/cc" \
|
||||
--subst-var-by "arPath" "${stdenv.cc.binutils}/bin/ar"
|
||||
''; # TODO remove in 1.3.0, superseeded by configure flags
|
||||
|
||||
buildInputs = [ which file perl curl python27 makeWrapper git ]
|
||||
++ stdenv.lib.optionals (!stdenv.isDarwin) [ procps valgrind ];
|
||||
# Fix dynamic linking against llvm
|
||||
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 \
|
||||
-e '/probe_need CFG_CURLORWGET/d'
|
||||
|
||||
# Useful debugging parameter
|
||||
#export VERBOSE=1
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
# Needed flags as the upstream configure script has a broken prefix substitution
|
||||
configureFlagsArray+=("--datadir=$out/share")
|
||||
configureFlagsArray+=("--infodir=$out/share/info")
|
||||
'';
|
||||
|
||||
# Procps is needed for one of the test cases
|
||||
nativeBuildInputs = [ file python2 ]
|
||||
++ stdenv.lib.optionals stdenv.isLinux [ procps ];
|
||||
buildInputs = [ llvmPackages_37.llvm ncurses ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
|
@ -1,18 +1,27 @@
|
||||
# Please make sure to check if rustfmt still builds when updating nightly
|
||||
|
||||
{ stdenv, callPackage }:
|
||||
|
||||
callPackage ./generic.nix {
|
||||
shortVersion = "2015-09-05";
|
||||
shortVersion = "2015-09-21";
|
||||
isRelease = false;
|
||||
# src rev for 2015-09-05's nightly channel
|
||||
srcRev = "779b2a9847319106647dcad12fc6dc472bc0cf4d";
|
||||
srcSha = "0m22lxpcjnwa68bpxhfvp07k52gyds8ykif2pf5r2x22lw28vbg3";
|
||||
srcRev = "547fd5c11e6902e2f9748e7b46893211b36da421";
|
||||
srcSha = "10wklbxz6f4ga9q2rxghih18xdw6xm01bay6c13y72c4bwlnkm2w";
|
||||
|
||||
/* 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 = stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
|
||||
|
||||
patches = [ ./patches/remove-uneeded-git.patch ]
|
||||
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec-head.patch;
|
||||
}
|
||||
|
||||
|
57
pkgs/development/compilers/rustc/patches/cc-ar-opts.patch
Normal file
57
pkgs/development/compilers/rustc/patches/cc-ar-opts.patch
Normal 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(),
|
24
pkgs/development/compilers/rustc/patches/grsec-head.patch
Normal file
24
pkgs/development/compilers/rustc/patches/grsec-head.patch
Normal 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
|
@ -1,13 +0,0 @@
|
||||
diff --git a/src/test/run-pass/issue-20797.rs b/src/test/run-pass/issue-20797.rs
|
||||
index 2772fc8..3d37b08 100644
|
||||
--- a/src/test/run-pass/issue-20797.rs
|
||||
+++ b/src/test/run-pass/issue-20797.rs
|
||||
@@ -97,7 +97,7 @@ impl<S: Strategy> Iterator for Subpaths<S> {
|
||||
}
|
||||
|
||||
fn _foo() {
|
||||
- let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/home")).unwrap();
|
||||
+ let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/tmp")).unwrap();
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -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 = ""
|
@ -1,28 +0,0 @@
|
||||
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
|
||||
index 402fbcd..8fe2de2 100644
|
||||
--- a/src/librustc_back/target/mod.rs
|
||||
+++ b/src/librustc_back/target/mod.rs
|
||||
@@ -172,8 +172,8 @@ impl Default for TargetOptions {
|
||||
/// incomplete, and if used for compilation, will certainly not work.
|
||||
fn default() -> TargetOptions {
|
||||
TargetOptions {
|
||||
- linker: "cc".to_string(),
|
||||
- ar: "ar".to_string(),
|
||||
+ linker: "@ccPath@".to_string(), // ignore-tidy-linelength
|
||||
+ ar: "@arPath@".to_string(), // ignore-tidy-linelength
|
||||
pre_link_args: Vec::new(),
|
||||
post_link_args: Vec::new(),
|
||||
cpu: "generic".to_string(),
|
||||
diff --git a/src/test/run-pass/issue-20797.rs b/src/test/run-pass/issue-20797.rs
|
||||
index 2772fc8..3d37b08 100644
|
||||
--- a/src/test/run-pass/issue-20797.rs
|
||||
+++ b/src/test/run-pass/issue-20797.rs
|
||||
@@ -97,7 +97,7 @@ impl<S: Strategy> Iterator for Subpaths<S> {
|
||||
}
|
||||
|
||||
fn _foo() {
|
||||
- let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/home")).unwrap();
|
||||
+ let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/tmp")).unwrap();
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -8,6 +8,11 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "1wiydkp8a4adwsgfsd688hpv2z7hjv5manhckchk96v6qdsbqk91";
|
||||
};
|
||||
|
||||
# Rust refers to jemalloc functions directly so make sure the prefix matchs.
|
||||
configureFlags = [
|
||||
"--with-jemalloc-prefix=je_"
|
||||
];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.canonware.com/jemalloc/index.html;
|
||||
description = "a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support";
|
||||
|
Loading…
Reference in New Issue
Block a user