summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorDavid Craven <david@craven.ch>2016-06-07 20:42:51 +0200
committerDavid Craven <david@craven.ch>2016-06-14 23:09:21 +0200
commit0720373dfc8ebb8962cdab9ba816c348fa7e6692 (patch)
treed92d8954919103d9a79bb9d97f48577b4ec1c7ae /pkgs/development
parent06027595fcf802f2b8a8fc5bf29111d1ffac5c48 (diff)
downloadnixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.tar
nixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.tar.gz
nixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.tar.bz2
nixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.tar.lz
nixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.tar.xz
nixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.tar.zst
nixlib-0720373dfc8ebb8962cdab9ba816c348fa7e6692.zip
cargo: Use stable releases instead of snapshots
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/rustc/default.nix (renamed from pkgs/development/compilers/rustc/stable.nix)8
-rw-r--r--pkgs/development/compilers/rustc/generic.nix6
-rw-r--r--pkgs/development/tools/build-managers/cargo/bootstrap.nix50
-rw-r--r--pkgs/development/tools/build-managers/cargo/common.nix38
-rw-r--r--pkgs/development/tools/build-managers/cargo/default.nix55
-rw-r--r--pkgs/development/tools/build-managers/cargo/generic.nix64
-rw-r--r--pkgs/development/tools/build-managers/cargo/head.nix43
-rwxr-xr-xpkgs/development/tools/build-managers/cargo/print-hashes.sh17
-rw-r--r--pkgs/development/tools/build-managers/cargo/snapshot.nix55
9 files changed, 156 insertions, 180 deletions
diff --git a/pkgs/development/compilers/rustc/stable.nix b/pkgs/development/compilers/rustc/default.nix
index 596ef2d0cb7a..dd7fd8a88dab 100644
--- a/pkgs/development/compilers/rustc/stable.nix
+++ b/pkgs/development/compilers/rustc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, callPackage }:
+{ stdenv, callPackage, targets ? [], targetToolchains ? [] }:
 
 callPackage ./generic.nix {
   shortVersion = "1.9.0";
@@ -6,8 +6,10 @@ callPackage ./generic.nix {
   forceBundledLLVM = false;
   configureFlags = [ "--release-channel=stable" ];
   srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779";
-  srcSha = "1pz4qx70mqv78fxm4w1mq7csk5pssq4qmr2vwwb5v8hyx03caff8";
+  srcSha = "167rh7hs77grn895h54s7np7f0k7b6i8z4wdfinncg4chy08hxq1";
   patches = [ ./patches/remove-uneeded-git.patch ]
     ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
-  rustc = callPackage ./bootstrap.nix {};
+  rustc = callPackage ./snapshot.nix {};
+  inherit targets;
+  inherit targetToolchains;
 }
diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix
index 09d8ad8bf00f..42deddd9e1d2 100644
--- a/pkgs/development/compilers/rustc/generic.nix
+++ b/pkgs/development/compilers/rustc/generic.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
-, llvm, jemalloc, ncurses, darwin, binutils, rustc
+, llvm, jemalloc, ncurses, darwin, binutils, rustc, git
 
 , isRelease ? false
 , shortVersion
@@ -112,8 +112,8 @@ stdenv.mkDerivation {
   '';
 
   # ps is needed for one of the test cases
-  nativeBuildInputs = [ file python2 procps rustc ];
-  buildInputs = [ ncurses ]
+  nativeBuildInputs = [ file python2 procps rustc git ];
+  buildInputs = [ ncurses ] ++ targetToolchains
     ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared;
 
   # https://github.com/rust-lang/rust/issues/30181
diff --git a/pkgs/development/tools/build-managers/cargo/bootstrap.nix b/pkgs/development/tools/build-managers/cargo/bootstrap.nix
new file mode 100644
index 000000000000..c4052232a8bb
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cargo/bootstrap.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, makeWrapper, cacert, zlib, rustc }:
+
+let
+  platform =
+    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 "missing boostrap url for platform ${stdenv.system}";
+
+  # fetch hashes by running `print-hashes.sh 1.9.0`
+  bootstrapHash =
+    if stdenv.system == "i686-linux"
+    then "dd4d9bf1b9393867eb18d00431e8fb733894984f2c7b5154bc1b64d045077b45"
+    else if stdenv.system == "x86_64-linux"
+    then "288ff13efa2577e81c77fc2cb6e2b49b1ed0ceab51b4fa12f7efb87039ac49b7"
+    else if stdenv.system == "i686-darwin"
+    then "4d4d4b256d6bd6ae2527cf61007b2553de200f0a1910b7ad41e4f51d2b21e536"
+    else if stdenv.system == "x86_64-darwin"
+    then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6"
+    else throw "missing boostrap hash for platform ${stdenv.system}";
+in
+stdenv.mkDerivation rec {
+  name = "cargo-bootstrap-${version}";
+  version = "1.9.0";
+
+  src = fetchurl {
+     url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";
+     sha256 = bootstrapHash;
+  };
+
+  passthru.rustc = rustc;
+  buildInputs = [makeWrapper zlib];
+  phases = ["unpackPhase" "installPhase"];
+
+  installPhase = ''
+    cp -r cargo "$out"
+
+    patchelf \
+      --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+      "$out/bin/cargo"
+
+    wrapProgram "$out/bin/cargo" \
+      --suffix PATH : "${rustc}/bin"
+  '';
+}
diff --git a/pkgs/development/tools/build-managers/cargo/common.nix b/pkgs/development/tools/build-managers/cargo/common.nix
deleted file mode 100644
index 649664793192..000000000000
--- a/pkgs/development/tools/build-managers/cargo/common.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{stdenv, version, rustc}:
-
-{
-  inherit version;
-
-  name = "cargo-${version}";
-
-  postInstall = ''
-    rm "$out/lib/rustlib/components" \
-       "$out/lib/rustlib/install.log" \
-       "$out/lib/rustlib/rust-installer-version" \
-       "$out/lib/rustlib/uninstall.sh" \
-       "$out/lib/rustlib/manifest-cargo"
-
-     wrapProgram "$out/bin/cargo" --suffix PATH : "${rustc}/bin" \
-       ${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''}
-  '';
-
-  platform = 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 throw "no snapshot to bootstrap for this platform (missing platform url suffix)";
-
-  passthru.rustc = rustc;
-
-  meta = with stdenv.lib; {
-    homepage = http://crates.io;
-    description = "Downloads your Rust project's dependencies and builds your project";
-    maintainers = with maintainers; [ wizeman retrry ];
-    license = [ licenses.mit licenses.asl20 ];
-    platforms = platforms.linux ++ platforms.darwin;
-  };
-}
diff --git a/pkgs/development/tools/build-managers/cargo/default.nix b/pkgs/development/tools/build-managers/cargo/default.nix
index 54909ce3b704..253a62e7bbe2 100644
--- a/pkgs/development/tools/build-managers/cargo/default.nix
+++ b/pkgs/development/tools/build-managers/cargo/default.nix
@@ -1,49 +1,14 @@
-{ stdenv, lib, cacert, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl
-, cmake, zlib, makeWrapper
-# Darwin dependencies
-, libiconv }:
+{ stdenv, callPackage, rustc, makeRustPlatform, recurseIntoAttrs }:
 
-with rustPlatform;
-
-with ((import ./common.nix) {
-  inherit stdenv rustc;
+let
+  cargoBootstrap = callPackage ./bootstrap.nix {};
+  rustPlatformBootstrap = recurseIntoAttrs (makeRustPlatform cargoBootstrap rustPlatformBootstrap);
+in
+callPackage ./generic.nix rec {
   version = "0.10.0";
-});
-
-buildRustPackage rec {
-  inherit name version meta passthru;
-
-  # Needs to use fetchgit instead of fetchFromGitHub to fetch submodules
-  src = fetchgit {
-    url = "git://github.com/rust-lang/cargo";
-    rev = "refs/tags/${version}";
-    sha256 = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2";
-  };
-
+  srcRev = "refs/tags/${version}";
+  srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2";
   depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b";
-
-  buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ]
-    ++ lib.optional stdenv.isDarwin libiconv;
-
-  configurePhase = ''
-    ./configure --enable-optimize --prefix=$out --local-cargo=${cargo}/bin/cargo
-  '';
-
-  buildPhase = "make";
-
-  checkPhase = ''
-    # Export SSL_CERT_FILE as without it one test fails with SSL verification error
-    export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
-    # Disable cross compilation tests
-    export CFG_DISABLE_CROSS_TESTS=1
-    cargo test
-  '';
-
-  # Disable check phase as there are failures (author_prefers_cargo test fails)
-  doCheck = false;
-
-  installPhase = ''
-    make install
-    ${postInstall}
-  '';
+  inherit rustc;
+  rustPlatform = rustPlatformBootstrap;
 }
diff --git a/pkgs/development/tools/build-managers/cargo/generic.nix b/pkgs/development/tools/build-managers/cargo/generic.nix
new file mode 100644
index 000000000000..4f74166bf625
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cargo/generic.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib
+, makeWrapper, libiconv, cacert, rustPlatform, rustc
+, version, srcRev, srcSha, depsSha256 }:
+
+rustPlatform.buildRustPackage rec {
+  name = "cargo-${version}";
+  inherit version;
+
+  src = fetchgit {
+    url = "https://github.com/rust-lang/cargo";
+    rev = srcRev;
+    sha256 = srcSha;
+  };
+
+  inherit depsSha256;
+
+  passthru.rustc = rustc;
+
+  buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ]
+    ++ stdenv.lib.optional stdenv.isDarwin libiconv;
+
+  configurePhase = ''
+    ./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.cargo}/bin/cargo
+  '';
+
+  buildPhase = "make";
+
+  installPhase = ''
+    make install
+    ${postInstall}
+  '';
+
+  postInstall = ''
+    rm "$out/lib/rustlib/components" \
+       "$out/lib/rustlib/install.log" \
+       "$out/lib/rustlib/rust-installer-version" \
+       "$out/lib/rustlib/uninstall.sh" \
+       "$out/lib/rustlib/manifest-cargo"
+
+    wrapProgram "$out/bin/cargo" \
+      --suffix PATH : "${rustc}/bin" \
+      --run "export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt" \
+      ${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''}
+  '';
+
+  checkPhase = ''
+    # Export SSL_CERT_FILE as without it one test fails with SSL verification error
+    export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
+    # Disable cross compilation tests
+    export CFG_DISABLE_CROSS_TESTS=1
+    cargo test
+  '';
+
+  # Disable check phase as there are failures (author_prefers_cargo test fails)
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = http://crates.io;
+    description = "Downloads your Rust project's dependencies and builds your project";
+    maintainers = with maintainers; [ wizeman retrry ];
+    license = [ licenses.mit licenses.asl20 ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/pkgs/development/tools/build-managers/cargo/head.nix b/pkgs/development/tools/build-managers/cargo/head.nix
index 475e2ab962c8..0faaf5e9a719 100644
--- a/pkgs/development/tools/build-managers/cargo/head.nix
+++ b/pkgs/development/tools/build-managers/cargo/head.nix
@@ -1,39 +1,10 @@
-{ stdenv, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl
-, cmake, zlib, makeWrapper }:
-
-with rustPlatform;
-
-with ((import ./common.nix) {
-  inherit stdenv rustc;
-  version = "2016-03-20";
-});
-
-buildRustPackage rec {
-  inherit name version meta passthru;
-
-  # Needs to use fetchgit instead of fetchFromGitHub to fetch submodules
-  src = fetchgit {
-    url = "git://github.com/rust-lang/cargo";
-    rev = "7d79da08238e3d47e0bc4406155bdcc45ccb8c82";
-    sha256 = "190qdii53s4vk940yzs2iizhfs22y2v8bzw051bl6bk9bs3y4fdd";
-  };
+{ stdenv, callPackage, rustc, rustPlatform }:
 
+callPackage ./generic.nix rec {
+  version = "2016.06.07";
+  srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28";
+  srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f";
   depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f";
-
-  buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ];
-
-  configurePhase = ''
-    ./configure --enable-optimize --prefix=$out --local-cargo=${cargo}/bin/cargo
-  '';
-
-  buildPhase = "make";
-
-  # Disable check phase as there are lots of failures (some probably due to
-  # trying to access the network).
-  doCheck = false;
-
-  installPhase = ''
-    make install
-    ${postInstall}
-  '';
+  inherit rustc;
+  inherit rustPlatform;
 }
diff --git a/pkgs/development/tools/build-managers/cargo/print-hashes.sh b/pkgs/development/tools/build-managers/cargo/print-hashes.sh
new file mode 100755
index 000000000000..4d1d20066b85
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cargo/print-hashes.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+PLATFORMS="i686-unknown-linux-gnu x86_64-unknown-linux-gnu i686-apple-darwin x86_64-apple-darwin"
+BASEURL="https://static.rust-lang.org/dist"
+VERSION=$1
+
+if [[ -z  $VERSION ]]
+then
+    echo "No version supplied"
+    exit -1
+fi
+
+for PLATFORM in $PLATFORMS
+do
+    URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256"
+    curl $URL
+done
diff --git a/pkgs/development/tools/build-managers/cargo/snapshot.nix b/pkgs/development/tools/build-managers/cargo/snapshot.nix
deleted file mode 100644
index 62539c2c7328..000000000000
--- a/pkgs/development/tools/build-managers/cargo/snapshot.nix
+++ /dev/null
@@ -1,55 +0,0 @@
-{ stdenv, fetchurl, zlib, makeWrapper, rustc }:
-
-/* Cargo binary snapshot */
-
-let snapshotDate = "2016-01-31";
-in
-
-with ((import ./common.nix) {
-  inherit stdenv rustc;
-  version = "snapshot-${snapshotDate}";
-});
-
-let snapshotHash = if stdenv.system == "i686-linux"
-      then "7e2f9c82e1af5aa43ef3ee2692b985a5f2398f0a"
-      else if stdenv.system == "x86_64-linux"
-      then "4c03a3fd2474133c7ad6d8bb5f6af9915ca5292a"
-      else if stdenv.system == "i686-darwin"
-      then "4d84d31449a5926f9e7ceb344540d6e5ea530b88"
-      else if stdenv.system == "x86_64-darwin"
-      then "f8baef5b0b3e6f9825be1f1709594695ac0f0abc"
-      else throw "no snapshot for platform ${stdenv.system}";
-    snapshotName = "cargo-nightly-${platform}.tar.gz";
-in
-
-stdenv.mkDerivation {
-  inherit name version meta passthru;
-
-  src = fetchurl {
-    url = "https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${snapshotDate}/${snapshotName}";
-    sha1 = snapshotHash;
-  };
-
-  buildInputs = [ makeWrapper ];
-
-  dontStrip = true;
-
-  __propagatedImpureHostDeps = [
-    "/usr/lib/libiconv.2.dylib"
-    "/usr/lib/libssl.0.9.8.dylib"
-    "/usr/lib/libcurl.4.dylib"
-    "/System/Library/Frameworks/GSS.framework/GSS"
-    "/System/Library/Frameworks/GSS.framework/Versions/Current"
-    "/System/Library/PrivateFrameworks/Heimdal.framework/Heimdal"
-    "/System/Library/PrivateFrameworks/Heimdal.framework/Versions/Current"
-  ];
-
-  installPhase = ''
-    mkdir -p "$out"
-    ./install.sh "--prefix=$out"
-  '' + (if stdenv.isLinux then ''
-    patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
-             --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/:${zlib.out}/lib" \
-             "$out/bin/cargo"
-  '' else "") + postInstall;
-}