diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-01-11 23:37:02 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-01-11 23:41:30 +0000 |
commit | 6c557e3f1c28cf87e9fba232811d6875dd1399c1 (patch) | |
tree | 035a071d5d8980df6de0fa42e2ef8fc0cce7055e /nixpkgs/pkgs/development/compilers/rust/rustc.nix | |
parent | da7500bc026e937ac7fce7b50f67a0e1765737a7 (diff) | |
parent | e4134747f5666bcab8680aff67fa3b63384f9a0f (diff) | |
download | nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.gz nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.bz2 nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.lz nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.xz nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.zst nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.zip |
Merge commit 'e4134747f5666bcab8680aff67fa3b63384f9a0f'
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/rust/rustc.nix')
-rw-r--r-- | nixpkgs/pkgs/development/compilers/rust/rustc.nix | 127 |
1 files changed, 30 insertions, 97 deletions
diff --git a/nixpkgs/pkgs/development/compilers/rust/rustc.nix b/nixpkgs/pkgs/development/compilers/rust/rustc.nix index daf7af1babdc..e5c8a709a900 100644 --- a/nixpkgs/pkgs/development/compilers/rust/rustc.nix +++ b/nixpkgs/pkgs/development/compilers/rust/rustc.nix @@ -1,39 +1,32 @@ { stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget -, fetchurl, file, python2, tzdata, ps -, llvmPackages_7, darwin, git, cmake, rustPlatform -, which, libffi, gdb +, fetchurl, file, python3 +, llvm_9, darwin, git, cmake, rust, rustPlatform +, pkgconfig, openssl +, which, libffi , withBundledLLVM ? false +, version +, sha256 }: let - inherit (stdenv.lib) optional optionalString; + inherit (stdenv.lib) optionals optional optionalString; inherit (darwin.apple_sdk.frameworks) Security; - llvmPackages = llvmPackages_7; - - llvmSharedForBuild = pkgsBuildBuild.llvmPackages.llvm.override { enableSharedLibraries = true; }; - llvmSharedForHost = pkgsBuildHost.llvmPackages.llvm.override { enableSharedLibraries = true; }; - llvmSharedForTarget = pkgsBuildTarget.llvmPackages.llvm.override { enableSharedLibraries = true; }; + llvmSharedForBuild = pkgsBuildBuild.llvm_9.override { enableSharedLibraries = true; }; + llvmSharedForHost = pkgsBuildHost.llvm_9.override { enableSharedLibraries = true; }; + llvmSharedForTarget = pkgsBuildTarget.llvm_9.override { enableSharedLibraries = true; }; # For use at runtime - llvmShared = llvmPackages.llvm.override { enableSharedLibraries = true; }; -in - -stdenv.mkDerivation rec { + llvmShared = llvm_9.override { enableSharedLibraries = true; }; +in stdenv.mkDerivation rec { pname = "rustc"; - version = "1.37.0"; + inherit version; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; - sha256 = "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj"; + inherit sha256; }; - # Provide the compiler-rt sources needed for profiling. - preConfigure = '' - mkdir src/llvm-project/compiler-rt - tar xf ${llvmPackages.compiler-rt.src} -C src/llvm-project/compiler-rt --strip-components=1 - ''; - __darwinAllowLocalNetworking = true; # rustc complains about modified source files otherwise @@ -48,11 +41,11 @@ stdenv.mkDerivation rec { # See: https://github.com/NixOS/nixpkgs/pull/56540#issuecomment-471624656 stripDebugList = [ "bin" ]; - NIX_LDFLAGS = + NIX_LDFLAGS = toString ( # when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch' optional (stdenv.isLinux && !withBundledLLVM) "--push-state --as-needed -lstdc++ --pop-state" ++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++" - ++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost}/lib"; + ++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost}/lib"); # Increase codegen units to introduce parallelism within the compiler. RUSTFLAGS = "-Ccodegen-units=10"; @@ -60,9 +53,9 @@ stdenv.mkDerivation rec { # We need rust to build rust. If we don't provide it, configure will try to download it. # Reference: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py configureFlags = let - setBuild = "--set=target.${stdenv.buildPlatform.config}"; - setHost = "--set=target.${stdenv.hostPlatform.config}"; - setTarget = "--set=target.${stdenv.targetPlatform.config}"; + setBuild = "--set=target.${rust.toRustTarget stdenv.buildPlatform}"; + setHost = "--set=target.${rust.toRustTarget stdenv.hostPlatform}"; + setTarget = "--set=target.${rust.toRustTarget stdenv.targetPlatform}"; ccForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}cc"; cxxForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}c++"; ccForHost = "${pkgsBuildHost.targetPackages.stdenv.cc}/bin/${pkgsBuildHost.targetPackages.stdenv.cc.targetPrefix}cc"; @@ -75,9 +68,9 @@ stdenv.mkDerivation rec { "--set=build.cargo=${rustPlatform.rust.cargo}/bin/cargo" "--enable-rpath" "--enable-vendor" - "--build=${stdenv.buildPlatform.config}" - "--host=${stdenv.hostPlatform.config}" - "--target=${stdenv.targetPlatform.config}" + "--build=${rust.toRustTarget stdenv.buildPlatform}" + "--host=${rust.toRustTarget stdenv.hostPlatform}" + "--target=${rust.toRustTarget stdenv.targetPlatform}" "${setBuild}.cc=${ccForBuild}" "${setHost}.cc=${ccForHost}" @@ -90,12 +83,12 @@ stdenv.mkDerivation rec { "${setBuild}.cxx=${cxxForBuild}" "${setHost}.cxx=${cxxForHost}" "${setTarget}.cxx=${cxxForTarget}" - ] ++ optional (!withBundledLLVM) [ + ] ++ optionals (!withBundledLLVM) [ "--enable-llvm-link-shared" "${setBuild}.llvm-config=${llvmSharedForBuild}/bin/llvm-config" "${setHost}.llvm-config=${llvmSharedForHost}/bin/llvm-config" "${setTarget}.llvm-config=${llvmSharedForTarget}/bin/llvm-config" - ] ++ optional stdenv.isLinux [ + ] ++ optionals stdenv.isLinux [ "--enable-profiler" # build libprofiler_builtins ]; @@ -107,18 +100,6 @@ stdenv.mkDerivation rec { --replace 'BOOTSTRAP_ARGS :=' 'BOOTSTRAP_ARGS := --jobs $(NIX_BUILD_CORES)' ''; - patches = [ - ./patches/net-tcp-disable-tests.patch - - # Re-evaluate if this we need to disable this one - #./patches/stdsimd-disable-doctest.patch - - # Fails on hydra - not locally; the exact reason is unknown. - # Comments in the test suggest that some non-reproducible environment - # variables such $RANDOM can make it fail. - # ./patches/disable-test-inherit-env.patch - ]; - # the rust build system complains that nix alters the checksums dontFixLibtool = true; @@ -131,74 +112,26 @@ stdenv.mkDerivation rec { sed -i configure \ -e '/probe_need CFG_CURL curl/d' - # On Hydra: `TcpListener::bind(&addr)`: Address already in use (os error 98)' - sed '/^ *fn fast_rebind()/i#[ignore]' -i src/libstd/net/tcp.rs - - # https://github.com/rust-lang/rust/issues/39522 - echo removing gdb-version-sensitive tests... - find src/test/debuginfo -type f -execdir grep -q ignore-gdb-version '{}' \; -print -delete - rm src/test/debuginfo/{borrowed-c-style-enum.rs,c-style-enum-in-composite.rs,gdb-pretty-struct-and-enums.rs,generic-enum-with-different-disr-sizes.rs} - # Useful debugging parameter # export VERBOSE=1 - '' + optionalString stdenv.isDarwin '' - # Disable all lldb tests. - # error: Can't run LLDB test because LLDB's python path is not set - rm -vr src/test/debuginfo/* - rm -v src/test/run-pass/backtrace-debuginfo.rs || true - - # error: No such file or directory - rm -v src/test/ui/run-pass/issues/issue-45731.rs || true - - # Disable tests that fail when sandboxing is enabled. - substituteInPlace src/libstd/sys/unix/ext/net.rs \ - --replace '#[test]' '#[test] #[ignore]' - substituteInPlace src/test/run-pass/env-home-dir.rs \ - --replace 'home_dir().is_some()' true - rm -v src/test/run-pass/fds-are-cloexec.rs || true # FIXME: pipes? - rm -v src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs || true # FIXME: ??? ''; # rustc unfortunately needs cmake to compile llvm-rt but doesn't # use it for the normal build. This disables cmake in Nix. dontUseCmakeConfigure = true; - # ps is needed for one of the test cases nativeBuildInputs = [ - file python2 ps rustPlatform.rust.rustc git cmake - which libffi removeReferencesTo - ] # Only needed for the debuginfo tests - ++ optional (!stdenv.isDarwin) gdb; + file python3 rustPlatform.rust.rustc git cmake + which libffi removeReferencesTo pkgconfig + ]; - buildInputs = optional stdenv.isDarwin Security + buildInputs = [ openssl ] + ++ optional stdenv.isDarwin Security ++ optional (!withBundledLLVM) llvmShared; outputs = [ "out" "man" "doc" ]; setOutputFlags = false; - # Disable codegen units and hardening for the tests. - preCheck = '' - export RUSTFLAGS= - export TZDIR=${tzdata}/share/zoneinfo - export hardeningDisable=all - '' + - # Ensure TMPDIR is set, and disable a test that removing the HOME - # variable from the environment falls back to another home - # directory. - optionalString stdenv.isDarwin '' - export TMPDIR=/tmp - sed -i '28s/home_dir().is_some()/true/' ./src/test/run-pass/env-home-dir.rs - ''; - - # 1. Upstream is not running tests on aarch64: - # see https://github.com/rust-lang/rust/issues/49807#issuecomment-380860567 - # So we do the same. - # 2. Tests run out of memory for i686 - #doCheck = !stdenv.isAarch64 && !stdenv.isi686; - - # Disabled for now; see https://github.com/NixOS/nixpkgs/pull/42348#issuecomment-402115598. - doCheck = false; - # remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so # and thus a transitive dependency on ncurses postInstall = '' @@ -218,7 +151,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { homepage = https://www.rust-lang.org/; description = "A safe, concurrent, practical language"; - maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy ]; + maintainers = with maintainers; [ madjar cstrahan globin havvy ]; license = [ licenses.mit licenses.asl20 ]; platforms = platforms.linux ++ platforms.darwin; }; |