about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-09-22 21:18:07 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-09-23 12:30:00 -0700
commitde2906e6706c6c342f016906865026cb443d96a1 (patch)
tree83a44ac19814f1f5e3c3710fb6770b3b8f4f6673 /pkgs/development/compilers
parentabb4088c6cefebe9ee804674a543032457184b15 (diff)
downloadnixlib-de2906e6706c6c342f016906865026cb443d96a1.tar
nixlib-de2906e6706c6c342f016906865026cb443d96a1.tar.gz
nixlib-de2906e6706c6c342f016906865026cb443d96a1.tar.bz2
nixlib-de2906e6706c6c342f016906865026cb443d96a1.tar.lz
nixlib-de2906e6706c6c342f016906865026cb443d96a1.tar.xz
nixlib-de2906e6706c6c342f016906865026cb443d96a1.tar.zst
nixlib-de2906e6706c6c342f016906865026cb443d96a1.zip
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).
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/rustc/default.nix36
-rw-r--r--pkgs/development/compilers/rustc/generic.nix51
-rw-r--r--pkgs/development/compilers/rustc/head.nix21
-rw-r--r--pkgs/development/compilers/rustc/patches/cc-ar-opts.patch57
-rw-r--r--pkgs/development/compilers/rustc/patches/grsec-head.patch24
-rw-r--r--pkgs/development/compilers/rustc/patches/head.patch13
-rw-r--r--pkgs/development/compilers/rustc/patches/remove-uneeded-git.patch19
-rw-r--r--pkgs/development/compilers/rustc/patches/stable.patch28
8 files changed, 161 insertions, 88 deletions
diff --git a/pkgs/development/compilers/rustc/default.nix b/pkgs/development/compilers/rustc/default.nix
index a4f70172e1f3..00bfb3222e0d 100644
--- a/pkgs/development/compilers/rustc/default.nix
+++ b/pkgs/development/compilers/rustc/default.nix
@@ -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";
-
-  # linux-x86_64
-  snapshotHashLinux64 = "5fd8698fdfe953e6c4d86cf4fa1d5f3a0053248c";
-
-  # macos-i386
-  snapshotHashDarwin686 = "9a273324a6b63a40f67a553029c0a9fb692ffd1f";
+  snapshotHashLinux686 = "3459275cdf3896f678e225843fa56f0d9fdbabe8";
+  snapshotHashLinux64 = "e451e3bd6e5fcef71e41ae6f3da9fb1cf0e13a0c";
+  snapshotHashDarwin686 = "428944a7984c0988e77909d82ca2ef77d96a1fbd";
+  snapshotHashDarwin64 = "b0515bb7d2892b9a58282fc865fee11a885406d6";
+  snapshotDate = "2015-07-26";
+  snapshotRev = "a5c12f4";
 
-  # 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;
 }
diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix
index ee7d0c7749d9..9df259cee8e2 100644
--- a/pkgs/development/compilers/rustc/generic.nix
+++ b/pkgs/development/compilers/rustc/generic.nix
@@ -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;
 
diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix
index 3b1cccee9413..045a47e88de6 100644
--- a/pkgs/development/compilers/rustc/head.nix
+++ b/pkgs/development/compilers/rustc/head.nix
@@ -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;
 }
 
diff --git a/pkgs/development/compilers/rustc/patches/cc-ar-opts.patch b/pkgs/development/compilers/rustc/patches/cc-ar-opts.patch
new file mode 100644
index 000000000000..e73d54de8f59
--- /dev/null
+++ b/pkgs/development/compilers/rustc/patches/cc-ar-opts.patch
@@ -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(),
diff --git a/pkgs/development/compilers/rustc/patches/grsec-head.patch b/pkgs/development/compilers/rustc/patches/grsec-head.patch
new file mode 100644
index 000000000000..b97b40c24091
--- /dev/null
+++ b/pkgs/development/compilers/rustc/patches/grsec-head.patch
@@ -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
diff --git a/pkgs/development/compilers/rustc/patches/head.patch b/pkgs/development/compilers/rustc/patches/head.patch
deleted file mode 100644
index 2425fff04a15..000000000000
--- a/pkgs/development/compilers/rustc/patches/head.patch
+++ /dev/null
@@ -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() {}
diff --git a/pkgs/development/compilers/rustc/patches/remove-uneeded-git.patch b/pkgs/development/compilers/rustc/patches/remove-uneeded-git.patch
new file mode 100644
index 000000000000..3c68d777f885
--- /dev/null
+++ b/pkgs/development/compilers/rustc/patches/remove-uneeded-git.patch
@@ -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 = ""
diff --git a/pkgs/development/compilers/rustc/patches/stable.patch b/pkgs/development/compilers/rustc/patches/stable.patch
deleted file mode 100644
index e927d7a742a7..000000000000
--- a/pkgs/development/compilers/rustc/patches/stable.patch
+++ /dev/null
@@ -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() {}