Merge pull request #17316 from the-kenny/rustc-beta-1.11.0

rustcBeta: Fix build
This commit is contained in:
Daiderd Jordan 2016-08-11 12:22:17 +02:00 committed by GitHub
commit 53b60c8873
10 changed files with 228 additions and 61 deletions

View file

@ -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,15 @@ rec {
};
cargo = callPackage ./cargo.nix rec {
version = "0.10.0";
srcRev = "refs/tags/${version}";
srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2";
depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b";
# 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
};

View file

@ -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,6 +26,8 @@ let
then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6"
else throw "missing boostrap hash for platform ${stdenv.system}";
needsPatchelf = stdenv.isLinux;
src = fetchurl {
url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";
sha256 = bootstrapHash;
@ -46,9 +50,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"
${optionalString needsPatchelf ''
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/rustc"
''}
# Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc
# (or similar) here. It causes strange effects where rustc loads
@ -71,9 +77,11 @@ rec {
./install.sh --prefix=$out \
--components=cargo
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/cargo"
${optionalString needsPatchelf ''
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/cargo"
''}
wrapProgram "$out/bin/cargo" \
--suffix PATH : "${rustc}/bin"

View file

@ -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"''}
'';

View file

@ -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
};

View file

@ -3,13 +3,18 @@
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;
configureFlags = [ "--release-channel=nightly" ];
srcRev = "d9a911d236cbecb47775276ba51a5f9111bdbc9c";
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;
inherit targetPatches;
inherit targetToolchains;
@ -17,10 +22,11 @@ rec {
};
cargo = callPackage ./cargo.nix rec {
version = "2016.06.07";
srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28";
srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f";
depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f";
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
};

View file

@ -0,0 +1,44 @@
From b6202b5d602ca8216febe8ce9078581faa32955e Mon Sep 17 00:00:00 2001
From: Moritz Ulrich <moritz@tarn-vedra.de>
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

View file

@ -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
@ -13,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 {
@ -42,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;
@ -55,11 +58,12 @@ 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;
postPatch = ''
@ -73,7 +77,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 \
@ -84,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
'';
@ -94,10 +101,17 @@ 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;
++ optional (!forceBundledLLVM) llvmShared;
# https://github.com/rust-lang/rust/issues/30181
# enableParallelBuilding = false; # missing files during linking, occasionally
@ -105,8 +119,12 @@ 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 = true;
dontSetConfigureCross = true;
}

View file

@ -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";

View file

@ -0,0 +1,58 @@
From fbc2ea65406236a740b8734dd41dc5ddbc24f8c9 Mon Sep 17 00:00:00 2001
From: mulrich <mulrich@entwicklerheld.local>
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)

View file

@ -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;