forked from M-Labs/nix-scripts
partial rust cleanup (#13)
This commit is contained in:
parent
68bddf00fb
commit
044332d178
|
@ -3,11 +3,6 @@ with pkgs;
|
|||
let
|
||||
pythonDeps = callPackage ./pkgs/python-deps.nix {};
|
||||
|
||||
# this code was copied from nipxkgs rev. ffafe9 (nixcloud team) and slightly modified
|
||||
rust = callPackage ./pkgs/rust
|
||||
(stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
|
||||
stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
||||
});
|
||||
llvm-src = callPackage ./fetch-llvm-clang.nix {};
|
||||
|
||||
boards = [
|
||||
|
@ -36,10 +31,14 @@ let
|
|||
};
|
||||
in
|
||||
rec {
|
||||
inherit (rust) rustc;
|
||||
inherit (pythonDeps) asyncserial levenshtein pythonparser quamash pyqtgraph-qt5 misoc migen microscope jesd204b lit outputcheck sphinx-argparse wavedrom sphinxcontrib-wavedrom;
|
||||
binutils-or1k = callPackage ./pkgs/binutils-or1k.nix {};
|
||||
llvm-or1k = callPackage ./pkgs/llvm-or1k.nix { inherit llvm-src; };
|
||||
rustc = callPackage ./pkgs/rust
|
||||
((stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
|
||||
stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
||||
}) //
|
||||
{ inherit llvm-or1k; });
|
||||
llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; };
|
||||
libartiq-support = callPackage ./pkgs/libartiq-support.nix { inherit rustc; };
|
||||
artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k llvm-or1k llvmlite-artiq libartiq-support lit outputcheck; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl
|
||||
{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm-or1k, fetchurl
|
||||
, targets ? []
|
||||
, targetToolchains ? []
|
||||
, targetPatches ? []
|
||||
|
@ -15,8 +15,32 @@ let
|
|||
rev = "f305fb024318e96997fbe6e4a105b0cc1052aad4"; # artiq-1.28.0 branch
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
in rec {
|
||||
# nixcloud team code
|
||||
rustc_internal = callPackage ./rustc.nix {
|
||||
inherit stdenv llvm-or1k targets targetPatches targetToolchains rustPlatform version src;
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
#configureFlags = [ "--release-channel=stable" ];
|
||||
|
||||
# 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;
|
||||
};
|
||||
or1k-crates = stdenv.mkDerivation {
|
||||
name = "or1k-crates";
|
||||
inherit src;
|
||||
|
@ -36,9 +60,8 @@ in rec {
|
|||
''${rustc} -Cpanic=unwind --crate-name panic_unwind src/libpanic_unwind/lib.rs --cfg llvm_libunwind
|
||||
'';
|
||||
};
|
||||
# nixcloud team code
|
||||
# this is basically a wrapper, which uses rustc_internal and inserts or1k-crates into it
|
||||
rustc = stdenv.mkDerivation {
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "rustc";
|
||||
src = ./.;
|
||||
installPhase = ''
|
||||
|
@ -54,35 +77,4 @@ in rec {
|
|||
license = [ licenses.mit licenses.asl20 ];
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
};
|
||||
# nixcloud team code
|
||||
# originally rustc but now renamed to rustc_internal
|
||||
rustc_internal = callPackage ./rustc.nix {
|
||||
inherit stdenv llvm targets targetPatches targetToolchains rustPlatform version src;
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
forceBundledLLVM = true;
|
||||
|
||||
#configureFlags = [ "--release-channel=stable" ];
|
||||
|
||||
# 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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{ stdenv, targetPackages
|
||||
, fetchurl, fetchgit, fetchzip, file, python2, tzdata, ps
|
||||
, llvm, jemalloc, ncurses, darwin, rustPlatform, git, cmake, curl
|
||||
, llvm-or1k, ncurses, zlib, darwin, rustPlatform, git, cmake, curl
|
||||
, which, libffi, gdb
|
||||
, version
|
||||
, forceBundledLLVM ? false
|
||||
, src
|
||||
, configureFlags ? []
|
||||
, patches
|
||||
|
@ -12,16 +11,12 @@
|
|||
, targetToolchains
|
||||
, doCheck ? true
|
||||
, broken ? false
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optional optionalString;
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
|
||||
llvmShared = llvm.override { enableSharedLibraries = true; };
|
||||
llvmOR1k = (import ../../default.nix {}).llvm-or1k;
|
||||
|
||||
target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
|
||||
src_rustc = fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/rustc-1.28.0-src.tar.gz";
|
||||
|
@ -47,7 +42,7 @@ stdenv.mkDerivation {
|
|||
# See https://github.com/NixOS/nixpkgs/pull/34227
|
||||
stripDebugList = if stdenv.isDarwin then [ "bin" ] else null;
|
||||
|
||||
NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
|
||||
NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvm-or1k}/lib";
|
||||
|
||||
# Enable nightly features in stable compiles (used for
|
||||
# bootstrapping, see https://github.com/rust-lang/rust/pull/37265).
|
||||
|
@ -63,12 +58,10 @@ stdenv.mkDerivation {
|
|||
configureFlags = configureFlags
|
||||
++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ]
|
||||
++ [ "--enable-vendor" ]
|
||||
# ++ [ "--jemalloc-root=${jemalloc}/lib"
|
||||
++ [ "--default-linker=${targetPackages.stdenv.cc}/bin/cc" ]
|
||||
++ optional (!forceBundledLLVM) [ "--enable-llvm-link-shared" ]
|
||||
++ [ "--enable-llvm-link-shared" ]
|
||||
++ optional (targets != []) "--target=${target}"
|
||||
#++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"
|
||||
++ [ "--llvm-root=${llvmOR1k}" ] ;
|
||||
++ [ "--llvm-root=${llvm-or1k}" ] ;
|
||||
|
||||
# The bootstrap.py will generated a Makefile that then executes the build.
|
||||
# The BOOTSTRAP_ARGS used by this Makefile must include all flags to pass
|
||||
|
@ -83,7 +76,6 @@ stdenv.mkDerivation {
|
|||
# HACK: we add the vendor folder from rustc 1.28 to make the compiling work
|
||||
tar xf ${src_rustc}
|
||||
mv rustc-1.28.0-src/src/vendor/ src/vendor
|
||||
cp -R ${llvmOR1k} src/llvm
|
||||
'';
|
||||
|
||||
patches = patches ++ targetPatches;
|
||||
|
@ -96,18 +88,10 @@ stdenv.mkDerivation {
|
|||
postPatch = ''
|
||||
patchShebangs src/etc
|
||||
|
||||
# Fix dynamic linking against llvm
|
||||
#${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 \
|
||||
-e '/probe_need CFG_CURL curl/d'
|
||||
|
||||
# Fix the use of jemalloc prefixes which our jemalloc doesn't have
|
||||
# TODO: reenable if we can figure out how to get our jemalloc to work
|
||||
#[ -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 tests.
|
||||
rm -vr src/test/run-make/linker-output-non-utf8 || true
|
||||
rm -vr src/test/run-make/issue-26092 || true
|
||||
|
@ -159,9 +143,8 @@ stdenv.mkDerivation {
|
|||
# Only needed for the debuginfo tests
|
||||
++ optional (!stdenv.isDarwin) gdb;
|
||||
|
||||
buildInputs = [ ncurses pkgs.zlib ] ++ targetToolchains
|
||||
++ optional stdenv.isDarwin Security
|
||||
++ optional (!forceBundledLLVM) llvmShared;
|
||||
buildInputs = [ ncurses zlib llvm-or1k ] ++ targetToolchains
|
||||
++ optional stdenv.isDarwin Security;
|
||||
|
||||
outputs = [ "out" "man" "doc" ];
|
||||
setOutputFlags = false;
|
||||
|
|
Loading…
Reference in New Issue