From 9896cf10289628a2098cd99bdd96cfb092916b27 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Mon, 27 Mar 2017 20:27:19 +0200 Subject: gcc: include dylibs for darwin build --- pkgs/development/compilers/gcc/5/default.nix | 10 ++++++++-- pkgs/development/compilers/gcc/builder.sh | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 3e9104a82fb..7c5cd686272 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -237,10 +237,16 @@ stdenv.mkDerivation ({ # This should kill all the stdinc frameworks that gcc and friends like to # insert into default search paths. - prePatch = if stdenv.isDarwin then '' + prePatch = stdenv.lib.optionalString stdenv.isDarwin '' substituteInPlace gcc/config/darwin-c.c \ --replace 'if (stdinc)' 'if (0)' - '' else null; + + substituteInPlace libgcc/config/t-slibgcc-darwin \ + --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)" + + substituteInPlace libgfortran/configure \ + --replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname" + ''; postPatch = if (stdenv.isGNU diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index de3e9ba3ef5..ee56425f00b 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -212,6 +212,7 @@ postInstall() { # Move runtime libraries to $lib. moveToOutput "lib/lib*.so*" "$lib" moveToOutput "lib/lib*.la" "$lib" + moveToOutput "lib/lib*.dylib" "$lib" moveToOutput "share/gcc-*/python" "$lib" for i in "$lib"/lib/*.{la,py}; do @@ -221,6 +222,7 @@ postInstall() { if [ -n "$enableMultilib" ]; then moveToOutput "lib64/lib*.so*" "$lib" moveToOutput "lib64/lib*.la" "$lib" + moveToOutput "lib64/lib*.dylib" "$lib" for i in "$lib"/lib64/*.{la,py}; do substituteInPlace "$i" --replace "$out" "$lib" @@ -251,6 +253,16 @@ postInstall() { done fi + if type "install_name_tool"; then + for i in "$lib"/lib/*.*.dylib; do + install_name_tool -id "$i" "$i" || true + for old_path in $(otool -L "$i" | grep "$out" | awk '{print $1}'); do + new_path=`echo "$old_path" | sed "s,$out,$lib,"` + install_name_tool -change "$old_path" "$new_path" "$i" || true + done + done + fi + # Get rid of some "fixed" header files rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux} -- cgit 1.4.1 From a7068ace35c5344fc2760733d32cca8fd4f01116 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 11 Feb 2017 18:24:24 -0500 Subject: Rewrite a few `stdenv.cross` uses that *should* be `targetPlatform` The previous commit redefines `stdenv.cross` for the sake of normal libaries, the most common use-case of that attribute. Some compilers however relied on the old definition so we have them use `targetPlatform` instead. This special casing is fine because we eventually want to remove `stdenv.cross` and use either `hostPlatform` or `targetPlatform` instead. --- pkgs/development/compilers/gcc/4.5/default.nix | 21 ++++++----- pkgs/development/compilers/gcc/4.8/default.nix | 43 +++++++++++----------- pkgs/development/compilers/gcc/4.9/default.nix | 43 +++++++++++----------- pkgs/development/compilers/gcc/5/default.nix | 43 +++++++++++----------- pkgs/development/compilers/gcc/6/default.nix | 43 +++++++++++----------- .../development/compilers/gcc/snapshot/default.nix | 43 +++++++++++----------- pkgs/top-level/all-packages.nix | 4 +- 7 files changed, 123 insertions(+), 117 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 12e7e23e90b..7f5e4f8c9a2 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -26,6 +26,7 @@ , gnat ? null , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , stripped ? true +, buildPlatform, hostPlatform, targetPlatform }: assert langJava -> zip != null && unzip != null @@ -271,15 +272,15 @@ stdenv.mkDerivation ({ targetConfig = if cross != null then cross.config else null; crossAttrs = { - AR = "${stdenv.cross.config}-ar"; - LD = "${stdenv.cross.config}-ld"; - CC = "${stdenv.cross.config}-gcc"; - CXX = "${stdenv.cross.config}-gcc"; - AR_FOR_TARGET = "${stdenv.cross.config}-ar"; - LD_FOR_TARGET = "${stdenv.cross.config}-ld"; - CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; - NM_FOR_TARGET = "${stdenv.cross.config}-nm"; - CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + AR = "${targetPlatform.config}-ar"; + LD = "${targetPlatform.config}-ld"; + CC = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-gcc"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + LD_FOR_TARGET = "${targetPlatform.config}-ld"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; + NM_FOR_TARGET = "${targetPlatform.config}-nm"; + CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else ""; dontStrip = true; @@ -311,7 +312,7 @@ stdenv.mkDerivation ({ ${if langAda then " --enable-libada" else ""} ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""} ${if cross != null then crossConfigureFlags else ""} - --target=${stdenv.cross.config} + --target=${targetPlatform.config} ''; }; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index e6f990113cc..72c22544d1e 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -34,6 +34,7 @@ , stripped ? true , gnused ? null , darwin ? null +, buildPlatform, hostPlatform, targetPlatform }: assert langJava -> zip != null && unzip != null @@ -123,12 +124,12 @@ let version = "4.8.5"; crossMingw = cross != null && cross.libc == "msvcrt"; crossDarwin = cross != null && cross.libc == "libSystem"; crossConfigureFlags = let - gccArch = stdenv.cross.gcc.arch or null; - gccCpu = stdenv.cross.gcc.cpu or null; - gccAbi = stdenv.cross.gcc.abi or null; - gccFpu = stdenv.cross.gcc.fpu or null; - gccFloat = stdenv.cross.gcc.float or null; - gccMode = stdenv.cross.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; @@ -382,26 +383,26 @@ stdenv.mkDerivation ({ else "install"; crossAttrs = let - xgccArch = stdenv.cross.gcc.arch or null; - xgccCpu = stdenv.cross.gcc.cpu or null; - xgccAbi = stdenv.cross.gcc.abi or null; - xgccFpu = stdenv.cross.gcc.fpu or null; - xgccFloat = stdenv.cross.gcc.float or null; + xgccArch = targetPlatform.gcc.arch or null; + xgccCpu = targetPlatform.gcc.cpu or null; + xgccAbi = targetPlatform.gcc.abi or null; + xgccFpu = targetPlatform.gcc.fpu or null; + xgccFloat = targetPlatform.gcc.float or null; xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { - AR = "${stdenv.cross.config}-ar"; - LD = "${stdenv.cross.config}-ld"; - CC = "${stdenv.cross.config}-gcc"; - CXX = "${stdenv.cross.config}-gcc"; - AR_FOR_TARGET = "${stdenv.cross.config}-ar"; - LD_FOR_TARGET = "${stdenv.cross.config}-ld"; - CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; - NM_FOR_TARGET = "${stdenv.cross.config}-nm"; - CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + AR = "${targetPlatform.config}-ar"; + LD = "${targetPlatform.config}-ld"; + CC = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-gcc"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + LD_FOR_TARGET = "${targetPlatform.config}-ld"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; + NM_FOR_TARGET = "${targetPlatform.config}-nm"; + CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else ""; dontStrip = true; @@ -431,7 +432,7 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${stdenv.cross.config} + --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index eb03148a4b8..594a61fdedf 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -34,6 +34,7 @@ , stripped ? true , gnused ? null , darwin ? null +, buildPlatform, hostPlatform, targetPlatform }: assert langJava -> zip != null && unzip != null @@ -125,12 +126,12 @@ let version = "4.9.4"; crossMingw = cross != null && cross.libc == "msvcrt"; crossDarwin = cross != null && cross.libc == "libSystem"; crossConfigureFlags = let - gccArch = stdenv.cross.gcc.arch or null; - gccCpu = stdenv.cross.gcc.cpu or null; - gccAbi = stdenv.cross.gcc.abi or null; - gccFpu = stdenv.cross.gcc.fpu or null; - gccFloat = stdenv.cross.gcc.float or null; - gccMode = stdenv.cross.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; @@ -389,26 +390,26 @@ stdenv.mkDerivation ({ else "install"; crossAttrs = let - xgccArch = stdenv.cross.gcc.arch or null; - xgccCpu = stdenv.cross.gcc.cpu or null; - xgccAbi = stdenv.cross.gcc.abi or null; - xgccFpu = stdenv.cross.gcc.fpu or null; - xgccFloat = stdenv.cross.gcc.float or null; + xgccArch = targetPlatform.gcc.arch or null; + xgccCpu = targetPlatform.gcc.cpu or null; + xgccAbi = targetPlatform.gcc.abi or null; + xgccFpu = targetPlatform.gcc.fpu or null; + xgccFloat = targetPlatform.gcc.float or null; xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { - AR = "${stdenv.cross.config}-ar"; - LD = "${stdenv.cross.config}-ld"; - CC = "${stdenv.cross.config}-gcc"; - CXX = "${stdenv.cross.config}-gcc"; - AR_FOR_TARGET = "${stdenv.cross.config}-ar"; - LD_FOR_TARGET = "${stdenv.cross.config}-ld"; - CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; - NM_FOR_TARGET = "${stdenv.cross.config}-nm"; - CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + AR = "${targetPlatform.config}-ar"; + LD = "${targetPlatform.config}-ld"; + CC = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-gcc"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + LD_FOR_TARGET = "${targetPlatform.config}-ld"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; + NM_FOR_TARGET = "${targetPlatform.config}-nm"; + CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else ""; dontStrip = true; @@ -438,7 +439,7 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${stdenv.cross.config} + --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 3e9104a82fb..f7d46deebcc 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -36,6 +36,7 @@ , binutils ? null , cloog # unused; just for compat with gcc4, as we override the parameter on some places , darwin ? null +, buildPlatform, hostPlatform, targetPlatform }: assert langJava -> zip != null && unzip != null @@ -129,12 +130,12 @@ let version = "5.4.0"; crossMingw = cross != null && cross.libc == "msvcrt"; crossDarwin = cross != null && cross.libc == "libSystem"; crossConfigureFlags = let - gccArch = stdenv.cross.gcc.arch or null; - gccCpu = stdenv.cross.gcc.cpu or null; - gccAbi = stdenv.cross.gcc.abi or null; - gccFpu = stdenv.cross.gcc.fpu or null; - gccFloat = stdenv.cross.gcc.float or null; - gccMode = stdenv.cross.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; @@ -398,26 +399,26 @@ stdenv.mkDerivation ({ else "install"; crossAttrs = let - xgccArch = stdenv.cross.gcc.arch or null; - xgccCpu = stdenv.cross.gcc.cpu or null; - xgccAbi = stdenv.cross.gcc.abi or null; - xgccFpu = stdenv.cross.gcc.fpu or null; - xgccFloat = stdenv.cross.gcc.float or null; + xgccArch = targetPlatform.gcc.arch or null; + xgccCpu = targetPlatform.gcc.cpu or null; + xgccAbi = targetPlatform.gcc.abi or null; + xgccFpu = targetPlatform.gcc.fpu or null; + xgccFloat = targetPlatform.gcc.float or null; xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { - AR = "${stdenv.cross.config}-ar"; - LD = "${stdenv.cross.config}-ld"; - CC = "${stdenv.cross.config}-gcc"; - CXX = "${stdenv.cross.config}-gcc"; - AR_FOR_TARGET = "${stdenv.cross.config}-ar"; - LD_FOR_TARGET = "${stdenv.cross.config}-ld"; - CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; - NM_FOR_TARGET = "${stdenv.cross.config}-nm"; - CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + AR = "${targetPlatform.config}-ar"; + LD = "${targetPlatform.config}-ld"; + CC = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-gcc"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + LD_FOR_TARGET = "${targetPlatform.config}-ld"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; + NM_FOR_TARGET = "${targetPlatform.config}-nm"; + CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else ""; dontStrip = true; @@ -446,7 +447,7 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${stdenv.cross.config} + --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index b4e588f6b14..1496e910dd1 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -36,6 +36,7 @@ , binutils ? null , cloog # unused; just for compat with gcc4, as we override the parameter on some places , darwin ? null +, buildPlatform, hostPlatform, targetPlatform }: assert langJava -> zip != null && unzip != null @@ -125,12 +126,12 @@ let version = "6.3.0"; crossMingw = cross != null && cross.libc == "msvcrt"; crossDarwin = cross != null && cross.libc == "libSystem"; crossConfigureFlags = let - gccArch = stdenv.cross.gcc.arch or null; - gccCpu = stdenv.cross.gcc.cpu or null; - gccAbi = stdenv.cross.gcc.abi or null; - gccFpu = stdenv.cross.gcc.fpu or null; - gccFloat = stdenv.cross.gcc.float or null; - gccMode = stdenv.cross.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; @@ -386,26 +387,26 @@ stdenv.mkDerivation ({ else "install"; crossAttrs = let - xgccArch = stdenv.cross.gcc.arch or null; - xgccCpu = stdenv.cross.gcc.cpu or null; - xgccAbi = stdenv.cross.gcc.abi or null; - xgccFpu = stdenv.cross.gcc.fpu or null; - xgccFloat = stdenv.cross.gcc.float or null; + xgccArch = targetPlatform.gcc.arch or null; + xgccCpu = targetPlatform.gcc.cpu or null; + xgccAbi = targetPlatform.gcc.abi or null; + xgccFpu = targetPlatform.gcc.fpu or null; + xgccFloat = targetPlatform.gcc.float or null; xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { - AR = "${stdenv.cross.config}-ar"; - LD = "${stdenv.cross.config}-ld"; - CC = "${stdenv.cross.config}-gcc"; - CXX = "${stdenv.cross.config}-gcc"; - AR_FOR_TARGET = "${stdenv.cross.config}-ar"; - LD_FOR_TARGET = "${stdenv.cross.config}-ld"; - CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; - NM_FOR_TARGET = "${stdenv.cross.config}-nm"; - CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + AR = "${targetPlatform.config}-ar"; + LD = "${targetPlatform.config}-ld"; + CC = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-gcc"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + LD_FOR_TARGET = "${targetPlatform.config}-ld"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; + NM_FOR_TARGET = "${targetPlatform.config}-nm"; + CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else ""; dontStrip = true; @@ -434,7 +435,7 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${stdenv.cross.config} + --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 12eb8b3a542..af48fdbd159 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -37,6 +37,7 @@ , cloog # unused; just for compat with gcc4, as we override the parameter on some places , darwin ? null , flex ? null +, buildPlatform, hostPlatform, targetPlatform }: assert langJava -> zip != null && unzip != null @@ -125,12 +126,12 @@ let version = "7-20170409"; crossMingw = cross != null && cross.libc == "msvcrt"; crossDarwin = cross != null && cross.libc == "libSystem"; crossConfigureFlags = let - gccArch = stdenv.cross.gcc.arch or null; - gccCpu = stdenv.cross.gcc.cpu or null; - gccAbi = stdenv.cross.gcc.abi or null; - gccFpu = stdenv.cross.gcc.fpu or null; - gccFloat = stdenv.cross.gcc.float or null; - gccMode = stdenv.cross.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; @@ -386,26 +387,26 @@ stdenv.mkDerivation ({ else "install"; crossAttrs = let - xgccArch = stdenv.cross.gcc.arch or null; - xgccCpu = stdenv.cross.gcc.cpu or null; - xgccAbi = stdenv.cross.gcc.abi or null; - xgccFpu = stdenv.cross.gcc.fpu or null; - xgccFloat = stdenv.cross.gcc.float or null; + xgccArch = targetPlatform.gcc.arch or null; + xgccCpu = targetPlatform.gcc.cpu or null; + xgccAbi = targetPlatform.gcc.abi or null; + xgccFpu = targetPlatform.gcc.fpu or null; + xgccFloat = targetPlatform.gcc.float or null; xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { - AR = "${stdenv.cross.config}-ar"; - LD = "${stdenv.cross.config}-ld"; - CC = "${stdenv.cross.config}-gcc"; - CXX = "${stdenv.cross.config}-gcc"; - AR_FOR_TARGET = "${stdenv.cross.config}-ar"; - LD_FOR_TARGET = "${stdenv.cross.config}-ld"; - CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; - NM_FOR_TARGET = "${stdenv.cross.config}-nm"; - CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + AR = "${targetPlatform.config}-ar"; + LD = "${targetPlatform.config}-ld"; + CC = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-gcc"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + LD_FOR_TARGET = "${targetPlatform.config}-ld"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; + NM_FOR_TARGET = "${targetPlatform.config}-nm"; + CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else ""; dontStrip = true; @@ -434,7 +435,7 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${stdenv.cross.config} + --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 91337d67bb4..5da33b38244 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4971,8 +4971,8 @@ with pkgs; gccCrossStageStatic = assert targetPlatform != buildPlatform; let libcCross1 = - if stdenv.cross.libc == "msvcrt" then windows.mingw_w64_headers - else if stdenv.cross.libc == "libSystem" then darwin.xcode + if targetPlatform.libc == "msvcrt" then windows.mingw_w64_headers + else if targetPlatform.libc == "libSystem" then darwin.xcode else null; in wrapGCCCross { gcc = forcedNativePackages.gcc.cc.override { -- cgit 1.4.1 From 295315cc87acd13caa39ea87c1d8d010e7a587df Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 25 Apr 2017 21:18:29 -0400 Subject: binutilsCross: Remove and use `binutils` instead always See previous commit for what was done to `binutils` to make this possible. There were some uses of `forcedNativePackages` added. The combination of overrides with that attribute is highly spooky: it's often important that if an overridden package comes from it, the replaced arguments for that package come from it. Long term this package set and all the spookiness should be gone and irrelevant: "Move along, nothing to see here!" No hashes should be changed with this commit --- pkgs/development/compilers/gcc/4.5/default.nix | 3 +-- pkgs/development/compilers/gcc/4.8/default.nix | 7 +++---- pkgs/development/compilers/gcc/4.9/default.nix | 7 +++---- pkgs/development/compilers/gcc/5/default.nix | 7 +++---- pkgs/development/compilers/gcc/6/default.nix | 7 +++---- .../development/compilers/gcc/snapshot/default.nix | 7 +++---- pkgs/development/compilers/ghc/head.nix | 12 +++++------ pkgs/os-specific/windows/mingw-w64/default.nix | 4 ++-- pkgs/os-specific/windows/mingwrt/default.nix | 4 ++-- pkgs/os-specific/windows/w32api/default.nix | 4 ++-- pkgs/stdenv/adapters.nix | 6 +++--- pkgs/stdenv/cross/default.nix | 2 +- pkgs/top-level/all-packages.nix | 23 ++++++++-------------- 13 files changed, 40 insertions(+), 53 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 7f5e4f8c9a2..19a538e613e 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -20,7 +20,6 @@ , enableMultilib ? false , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -225,7 +224,7 @@ stdenv.mkDerivation ({ ++ (optional langJava boehmgc) ++ (optionals langJava [zip unzip]) ++ (optionals javaAwtGtk ([gtk2 pkgconfig libart_lgpl] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) ; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 72c22544d1e..714554019e4 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -171,8 +170,8 @@ let version = "4.8.5"; else " --with-headers=${libcCross.dev}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -294,7 +293,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 594a61fdedf..3bf279635aa 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -172,8 +171,8 @@ let version = "4.9.4"; else " --with-headers=${libcCross.dev}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -299,7 +298,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index f7d46deebcc..25053542678 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -176,8 +175,8 @@ let version = "5.4.0"; else " --with-headers=${getDev libcCross}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -309,7 +308,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 1496e910dd1..57bb336ccbf 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -172,8 +171,8 @@ let version = "6.3.0"; else " --with-headers=${getDev libcCross}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -297,7 +296,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index af48fdbd159..6b08f279790 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -172,8 +171,8 @@ let version = "7-20170409"; else " --with-headers=${getDev libcCross}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -297,7 +296,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index ed6f4717446..006a9f8fbc4 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -99,17 +99,17 @@ in stdenv.mkDerivation (rec { configureFlags = [ "CC=${stdenv.ccCross}/bin/${cross.config}-cc" - "LD=${stdenv.binutilsCross}/bin/${cross.config}-ld" - "AR=${stdenv.binutilsCross}/bin/${cross.config}-ar" - "NM=${stdenv.binutilsCross}/bin/${cross.config}-nm" - "RANLIB=${stdenv.binutilsCross}/bin/${cross.config}-ranlib" + "LD=${stdenv.binutils}/bin/${cross.config}-ld" + "AR=${stdenv.binutils}/bin/${cross.config}-ar" + "NM=${stdenv.binutils}/bin/${cross.config}-nm" + "RANLIB=${stdenv.binutils}/bin/${cross.config}-ranlib" "--target=${cross.config}" "--enable-bootstrap-with-devel-snapshot" ] ++ # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; - buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutilsCross ]; + buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ]; dontSetConfigureCross = true; @@ -118,6 +118,6 @@ in stdenv.mkDerivation (rec { cc = "${stdenv.ccCross}/bin/${cross.config}-cc"; - ld = "${stdenv.binutilsCross}/bin/${cross.config}-ld"; + ld = "${stdenv.binutils}/bin/${cross.config}-ld"; }; }) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index a9df0d29e09..49612b0b461 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, binutilsCross ? null, gccCross ? null +{ stdenv, fetchurl, binutils ? null, gccCross ? null , onlyHeaders ? false , onlyPthreads ? false }: @@ -27,7 +27,7 @@ stdenv.mkDerivation ({ cd mingw-w64-libraries/winpthreads ''; } else { - buildInputs = [ gccCross binutilsCross ]; + buildInputs = [ gccCross binutils ]; crossConfig = gccCross.crossConfig; diff --git a/pkgs/os-specific/windows/mingwrt/default.nix b/pkgs/os-specific/windows/mingwrt/default.nix index 286c63d0163..98461d690d9 100644 --- a/pkgs/os-specific/windows/mingwrt/default.nix +++ b/pkgs/os-specific/windows/mingwrt/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}: +{stdenv, fetchurl, binutils ? null, gccCross ? null, onlyHeaders ? false}: let name = "mingwrt-3.20"; @@ -20,7 +20,7 @@ stdenv.mkDerivation (rec { cp -R include $out ''; } else { - buildInputs = [ gccCross binutilsCross ]; + buildInputs = [ gccCross binutils ]; crossConfig = gccCross.crossConfig; diff --git a/pkgs/os-specific/windows/w32api/default.nix b/pkgs/os-specific/windows/w32api/default.nix index 2a5af71b5ec..3443fff9668 100644 --- a/pkgs/os-specific/windows/w32api/default.nix +++ b/pkgs/os-specific/windows/w32api/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, xz, binutilsCross ? null +{ stdenv, fetchurl, xz, binutils ? null , gccCross ? null, onlyHeaders ? false }: let @@ -23,7 +23,7 @@ stdenv.mkDerivation ({ cp -R include $out ''; } else { - buildInputs = [ gccCross binutilsCross ]; + buildInputs = [ gccCross binutils ]; crossConfig = gccCross.crossConfig; diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 65a0bf98456..7eab7ddb072 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -56,7 +56,7 @@ rec { # Return a modified stdenv that adds a cross compiler to the # builds. - makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // { + makeStdenvCross = stdenv: cross: binutils: gccCross: stdenv // { # Overrides are surely not valid as packages built with this run on a # different platform. @@ -91,7 +91,7 @@ rec { name = name + "-" + cross.config; nativeBuildInputs = nativeBuildInputs ++ nativeInputsFromBuildInputs - ++ [ gccCross binutilsCross ] + ++ [ gccCross binutils ] ++ stdenv.lib.optional selfNativeBuildInput nativeDrv # without proper `file` command, libtool sometimes fails # to recognize 64-bit DLLs @@ -110,7 +110,7 @@ rec { crossConfig = cross.config; } // args.crossAttrs or {}); - inherit gccCross binutilsCross; + inherit gccCross binutils; ccCross = gccCross; }; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index dec4b036092..7fe56725170 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -39,7 +39,7 @@ in bootStages ++ [ binutils cc else buildPackages.makeStdenvCross buildPackages.stdenv crossSystem - buildPackages.binutilsCross buildPackages.gccCrossStageFinal; + buildPackages.binutils buildPackages.gccCrossStageFinal; }) ] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a351284632b..00243e82b9a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4982,10 +4982,10 @@ with pkgs; libcCross = libcCross1; enableShared = false; # Why is this needed? - inherit (forcedNativePackages) binutilsCross; + inherit (forcedNativePackages) binutils; }; libc = libcCross1; - binutils = binutilsCross; + inherit (forcedNativePackages) binutils; cross = targetPlatform; }; @@ -4993,7 +4993,7 @@ with pkgs; gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapGCCCross { gcc = gccCrossStageStatic.gcc; libc = windows.mingw_headers2; - binutils = binutilsCross; + inherit (forcedNativePackages) binutils; cross = targetPlatform; }; @@ -5006,10 +5006,10 @@ with pkgs; # ), so don't even try. langCC = targetPlatform.config != "i686-pc-mingw32"; # Why is this needed? - inherit (forcedNativePackages) binutilsCross; + inherit (forcedNativePackages) binutils; }; libc = libcCross; - binutils = binutilsCross; + inherit (forcedNativePackages) binutils; cross = targetPlatform; }; @@ -6346,13 +6346,6 @@ with pkgs; gold = false; }); - binutilsCross = assert targetPlatform != buildPlatform; lowPrio ( - if targetPlatform.libc == "libSystem" then darwin.cctools_cross - else forcedNativePackages.binutils.override { - noSysDirs = true; - cross = targetPlatform; - }); - bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { }; bison3 = callPackage ../development/tools/parsing/bison/3.x.nix { }; bison = bison3; @@ -12305,7 +12298,7 @@ with pkgs; w32api = callPackage ../os-specific/windows/w32api { gccCross = gccCrossStageStatic; - binutilsCross = binutilsCross; + binutils = binutils; }; w32api_headers = w32api.override { @@ -12314,7 +12307,7 @@ with pkgs; mingw_runtime = callPackage ../os-specific/windows/mingwrt { gccCross = gccCrossMingw2; - binutilsCross = binutilsCross; + binutils = binutils; }; mingw_runtime_headers = mingw_runtime.override { @@ -12338,7 +12331,7 @@ with pkgs; mingw_w64 = callPackage ../os-specific/windows/mingw-w64 { gccCross = gccCrossStageStatic; - binutilsCross = binutilsCross; + binutils = binutils; }; mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64 { -- cgit 1.4.1