Merge pull request #7501 from wizeman/u/upd-rust

Add support for Rust / Cargo packaging
This commit is contained in:
Ricardo M. Correia
2015-05-12 17:30:11 +02:00
17 changed files with 513 additions and 38 deletions
@@ -3,6 +3,16 @@
{
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"
'';
platform = if stdenv.system == "i686-linux"
then "i686-unknown-linux-gnu"
else if stdenv.system == "x86_64-linux"
@@ -19,6 +29,4 @@
license = [ licenses.mit licenses.asl20 ];
platforms = platforms.linux;
};
name = "cargo-${version}";
}
@@ -0,0 +1,36 @@
{ stdenv, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl
, cmake, zlib }:
with ((import ./common.nix) { inherit stdenv; version = "2015-05-11"; });
with rustPlatform;
buildRustPackage rec {
inherit name version meta;
src = fetchgit {
url = "https://github.com/rust-lang/cargo.git";
rev = "a078e01ffab70738eafb7401704d1eaf90b94de2";
sha256 = "0vw62kxlmkajyix6n4cdz7w9l26dspjiw2fk4xkj33gzzc8rq9g8";
leaveDotGit = true;
};
depsSha256 = "1sk79w2wxvpgfkxr0nbrqqxdih4abiqvawdd88r2p9cqzrkdg8by";
buildInputs = [ file curl pkgconfig python openssl cmake zlib ];
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}
'';
}
@@ -19,11 +19,8 @@ let snapshotHash = if stdenv.system == "i686-linux"
snapshotName = "cargo-nightly-${platform}.tar.gz";
in
stdenv.mkDerivation {
inherit name;
inherit version;
inherit meta;
inherit name version meta;
src = fetchurl {
url = "https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${snapshotDate}/${snapshotName}";
@@ -35,10 +32,8 @@ stdenv.mkDerivation {
installPhase = ''
mkdir -p "$out"
./install.sh "--prefix=$out"
rm "$out/lib/rustlib/components" \
"$out/lib/rustlib/install.log" \
"$out/lib/rustlib/rust-installer-version" \
"$out/lib/rustlib/uninstall.sh"
${postInstall}
'' + (if stdenv.isLinux then ''
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.cc.dynamicLinker}" \
--set-rpath "${stdenv.cc.cc}/lib/:${stdenv.cc.cc}/lib64/:${zlib}/lib" \