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 | |
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')
51 files changed, 153 insertions, 460 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/' } diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index c633310a37a4..c0c8e46fbb07 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -222,8 +222,8 @@ stdenv.mkDerivation ({ setupCompileFlags="${concatStringsSep " " setupCompileFlags}" configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags" - # nativePkgs defined in stdenv/setup.hs - for p in "''${nativePkgs[@]}"; do + # host.*Pkgs defined in stdenv/setup.hs + for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/ continue diff --git a/pkgs/development/idris-modules/build-idris-package.nix b/pkgs/development/idris-modules/build-idris-package.nix index 9dfa3430ed8b..66eddd0e3602 100644 --- a/pkgs/development/idris-modules/build-idris-package.nix +++ b/pkgs/development/idris-modules/build-idris-package.nix @@ -18,7 +18,8 @@ fi } - envHooks+=(addIdrisLibs) + # All run-time deps + addEnvHooks 0 addIdrisLibs ''; buildPhase = '' diff --git a/pkgs/development/idris-modules/with-packages.nix b/pkgs/development/idris-modules/with-packages.nix index d2b09808ec15..d4638670f699 100644 --- a/pkgs/development/idris-modules/with-packages.nix +++ b/pkgs/development/idris-modules/with-packages.nix @@ -14,7 +14,7 @@ fi } - envHooks+=(installIdrisLib) + envHostTargetHooks+=(installIdrisLib) ''; unpackPhase = '' diff --git a/pkgs/development/interpreters/elixir/setup-hook.sh b/pkgs/development/interpreters/elixir/setup-hook.sh index 2ed3b2e6454b..501eca3cf02a 100644 --- a/pkgs/development/interpreters/elixir/setup-hook.sh +++ b/pkgs/development/interpreters/elixir/setup-hook.sh @@ -2,4 +2,4 @@ addErlLibPath() { addToSearchPath ERL_LIBS $1/lib/elixir/lib } -envHooks+=(addErlLibPath) +addEnvHooks "$hostOffset" addErlLibPath diff --git a/pkgs/development/interpreters/erlang/setup-hook.sh b/pkgs/development/interpreters/erlang/setup-hook.sh index 68c0f762dfc5..3962d154ba9f 100644 --- a/pkgs/development/interpreters/erlang/setup-hook.sh +++ b/pkgs/development/interpreters/erlang/setup-hook.sh @@ -2,4 +2,4 @@ addErlangLibPath() { addToSearchPath ERL_LIBS $1/lib/erlang/lib } -envHooks+=(addErlangLibPath) +addEnvHooks "$hostOffset" addErlangLibPath diff --git a/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/pkgs/development/interpreters/guile/setup-hook-2.0.sh index fd1dc944ed44..c7fb4f70fc6a 100644 --- a/pkgs/development/interpreters/guile/setup-hook-2.0.sh +++ b/pkgs/development/interpreters/guile/setup-hook-2.0.sh @@ -10,4 +10,4 @@ addGuileLibPath () { fi } -envHooks+=(addGuileLibPath) +addEnvHooks "$hostOffset" addGuileLibPath diff --git a/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/pkgs/development/interpreters/guile/setup-hook-2.2.sh index 86c1e0d3e4a9..73e700bde026 100644 --- a/pkgs/development/interpreters/guile/setup-hook-2.2.sh +++ b/pkgs/development/interpreters/guile/setup-hook-2.2.sh @@ -10,4 +10,4 @@ addGuileLibPath () { fi } -envHooks+=(addGuileLibPath) +addEnvHooks "$hostOffset" addGuileLibPath diff --git a/pkgs/development/interpreters/guile/setup-hook.sh b/pkgs/development/interpreters/guile/setup-hook.sh index c1d19e579ed5..bf04fee1e893 100644 --- a/pkgs/development/interpreters/guile/setup-hook.sh +++ b/pkgs/development/interpreters/guile/setup-hook.sh @@ -5,4 +5,4 @@ addGuileLibPath () { fi } -envHooks+=(addGuileLibPath) +addEnvHooks "$hostOffset" addGuileLibPath diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix index ff192c072865..2224a13ba7c0 100644 --- a/pkgs/development/interpreters/jruby/default.nix +++ b/pkgs/development/interpreters/jruby/default.nix @@ -36,7 +36,7 @@ jruby = stdenv.mkDerivation rec { addToSearchPath GEM_PATH \$1/${passthru.gemPath} } - envHooks+=(addGemPath) + addEnvHooks "$hostOffset" addGemPath EOF ''; diff --git a/pkgs/development/interpreters/perl/setup-hook.sh b/pkgs/development/interpreters/perl/setup-hook.sh index a8656b8531db..7909412806c8 100644 --- a/pkgs/development/interpreters/perl/setup-hook.sh +++ b/pkgs/development/interpreters/perl/setup-hook.sh @@ -2,4 +2,4 @@ addPerlLibPath () { addToSearchPath PERL5LIB $1/lib/perl5/site_perl } -envHooks+=(addPerlLibPath) +addEnvHooks "$hostOffset" addPerlLibPath diff --git a/pkgs/development/interpreters/python/setup-hook.sh b/pkgs/development/interpreters/python/setup-hook.sh index 35726280a75f..77ec9e9ac0bf 100644 --- a/pkgs/development/interpreters/python/setup-hook.sh +++ b/pkgs/development/interpreters/python/setup-hook.sh @@ -12,7 +12,7 @@ toPythonPath() { echo $result } -envHooks+=(addPythonPath) +addEnvHooks "$hostOffset" addPythonPath # Determinism: The interpreter is patched to write null timestamps when compiling python files. # This way python doesn't try to update them when we freeze timestamps in nix store. diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index d664c00bc31d..478c2b45b26e 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -142,7 +142,7 @@ let addToSearchPath GEM_PATH \$1/${passthru.gemPath} } - envHooks+=(addGemPath) + addEnvHooks "$hostOffset" addGemPath EOF '' + opString useRailsExpress '' rbConfig=$(find $out/lib/ruby -name rbconfig.rb) diff --git a/pkgs/development/libraries/SDL/setup-hook.sh b/pkgs/development/libraries/SDL/setup-hook.sh index 3696e743a07a..20382f18f529 100644 --- a/pkgs/development/libraries/SDL/setup-hook.sh +++ b/pkgs/development/libraries/SDL/setup-hook.sh @@ -4,8 +4,4 @@ addSDLPath () { fi } -if test -n "$crossConfig"; then - crossEnvHooks+=(addSDLPath) -else - envHooks+=(addSDLPath) -fi +addEnvHooks "$hostOffset" addSDLPath diff --git a/pkgs/development/libraries/SDL2/setup-hook.sh b/pkgs/development/libraries/SDL2/setup-hook.sh index 5a26440f37b3..3acce9d473c5 100644 --- a/pkgs/development/libraries/SDL2/setup-hook.sh +++ b/pkgs/development/libraries/SDL2/setup-hook.sh @@ -4,8 +4,4 @@ addSDL2Path () { fi } -if test -n "$crossConfig"; then - crossEnvHooks+=(addSDL2Path) -else - envHooks+=(addSDL2Path) -fi +addEnvHooks "$hostOffset" addSDL2Path diff --git a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh index ba7ab82f50b4..5a7dcd792996 100644 --- a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh +++ b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh @@ -14,4 +14,4 @@ findGdkPixbufLoaders() { } -envHooks+=(findGdkPixbufLoaders) +addEnvHooks "$hostOffset" findGdkPixbufLoaders diff --git a/pkgs/development/libraries/glib/setup-hook.sh b/pkgs/development/libraries/glib/setup-hook.sh index c5cf293902cd..98341376fdf6 100644 --- a/pkgs/development/libraries/glib/setup-hook.sh +++ b/pkgs/development/libraries/glib/setup-hook.sh @@ -5,7 +5,7 @@ make_glib_find_gsettings_schemas() { addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"* fi } -envHooks+=(make_glib_find_gsettings_schemas) +addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas # Install gschemas, if any, in a package-specific directory glibPreInstallPhase() { diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 5af914d179b8..cfec3209b98a 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -141,7 +141,7 @@ stdenv.mkDerivation ({ outputs = [ "out" "bin" "dev" "static" ]; - nativeBuildInputs = lib.optional (cross != null) buildPackages.stdenv.cc; + depsBuildBuild = [ buildPackages.stdenv.cc ]; buildInputs = lib.optionals withGd [ gd libpng ]; # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix index e3bacc86d58e..dce052f8baab 100644 --- a/pkgs/development/libraries/gmp/6.x.nix +++ b/pkgs/development/libraries/gmp/6.x.nix @@ -19,8 +19,8 @@ let self = stdenv.mkDerivation rec { outputs = [ "out" "dev" "info" ]; passthru.static = self.out; - nativeBuildInputs = [ m4 ] - ++ stdenv.lib.optional (buildPlatform != hostPlatform) buildPackages.stdenv.cc; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = [ m4 ]; configureFlags = # Build a "fat binary", with routines for several sub-architectures diff --git a/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/pkgs/development/libraries/gobject-introspection/setup-hook.sh index 583d8475ec3b..6d3488a6622d 100644 --- a/pkgs/development/libraries/gobject-introspection/setup-hook.sh +++ b/pkgs/development/libraries/gobject-introspection/setup-hook.sh @@ -11,7 +11,7 @@ make_gobject_introspection_find_gir_files() { fi } -envHooks+=(make_gobject_introspection_find_gir_files) +addEnvHooks "$hostOffset" make_gobject_introspection_find_gir_files _multioutMoveGlibGir() { moveToOutput share/gir-1.0 "${!outputDev}" diff --git a/pkgs/development/libraries/grantlee/5/setup-hook.sh b/pkgs/development/libraries/grantlee/5/setup-hook.sh index aaa64868dc94..b51cb4a31909 100644 --- a/pkgs/development/libraries/grantlee/5/setup-hook.sh +++ b/pkgs/development/libraries/grantlee/5/setup-hook.sh @@ -10,8 +10,4 @@ _grantleeEnvHook() { propagatedUserEnvPkgs+=" $1" fi } -if [ "$crossEnv" ]; then - crossEnvHooks+=(_grantleeEnvHook) -else - envHooks+=(_grantleeEnvHook) -fi +addEnvHooks "$hostOffset" _grantleeEnvHook diff --git a/pkgs/development/libraries/gstreamer/core/setup-hook.sh b/pkgs/development/libraries/gstreamer/core/setup-hook.sh index 3dd7812ece6d..b8c741af578f 100644 --- a/pkgs/development/libraries/gstreamer/core/setup-hook.sh +++ b/pkgs/development/libraries/gstreamer/core/setup-hook.sh @@ -5,5 +5,5 @@ addGstreamer1LibPath () { fi } -envHooks+=(addGstreamer1LibPath) +addEnvHooks "$hostOffset" addGstreamer1LibPath diff --git a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh index e89aeda5bc1c..65ce26112519 100644 --- a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh +++ b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh @@ -5,4 +5,4 @@ addGstreamerLibPath () { fi } -envHooks+=(addGstreamerLibPath) +addEnvHooks "$hostOffset" addGstreamerLibPath diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh index c1b1e21852cf..88091e78a0cd 100644 --- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh +++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh @@ -2,7 +2,7 @@ _ecmEnvHook() { addToSearchPath XDG_DATA_DIRS "$1/share" addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg" } -envHooks+=(_ecmEnvHook) +addEnvHooks "$targetOffset" _ecmEnvHook _ecmPreConfigureHook() { # Because we need to use absolute paths here, we must set *all* the paths. diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix index 661e89e30782..0a600fe8d057 100644 --- a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix +++ b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix @@ -8,10 +8,18 @@ mkDerivation { name = "kdoctools"; meta = { maintainers = [ lib.maintainers.ttuegel ]; }; - nativeBuildInputs = [ extra-cmake-modules ]; - propagatedNativeBuildInputs = [ perl perlPackages.URI ]; + nativeBuildInputs = [ + extra-cmake-modules + # The build system insists on having native Perl. + perl perlPackages.URI + ]; + propagatedBuildInputs = [ + # kdoctools at runtime actually needs Perl for the platform kdoctools is + # running on, not necessarily native perl. + perl perlPackages.URI + qtbase + ]; buildInputs = [ karchive ki18n ]; - propagatedBuildInputs = [ qtbase ]; outputs = [ "out" "dev" ]; patches = [ ./kdoctools-no-find-docbook-xml.patch ]; cmakeFlags = [ diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh index 5cfffbd622d1..2928d9b34dbe 100644 --- a/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh +++ b/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh @@ -2,4 +2,4 @@ addXdgData() { addToSearchPath XDG_DATA_DIRS "$1/share" } -envHooks+=(addXdgData) +addEnvHooks "$targetOffset" addXdgData diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix index 7ffc40f14946..d6d6989761bc 100644 --- a/pkgs/development/libraries/libopcodes/default.nix +++ b/pkgs/development/libraries/libopcodes/default.nix @@ -19,7 +19,8 @@ stdenv.mkDerivation rec { find . ../include/opcode -type f -exec sed {} -i -e 's/"bfd.h"/<bfd.h>/' \; ''; - nativeBuildInputs = [ autoreconfHook264 bison buildPackages.stdenv.cc ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = [ autoreconfHook264 bison ]; buildInputs = [ libiberty ]; # dis-asm.h includes bfd.h propagatedBuildInputs = [ libbfd ]; diff --git a/pkgs/development/libraries/librep/setup-hook.sh b/pkgs/development/libraries/librep/setup-hook.sh index 420d63d6c513..4d875b693304 100644 --- a/pkgs/development/libraries/librep/setup-hook.sh +++ b/pkgs/development/libraries/librep/setup-hook.sh @@ -2,4 +2,4 @@ addRepDLLoadPath () { addToSearchPath REP_DL_LOAD_PATH $1/lib/rep } -envHooks+=(addRepDLLoadPath) +addEnvHooks "$hostOffset" addRepDLLoadPath diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index 9aade8b96725..79414f016d39 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -37,10 +37,11 @@ stdenv.mkDerivation rec { # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris: CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED"; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ pkgconfig ] ++ lib.optionals (buildPlatform != hostPlatform) [ - buildPackages.ncurses buildPackages.stdenv.cc + buildPackages.ncurses ]; buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm; diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh index 8ec7eeda8aee..754a75cbef4f 100644 --- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh @@ -42,11 +42,7 @@ qtEnvHook() { propagatedUserEnvPkgs+=" $1" fi } -if [ "$crossConfig" ]; then - crossEnvHooks+=(qtEnvHook) -else - envHooks+=(qtEnvHook) -fi +envHostTargetHooks+=(qtEnvHook) postPatchMkspecs() { local bin="${!outputBin}" diff --git a/pkgs/development/libraries/rep-gtk/setup-hook.sh b/pkgs/development/libraries/rep-gtk/setup-hook.sh index 420d63d6c513..4d875b693304 100644 --- a/pkgs/development/libraries/rep-gtk/setup-hook.sh +++ b/pkgs/development/libraries/rep-gtk/setup-hook.sh @@ -2,4 +2,4 @@ addRepDLLoadPath () { addToSearchPath REP_DL_LOAD_PATH $1/lib/rep } -envHooks+=(addRepDLLoadPath) +addEnvHooks "$hostOffset" addRepDLLoadPath diff --git a/pkgs/development/libraries/slib/setup-hook.sh b/pkgs/development/libraries/slib/setup-hook.sh index 62b72d6dc0ab..3c7e91e81886 100644 --- a/pkgs/development/libraries/slib/setup-hook.sh +++ b/pkgs/development/libraries/slib/setup-hook.sh @@ -10,4 +10,4 @@ addSlibPath () { fi } -envHooks+=(addSlibPath) +addEnvHooks "$hostOffset" addSlibPath diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh index 7ac8c70d59f8..eb6052d58db5 100644 --- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh +++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh @@ -31,7 +31,7 @@ collectNixLispLDLP () { export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF -envHooks+=(addASDFPaths setLisp collectNixLispLDLP) +addEnvHooks "$targetOffset" addASDFPaths setLisp collectNixLispLDLP mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home" mkdir -p "$HOME"/.cache/common-lisp diff --git a/pkgs/development/ocaml-modules/eliom/setup-hook.sh b/pkgs/development/ocaml-modules/eliom/setup-hook.sh index 096d8f8bf635..9868ab93f791 100644 --- a/pkgs/development/ocaml-modules/eliom/setup-hook.sh +++ b/pkgs/development/ocaml-modules/eliom/setup-hook.sh @@ -2,4 +2,4 @@ addOcsigenDistilleryTemplate() { addToSearchPathWithCustomDelimiter : ELIOM_DISTILLERY_PATH $1/eliom-distillery-templates } -envHooks+=(addOcsigenDistilleryTemplate) +addEnvHooks "$hostOffset" addOcsigenDistilleryTemplate diff --git a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh index a93a7250bebb..6d9504370165 100644 --- a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh +++ b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh @@ -2,4 +2,4 @@ addOcamlMakefile () { export OCAMLMAKEFILE="@out@/include/OCamlMakefile" } -envHooks+=(addOcamlMakefile) +addEnvHooks "$targetOffset" addOcamlMakefile diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh index 614e00314212..a92d54b3f144 100755 --- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh +++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh @@ -72,11 +72,7 @@ if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then configurePhase=cmakeConfigurePhase fi -if [ -n "$crossConfig" ]; then - crossEnvHooks+=(addCMakeParams) -else - envHooks+=(addCMakeParams) -fi +addEnvHooks "$targetOffset" addCMakeParams makeCmakeFindLibs(){ isystem_seen= diff --git a/pkgs/development/tools/misc/automake/setup-hook.sh b/pkgs/development/tools/misc/automake/setup-hook.sh index 5cd8c6229f68..292632b7cbce 100644 --- a/pkgs/development/tools/misc/automake/setup-hook.sh +++ b/pkgs/development/tools/misc/automake/setup-hook.sh @@ -2,4 +2,4 @@ addAclocals () { addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal } -envHooks+=(addAclocals) +addEnvHooks "$hostOffset" addAclocals diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 1b0166526996..31c86c785c2d 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -65,7 +65,8 @@ stdenv.mkDerivation rec { outputs = [ "out" "info" "man" ]; - nativeBuildInputs = [ bison buildPackages.stdenv.cc ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = [ bison ]; buildInputs = [ zlib ]; inherit noSysDirs; @@ -90,11 +91,7 @@ stdenv.mkDerivation rec { else "-static-libgcc"; # TODO(@Ericson2314): Always pass "--target" and always targetPrefix. - 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 = [ "--enable-targets=all" "--enable-64-bit-bfd" diff --git a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh index 1c153976a343..34a9b9f1173b 100644 --- a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh +++ b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh @@ -3,8 +3,4 @@ addPkgConfigPath () { addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig } -if test -n "$crossConfig"; then - crossEnvHooks+=(addPkgConfigPath) -else - envHooks+=(addPkgConfigPath) -fi +addEnvHooks "$targetOffset" addPkgConfigPath diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix index 846546ae7699..186b78ce3f36 100644 --- a/pkgs/development/tools/ocaml/findlib/default.nix +++ b/pkgs/development/tools/ocaml/findlib/default.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { fi } - envHooks+=(addOCamlPath) + addEnvHooks "$targetOffset" addOCamlPath ''; meta = { diff --git a/pkgs/development/web/nodejs/setup-hook.sh b/pkgs/development/web/nodejs/setup-hook.sh index e1f4d9089f38..18368588c2af 100644 --- a/pkgs/development/web/nodejs/setup-hook.sh +++ b/pkgs/development/web/nodejs/setup-hook.sh @@ -2,4 +2,4 @@ addNodePath () { addToSearchPath NODE_PATH $1/lib/node_modules } -envHooks+=(addNodePath) +addEnvHooks "$hostOffset" addNodePath |