cargo: Use stable releases instead of snapshots

This commit is contained in:
David Craven 2016-06-07 20:42:51 +02:00
parent 06027595fc
commit 0720373dfc
10 changed files with 164 additions and 206 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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"
'';
}

View File

@ -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;
};
}

View File

@ -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;
}

View File

@ -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;
};
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -2527,7 +2527,7 @@ in
netatalk = callPackage ../tools/filesystems/netatalk { };
netcdf = callPackage ../development/libraries/netcdf { };
netcdf-mpi = appendToName "mpi" (netcdf.override {
hdf5 = hdf5-mpi;
});
@ -4491,7 +4491,7 @@ in
inherit (self.haskellPackages) ghc;
cabal-install = haskell.lib.disableSharedExecutables haskellPackages.cabal-install;
stack = haskell.lib.overrideCabal haskellPackages.stack (drv: {
enableSharedExecutables = false;
isLibrary = false;
@ -5262,18 +5262,14 @@ in
rtags = callPackage ../development/tools/rtags/default.nix {};
rustc = rustcStable;
rustcStable = callPackage ../development/compilers/rustc/stable.nix {};
rustcStable = callPackage ../development/compilers/rustc {};
rustcBeta = lowPrio (callPackage ../development/compilers/rustc/beta.nix {});
rustcUnstable = lowPrio (callPackage ../development/compilers/rustc/head.nix {});
rustPlatform = rustStable;
rustStable = recurseIntoAttrs (makeRustPlatform cargo rustStable);
rustBeta = lowPrio (recurseIntoAttrs (makeRustPlatform cargoUnstable rustBeta));
rustUnstable = lowPrio (recurseIntoAttrs (makeRustPlatform cargoUnstable rustUnstable));
cargo = callPackage ../development/tools/build-managers/cargo {};
cargoUnstable = lowPrio (callPackage ../development/tools/build-managers/cargo/head.nix {});
# rust platform to build cargo itself (with cargoSnapshot)
rustCargoPlatform = makeRustPlatform (cargoSnapshot rustcStable) rustCargoPlatform;
rustUnstableCargoPlatform = makeRustPlatform (cargoSnapshot rustcUnstable) rustUnstableCargoPlatform;
rustPlatform = recurseIntoAttrs (makeRustPlatform cargo rustPlatform);
makeRustPlatform = cargo: self:
let
@ -5955,20 +5951,6 @@ in
byacc = callPackage ../development/tools/parsing/byacc { };
cargo = callPackage ../development/tools/build-managers/cargo {
# cargo needs to be built with rustCargoPlatform, which uses cargoSnapshot
rustPlatform = rustCargoPlatform;
};
cargoUnstable = lowPrio (callPackage ../development/tools/build-managers/cargo/head.nix {
rustPlatform = rustUnstableCargoPlatform;
});
cargoSnapshot = rustc:
callPackage ../development/tools/build-managers/cargo/snapshot.nix {
inherit rustc;
};
casperjs = callPackage ../development/tools/casperjs {
inherit (texFunctions) fontsConf;
};
@ -10840,7 +10822,7 @@ in
batman_adv = callPackage ../os-specific/linux/batman-adv {};
bcc = callPackage ../os-specific/linux/bcc { };
bbswitch = callPackage ../os-specific/linux/bbswitch {};
ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { };
@ -16015,7 +15997,7 @@ in
openspecfun = callPackage ../development/libraries/science/math/openspecfun {};
magma = callPackage ../development/libraries/science/math/magma { };
magma = callPackage ../development/libraries/science/math/magma { };
mathematica = callPackage ../applications/science/math/mathematica { };
mathematica9 = callPackage ../applications/science/math/mathematica/9.nix { };