Merge pull request #40933 from obsidiansystems/linux-to-darwin

stdenv, binutils: Build cctools targeting macOS on Linux without pointless rebuilds
This commit is contained in:
John Ericson 2018-05-23 11:37:43 -04:00 committed by GitHub
commit ee9dc37e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -19,10 +19,11 @@ in
stdenv.mkDerivation rec {
name = targetPrefix + basename;
src = fetchurl {
# HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl {
url = "mirror://gnu/binutils/${basename}.tar.bz2";
sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg";
};
});
patches = [
# Turn on --enable-new-dtags by default to make the linker set

View File

@ -90,9 +90,14 @@ let
'' + lib.optionalString hostPlatform.isDarwin ''
export NIX_DONT_SET_RPATH=1
export NIX_NO_SELF_RPATH=1
'' + lib.optionalString targetPlatform.isDarwin ''
export NIX_TARGET_DONT_SET_RPATH=1
'';
''
# TODO this should be uncommented, but it causes stupid mass rebuilds. I
# think the best solution would just be to fixup linux RPATHs so we don't
# need to set `-rpath` anywhere.
# + lib.optionalString targetPlatform.isDarwin ''
# export NIX_TARGET_DONT_SET_RPATH=1
# ''
;
inherit initialPath shell
defaultNativeBuildInputs defaultBuildInputs;