cargo: Use stable releases instead of snapshots
This commit is contained in:
50
pkgs/development/tools/build-managers/cargo/bootstrap.nix
Normal file
50
pkgs/development/tools/build-managers/cargo/bootstrap.nix
Normal 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"
|
||||
'';
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
64
pkgs/development/tools/build-managers/cargo/generic.nix
Normal file
64
pkgs/development/tools/build-managers/cargo/generic.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
17
pkgs/development/tools/build-managers/cargo/print-hashes.sh
Executable file
17
pkgs/development/tools/build-managers/cargo/print-hashes.sh
Executable 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
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user