diff options
author | John Ericson <Ericson2314@yahoo.com> | 2017-12-30 22:58:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-30 22:58:02 -0500 |
commit | 4d2b7638173afb4c0f0c12a43654bcff5c9500ab (patch) | |
tree | 04068195f42530a34d44a63019ddc9f77654804c /pkgs/development/compilers | |
parent | 553fd19e679b68082329fdae40dcfb40c2f72cba (diff) | |
parent | a98e68676dc96e9021d9bb0a9f210ac1a35d368b (diff) | |
download | nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.tar nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.tar.gz nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.tar.bz2 nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.tar.lz nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.tar.xz nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.tar.zst nixlib-4d2b7638173afb4c0f0c12a43654bcff5c9500ab.zip |
Merge pull request #26805 from obsidiansystems/cross-elegant
Make cross compilation elegant
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/chicken/setup-hook.sh | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.5/default.nix | 68 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.8/default.nix | 54 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.9/default.nix | 68 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/5/default.nix | 72 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/6/default.nix | 71 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/7/default.nix | 71 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/snapshot/default.nix | 71 | ||||
-rw-r--r-- | pkgs/development/compilers/go/setup-hook.sh | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/haxe/setup-hook.sh | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/sbcl/default.nix | 2 |
11 files changed, 96 insertions, 387 deletions
diff --git a/pkgs/development/compilers/chicken/setup-hook.sh b/pkgs/development/compilers/chicken/setup-hook.sh index d7f28539dc64..b0d9b53b5378 100644 --- a/pkgs/development/compilers/chicken/setup-hook.sh +++ b/pkgs/development/compilers/chicken/setup-hook.sh @@ -4,4 +4,4 @@ addChickenRepositoryPath() { export CHICKEN_INCLUDE_PATH="$1/share;$CHICKEN_INCLUDE_PATH" } -envHooks=(${envHooks[@]} addChickenRepositoryPath) +addEnvHooks "$targetOffset" addChickenRepositoryPath diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 36fde924e9b9..a312276b33e4 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -229,11 +229,22 @@ stdenv.mkDerivation ({ inherit noSysDirs profiledCompiler staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ optional (perl != null) perl; - buildInputs = [ gmp mpfr libmpc libelf ] - ++ (optional (ppl != null) ppl) + # For building runtime libs + depsBuildTarget = + if hostPlatform == buildPlatform then [ + targetPackages.stdenv.cc.bintools # newly-built gcc will be used + ] else assert targetPlatform == hostPlatform; [ # build != host == target + stdenv.cc + ]; + + buildInputs = [ + gmp mpfr libmpc libelf + targetPackages.stdenv.cc.bintools # For linking code at run-time + ] ++ (optional (ppl != null) ppl) ++ (optional (cloogppl != null) cloogppl) ++ (optional (zlib != null) zlib) ++ (optional langJava boehmgc) @@ -245,11 +256,7 @@ stdenv.mkDerivation ({ ; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -314,56 +321,9 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; - CC = "gcc"; - # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. # diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index e626abc50d14..91daeadba707 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -267,6 +267,7 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ (optional (perl != null) perl) ++ (optional javaAwtGtk pkgconfig); @@ -297,11 +298,7 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -397,57 +394,12 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; buildFlags = ""; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 - CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc"; + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 621c45cdff38..844e0a7bebf4 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -262,12 +262,23 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ (optional (perl != null) perl) ++ (optional javaAwtGtk pkgconfig); - buildInputs = [ gmp mpfr libmpc libelf ] - ++ (optional (cloog != null) cloog) + # For building runtime libs + depsBuildTarget = + if hostPlatform == buildPlatform then [ + targetPackages.stdenv.cc.bintools # newly-built gcc will be used + ] else assert targetPlatform == hostPlatform; [ # build != host == target + stdenv.cc + ]; + + buildInputs = [ + gmp mpfr libmpc libelf + targetPackages.stdenv.cc.bintools # For linking code at run-time + ] ++ (optional (cloog != null) cloog) ++ (optional (isl != null) isl) ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) @@ -296,11 +307,7 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -395,57 +402,12 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; buildFlags = ""; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 - CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc"; + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 709e87c34454..148409bee9bf 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -49,9 +49,6 @@ assert libelf != null -> zlib != null; # Make sure we get GNU sed. assert hostPlatform.isDarwin -> gnused != null; -# Need c++filt on darwin -assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null; - # The go frontend is written in c++ assert langGo -> langCC; @@ -277,17 +274,27 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ (optional (perl != null) perl) ++ (optional javaAwtGtk pkgconfig); - buildInputs = [ gmp mpfr libmpc libelf ] - ++ (optional (isl != null) isl) + # For building runtime libs + depsBuildTarget = + if hostPlatform == buildPlatform then [ + targetPackages.stdenv.cc.bintools # newly-built gcc will be used + ] else assert targetPlatform == hostPlatform; [ # build != host == target + stdenv.cc + ]; + + buildInputs = [ + gmp mpfr libmpc libelf + targetPackages.stdenv.cc.bintools # For linking code at run-time + ] ++ (optional (isl != null) isl) ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) - ++ (optionals (buildPlatform != hostPlatform) [buildPackages.stdenv.cc]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) @@ -309,11 +316,7 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -404,57 +407,12 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; buildFlags = ""; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 - CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc"; + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 33a034adf667..c6114b7e6395 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -49,9 +49,6 @@ assert libelf != null -> zlib != null; # Make sure we get GNU sed. assert hostPlatform.isDarwin -> gnused != null; -# Need c++filt on darwin -assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null; - # The go frontend is written in c++ assert langGo -> langCC; @@ -276,12 +273,23 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ (optional (perl != null) perl) ++ (optional javaAwtGtk pkgconfig); - buildInputs = [ gmp mpfr libmpc libelf ] - ++ (optional (isl != null) isl) + # For building runtime libs + depsBuildTarget = + if hostPlatform == buildPlatform then [ + targetPackages.stdenv.cc.bintools # newly-built gcc will be used + ] else assert targetPlatform == hostPlatform; [ # build != host == target + stdenv.cc + ]; + + buildInputs = [ + gmp mpfr libmpc libelf + targetPackages.stdenv.cc.bintools # For linking code at run-time + ] ++ (optional (isl != null) isl) ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) @@ -311,11 +319,7 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -405,57 +409,12 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; buildFlags = ""; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 - CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc"; + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 291ec944b554..c20546b59e8e 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -50,9 +50,6 @@ assert libelf != null -> zlib != null; # Make sure we get GNU sed. assert hostPlatform.isDarwin -> gnused != null; -# Need c++filt on darwin -assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null; - # The go frontend is written in c++ assert langGo -> langCC; @@ -273,12 +270,23 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ (optional (perl != null) perl) ++ (optional javaAwtGtk pkgconfig); - buildInputs = [ gmp mpfr libmpc libelf flex ] - ++ (optional (isl != null) isl) + # For building runtime libs + depsBuildTarget = + if hostPlatform == buildPlatform then [ + targetPackages.stdenv.cc.bintools # newly-built gcc will be used + ] else assert targetPlatform == hostPlatform; [ # build != host == target + stdenv.cc + ]; + + buildInputs = [ + gmp mpfr libmpc libelf flex + targetPackages.stdenv.cc.bintools # For linking code at run-time + ] ++ (optional (isl != null) isl) ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) @@ -304,11 +312,7 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -399,57 +403,12 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; buildFlags = ""; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 - CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc"; + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index e8668712e2ea..c571487361b2 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -50,9 +50,6 @@ assert libelf != null -> zlib != null; # Make sure we get GNU sed. assert hostPlatform.isDarwin -> gnused != null; -# Need c++filt on darwin -assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null; - # The go frontend is written in c++ assert langGo -> langCC; @@ -260,12 +257,23 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava libcCross crossMingw; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ texinfo which gettext ] ++ (optional (perl != null) perl) ++ (optional javaAwtGtk pkgconfig); - buildInputs = [ gmp mpfr libmpc libelf flex ] - ++ (optional (isl != null) isl) + # For building runtime libs + depsBuildTarget = + if hostPlatform == buildPlatform then [ + targetPackages.stdenv.cc.bintools # newly-built gcc will be used + ] else assert targetPlatform == hostPlatform; [ # build != host == target + stdenv.cc + ]; + + buildInputs = [ + gmp mpfr libmpc libelf flex + targetPackages.stdenv.cc.bintools # For linking code at run-time + ] ++ (optional (isl != null) isl) ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) @@ -291,11 +299,7 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = - # TODO(@Ericson2314): Figure out what's going wrong with Arm - if hostPlatform == targetPlatform && targetPlatform.isArm - then [] - else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = # Basic dependencies @@ -386,57 +390,12 @@ stdenv.mkDerivation ({ /* For cross-built gcc (build != host == target) */ crossAttrs = { - AR_FOR_BUILD = "ar"; - AS_FOR_BUILD = "as"; - LD_FOR_BUILD = "ld"; - NM_FOR_BUILD = "nm"; - OBJCOPY_FOR_BUILD = "objcopy"; - OBJDUMP_FOR_BUILD = "objdump"; - RANLIB_FOR_BUILD = "ranlib"; - SIZE_FOR_BUILD = "size"; - STRINGS_FOR_BUILD = "strings"; - STRIP_FOR_BUILD = "strip"; - CC_FOR_BUILD = "gcc"; - CXX_FOR_BUILD = "g++"; - - AR = "${targetPlatform.config}-ar"; - AS = "${targetPlatform.config}-as"; - LD = "${targetPlatform.config}-ld"; - NM = "${targetPlatform.config}-nm"; - OBJCOPY = "${targetPlatform.config}-objcopy"; - OBJDUMP = "${targetPlatform.config}-objdump"; - RANLIB = "${targetPlatform.config}-ranlib"; - SIZE = "${targetPlatform.config}-size"; - STRINGS = "${targetPlatform.config}-strings"; - STRIP = "${targetPlatform.config}-strip"; - CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-g++"; - - AR_FOR_TARGET = "${targetPlatform.config}-ar"; - AS_FOR_TARGET = "${targetPlatform.config}-as"; - LD_FOR_TARGET = "${targetPlatform.config}-ld"; - NM_FOR_TARGET = "${targetPlatform.config}-nm"; - OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; - OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; - RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; - SIZE_FOR_TARGET = "${targetPlatform.config}-size"; - STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; - STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; - CXX_FOR_TARGET = "${targetPlatform.config}-g++"; - dontStrip = true; buildFlags = ""; }; - NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools; - NIX_BUILD_CC = buildPackages.stdenv.cc; - - # Needed for the cross compilation to work - AR = "ar"; - LD = "ld"; # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 - CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc"; + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the # library headers and binaries, regarless of the language being compiled. diff --git a/pkgs/development/compilers/go/setup-hook.sh b/pkgs/development/compilers/go/setup-hook.sh index 1b91c8312b88..7dce15eeb102 100644 --- a/pkgs/development/compilers/go/setup-hook.sh +++ b/pkgs/development/compilers/go/setup-hook.sh @@ -2,4 +2,4 @@ addToGoPath() { addToSearchPath GOPATH $1/share/go } -envHooks=(${envHooks[@]} addToGoPath) +addEnvHooks "$targetOffset" addToGoPath diff --git a/pkgs/development/compilers/haxe/setup-hook.sh b/pkgs/development/compilers/haxe/setup-hook.sh index 21cc0206859f..e6496107a5ee 100644 --- a/pkgs/development/compilers/haxe/setup-hook.sh +++ b/pkgs/development/compilers/haxe/setup-hook.sh @@ -4,4 +4,4 @@ addHaxeLibPath() { fi } -envHooks+=(addHaxeLibPath) +addEnvHooks "$targetOffset" addHaxeLibPath diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index b800d71198af..cd3120ed8312 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -91,7 +91,7 @@ stdenv.mkDerivation rec { # Specifying $SBCL_HOME is only truly needed with `purgeNixReferences = true`. setupHook = writeText "setupHook.sh" '' - envHooks+=(_setSbclHome) + addEnvHooks "$targetOffset" _setSbclHome _setSbclHome() { export SBCL_HOME='@out@/lib/sbcl/' } |