git.iko.soy/typeable/nixpkgs
on master help sign in
Rust infrastructure refactoring

Rust infrastructure updates & refactoring

commitb05f991f5fd6cb6f03b2812bf59f425229f9b26d authorMoritz Ulrich <moritz@tarn-vedra.de> dateFri 3 Jun 2016, 00:11 (10 years ago) parent45c6dee895db6d
12 files changed+172−125
pkgs/build-support/rust/default.nix+1 pkgs/build-support/rust/fetch-cargo-deps+1−1 pkgs/development/compilers/rustc/beta.nix+12 pkgs/development/compilers/rustc/bootstrap.nix+58 pkgs/development/compilers/rustc/default.nix−27 pkgs/development/compilers/rustc/generic.nix+18−66 pkgs/development/compilers/rustc/head.nix+9−23 pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch+25 pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch+25 pkgs/development/compilers/rustc/stable.nix+13 pkgs/development/tools/build-managers/cargo/head.nix+3−3 pkgs/top-level/all-packages.nix+7−5
pkgs/build-support/rust/default.nix+1
@@ -44,6 +44,7 @@ in stdenv.mkDerivation (args // {
4444
4545 export CARGO_HOME="$(realpath deps)"
4646 export RUST_LOG=${logLevel}
47+ export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
4748
4849 # Let's find out which $indexHash cargo uses for file:///dev/null
4950 (cd $sourceRoot && cargo fetch &>/dev/null) || true
pkgs/build-support/rust/fetch-cargo-deps+1−1
@@ -147,7 +147,7 @@ EOF
147147 done
148148
149149 # Create ad-hoc branches for the revs we need
150− echo "$revs" | while read rev; do
150+ echo "$revs" | tr " " "\n" | while read -d " " rev; do
151151 echo "Creating git branch b_$rev $rev"
152152 git branch b_$rev $rev
153153 done
pkgs/development/compilers/rustc/beta.nixnew file+12
@@ -0,0 +1,12 @@
1+{ stdenv, callPackage, rustcStable }:
2+
3+callPackage ./generic.nix {
4+ shortVersion = "beta-1.10.0";
5+ forceBundledLLVM = false;
6+ configureFlags = [ "--release-channel=beta" ];
7+ srcRev = "39f3c16cca889ef3f1719d9177e3315258222a65";
8+ srcSha = "01bx6616lslp2mbj4h8bb6m042fs0y1z8g0jgpxvbk3fbhzwafrx";
9+ patches = [ ./patches/disable-lockfile-check.patch ] ++
10+ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
11+ rustc = rustcStable;
12+}
pkgs/development/compilers/rustc/bootstrap.nixnew file+58
@@ -0,0 +1,58 @@
1+{ stdenv, fetchurl }:
2+
3+let
4+ platform = if stdenv.system == "i686-linux"
5+ then "linux-i386"
6+ else if stdenv.system == "x86_64-linux"
7+ then "linux-x86_64"
8+ else if stdenv.system == "i686-darwin"
9+ then "macos-i386"
10+ else if stdenv.system == "x86_64-darwin"
11+ then "macos-x86_64"
12+ else abort "no snapshot to bootstrap for this platform (missing platform url suffix)";
13+
14+ /* Rust is bootstrapped from an earlier built version. We need
15+ to fetch these earlier versions, which vary per platform.
16+ The shapshot info you want can be found at
17+ https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
18+ with the set you want at the top. Make sure this is the latest snapshot
19+ for the tagged release and not a snapshot in the current HEAD.
20+ NOTE: Rust 1.9.0 is the last version that uses snapshots
21+ */
22+
23+ snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
24+ snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
25+ snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
26+ snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
27+ snapshotDate = "2016-03-18";
28+ snapshotRev = "235d774";
29+
30+ snapshotHash = if stdenv.system == "i686-linux"
31+ then snapshotHashLinux686
32+ else if stdenv.system == "x86_64-linux"
33+ then snapshotHashLinux64
34+ else if stdenv.system == "i686-darwin"
35+ then snapshotHashDarwin686
36+ else if stdenv.system == "x86_64-darwin"
37+ then snapshotHashDarwin64
38+ else abort "no snapshot for platform ${stdenv.system}";
39+
40+ snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
41+in
42+
43+stdenv.mkDerivation {
44+ name = "rust-bootstrap";
45+ src = fetchurl {
46+ url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
47+ sha1 = snapshotHash;
48+ };
49+ dontStrip = true;
50+ installPhase = ''
51+ mkdir -p "$out"
52+ cp -r bin "$out/bin"
53+ '' + stdenv.lib.optionalString stdenv.isLinux ''
54+ patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
55+ --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \
56+ "$out/bin/rustc"
57+ '';
58+}
pkgs/development/compilers/rustc/default.nixdeleted−27
@@ -1,27 +0,0 @@
1−{ stdenv, callPackage }:
2−
3−callPackage ./generic.nix {
4− shortVersion = "1.9.0";
5− isRelease = true;
6− forceBundledLLVM = false;
7− configureFlags = [ "--release-channel=stable" ];
8− srcSha = "0yg5admbypqld0gmxbhrh2yag5kxjklpjgldrp3pd5vczkl13aml";
9−
10− /* Rust is bootstrapped from an earlier built version. We need
11− to fetch these earlier versions, which vary per platform.
12− The shapshot info you want can be found at
13− https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
14− with the set you want at the top. Make sure this is the latest snapshot
15− for the tagged release and not a snapshot in the current HEAD.
16− */
17−
18− snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
19− snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
20− snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
21− snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
22− snapshotDate = "2016-03-18";
23− snapshotRev = "235d774";
24−
25− patches = [ ./patches/remove-uneeded-git.patch ]
26− ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
27−}
pkgs/development/compilers/rustc/generic.nix+18−66
@@ -1,14 +1,11 @@
11{ stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
2−, llvm, jemalloc, ncurses, darwin, binutils
2+, llvm, jemalloc, ncurses, darwin, binutils, rustc
33
4−, shortVersion, isRelease
4+, isRelease ? false
5+, shortVersion
56, forceBundledLLVM ? false
6−, srcSha, srcRev ? ""
7−, snapshotHashLinux686, snapshotHashLinux64
8−, snapshotHashDarwin686, snapshotHashDarwin64
9−, snapshotDate, snapshotRev
7+, srcSha, srcRev
108, configureFlags ? []
11−
129, patches
1310} @ args:
1411
@@ -26,9 +23,8 @@ sure those derivations still compile. (racer, for example).
2623
2724*/
2825
29−assert (if isRelease then srcRev == "" else srcRev != "");
30−
31−let version = if isRelease then
26+let
27+ version = if isRelease then
3228 "${shortVersion}"
3329 else
3430 "${shortVersion}-g${builtins.substring 0 7 srcRev}";
@@ -39,16 +35,6 @@ let version = if isRelease then
3935
4036 llvmShared = llvm.override { enableSharedLibraries = true; };
4137
42− platform = if stdenv.system == "i686-linux"
43− then "linux-i386"
44− else if stdenv.system == "x86_64-linux"
45− then "linux-x86_64"
46− else if stdenv.system == "i686-darwin"
47− then "macos-i386"
48− else if stdenv.system == "x86_64-darwin"
49− then "macos-x86_64"
50− else abort "no snapshot to bootstrap for this platform (missing platform url suffix)";
51−
5238 target = if stdenv.system == "i686-linux"
5339 then "i686-unknown-linux-gnu"
5440 else if stdenv.system == "x86_64-linux"
@@ -66,20 +52,9 @@ let version = if isRelease then
6652 license = [ licenses.mit licenses.asl20 ];
6753 platforms = platforms.linux ++ platforms.darwin;
6854 };
69−
70− snapshotHash = if stdenv.system == "i686-linux"
71− then snapshotHashLinux686
72− else if stdenv.system == "x86_64-linux"
73− then snapshotHashLinux64
74− else if stdenv.system == "i686-darwin"
75− then snapshotHashDarwin686
76− else if stdenv.system == "x86_64-darwin"
77− then snapshotHashDarwin64
78− else abort "no snapshot for platform ${stdenv.system}";
79− snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
8055in
8156
82−with stdenv.lib; stdenv.mkDerivation {
57+stdenv.mkDerivation {
8358 inherit name;
8459 inherit version;
8560 inherit meta;
@@ -88,42 +63,19 @@ with stdenv.lib; stdenv.mkDerivation {
8863
8964 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
9065
91− src = if isRelease then
92− fetchzip {
93− url = "http://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
94− sha256 = srcSha;
95− }
96− else
97− fetchgit {
98− url = https://github.com/rust-lang/rust;
99− rev = srcRev;
100− sha256 = srcSha;
101− };
102−
103− # We need rust to build rust. If we don't provide it, configure will try to download it.
104− snapshot = stdenv.mkDerivation {
105− name = "rust-stage0";
106− src = fetchurl {
107− url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
108− sha1 = snapshotHash;
109− };
110− dontStrip = true;
111− installPhase = ''
112− mkdir -p "$out"
113− cp -r bin "$out/bin"
114− '' + optionalString stdenv.isLinux ''
115− patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
116− --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \
117− "$out/bin/rustc"
118− '';
66+ src = fetchgit {
67+ url = https://github.com/rust-lang/rust;
68+ rev = srcRev;
69+ sha256 = srcSha;
11970 };
12071
72+ # We need rust to build rust. If we don't provide it, configure will try to download it.
12173 configureFlags = configureFlags
122− ++ [ "--enable-local-rust" "--local-rust-root=$snapshot" "--enable-rpath" ]
74+ ++ [ "--enable-local-rust" "--local-rust-root=${rustc}" "--enable-rpath" ]
12375 # ++ [ "--jemalloc-root=${jemalloc}/lib"
12476 ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ]
125− ++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
126− ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
77+ ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang"
78+ ++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
12779
12880 inherit patches;
12981
@@ -138,7 +90,7 @@ with stdenv.lib; stdenv.mkDerivation {
13890 --replace "\$\$(subst /,//," "\$\$(subst /,/,"
13991
14092 # Fix dynamic linking against llvm
141− ${optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
93+ ${stdenv.lib.optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
14294
14395 # Fix the configure script to not require curl as we won't use it
14496 sed -i configure \
@@ -160,9 +112,9 @@ with stdenv.lib; stdenv.mkDerivation {
160112 '';
161113
162114 # ps is needed for one of the test cases
163− nativeBuildInputs = [ file python2 procps ];
115+ nativeBuildInputs = [ file python2 procps rustc ];
164116 buildInputs = [ ncurses ]
165− ++ optional (!forceBundledLLVM) llvmShared;
117+ ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared;
166118
167119 # https://github.com/rust-lang/rust/issues/30181
168120 # enableParallelBuilding = false; # missing files during linking, occasionally
pkgs/development/compilers/rustc/head.nix+9−23
@@ -1,27 +1,13 @@
11# Please make sure to check if rustfmt still builds when updating nightly
2−{ stdenv, callPackage }:
2+{ stdenv, callPackage, rustcStable }:
33
44callPackage ./generic.nix {
5− shortVersion = "2016-03-22";
6− isRelease = false;
7− forceBundledLLVM = true;
8− srcRev = "6cc502c986d42da407e26a49d4f09f21d3072fcb";
9− srcSha = "096lsc8irh9a7w494yaji28kzy9frs2myqrfyj0fzbxkvs3yfhzz";
10−
11− /* Rust is bootstrapped from an earlier built version. We need
12− to fetch these earlier versions, which vary per platform.
13− The shapshot info you want can be found at
14− https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
15− with the set you want at the top.
16− */
17−
18− snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
19− snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
20− snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
21− snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
22− snapshotDate = "2016-03-18";
23− snapshotRev = "235d774";
24−
25− patches = [ ./patches/remove-uneeded-git.patch ]
26− ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
5+ shortVersion = "master-1.11.0";
6+ forceBundledLLVM = false;
7+ srcRev = "298730e7032cd55809423773da397cd5c7d827d4";
8+ srcSha = "0hyz5j1z75sjkgsifzgxviv3b1lhgaz8wqwvmq80xx5vd78yd0c1";
9+ patches = [ ./patches/disable-lockfile-check.patch
10+ ./patches/use-rustc-1.9.0.patch ] ++
11+ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
12+ rustc = rustcStable;
2713}
pkgs/development/compilers/rustc/patches/disable-lockfile-check.patchnew file+25
@@ -0,0 +1,25 @@
1+From e7378e267bba203bd593b49705c24303b0a46cb7 Mon Sep 17 00:00:00 2001
2+From: David Craven <david@craven.ch>
3+Date: Wed, 1 Jun 2016 01:41:35 +0200
4+Subject: [PATCH] disable-lockfile-check
5+
6+---
7+ src/tools/tidy/src/main.rs | 2 +-
8+ 1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
11+index 2839bbd..50142ff 100644
12+--- a/src/tools/tidy/src/main.rs
13++++ b/src/tools/tidy/src/main.rs
14+@@ -47,7 +47,7 @@ fn main() {
15+ errors::check(&path, &mut bad);
16+ cargo::check(&path, &mut bad);
17+ features::check(&path, &mut bad);
18+- cargo_lock::check(&path, &mut bad);
19++ //cargo_lock::check(&path, &mut bad);
20+
21+ if bad {
22+ panic!("some tidy checks failed");
23+--
24+2.8.3
25+
pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patchnew file+25
@@ -0,0 +1,25 @@
1+From 2710f3c8ae142abe1720b3476cd1ca60cee0c077 Mon Sep 17 00:00:00 2001
2+From: David Craven <david@craven.ch>
3+Date: Wed, 1 Jun 2016 00:12:35 +0200
4+Subject: [PATCH] Patch stage0.txt to use rustc 1.9.0
5+
6+---
7+ src/stage0.txt | 4 ++--
8+ 1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+diff --git a/src/stage0.txt b/src/stage0.txt
11+index 58b7f8f..3c84cab 100644
12+--- a/src/stage0.txt
13++++ b/src/stage0.txt
14+@@ -12,6 +12,6 @@
15+ # tarball for a stable release you'll likely see `1.x.0-$date` where `1.x.0` was
16+ # released on `$date`
17+
18+-rustc: beta-2016-04-13
19+-rustc_key: c2743eb4
20++rustc: 1.9.0-2016-05-24
21++rustc_key: d16b8f0e
22+ cargo: nightly-2016-04-10
23+--
24+2.8.3
25+
pkgs/development/compilers/rustc/stable.nixnew file+13
@@ -0,0 +1,13 @@
1+{ stdenv, callPackage }:
2+
3+callPackage ./generic.nix {
4+ shortVersion = "1.9.0";
5+ isRelease = true;
6+ forceBundledLLVM = false;
7+ configureFlags = [ "--release-channel=stable" ];
8+ srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779";
9+ srcSha = "1pz4qx70mqv78fxm4w1mq7csk5pssq4qmr2vwwb5v8hyx03caff8";
10+ patches = [ ./patches/remove-uneeded-git.patch ]
11+ ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
12+ rustc = callPackage ./bootstrap.nix {};
13+}
pkgs/development/tools/build-managers/cargo/head.nix+3−3
@@ -14,11 +14,11 @@ buildRustPackage rec {
1414 # Needs to use fetchgit instead of fetchFromGitHub to fetch submodules
1515 src = fetchgit {
1616 url = "git://github.com/rust-lang/cargo";
17− rev = "132b82d75f607dcb1116b8d44fe60f202f1eb110";
18− sha256 = "0kx2m0p45zr0ils2ax19sr32cibjppgwj8xvsgrfvzvlnc540xpl";
17+ rev = "7d79da08238e3d47e0bc4406155bdcc45ccb8c82";
18+ sha256 = "190qdii53s4vk940yzs2iizhfs22y2v8bzw051bl6bk9bs3y4fdd";
1919 };
2020
21− depsSha256 = "19d2fl5p92108a0yjpix0qxdc23jy122xc87k69hk0pwwxa92l3a";
21+ depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f";
2222
2323 buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ];
2424
pkgs/top-level/all-packages.nix+7−5
@@ -5264,17 +5264,19 @@ in
52645264
52655265 rtags = callPackage ../development/tools/rtags/default.nix {};
52665266
5267− rustcMaster = lowPrio (callPackage ../development/compilers/rustc/head.nix {});
5268− rustc = callPackage ../development/compilers/rustc {};
5267+ rustc = rustcStable;
5268+ rustcStable = callPackage ../development/compilers/rustc/stable.nix {};
5269+ rustcBeta = lowPrio (callPackage ../development/compilers/rustc/beta.nix {});
5270+ rustcUnstable = lowPrio (callPackage ../development/compilers/rustc/head.nix {});
52695271
52705272 rustPlatform = rustStable;
5271−
52725273 rustStable = recurseIntoAttrs (makeRustPlatform cargo rustStable);
5274+ rustBeta = lowPrio (recurseIntoAttrs (makeRustPlatform cargoUnstable rustBeta));
52735275 rustUnstable = lowPrio (recurseIntoAttrs (makeRustPlatform cargoUnstable rustUnstable));
52745276
52755277 # rust platform to build cargo itself (with cargoSnapshot)
5276− rustCargoPlatform = makeRustPlatform (cargoSnapshot rustc) rustCargoPlatform;
5277− rustUnstableCargoPlatform = makeRustPlatform (cargoSnapshot rustcMaster) rustUnstableCargoPlatform;
5278+ rustCargoPlatform = makeRustPlatform (cargoSnapshot rustcStable) rustCargoPlatform;
5279+ rustUnstableCargoPlatform = makeRustPlatform (cargoSnapshot rustcUnstable) rustUnstableCargoPlatform;
52785280
52795281 makeRustPlatform = cargo: self:
52805282 let