about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2016-06-03 00:11:13 +0200
committerMoritz Ulrich <moritz@tarn-vedra.de>2016-06-03 00:11:13 +0200
commitb05f991f5fd6cb6f03b2812bf59f425229f9b26d (patch)
tree3c1462f1ab86a9b83059299c859ca85faab8a301 /pkgs/development/compilers
parent45c6dee427f78378e814ed776df21a90f58b555e (diff)
parent895db6daf369ab88c4ec626df905c7c74d0d33d9 (diff)
downloadnixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.tar
nixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.tar.gz
nixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.tar.bz2
nixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.tar.lz
nixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.tar.xz
nixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.tar.zst
nixlib-b05f991f5fd6cb6f03b2812bf59f425229f9b26d.zip
Rust infrastructure refactoring
Rust infrastructure updates & refactoring
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/rustc/beta.nix12
-rw-r--r--pkgs/development/compilers/rustc/bootstrap.nix58
-rw-r--r--pkgs/development/compilers/rustc/default.nix27
-rw-r--r--pkgs/development/compilers/rustc/generic.nix84
-rw-r--r--pkgs/development/compilers/rustc/head.nix32
-rw-r--r--pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch25
-rw-r--r--pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch25
-rw-r--r--pkgs/development/compilers/rustc/stable.nix13
8 files changed, 160 insertions, 116 deletions
diff --git a/pkgs/development/compilers/rustc/beta.nix b/pkgs/development/compilers/rustc/beta.nix
new file mode 100644
index 000000000000..7dbd8ae7a695
--- /dev/null
+++ b/pkgs/development/compilers/rustc/beta.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, rustcStable }:
+
+callPackage ./generic.nix {
+  shortVersion = "beta-1.10.0";
+  forceBundledLLVM = false;
+  configureFlags = [ "--release-channel=beta" ];
+  srcRev = "39f3c16cca889ef3f1719d9177e3315258222a65";
+  srcSha = "01bx6616lslp2mbj4h8bb6m042fs0y1z8g0jgpxvbk3fbhzwafrx";
+  patches = [ ./patches/disable-lockfile-check.patch ] ++
+    stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
+  rustc = rustcStable;
+}
diff --git a/pkgs/development/compilers/rustc/bootstrap.nix b/pkgs/development/compilers/rustc/bootstrap.nix
new file mode 100644
index 000000000000..8bff511459dc
--- /dev/null
+++ b/pkgs/development/compilers/rustc/bootstrap.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl }:
+
+let
+  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)";
+
+  /* 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.
+    NOTE: Rust 1.9.0 is the last version that uses snapshots
+  */
+
+  snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
+  snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
+  snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
+  snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
+  snapshotDate = "2016-03-18";
+  snapshotRev = "235d774";
+
+  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 {
+  name = "rust-bootstrap";
+  src = fetchurl {
+    url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
+    sha1 = snapshotHash;
+  };
+  dontStrip = true;
+  installPhase = ''
+    mkdir -p "$out"
+    cp -r bin "$out/bin"
+  '' + stdenv.lib.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"
+  '';
+}
diff --git a/pkgs/development/compilers/rustc/default.nix b/pkgs/development/compilers/rustc/default.nix
deleted file mode 100644
index 6c5aa04d7076..000000000000
--- a/pkgs/development/compilers/rustc/default.nix
+++ /dev/null
@@ -1,27 +0,0 @@
-{ stdenv, callPackage }:
-
-callPackage ./generic.nix {
-  shortVersion = "1.9.0";
-  isRelease = true;
-  forceBundledLLVM = false;
-  configureFlags = [ "--release-channel=stable" ];
-  srcSha = "0yg5admbypqld0gmxbhrh2yag5kxjklpjgldrp3pd5vczkl13aml";
-
-  /* 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 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
-  snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
-  snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
-  snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
-  snapshotDate = "2016-03-18";
-  snapshotRev = "235d774";
-
-  patches = [ ./patches/remove-uneeded-git.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 976c1b932b5a..09d8ad8bf00f 100644
--- a/pkgs/development/compilers/rustc/generic.nix
+++ b/pkgs/development/compilers/rustc/generic.nix
@@ -1,14 +1,11 @@
 { stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
-, llvm, jemalloc, ncurses, darwin, binutils
+, llvm, jemalloc, ncurses, darwin, binutils, rustc
 
-, shortVersion, isRelease
+, isRelease ? false
+, shortVersion
 , forceBundledLLVM ? false
-, srcSha, srcRev ? ""
-, snapshotHashLinux686, snapshotHashLinux64
-, snapshotHashDarwin686, snapshotHashDarwin64
-, snapshotDate, snapshotRev
+, srcSha, srcRev
 , configureFlags ? []
-
 , patches
 } @ args:
 
@@ -26,9 +23,8 @@ sure those derivations still compile. (racer, for example).
 
 */
 
-assert (if isRelease then srcRev == "" else srcRev != "");
-
-let version = if isRelease then
+let
+    version = if isRelease then
         "${shortVersion}"
       else
         "${shortVersion}-g${builtins.substring 0 7 srcRev}";
@@ -39,16 +35,6 @@ let version = if isRelease then
 
     llvmShared = llvm.override { enableSharedLibraries = true; };
 
-    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"
@@ -66,20 +52,9 @@ let version = if isRelease then
       license = [ licenses.mit licenses.asl20 ];
       platforms = platforms.linux ++ platforms.darwin;
     };
