From 4115e94c87391f8e234e710f386172a26ae1c83b Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Tue, 19 Jul 2016 10:25:35 +0200 Subject: [PATCH 01/15] rustBeta.rustc: beta-1.10.10 -> 1.11.0, rustBeta.cargo: 0.10.0 -> 0.12.0. --- pkgs/development/compilers/rust/beta.nix | 20 +++++++++++--------- pkgs/development/compilers/rust/rustc.nix | 12 ++++++++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/rust/beta.nix b/pkgs/development/compilers/rust/beta.nix index 4b4ee89f981b..52e57c3ce356 100644 --- a/pkgs/development/compilers/rust/beta.nix +++ b/pkgs/development/compilers/rust/beta.nix @@ -3,13 +3,15 @@ rec { rustc = callPackage ./rustc.nix { - shortVersion = "beta-1.10.0"; + shortVersion = "beta-1.11.0"; forceBundledLLVM = false; + needsCmake = true; configureFlags = [ "--release-channel=beta" ]; - srcRev = "d18e321abeecc69e4d1bf9cafba4fba53ddf267d"; - srcSha = "1ck8mbjrq0bzq5xzwgaqdilakwm2ab0xpzqibjycds62ad4yw774"; - patches = [ ./patches/disable-lockfile-check.patch ] - ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; + srcRev = "9333c420da0da6291740c313d5af3d620b55b8bc"; + srcSha = "05z6i4s5jjw3c5ypap6kzxk81bg4dib47h51znvsvcvr0svsnkgs"; + patches = [ + ./patches/disable-lockfile-check.patch + ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; inherit targets; inherit targetPatches; inherit targetToolchains; @@ -17,10 +19,10 @@ rec { }; cargo = callPackage ./cargo.nix rec { - version = "0.10.0"; - srcRev = "refs/tags/${version}"; - srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2"; - depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b"; + version = "0.12.0"; + srcRev = "6c27aa6985c18d644cbf6a13d54c8ae36aeaae12"; + srcSha = "1piq13aigd0yz0ysff450bfg3z56pw0vzzbzzpcppsnnrnh8zdb2"; + depsSha256 = "1jrwzm9fd15kf2d5zb17q901hx32h711ivcwdpxpmzwq08sjlcvl"; inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index b1b33d57bb25..e9df84a96a08 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -1,7 +1,8 @@ { stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps -, llvm, jemalloc, ncurses, darwin, binutils, rustPlatform, git +, llvm, jemalloc, ncurses, darwin, binutils, rustPlatform, git, cmake, curl , isRelease ? false +, needsCmake ? false , shortVersion , forceBundledLLVM ? false , srcSha, srcRev @@ -94,8 +95,15 @@ stdenv.mkDerivation { configureFlagsArray+=("--infodir=$out/share/info") ''; + # New -beta and -unstable unfortunately need cmake for compiling + # llvm-rt but don't use it for the normal build. This disables cmake + # in Nix. + dontUseCmakeConfigure = needsCmake; + # ps is needed for one of the test cases - nativeBuildInputs = [ file python2 procps rustPlatform.rust.rustc git ]; + nativeBuildInputs = [ file python2 procps rustPlatform.rust.rustc git ] + ++ stdenv.lib.optional needsCmake [ cmake curl ]; + buildInputs = [ ncurses ] ++ targetToolchains ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared; From 755be0e1cec47a2206f5b8f6a7a6f6ae17db640f Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Tue, 26 Jul 2016 13:20:04 +0200 Subject: [PATCH 02/15] rustBeta.cargo: Fix build. --- pkgs/development/compilers/rust/beta.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/rust/beta.nix b/pkgs/development/compilers/rust/beta.nix index 52e57c3ce356..f2a02348a3c5 100644 --- a/pkgs/development/compilers/rust/beta.nix +++ b/pkgs/development/compilers/rust/beta.nix @@ -19,10 +19,10 @@ rec { }; cargo = callPackage ./cargo.nix rec { - version = "0.12.0"; - srcRev = "6c27aa6985c18d644cbf6a13d54c8ae36aeaae12"; - srcSha = "1piq13aigd0yz0ysff450bfg3z56pw0vzzbzzpcppsnnrnh8zdb2"; - depsSha256 = "1jrwzm9fd15kf2d5zb17q901hx32h711ivcwdpxpmzwq08sjlcvl"; + version = "beta-0.13.0"; + srcRev = "fb2faf29b26da39bd815b470ca73255dbfe30e42"; + srcSha = "1r7wd3hp85mvmm7ivj01k65qcgb6qk1mys9mp48ww9k5cdniwcaj"; + depsSha256 = "0lsf99pgl6wnl1lfk0drp5l4agrx7hzgdbps7hy3rprbf41jd6ai"; inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; From 0f25add68da6b4e3f61e5f568d7cd6d49479e67a Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Tue, 26 Jul 2016 16:20:40 +0200 Subject: [PATCH 03/15] rustUnstable.rustc: master-1.11.0 -> master-1.12.0 Note that tests are failing for this commit. --- pkgs/development/compilers/rust/head.nix | 21 +++++++++++---------- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/rust/head.nix b/pkgs/development/compilers/rust/head.nix index bbfe5c9a1529..5cedc4b72a9a 100644 --- a/pkgs/development/compilers/rust/head.nix +++ b/pkgs/development/compilers/rust/head.nix @@ -3,13 +3,14 @@ rec { rustc = callPackage ./rustc.nix { - shortVersion = "master-1.11.0"; + shortVersion = "master-1.12.0"; forceBundledLLVM = false; - srcRev = "298730e7032cd55809423773da397cd5c7d827d4"; - srcSha = "0hyz5j1z75sjkgsifzgxviv3b1lhgaz8wqwvmq80xx5vd78yd0c1"; - patches = [ ./patches/disable-lockfile-check.patch - ./patches/use-rustc-1.9.0.patch ] - ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; + needsCmake = true; + srcRev = "c77f8ce7c3284441a00faed6782d08eb5a78296c"; + srcSha = "11y24bm2rj7bzsf86iyx3v286ygxprch4c804qbl1w477mkhcac7"; + patches = [ + ./patches/disable-lockfile-check.patch + ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; inherit targets; inherit targetPatches; inherit targetToolchains; @@ -17,10 +18,10 @@ rec { }; cargo = callPackage ./cargo.nix rec { - version = "2016.06.07"; - srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28"; - srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f"; - depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f"; + version = "master-0.13.0"; + srcRev = "fb2faf29b26da39bd815b470ca73255dbfe30e42"; + srcSha = "1r7wd3hp85mvmm7ivj01k65qcgb6qk1mys9mp48ww9k5cdniwcaj"; + depsSha256 = "0lsf99pgl6wnl1lfk0drp5l4agrx7hzgdbps7hy3rprbf41jd6ai"; inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 857681504b4f..b54cf934a068 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5481,7 +5481,9 @@ in rust = rustStable; rustStable = callPackage ../development/compilers/rust {}; rustBeta = lowPrio (callPackage ../development/compilers/rust/beta.nix {}); - rustUnstable = lowPrio (callPackage ../development/compilers/rust/head.nix {}); + rustUnstable = lowPrio (callPackage ../development/compilers/rust/head.nix { + rustPlatform = recurseIntoAttrs (makeRustPlatform rustBeta); + }); cargo = rust.cargo; rustc = rust.rustc; From 12fe1549536ce10e445b8520dd64dde4cac43ce7 Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Fri, 29 Jul 2016 12:14:51 +0200 Subject: [PATCH 04/15] rust-bootstrap: Don't run patchelf on darwin. --- pkgs/development/compilers/rust/bootstrap.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index bfc82c4317d7..56e19650579c 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -24,6 +24,8 @@ let then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6" else throw "missing boostrap hash for platform ${stdenv.system}"; + needsPatchelf = (stdenv.system == "i686-linux") || (stdenv.system == "x86_64-linux"); + src = fetchurl { url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; sha256 = bootstrapHash; @@ -46,9 +48,11 @@ rec { ./install.sh --prefix=$out \ --components=rustc,rust-std-${platform},rust-docs - patchelf \ - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/rustc" + ${if needsPatchelf then '' + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/rustc" + '' else ""} # Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc # (or similar) here. It causes strange effects where rustc loads @@ -71,9 +75,11 @@ rec { ./install.sh --prefix=$out \ --components=cargo - patchelf \ - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/cargo" + ${if needsPatchelf then '' + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/cargo" + '' else ""} wrapProgram "$out/bin/cargo" \ --suffix PATH : "${rustc}/bin" From 899d02642672005a3e65d71d9cbf5908601f094c Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Sun, 31 Jul 2016 20:06:01 +0200 Subject: [PATCH 05/15] rustUnstable.rustc: Fix tests by disabling lowering thread-count. --- pkgs/development/compilers/rust/head.nix | 6 ++- ...test-run-a-smaller-number-of-threads.patch | 44 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch diff --git a/pkgs/development/compilers/rust/head.nix b/pkgs/development/compilers/rust/head.nix index 5cedc4b72a9a..9befaca86daa 100644 --- a/pkgs/development/compilers/rust/head.nix +++ b/pkgs/development/compilers/rust/head.nix @@ -6,10 +6,12 @@ rec { shortVersion = "master-1.12.0"; forceBundledLLVM = false; needsCmake = true; - srcRev = "c77f8ce7c3284441a00faed6782d08eb5a78296c"; - srcSha = "11y24bm2rj7bzsf86iyx3v286ygxprch4c804qbl1w477mkhcac7"; + configureFlags = [ "--release-channel=nightly" ]; + srcRev = "d9a911d236cbecb47775276ba51a5f9111bdbc9c"; + srcSha = "07wybqvnw99fljmcy33vb9iwirmp10cwy47n008p396s7pb852hv"; patches = [ ./patches/disable-lockfile-check.patch + ./patches/tcp-stress-test-run-a-smaller-number-of-threads.patch ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; inherit targets; inherit targetPatches; diff --git a/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch b/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch new file mode 100644 index 000000000000..1b1d62160f65 --- /dev/null +++ b/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch @@ -0,0 +1,44 @@ +From b6202b5d602ca8216febe8ce9078581faa32955e Mon Sep 17 00:00:00 2001 +From: Moritz Ulrich +Date: Sat, 30 Jul 2016 09:01:13 +0200 +Subject: [PATCH] tcp-stress-test: Run a smaller number of threads. + +--- + src/test/run-pass/tcp-stress.rs | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs +index dfc8649..df8cdc9 100644 +--- a/src/test/run-pass/tcp-stress.rs ++++ b/src/test/run-pass/tcp-stress.rs +@@ -21,6 +21,8 @@ use std::sync::mpsc::channel; + use std::time::Duration; + use std::thread::{self, Builder}; + ++const TARGET_CNT: usize = 256; ++ + fn main() { + // This test has a chance to time out, try to not let it time out + thread::spawn(move|| -> () { +@@ -42,8 +44,9 @@ fn main() { + }); + + let (tx, rx) = channel(); ++ + let mut spawned_cnt = 0; +- for _ in 0..1000 { ++ for _ in 0..TARGET_CNT { + let tx = tx.clone(); + let res = Builder::new().stack_size(64 * 1024).spawn(move|| { + match TcpStream::connect(addr) { +@@ -66,6 +69,6 @@ fn main() { + for _ in 0..spawned_cnt { + rx.recv().unwrap(); + } +- assert_eq!(spawned_cnt, 1000); ++ assert_eq!(spawned_cnt, TARGET_CNT); + process::exit(0); + } +-- +2.9.1 + From d5569064c38a8cd816a1e4aecfe23e3d52054df9 Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Mon, 1 Aug 2016 09:45:56 +0200 Subject: [PATCH 06/15] rustcUnstable: Add note about when to drop the patch. --- pkgs/development/compilers/rust/head.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/compilers/rust/head.nix b/pkgs/development/compilers/rust/head.nix index 9befaca86daa..738c21a53275 100644 --- a/pkgs/development/compilers/rust/head.nix +++ b/pkgs/development/compilers/rust/head.nix @@ -11,6 +11,8 @@ rec { srcSha = "07wybqvnw99fljmcy33vb9iwirmp10cwy47n008p396s7pb852hv"; patches = [ ./patches/disable-lockfile-check.patch + # Drop this patch after + # https://github.com/rust-lang/rust/pull/35140 gets merged ./patches/tcp-stress-test-run-a-smaller-number-of-threads.patch ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; inherit targets; From 6fd05916744705ff6428bb1be2062a20ac2060bb Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Mon, 1 Aug 2016 09:49:03 +0200 Subject: [PATCH 07/15] rustc: Disable doCheck on Darwin. --- pkgs/development/compilers/rust/rustc.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index e9df84a96a08..e98333d4d74e 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -115,6 +115,7 @@ stdenv.mkDerivation { preCheck = "export TZDIR=${tzdata}/share/zoneinfo"; - doCheck = true; + # Disable doCheck on Darwin to work around upstream issue + doCheck = !stdenv.isDarwin; dontSetConfigureCross = true; } From 3cfe3ab6b686e3ec633323d8df8b70e782c56cdf Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Mon, 8 Aug 2016 15:55:05 +0200 Subject: [PATCH 08/15] libgit2: Disable Security.framework transport on Darwin. When used by cargo, `libgit2` crashes with a Segmentation Fault on Darwin. This crash is somehow connected to the `Security.framework` native to Darwin, and while being easy to reproduce, is very hard to track down. This commit introduces a patch to `libgit2` which disables the troublesome transport and instead depends on `libcurl`. The patch also adds support for `SSL_CERT_FILE` to `libgit2`. Upstream tracking issue is https://github.com/libgit2/libgit2/issues/3885. --- pkgs/development/libraries/git2/default.nix | 14 ++++- .../git2/disable-security.framework.patch | 58 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/git2/disable-security.framework.patch diff --git a/pkgs/development/libraries/git2/default.nix b/pkgs/development/libraries/git2/default.nix index 7aaac299b0e3..0a0c5858917f 100644 --- a/pkgs/development/libraries/git2/default.nix +++ b/pkgs/development/libraries/git2/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, cmake, zlib, python, libssh2, openssl, http-parser, libiconv }: +{ stdenv, fetchurl, pkgconfig, cmake, zlib, python, libssh2, openssl, curl, http-parser, libiconv }: stdenv.mkDerivation (rec { version = "0.24.1"; @@ -10,10 +10,20 @@ stdenv.mkDerivation (rec { sha256 = "0rw80480dx2f6a2wbb1bwixygg1iwq3r7vwhxdmkkf4lpxd35jhd"; }; + # TODO: `cargo` (rust's package manager) surfaced a serious bug in + # libgit2 when the `Security.framework` transport is used on Darwin. + # The upstream issue is tracked at + # https://github.com/libgit2/libgit2/issues/3885 - feel free to + # remove this patch as soon as it's resolved (i.E. when cargo is + # working fine without this patch) + patches = stdenv.lib.optionals stdenv.isDarwin [ + ./disable-security.framework.patch + ]; + cmakeFlags = "-DTHREADSAFE=ON"; nativeBuildInputs = [ cmake python pkgconfig ]; - buildInputs = [ zlib libssh2 openssl http-parser ]; + buildInputs = [ zlib libssh2 openssl http-parser curl ]; meta = { description = "The Git linkable library"; diff --git a/pkgs/development/libraries/git2/disable-security.framework.patch b/pkgs/development/libraries/git2/disable-security.framework.patch new file mode 100644 index 000000000000..ce6a008b1c4c --- /dev/null +++ b/pkgs/development/libraries/git2/disable-security.framework.patch @@ -0,0 +1,58 @@ +From fbc2ea65406236a740b8734dd41dc5ddbc24f8c9 Mon Sep 17 00:00:00 2001 +From: mulrich +Date: Mon, 8 Aug 2016 15:36:07 +0200 +Subject: [PATCH] disable security.framework + +--- + CMakeLists.txt | 7 +++---- + src/curl_stream.c | 9 ++++++++- + 2 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93a9e47..331e148 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,7 +49,8 @@ ENDIF() + + IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + SET( USE_ICONV ON ) +- FIND_PACKAGE(Security) ++ # FIND_PACKAGE(Security) ++ SET(SECURITY_FOUND "NO") + FIND_PACKAGE(CoreFoundation REQUIRED) + ENDIF() + +@@ -87,9 +88,7 @@ IF(MSVC) + OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF) + ENDIF() + +-IF (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +- OPTION( USE_OPENSSL "Link with and use openssl library" ON ) +-ENDIF() ++OPTION( USE_OPENSSL "Link with and use openssl library" ON ) + + CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h" + HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C) +diff --git a/src/curl_stream.c b/src/curl_stream.c +index 98de187..a8a9f4c 100644 +--- a/src/curl_stream.c ++++ b/src/curl_stream.c +@@ -309,7 +309,14 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port) + curl_easy_setopt(handle, CURLOPT_HTTPPROXYTUNNEL, 1); + curl_easy_setopt(handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); + +- /* curl_easy_setopt(handle, CURLOPT_VERBOSE, 1); */ ++ const char* cainfo = getenv("SSL_CERT_FILE"); ++ if(cainfo != NULL) { ++ curl_easy_setopt(handle, CURLOPT_CAINFO, cainfo); ++ } ++ ++ /* ++ curl_easy_setopt(handle, CURLOPT_VERBOSE, 1); ++ */ + + st->parent.version = GIT_STREAM_VERSION; + st->parent.encrypted = 0; /* we don't encrypt ourselves */ +-- +2.3.8 (Apple Git-58) + From 57a690fbe4fc046b8e7d59d0657d99451b9784e9 Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Mon, 8 Aug 2016 15:55:26 +0200 Subject: [PATCH 09/15] cargo: Force usage of pkgs.cacert. --- pkgs/development/compilers/rust/cargo.nix | 19 ++++++++++++++----- pkgs/development/compilers/rust/default.nix | 13 +++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix index fc4bf732cf6b..537764ebca2b 100644 --- a/pkgs/development/compilers/rust/cargo.nix +++ b/pkgs/development/compilers/rust/cargo.nix @@ -1,6 +1,7 @@ { stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib -, makeWrapper, libiconv, cacert, rustPlatform, rustc -, version, srcRev, srcSha, depsSha256 }: +, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2 +, version, srcRev, srcSha, depsSha256 +, patches ? []}: rustPlatform.buildRustPackage rec { name = "cargo-${version}"; @@ -13,11 +14,14 @@ rustPlatform.buildRustPackage rec { }; inherit depsSha256; + inherit patches; passthru.rustc = rustc; - buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ] - ++ stdenv.lib.optional stdenv.isDarwin libiconv; + buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper libgit2 ] + ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ]; + + LIBGIT2_SYS_USE_PKG_CONFIG=1; configurePhase = '' ./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.rust.cargo}/bin/cargo @@ -37,9 +41,14 @@ rustPlatform.buildRustPackage rec { "$out/lib/rustlib/uninstall.sh" \ "$out/lib/rustlib/manifest-cargo" + # NOTE: We override the `http.cainfo` option usually specified in + # `.cargo/config`. This is an issue when users want to specify + # their own certificate chain as environment variables take + # precedence wrapProgram "$out/bin/cargo" \ --suffix PATH : "${rustc}/bin" \ - --run "export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt" \ + --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"''} ''; diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index adabdd71a1dd..bfab4453a349 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -23,10 +23,15 @@ rec { }; cargo = callPackage ./cargo.nix rec { - version = "0.11.0"; - srcRev = "refs/tags/${version}"; - srcSha = "0ic2093bmwiw6vl2l9yhip87ni6dbz7dhrizy9wdx61229k16hc4"; - depsSha256 = "0690sgn6fcay7sazlmrbbn4jbhnvmznrpz5z3rvkbaifkjrg4w6d"; + # TODO: We're temporarily tracking master here as Darwin needs the + # `http.cainfo` option from .cargo/config which isn't released + # yet. + + version = "master-2016-07-25"; + srcRev = "f09ef68cc47956ccc5f99212bdcdd15298c400a0"; + srcSha = "1r6q9jd0fl6mzhwkvrrcv358q2784hg51dfpy28xgh4n61m7c155"; + depsSha256 = "1p1ygabg9k9b0azm0mrx8asjzdi35c5zw53iysba198lli6bhdl4"; + inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; From c8f878436ebc2afe8dddff5467d771acb8f3548e Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Mon, 8 Aug 2016 22:20:56 +0200 Subject: [PATCH 10/15] rustBeta.cargo: cargo -> 2016-07-25. --- pkgs/development/compilers/rust/beta.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/rust/beta.nix b/pkgs/development/compilers/rust/beta.nix index f2a02348a3c5..130b3311cc58 100644 --- a/pkgs/development/compilers/rust/beta.nix +++ b/pkgs/development/compilers/rust/beta.nix @@ -19,10 +19,15 @@ rec { }; cargo = callPackage ./cargo.nix rec { - version = "beta-0.13.0"; - srcRev = "fb2faf29b26da39bd815b470ca73255dbfe30e42"; - srcSha = "1r7wd3hp85mvmm7ivj01k65qcgb6qk1mys9mp48ww9k5cdniwcaj"; - depsSha256 = "0lsf99pgl6wnl1lfk0drp5l4agrx7hzgdbps7hy3rprbf41jd6ai"; + # TODO: We're temporarily tracking master here as Darwin needs the + # `http.cainfo` option from .cargo/config which isn't released + # yet. + + version = "beta-2016-07-25"; + srcRev = "f09ef68cc47956ccc5f99212bdcdd15298c400a0"; + srcSha = "1r6q9jd0fl6mzhwkvrrcv358q2784hg51dfpy28xgh4n61m7c155"; + depsSha256 = "055ky0lkrcsi976kmvc4lqyv0sjdpcj3jv36kz9hkqq0gip3crjc"; + inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; From 3dc73927fe41eb6812f8de375ee5ab89e9a81777 Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Mon, 8 Aug 2016 22:21:23 +0200 Subject: [PATCH 11/15] rustHead.cargo: cargo -> 2016-07-25. --- pkgs/development/compilers/rust/head.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/rust/head.nix b/pkgs/development/compilers/rust/head.nix index 738c21a53275..3406fdb317fa 100644 --- a/pkgs/development/compilers/rust/head.nix +++ b/pkgs/development/compilers/rust/head.nix @@ -22,10 +22,11 @@ rec { }; cargo = callPackage ./cargo.nix rec { - version = "master-0.13.0"; - srcRev = "fb2faf29b26da39bd815b470ca73255dbfe30e42"; - srcSha = "1r7wd3hp85mvmm7ivj01k65qcgb6qk1mys9mp48ww9k5cdniwcaj"; - depsSha256 = "0lsf99pgl6wnl1lfk0drp5l4agrx7hzgdbps7hy3rprbf41jd6ai"; + version = "master-2016-07-25"; + srcRev = "f09ef68cc47956ccc5f99212bdcdd15298c400a0"; + srcSha = "1r6q9jd0fl6mzhwkvrrcv358q2784hg51dfpy28xgh4n61m7c155"; + depsSha256 = "1p1ygabg9k9b0azm0mrx8asjzdi35c5zw53iysba198lli6bhdl4"; + inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; From 2b806e9b7129a66cf34664e220cf2ecd08371549 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sun, 7 Aug 2016 23:43:54 +0200 Subject: [PATCH 12/15] rustc: Set TMPDIR on Darwin to fix build. --- pkgs/development/compilers/rust/bootstrap.nix | 4 +- pkgs/development/compilers/rust/rustc.nix | 49 ++++++++++--------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index 56e19650579c..7bbae9273b51 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -1,6 +1,8 @@ { stdenv, fetchurl, makeWrapper, cacert, zlib }: let + inherit (stdenv.lib) optionalString; + platform = if stdenv.system == "i686-linux" then "i686-unknown-linux-gnu" @@ -24,7 +26,7 @@ let then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6" else throw "missing boostrap hash for platform ${stdenv.system}"; - needsPatchelf = (stdenv.system == "i686-linux") || (stdenv.system == "x86_64-linux"); + needsPatchelf = stdenv.isLinux; src = fetchurl { url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index e98333d4d74e..f67444eba62f 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -14,26 +14,28 @@ } @ args: let - version = if isRelease then - "${shortVersion}" - else - "${shortVersion}-g${builtins.substring 0 7 srcRev}"; + inherit (stdenv.lib) optional optionalString; - name = "rustc-${version}"; + version = if isRelease then + "${shortVersion}" + else + "${shortVersion}-g${builtins.substring 0 7 srcRev}"; - procps = if stdenv.isDarwin then darwin.ps else args.procps; + name = "rustc-${version}"; - llvmShared = llvm.override { enableSharedLibraries = true; }; + procps = if stdenv.isDarwin then darwin.ps else args.procps; - target = builtins.replaceStrings [" "] [","] (builtins.toString targets); + llvmShared = llvm.override { enableSharedLibraries = true; }; - meta = with stdenv.lib; { - homepage = http://www.rust-lang.org/; - description = "A safe, concurrent, practical language"; - maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ]; - license = [ licenses.mit licenses.asl20 ]; - platforms = platforms.linux ++ platforms.darwin; - }; + target = builtins.replaceStrings [" "] [","] (builtins.toString targets); + + meta = with stdenv.lib; { + homepage = http://www.rust-lang.org/; + description = "A safe, concurrent, practical language"; + maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ]; + license = [ licenses.mit licenses.asl20 ]; + platforms = platforms.linux ++ platforms.darwin; + }; in stdenv.mkDerivation { @@ -43,7 +45,7 @@ stdenv.mkDerivation { __impureHostDeps = [ "/usr/lib/libedit.3.dylib" ]; - NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib"; + NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib"; src = fetchgit { url = https://github.com/rust-lang/rust; @@ -56,9 +58,9 @@ stdenv.mkDerivation { ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ] # ++ [ "--jemalloc-root=${jemalloc}/lib" ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ] - ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang" - ++ stdenv.lib.optional (targets != []) "--target=${target}" - ++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; + ++ optional (stdenv.cc.cc ? isClang) "--enable-clang" + ++ optional (targets != []) "--target=${target}" + ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; patches = patches ++ targetPatches; passthru.target = target; @@ -74,7 +76,7 @@ stdenv.mkDerivation { --replace "\$\$(subst /,//," "\$\$(subst /,/," # Fix dynamic linking against llvm - ${stdenv.lib.optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''} + ${optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''} # Fix the configure script to not require curl as we won't use it sed -i configure \ @@ -105,7 +107,7 @@ stdenv.mkDerivation { ++ stdenv.lib.optional needsCmake [ cmake curl ]; buildInputs = [ ncurses ] ++ targetToolchains - ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared; + ++ optional (!forceBundledLLVM) llvmShared; # https://github.com/rust-lang/rust/issues/30181 # enableParallelBuilding = false; # missing files during linking, occasionally @@ -113,7 +115,10 @@ stdenv.mkDerivation { outputs = [ "out" "doc" ]; setOutputFlags = false; - preCheck = "export TZDIR=${tzdata}/share/zoneinfo"; + preCheck = '' + export TZDIR=${tzdata}/share/zoneinfo + ${optionalString stdenv.isDarwin "export TMPDIR=/tmp"} + ''; # Disable doCheck on Darwin to work around upstream issue doCheck = !stdenv.isDarwin; From 86326cbf549205f3c9e2bc338cc69dc02239dc3a Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Tue, 9 Aug 2016 08:20:49 +0200 Subject: [PATCH 13/15] rustc: Re-enable doCheck on Darwin. --- pkgs/development/compilers/rust/rustc.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index f67444eba62f..1bc001203e91 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -121,6 +121,6 @@ stdenv.mkDerivation { ''; # Disable doCheck on Darwin to work around upstream issue - doCheck = !stdenv.isDarwin; + doCheck = true; dontSetConfigureCross = true; } From 3324123eb7e4ee9cab9b53c9655971430f59ec2b Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Tue, 9 Aug 2016 08:23:27 +0200 Subject: [PATCH 14/15] rustc-bootstrap: Use optionalString. --- pkgs/development/compilers/rust/bootstrap.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index 7bbae9273b51..1ced865fc909 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -50,11 +50,11 @@ rec { ./install.sh --prefix=$out \ --components=rustc,rust-std-${platform},rust-docs - ${if needsPatchelf then '' + ${optionalString needsPatchelf '' patchelf \ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/rustc" - '' else ""} + ''} # Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc # (or similar) here. It causes strange effects where rustc loads @@ -77,11 +77,11 @@ rec { ./install.sh --prefix=$out \ --components=cargo - ${if needsPatchelf then '' + ${optionalString needsPatchelf '' patchelf \ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/cargo" - '' else ""} + ''} wrapProgram "$out/bin/cargo" \ --suffix PATH : "${rustc}/bin" From 02608c6a3c70eebd7a7bcc45a21e40b8e27297b7 Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Wed, 10 Aug 2016 21:13:22 +0200 Subject: [PATCH 15/15] rustc: Disable failing linker-output-utf8 test. --- pkgs/development/compilers/rust/rustc.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 1bc001203e91..85e842176f47 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -63,6 +63,7 @@ stdenv.mkDerivation { ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; patches = patches ++ targetPatches; + passthru.target = target; postPatch = '' @@ -87,6 +88,9 @@ stdenv.mkDerivation { #[ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs #[ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+ + # Disable fragile linker-output-non-utf8 test + rm -vr src/test/run-make/linker-output-non-utf8/ + # Useful debugging parameter #export VERBOSE=1 '';