Merge pull request #16052 from dvc94ch/rust-cross
Rust and cargo improvements
This commit is contained in:
@@ -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 +0,0 @@
|
||||
{ stdenv, lib, cacert, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl
|
||||
, cmake, zlib, makeWrapper
|
||||
# Darwin dependencies
|
||||
, libiconv }:
|
||||
|
||||
with rustPlatform;
|
||||
|
||||
with ((import ./common.nix) {
|
||||
inherit stdenv rustc;
|
||||
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";
|
||||
};
|
||||
|
||||
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}
|
||||
'';
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{ 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";
|
||||
};
|
||||
|
||||
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}
|
||||
'';
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -17,13 +17,13 @@ buildRustPackage rec {
|
||||
buildInputs = [ makeWrapper ];
|
||||
|
||||
preCheck = ''
|
||||
export RUST_SRC;_PATH="${rustc.src}/src"
|
||||
export RUST_SRC;_PATH="${rustPlatform.rust.rustc.src}/src"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp -p target/release/racer $out/bin/
|
||||
wrapProgram $out/bin/racer --set RUST_SRC_PATH "${rustc.src}/src"
|
||||
wrapProgram $out/bin/racer --set RUST_SRC_PATH "${rustPlatform.rust.rustc.src}/src"
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
||||
@@ -17,7 +17,7 @@ buildRustPackage rec {
|
||||
|
||||
buildInputs = [ makeWrapper ];
|
||||
|
||||
RUST_SRC_PATH = ''${rustc.src}/src'';
|
||||
RUST_SRC_PATH = ''${rustPlatform.rust.rustc.src}/src'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
Reference in New Issue
Block a user