-
-    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
 
-with stdenv.lib; stdenv.mkDerivation {
+stdenv.mkDerivation {
   inherit name;
   inherit version;
   inherit meta;
@@ -88,42 +63,19 @@ with stdenv.lib; stdenv.mkDerivation {
 
   NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
 
-  src = if isRelease then
-      fetchzip {
-        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"
-    '' + 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"
-    '';
+  src = 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.
   configureFlags = configureFlags
-                ++ [ "--enable-local-rust" "--local-rust-root=$snapshot" "--enable-rpath" ]
+                ++ [ "--enable-local-rust" "--local-rust-root=${rustc}" "--enable-rpath" ]
                 # ++ [ "--jemalloc-root=${jemalloc}/lib"
                 ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ]
-                ++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
-                ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
+                ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang"
+                ++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
 
   inherit patches;
 
@@ -138,7 +90,7 @@ with stdenv.lib; stdenv.mkDerivation {
       --replace "\$\$(subst  /,//," "\$\$(subst /,/,"
 
     # Fix dynamic linking against llvm
-    ${optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
+    ${stdenv.lib.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 \
@@ -160,9 +112,9 @@ with stdenv.lib; stdenv.mkDerivation {
   '';
 
   # ps is needed for one of the test cases
-  nativeBuildInputs = [ file python2 procps ];
+  nativeBuildInputs = [ file python2 procps rustc ];
   buildInputs = [ ncurses ]
-    ++ optional (!forceBundledLLVM) llvmShared;
+    ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared;
 
   # https://github.com/rust-lang/rust/issues/30181
   # enableParallelBuilding = false; # missing files during linking, occasionally
diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix
index bb67b88c4780..8d9373eb3c3d 100644
--- a/pkgs/development/compilers/rustc/head.nix
+++ b/pkgs/development/compilers/rustc/head.nix
@@ -1,27 +1,13 @@
 # Please make sure to check if rustfmt still builds when updating nightly
-{ stdenv, callPackage }:
+{ stdenv, callPackage, rustcStable }:
 
 callPackage ./generic.nix {
-  shortVersion = "2016-03-22";
-  isRelease = false;
-  forceBundledLLVM = true;
-  srcRev = "6cc502c986d42da407e26a49d4f09f21d3072fcb";
-  srcSha = "096lsc8irh9a7w494yaji28kzy9frs2myqrfyj0fzbxkvs3yfhzz";
-
-  /* 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 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
-  snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
-  snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
-  snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
-  snapshotDate = "2016-03-18";
-  snapshotRev = "235d774";
-
-  patches = [ ./patches/remove-uneeded-git.patch ]
-    ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
+  shortVersion = "master-1.11.0";
+  forceBundledLLVM = false;
+  srcRev = "298730e7032cd55809423773da397cd5c7d827d4";
+  srcSha = "0hyz5j1z75sjkgsifzgxviv3b1lhgaz8wqwvmq80xx5vd78yd0c1";
+  patches = [ ./patches/disable-lockfile-check.patch
+              ./patches/use-rustc-1.9.0.patch ] ++
+    stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
+  rustc = rustcStable;
 }
diff --git a/pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch b/pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch
new file mode 100644
index 000000000000..0c01cb1a7f19
--- /dev/null
+++ b/pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch
@@ -0,0 +1,25 @@
+From e7378e267bba203bd593b49705c24303b0a46cb7 Mon Sep 17 00:00:00 2001
+From: David Craven <david@craven.ch>
+Date: Wed, 1 Jun 2016 01:41:35 +0200
+Subject: [PATCH] disable-lockfile-check
+
+---
+ src/tools/tidy/src/main.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
+index 2839bbd..50142ff 100644
+--- a/src/tools/tidy/src/main.rs
++++ b/src/tools/tidy/src/main.rs
+@@ -47,7 +47,7 @@ fn main() {
+     errors::check(&path, &mut bad);
+     cargo::check(&path, &mut bad);
+     features::check(&path, &mut bad);
+-    cargo_lock::check(&path, &mut bad);
++    //cargo_lock::check(&path, &mut bad);
+ 
+     if bad {
+         panic!("some tidy checks failed");
+-- 
+2.8.3
+
diff --git a/pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch b/pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch
new file mode 100644
index 000000000000..150306744be6
--- /dev/null
+++ b/pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch
@@ -0,0 +1,25 @@
+From 2710f3c8ae142abe1720b3476cd1ca60cee0c077 Mon Sep 17 00:00:00 2001
+From: David Craven <david@craven.ch>
+Date: Wed, 1 Jun 2016 00:12:35 +0200
+Subject: [PATCH] Patch stage0.txt to use rustc 1.9.0
+
+---
+ src/stage0.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/stage0.txt b/src/stage0.txt
+index 58b7f8f..3c84cab 100644
+--- a/src/stage0.txt
++++ b/src/stage0.txt
+@@ -12,6 +12,6 @@
+ # tarball for a stable release you'll likely see `1.x.0-$date` where `1.x.0` was
+ # released on `$date`
+ 
+-rustc: beta-2016-04-13
+-rustc_key: c2743eb4
++rustc: 1.9.0-2016-05-24
++rustc_key: d16b8f0e
+ cargo: nightly-2016-04-10
+-- 
+2.8.3
+
diff --git a/pkgs/development/compilers/rustc/stable.nix b/pkgs/development/compilers/rustc/stable.nix
new file mode 100644
index 000000000000..596ef2d0cb7a
--- /dev/null
+++ b/pkgs/development/compilers/rustc/stable.nix
@@ -0,0 +1,13 @@
+{ stdenv, callPackage }:
+
+callPackage ./generic.nix {
+  shortVersion = "1.9.0";
+  isRelease = true;
+  forceBundledLLVM = false;
+  configureFlags = [ "--release-channel=stable" ];
+  srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779";
+  srcSha = "1pz4qx70mqv78fxm4w1mq7csk5pssq4qmr2vwwb5v8hyx03caff8";
+  patches = [ ./patches/remove-uneeded-git.patch ]
+    ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
+  rustc = callPackage ./bootstrap.nix {};
+}