rustc: build on darwin
This commit is contained in:
parent
01eb385346
commit
c20b6846f2
@ -14,6 +14,7 @@
|
|||||||
, compiler-rt_src
|
, compiler-rt_src
|
||||||
, libcxxabi
|
, libcxxabi
|
||||||
, debugVersion ? false
|
, debugVersion ? false
|
||||||
|
, enableSharedLibraries ? !stdenv.isDarwin
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -46,10 +47,11 @@ in stdenv.mkDerivation rec {
|
|||||||
"-DLLVM_BUILD_TESTS=ON"
|
"-DLLVM_BUILD_TESTS=ON"
|
||||||
"-DLLVM_ENABLE_FFI=ON"
|
"-DLLVM_ENABLE_FFI=ON"
|
||||||
"-DLLVM_ENABLE_RTTI=ON"
|
"-DLLVM_ENABLE_RTTI=ON"
|
||||||
] ++ stdenv.lib.optionals (!isDarwin) [
|
] ++ stdenv.lib.optional enableSharedLibraries
|
||||||
"-DBUILD_SHARED_LIBS=ON"
|
"-DBUILD_SHARED_LIBS=ON"
|
||||||
|
++ stdenv.lib.optional (!isDarwin)
|
||||||
"-DLLVM_BINUTILS_INCDIR=${binutils}/include"
|
"-DLLVM_BINUTILS_INCDIR=${binutils}/include"
|
||||||
] ++ stdenv.lib.optionals ( isDarwin) [
|
++ stdenv.lib.optionals ( isDarwin) [
|
||||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||||
"-DCAN_TARGET_i386=false"
|
"-DCAN_TARGET_i386=false"
|
||||||
];
|
];
|
||||||
|
@ -37,6 +37,8 @@ let version = if isRelease then
|
|||||||
|
|
||||||
name = "rustc-${version}";
|
name = "rustc-${version}";
|
||||||
|
|
||||||
|
llvmShared = llvmPackages_37.llvm.override { enableSharedLibraries = true; };
|
||||||
|
|
||||||
platform = if stdenv.system == "i686-linux"
|
platform = if stdenv.system == "i686-linux"
|
||||||
then "linux-i386"
|
then "linux-i386"
|
||||||
else if stdenv.system == "x86_64-linux"
|
else if stdenv.system == "x86_64-linux"
|
||||||
@ -84,6 +86,8 @@ with stdenv.lib; stdenv.mkDerivation {
|
|||||||
|
|
||||||
__impureHostDeps = [ "/usr/lib/libedit.3.dylib" ];
|
__impureHostDeps = [ "/usr/lib/libedit.3.dylib" ];
|
||||||
|
|
||||||
|
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
|
||||||
|
|
||||||
src = if isRelease then
|
src = if isRelease then
|
||||||
fetchzip {
|
fetchzip {
|
||||||
url = "http://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
|
url = "http://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
|
||||||
@ -119,7 +123,7 @@ with stdenv.lib; stdenv.mkDerivation {
|
|||||||
# ++ [ "--jemalloc-root=${jemalloc}/lib"
|
# ++ [ "--jemalloc-root=${jemalloc}/lib"
|
||||||
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${stdenv.cc.binutils}/bin/ar" ]
|
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${stdenv.cc.binutils}/bin/ar" ]
|
||||||
++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
|
++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
|
||||||
++ optional (!forceBundledLLVM) "--llvm-root=${llvmPackages_37.llvm}";
|
++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
|
||||||
|
|
||||||
inherit patches;
|
inherit patches;
|
||||||
|
|
||||||
@ -155,11 +159,10 @@ with stdenv.lib; stdenv.mkDerivation {
|
|||||||
configureFlagsArray+=("--infodir=$out/share/info")
|
configureFlagsArray+=("--infodir=$out/share/info")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Procps is needed for one of the test cases
|
# ps is needed for one of the test cases
|
||||||
nativeBuildInputs = [ file python2 ]
|
nativeBuildInputs = [ file python2 procps ];
|
||||||
++ optionals stdenv.isLinux [ procps ];
|
|
||||||
buildInputs = [ ncurses ]
|
buildInputs = [ ncurses ]
|
||||||
++ optional (!forceBundledLLVM) llvmPackages_37.llvm;
|
++ optional (!forceBundledLLVM) llvmShared;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
@ -4775,7 +4775,11 @@ let
|
|||||||
rtags = callPackage ../development/tools/rtags/default.nix {};
|
rtags = callPackage ../development/tools/rtags/default.nix {};
|
||||||
|
|
||||||
rustcMaster = callPackage ../development/compilers/rustc/head.nix {};
|
rustcMaster = callPackage ../development/compilers/rustc/head.nix {};
|
||||||
rustc = callPackage ../development/compilers/rustc {};
|
rustc = callPackage ../development/compilers/rustc {
|
||||||
|
callPackage = newScope ({
|
||||||
|
procps = if stdenv.isDarwin then darwin.ps else procps;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
rustPlatform = rustStable;
|
rustPlatform = rustStable;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user