diff options
author | Daiderd Jordan <daiderd@gmail.com> | 2017-11-17 22:45:34 +0100 |
---|---|---|
committer | Daiderd Jordan <daiderd@gmail.com> | 2017-11-17 22:45:34 +0100 |
commit | 36818207e97d70a209958e305f746c514ee3cc14 (patch) | |
tree | 9f99dbca94777a0917c4ef0b4c3c4039b811f455 /pkgs/development/compilers/rust | |
parent | 1352789cfc2edd57a26d50ea1eb248b2c0cc3dd3 (diff) | |
parent | 399a22e9846779402cda3557ffccb0456e3a3ffb (diff) | |
download | nixlib-36818207e97d70a209958e305f746c514ee3cc14.tar nixlib-36818207e97d70a209958e305f746c514ee3cc14.tar.gz nixlib-36818207e97d70a209958e305f746c514ee3cc14.tar.bz2 nixlib-36818207e97d70a209958e305f746c514ee3cc14.tar.lz nixlib-36818207e97d70a209958e305f746c514ee3cc14.tar.xz nixlib-36818207e97d70a209958e305f746c514ee3cc14.tar.zst nixlib-36818207e97d70a209958e305f746c514ee3cc14.zip |
Merge branch 'master' into staging
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r-- | pkgs/development/compilers/rust/binaryBuild.nix | 55 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/bootstrap.nix | 19 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/cargo.nix | 21 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/default.nix | 4 |
4 files changed, 58 insertions, 41 deletions
diff --git a/pkgs/development/compilers/rust/binaryBuild.nix b/pkgs/development/compilers/rust/binaryBuild.nix index cbe92df814cb..8dfe26f72f4a 100644 --- a/pkgs/development/compilers/rust/binaryBuild.nix +++ b/pkgs/development/compilers/rust/binaryBuild.nix @@ -6,12 +6,32 @@ }: let - inherit (stdenv.lib) optionalString; - - needsPatchelf = stdenv.isLinux; + inherit (stdenv.lib) getLib optionalString; + inherit (darwin) libiconv; + inherit (darwin.apple_sdk.frameworks) Security; bootstrapping = versionType == "bootstrap"; + patchBootstrapCargo = '' + ${optionalString (stdenv.isLinux && bootstrapping) '' + patchelf \ + --set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/cargo" + ''} + ${optionalString (stdenv.isDarwin && bootstrapping) '' + install_name_tool \ + -change /usr/lib/libiconv.2.dylib '${getLib libiconv}/lib/libiconv.2.dylib' \ + "$out/bin/cargo" + install_name_tool \ + -change /usr/lib/libcurl.4.dylib '${getLib curl}/lib/libcurl.4.dylib' \ + "$out/bin/cargo" + install_name_tool \ + -change /usr/lib/libz.1.dylib '${getLib zlib}/lib/libz.1.dylib' \ + "$out/bin/cargo" + ''} + ''; + installComponents = "rustc,rust-std-${platform}" + (optionalString bootstrapping ",rust-docs,cargo") @@ -34,22 +54,21 @@ rec { license = [ licenses.mit licenses.asl20 ]; }; - phases = ["unpackPhase" "installPhase"]; + phases = ["unpackPhase" "installPhase" "fixupPhase"]; - propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security; + propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin Security; installPhase = '' ./install.sh --prefix=$out \ --components=${installComponents} - ${optionalString (needsPatchelf && bootstrapping) '' + ${optionalString (stdenv.isLinux && bootstrapping) '' patchelf \ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/rustdoc" + "$out/bin/rustc" patchelf \ - --set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/cargo" + "$out/bin/rustdoc" ''} ${optionalString (stdenv.isDarwin && bootstrapping) '' install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo" @@ -57,19 +76,14 @@ rec { install_name_tool -change /usr/lib/libz.1.dylib '${stdenv.lib.getLib zlib}/lib/libz.1.dylib' "$out/bin/cargo" ''} - ${optionalString needsPatchelf '' - patchelf \ - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/rustc" + ${patchBootstrapCargo} # Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc # (or similar) here. It causes strange effects where rustc loads # the wrong libraries in a bootstrap-build causing failures that # are very hard to track dow. For details, see # https://github.com/rust-lang/rust/issues/34722#issuecomment-232164943 - ''} ''; - }; cargo = stdenv.mkDerivation rec { @@ -85,19 +99,16 @@ rec { license = [ licenses.mit licenses.asl20 ]; }; + phases = ["unpackPhase" "installPhase" "fixupPhase"]; + buildInputs = [ makeWrapper ]; - phases = ["unpackPhase" "installPhase"]; + propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin Security; installPhase = '' ./install.sh --prefix=$out \ --components=cargo - ${optionalString needsPatchelf '' - patchelf \ - --set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \ - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/cargo" - ''} + ${patchBootstrapCargo} wrapProgram "$out/bin/cargo" \ --suffix PATH : "${rustc}/bin" diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index d9aa3f757a4e..da9680943b57 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -1,16 +1,16 @@ -{ stdenv, fetchurl, makeWrapper, cacert, zlib, curl, darwin }: +{ stdenv, fetchurl, callPackage }: let # Note: the version MUST be one version prior to the version we're # building - version = "1.19.0"; + version = "1.20.0"; - # fetch hashes by running `print-hashes.sh 1.19.0` + # fetch hashes by running `print-hashes.sh 1.20.0` hashes = { - i686-unknown-linux-gnu = "657b78f3c1a1b4412e12f7278e20cc318022fa276a58f0d38a0d15b515e39713"; - x86_64-unknown-linux-gnu = "30ff67884464d32f6bbbde4387e7557db98868e87fb2afbb77c9b7716e3bff09"; - i686-apple-darwin = "bdfd2189245dc5764c9f26bdba1429c2bf9d57477d8e6e3f0ba42ea0dc63edeb"; - x86_64-apple-darwin = "5c668fb60a3ba3e97dc2cb8967fc4bb9422b629155284dcb89f94d116bb17820"; + i686-unknown-linux-gnu = "abe592e06616cdc2fcca56ddbe482050dd49a1fada35e2af031c64fe6eb14668"; + x86_64-unknown-linux-gnu = "ca1cf3aed73ff03d065a7d3e57ecca92228d35dc36d9274a6597441319f18eb8"; + i686-apple-darwin = "b3c2470f8f132d285e6c989681e251592b67071bc9d93cac8a2e6b66f7bdfcb5"; + x86_64-apple-darwin = "fa1fb8896d5e327cbe6deeb50e6e9a3346de629f2e6bcbd8c10f19f3e2ed67d5"; }; platform = @@ -29,9 +29,8 @@ let sha256 = hashes."${platform}"; }; -in import ./binaryBuild.nix - { inherit stdenv fetchurl makeWrapper cacert zlib curl darwin; +in callPackage ./binaryBuild.nix + { inherit version src platform; buildRustPackage = null; - inherit version src platform; versionType = "bootstrap"; } diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix index 682e85ce867b..fb3001bbf17b 100644 --- a/pkgs/development/compilers/rust/cargo.nix +++ b/pkgs/development/compilers/rust/cargo.nix @@ -1,7 +1,11 @@ { stdenv, fetchFromGitHub, file, curl, pkgconfig, python, openssl, cmake, zlib , makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2, darwin , version, srcSha, cargoSha256 -, patches ? []}: +, patches ? [] }: + +let + inherit (darwin.apple_sdk.frameworks) CoreFoundation; +in rustPlatform.buildRustPackage rec { name = "cargo-${version}"; @@ -21,13 +25,17 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkgconfig ]; buildInputs = [ file curl python openssl cmake zlib makeWrapper libgit2 ] - # FIXME: Use impure version of CoreFoundation because of missing symbols. - # CFURLSetResourcePropertyForKey is defined in the headers but there's no - # corresponding implementation in the sources from opensource.apple.com. - ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.CoreFoundation libiconv ]; + ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ]; LIBGIT2_SYS_USE_PKG_CONFIG=1; + # FIXME: Use impure version of CoreFoundation because of missing symbols. + # CFURLSetResourcePropertyForKey is defined in the headers but there's no + # corresponding implementation in the sources from opensource.apple.com. + preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' + export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE" + ''; + postInstall = '' # NOTE: We override the `http.cainfo` option usually specified in # `.cargo/config`. This is an issue when users want to specify @@ -36,8 +44,7 @@ rustPlatform.buildRustPackage rec { wrapProgram "$out/bin/cargo" \ --suffix PATH : "${rustc}/bin" \ --set CARGO_HTTP_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \ - --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" \ - ${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''} + --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" ''; checkPhase = '' diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index c42c958b170c..3973eaff1878 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -6,7 +6,7 @@ let rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {})); - version = "1.20.0"; + version = "1.21.0"; in rec { rustc = callPackage ./rustc.nix { @@ -18,7 +18,7 @@ rec { src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; - sha256 = "0542y4rnzlsrricai130mqyxl8r6rd991frb4qsnwb27yigqg91a"; + sha256 = "1yj8lnxybjrybp00fqhxw8fpr641dh8wcn9mk44xjnsb4i1c21qp"; }; patches = [ |