git.iko.soy/typeable/nixpkgs
on master help sign in
Merge accepted cross compilation PRs into staging
commit16be434b0bec4d14a893010b46f56a64cab74cc1 authorJohn Ericson <John.Ericson@Obsidian.Systems> dateWed 28 Jun 2017, 23:17 (9 years ago) parentd76bc8eb0ada07
83 files changed+308−347
doc/cross-compilation.xml−5 pkgs/applications/editors/vim/default.nix−3 pkgs/applications/graphics/ImageMagick/7.0.nix+4−3 pkgs/applications/graphics/ImageMagick/default.nix+5−4 pkgs/applications/graphics/fbida/default.nix−4 pkgs/applications/networking/offrss/default.nix−1 pkgs/applications/version-management/fossil/default.nix+1−1 pkgs/applications/video/omxplayer/default.nix+6−3 pkgs/build-support/cc-wrapper/default.nix+1−1 pkgs/build-support/gcc-wrapper-old/default.nix+16−10 pkgs/build-support/kernel/make-initrd.nix+5−7 pkgs/development/interpreters/guile/2.0.nix+4−2 pkgs/development/interpreters/guile/default.nix+4−2 pkgs/development/interpreters/lua-5/5.2.nix+4−8 pkgs/development/interpreters/lua-5/5.3.nix+4−8 pkgs/development/libraries/SDL/default.nix+6−6 pkgs/development/libraries/boehm-gc/default.nix+4−2 pkgs/development/libraries/boost/generic.nix+9−8 pkgs/development/libraries/ffmpeg-full/default.nix+5−21 pkgs/development/libraries/ffmpeg/generic.nix+5−21 pkgs/development/libraries/fontconfig/2.10.nix+4−2 pkgs/development/libraries/fontconfig/default.nix+5−3 pkgs/development/libraries/freetype/default.nix+7−7 pkgs/development/libraries/glew/1.10.nix+7−9 pkgs/development/libraries/glew/default.nix+7−9 pkgs/development/libraries/libav/default.nix+3−2 pkgs/development/libraries/libffi/default.nix+4−2 pkgs/development/libraries/libiconv/default.nix+5−3 pkgs/development/libraries/libjpeg-turbo/default.nix+4−2 pkgs/development/libraries/libmsgpack/generic.nix+2−1 pkgs/development/libraries/libpng/12.nix+5−3 pkgs/development/libraries/libpng/default.nix+4−2 pkgs/development/libraries/libssh2/default.nix+4−2 pkgs/development/libraries/libvpx/default.nix+14−16 pkgs/development/libraries/libvpx/git.nix+14−16 pkgs/development/libraries/libxml2/default.nix+5−3 pkgs/development/libraries/libxslt/default.nix+3−2 pkgs/development/libraries/newt/default.nix+1−1 pkgs/development/libraries/nlohmann_json/default.nix+4−2 pkgs/development/libraries/openssl/default.nix+5−8 pkgs/development/libraries/poppler/default.nix+2−1 pkgs/development/libraries/qt-4.x/4.8/default.nix+9−10 pkgs/development/libraries/readline/6.2.nix+4−2 pkgs/development/libraries/readline/6.3.nix+4−2 pkgs/development/libraries/readline/7.0.nix+4−2 pkgs/development/libraries/zlib/default.nix+2−4 pkgs/development/tools/build-managers/cmake/2.8.nix+2−1 pkgs/development/tools/misc/libtool/libtool2.nix+4−2 pkgs/games/scummvm/default.nix+5−2 pkgs/misc/uboot/default.nix+5−3 pkgs/os-specific/linux/kernel-headers/default.nix+4−2 pkgs/os-specific/linux/kernel/generic.nix+3−2 pkgs/os-specific/linux/kernel/linux-3.10.nix+1−1 pkgs/os-specific/linux/kernel/linux-4.11.nix+1−1 pkgs/os-specific/linux/kernel/linux-4.4.nix+1−1 pkgs/os-specific/linux/kernel/linux-4.9.nix+1−1 pkgs/os-specific/linux/kernel/linux-chromiumos-3.18.nix+1−1 pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix+1−1 pkgs/os-specific/linux/kernel/linux-mptcp.nix+1−1 pkgs/os-specific/linux/kernel/linux-rpi.nix+1−1 pkgs/os-specific/linux/kernel/linux-testing.nix+1−1 pkgs/os-specific/linux/kernel/manual-config.nix+2−1 pkgs/os-specific/linux/kernel/perf.nix+1−1 pkgs/os-specific/linux/klibc/default.nix+8−11 pkgs/os-specific/linux/mdadm/4.nix+6−3 pkgs/os-specific/linux/mdadm/default.nix+6−3 pkgs/os-specific/linux/mingetty/default.nix−4 pkgs/os-specific/linux/procps-ng/default.nix−4 pkgs/os-specific/linux/procps/watch.nix−4 pkgs/os-specific/linux/shadow/default.nix+4−2 pkgs/os-specific/linux/sysvinit/default.nix+1−5 pkgs/os-specific/windows/jom/default.nix+1−1 pkgs/os-specific/windows/pthread-w32/default.nix+1−1 pkgs/os-specific/windows/wxMSW-2.8/default.nix+3−8 pkgs/tools/filesystems/mtdutils/default.nix−4 pkgs/tools/graphics/optipng/default.nix+13−15 pkgs/tools/networking/tcpdump/default.nix+4−2 pkgs/tools/package-management/nix/default.nix+3−2 pkgs/tools/system/tm/default.nix−4 pkgs/tools/system/ts/default.nix+3−6 pkgs/tools/text/html-tidy/default.nix+4−2 pkgs/tools/text/replace/default.nix+1−5 pkgs/top-level/stage.nix−2
doc/cross-compilation.xml−5
@@ -79,11 +79,6 @@
7979 </listitem>
8080 </varlistentry>
8181 </variablelist>
82− <note><para>
83− If you dig around nixpkgs, you may notice there is also <varname>stdenv.cross</varname>.
84− This field defined as <varname>hostPlatform</varname> when the host and build platforms differ, but otherwise not defined at all.
85− This field is obsolete and will soon disappear—please do not use it.
86− </para></note>
8782 <para>
8883 The exact schema these fields follow is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up.
8984 You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent.
pkgs/applications/editors/vim/default.nix−3
@@ -36,9 +36,6 @@ stdenv.mkDerivation rec {
3636 "ac_cv_sizeof_int=4"
3737 "vim_cv_memmove_handles_overlap=yes"
3838 "vim_cv_memmove_handles_overlap=yes"
39−
40− # TODO(@Ericson2314): wont' be needed soon.
41− "STRIP=${hostPlatform.config}-strip"
4239 ];
4340
4441 postInstall = ''
pkgs/applications/graphics/ImageMagick/7.0.nix+4−3
@@ -2,6 +2,7 @@
22, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg
33, lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp
44, ApplicationServices
5+, buildPlatform, hostPlatform
56}:
67
78let
@@ -47,7 +48,7 @@ stdenv.mkDerivation rec {
4748 [ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts"
4849 "--with-gslib"
4950 ]
50− ++ lib.optionals (stdenv.cross.libc or null == "msvcrt")
51+ ++ lib.optionals hostPlatform.isMinGW
5152 [ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM
5253 ;
5354
@@ -57,13 +58,13 @@ stdenv.mkDerivation rec {
5758 [ zlib fontconfig freetype ghostscript
5859 libpng libtiff libxml2
5960 ]
60− ++ lib.optionals (stdenv.cross.libc or null != "msvcrt")
61+ ++ lib.optionals (!hostPlatform.isMinGW)
6162 [ openexr librsvg openjpeg ]
6263 ++ lib.optional stdenv.isDarwin ApplicationServices;
6364
6465 propagatedBuildInputs =
6566 [ bzip2 freetype libjpeg lcms2 ]
66− ++ lib.optionals (stdenv.cross.libc or null != "msvcrt")
67+ ++ lib.optionals (!hostPlatform.isMinGW)
6768 [ libX11 libXext libXt libwebp ]
6869 ;
6970
pkgs/applications/graphics/ImageMagick/default.nix+5−4
@@ -2,6 +2,7 @@
22, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg
33, lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp
44, ApplicationServices
5+, buildPlatform, hostPlatform
56}:
67
78let
@@ -18,7 +19,7 @@ let
1819 }
1920 # Freeze version on mingw so we don't need to port the patch too often.
2021 # FIXME: This version has multiple security vulnerabilities
21− // lib.optionalAttrs (stdenv.cross.libc or null == "msvcrt") {
22+ // lib.optionalAttrs (hostPlatform.isMinGW) {
2223 version = "6.9.2-0";
2324 sha256 = "17ir8bw1j7g7srqmsz3rx780sgnc21zfn0kwyj78iazrywldx8h7";
2425 patches = [(fetchpatch {
@@ -59,7 +60,7 @@ stdenv.mkDerivation rec {
5960 [ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts"
6061 "--with-gslib"
6162 ]
62− ++ lib.optionals (stdenv.cross.libc or null == "msvcrt")
63+ ++ lib.optionals (hostPlatform.isMinGW)
6364 [ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM
6465 ;
6566
@@ -69,13 +70,13 @@ stdenv.mkDerivation rec {
6970 [ zlib fontconfig freetype ghostscript
7071 libpng libtiff libxml2
7172 ]
72− ++ lib.optionals (stdenv.cross.libc or null != "msvcrt")
73+ ++ lib.optionals (!hostPlatform.isMinGW)
7374 [ openexr librsvg openjpeg ]
7475 ++ lib.optional stdenv.isDarwin ApplicationServices;
7576
7677 propagatedBuildInputs =
7778 [ bzip2 freetype libjpeg lcms2 ]
78− ++ lib.optionals (stdenv.cross.libc or null != "msvcrt")
79+ ++ lib.optionals (!hostPlatform.isMinGW)
7980 [ libX11 libXext libXt libwebp ]
8081 ;
8182
pkgs/applications/graphics/fbida/default.nix−4
@@ -21,10 +21,6 @@ stdenv.mkDerivation rec {
2121 sed -e 's@ cpp\>@ gcc -E -@' -i GNUmakefile
2222 '';
2323
24− crossAttrs = {
25− makeFlags = makeFlags ++ [ "CC=${stdenv.cross.config}-gcc" "STRIP=" ];
26− };
27−
2824 meta = with stdenv.lib; {
2925 description = "Image viewing and manipulation programs";
3026 homepage = https://www.kraxel.org/blog/linux/fbida/;
pkgs/applications/networking/offrss/default.nix−1
@@ -13,7 +13,6 @@ stdenv.mkDerivation {
1313 preConfigure = ''
1414 sed 's/^PDF/#PDF/' -i Makefile
1515 '';
16− makeFlags = "CC=${stdenv.cross.config}-gcc";
1716 };
1817
1918 buildInputs = [ curl libmrss podofo ]
pkgs/applications/version-management/fossil/default.nix+1−1
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
3737
3838 crossAttrs = {
3939 doCheck = false;
40− makeFlagsArray = [ "TCC=${stdenv.cross.config}-gcc" ];
40+ makeFlags = [ "TCC=$CC" ];
4141 };
4242
4343 meta = {
pkgs/applications/video/omxplayer/default.nix+6−3
@@ -1,4 +1,7 @@
1−{ stdenv, fetchurl, raspberrypifw, pcre, boost, freetype, zlib }:
1+{ stdenv, fetchurl
2+, raspberrypifw, pcre, boost, freetype, zlib
3+, hostPlatform
4+}:
25
36let
47 ffmpeg = stdenv.mkDerivation rec {
@@ -46,10 +49,10 @@ let
4649 crossAttrs = {
4750 configurePlatforms = [];
4851 configureFlags = configureFlags ++ [
49− "--cross-prefix=${stdenv.cross.config}-"
52+ "--cross-prefix=${stdenv.cc.prefix}"
5053 "--enable-cross-compile"
5154 "--target_os=linux"
52− "--arch=${stdenv.cross.arch}"
55+ "--arch=${hostPlatform.arch}"
5356 ];
5457 };
5558
pkgs/build-support/cc-wrapper/default.nix+1−1
@@ -71,7 +71,7 @@ let
7171
7272 '' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) ''
7373 cat << 'EOF' >> $out
74− for CMD in ar as nm objcopy ranlib strip strings size ld
74+ for CMD in ar as nm objcopy ranlib strip strings size ld windres
7575 do
7676 # which is not part of stdenv, but compgen will do for now
7777 if
pkgs/build-support/gcc-wrapper-old/default.nix+16−10
@@ -8,6 +8,7 @@
88{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
99, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
1010, zlib ? null
11+, hostPlatform, targetPlatform
1112}:
1213
1314assert nativeTools -> nativePrefix != "";
@@ -69,9 +70,9 @@ stdenv.mkDerivation {
6970 # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
7071 # do this sufficient if/else.
7172 dynamicLinker =
72− (if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
73− if stdenv.cross.arch == "mips" then "ld.so.1" else
74− if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
73+ (if hostPlatform.arch == "arm" then "ld-linux.so.3" else
74+ if hostPlatform.arch == "mips" then "ld.so.1" else
75+ if stdenv.lib.hasSuffix "pc-gnu" hostPlatform.config then "ld.so.1" else
7576 abort "don't know the name of the dynamic linker for this platform");
7677 };
7778
@@ -85,15 +86,20 @@ stdenv.mkDerivation {
8586 + " (wrapper script)";
8687 };
8788
88− # The dynamic linker has different names on different Linux platforms.
89+ # The dynamic linker has different names on different platforms.
8990 dynamicLinker =
9091 if !nativeLibc then
91− (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
92− if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
92+ (if targetPlatform.system == "i686-linux" then "ld-linux.so.2" else
93+ if targetPlatform.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
9394 # ARM with a wildcard, which can be "" or "-armhf".
94− if stdenv.isArm then "ld-linux*.so.3" else
95− if stdenv.system == "powerpc-linux" then "ld.so.1" else
96− if stdenv.system == "mips64el-linux" then "ld.so.1" else
97− abort "don't know the name of the dynamic linker for this platform")
95+ if targetPlatform.isArm32 then "ld-linux*.so.3" else
96+ if targetPlatform.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else
97+ if targetPlatform.system == "powerpc-linux" then "ld.so.1" else
98+ if targetPlatform.system == "mips64el-linux" then "ld.so.1" else
99+ if targetPlatform.system == "x86_64-darwin" then "/usr/lib/dyld" else
100+ if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else
101+ builtins.trace
102+ "Don't know the name of the dynamic linker for platform ${targetPlatform.config}, so guessing instead."
103+ null)
98104 else "";
99105}
pkgs/build-support/kernel/make-initrd.nix+5−7
@@ -12,7 +12,9 @@
1212# `contents = {object = ...; symlink = /init;}' is a typical
1313# argument.
1414
15−{ stdenv, perl, cpio, contents, ubootChooser, compressor, prepend }:
15+{ stdenv, perl, cpio, contents, ubootChooser, compressor, prepend
16+, hostPlatform
17+}:
1618
1719let
1820 inputsFun = ubootName : [ perl cpio ]
@@ -22,9 +24,9 @@ in
2224stdenv.mkDerivation {
2325 name = "initrd";
2426 builder = ./make-initrd.sh;
25− nativeBuildInputs = inputsFun stdenv.platform.uboot;
27+ nativeBuildInputs = inputsFun hostPlatform.platform.uboot;
2628
27− makeUInitrd = makeUInitrdFun stdenv.platform.uboot;
29+ makeUInitrd = makeUInitrdFun hostPlatform.platform.uboot;
2830
2931 # !!! should use XML.
3032 objects = map (x: x.object) contents;
@@ -36,9 +38,5 @@ stdenv.mkDerivation {
3638 map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
3739 pathsFromGraph = ./paths-from-graph.pl;
3840
39− crossAttrs = {
40− nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
41− makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
42− };
4341 inherit compressor prepend;
4442}
pkgs/development/interpreters/guile/2.0.nix+4−2
@@ -1,5 +1,7 @@
11{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2−, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }:
2+, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
3+, hostPlatform
4+}:
35
46# Do either a coverage analysis build or a standard build.
57(if coverageAnalysis != null
@@ -84,7 +86,7 @@
8486 setupHook = ./setup-hook-2.0.sh;
8587
8688 crossAttrs.preConfigure =
87− stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
89+ stdenv.lib.optionalString (hostPlatform.isHurd)
8890 # On GNU, libgc depends on libpthread, but the cross linker doesn't
8991 # know where to find libpthread, which leads to erroneous test failures
9092 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
pkgs/development/interpreters/guile/default.nix+4−2
@@ -1,5 +1,7 @@
11{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2−, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }:
2+, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
3+, hostPlatform
4+}:
35
46# Do either a coverage analysis build or a standard build.
57(if coverageAnalysis != null
@@ -80,7 +82,7 @@
8082 setupHook = ./setup-hook-2.2.sh;
8183
8284 crossAttrs.preConfigure =
83− stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
85+ stdenv.lib.optionalString (hostPlatform.isHurd)
8486 # On GNU, libgc depends on libpthread, but the cross linker doesn't
8587 # know where to find libpthread, which leads to erroneous test failures
8688 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
pkgs/development/interpreters/lua-5/5.2.nix+4−8
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, readline, compat ? false }:
1+{ stdenv, fetchurl, readline, compat ? false
2+, hostPlatform
3+}:
24
35let
46 dsoPatch = fetchurl {
@@ -55,21 +57,15 @@ stdenv.mkDerivation rec {
5557 '';
5658
5759 crossAttrs = let
58− isMingw = stdenv.cross.libc == "msvcrt";
59− isDarwin = stdenv.cross.libc == "libSystem";
60+ inherit (hostPlatform) isDarwin isMingw;
6061 in {
6162 configurePhase = ''
6263 makeFlagsArray=(
6364 INSTALL_TOP=$out
6465 INSTALL_MAN=$out/share/man/man1
65− CC=${stdenv.cross.config}-gcc
66− STRIP=:
67− RANLIB=${stdenv.cross.config}-ranlib
6866 V=${luaversion}
6967 R=${version}
7068 ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
71− AR="${stdenv.cross.config}-ar rcu"
72− macosx
7369 ''}
7470 )
7571 '' + stdenv.lib.optionalString isMingw ''
pkgs/development/interpreters/lua-5/5.3.nix+4−8
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, readline, compat ? false }:
1+{ stdenv, fetchurl, readline, compat ? false
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "lua-${version}";
@@ -54,21 +56,15 @@ stdenv.mkDerivation rec {
5456 '';
5557
5658 crossAttrs = let
57− isMingw = stdenv.cross.libc == "msvcrt";
58− isDarwin = stdenv.cross.libc == "libSystem";
59+ inherit (hostPlatform) isDarwin isMingw;
5960 in {
6061 configurePhase = ''
6162 makeFlagsArray=(
6263 INSTALL_TOP=$out
6364 INSTALL_MAN=$out/share/man/man1
64− CC=${stdenv.cross.config}-gcc
65− STRIP=:
66− RANLIB=${stdenv.cross.config}-ranlib
6765 V=${luaversion}
6866 R=${version}
6967 ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
70− AR="${stdenv.cross.config}-ar rcu"
71− macosx
7268 ''}
7369 )
7470 '' + stdenv.lib.optionalString isMingw ''
pkgs/development/libraries/SDL/default.nix+6−6
@@ -1,14 +1,15 @@
11{ stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap
22, openglSupport ? false, mesa_noglu, mesa_glu
33, alsaSupport ? true, alsaLib
4−, x11Support ? true, libXext, libICE, libXrandr
4+, x11Support ? hostPlatform == buildPlatform, libXext, libICE, libXrandr
55, pulseaudioSupport ? true, libpulseaudio
66, OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa
7+, hostPlatform, buildPlatform
78}:
89
910# OSS is no longer supported, for it's much crappier than ALSA and
1011# PulseAudio.
11−assert (stdenv.isLinux && !(stdenv ? cross)) -> alsaSupport || pulseaudioSupport;
12+assert hostPlatform.isLinux -> alsaSupport || pulseaudioSupport;
1213
1314let
1415 inherit (stdenv.lib) optional optionals;
@@ -37,7 +38,7 @@ stdenv.mkDerivation rec {
3738 optional stdenv.isDarwin Cocoa;
3839
3940 buildInputs = let
40− notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt";
41+ notMingw = !hostPlatform.isMinGW;
4142 in optional notMingw audiofile
4243 ++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ];
4344
@@ -52,9 +53,8 @@ stdenv.mkDerivation rec {
5253 "--enable-rpath"
5354 "--disable-pulseaudio-shared"
5455 "--disable-osmesa-shared"
55− ] ++ optionals (stdenv ? cross) ([
56− "--without-x"
57− ] ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib");
56+ ] ++ optional (!x11Support) "--without-x"
57+ ++ optional (alsaSupport && hostPlatform != buildPlatform) "--with-alsa-prefix=${alsaLib.out}/lib";
5858
5959 patches = [
6060 # Fix window resizing issues, e.g. for xmonad
pkgs/development/libraries/boehm-gc/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ lib, stdenv, fetchurl, pkgconfig, libatomic_ops, enableLargeConfig ? false }:
1+{ lib, stdenv, fetchurl, pkgconfig, libatomic_ops, enableLargeConfig ? false
2+, buildPlatform, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "boehm-gc-7.6.0";
@@ -20,7 +22,7 @@ stdenv.mkDerivation rec {
2022 doCheck = true;
2123
2224 # Don't run the native `strip' when cross-compiling.
23− dontStrip = stdenv ? cross;
25+ dontStrip = hostPlatform != buildPlatform;
2426
2527 postInstall =
2628 ''
pkgs/development/libraries/boost/generic.nix+9−8
@@ -1,10 +1,11 @@
11{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
2+, buildPlatform, hostPlatform
23, toolset ? if stdenv.cc.isClang then "clang" else null
34, enableRelease ? true
45, enableDebug ? false
56, enableSingleThreaded ? false
67, enableMultiThreaded ? true
7−, enableShared ? !(stdenv.cross.libc or null == "msvcrt") # problems for now
8+, enableShared ? !(hostPlatform.libc == "msvcrt") # problems for now
89, enableStatic ? !enableShared
910, enablePIC ? false
1011, enableExceptions ? false
@@ -76,11 +77,11 @@ let
7677 "--user-config=user-config.jam"
7778 "toolset=gcc-cross"
7879 "--without-python"
79− ] ++ optionals (stdenv.cross.libc == "msvcrt") [
80+ ] ++ optionals (hostPlatform.libc == "msvcrt") [
8081 "target-os=windows"
8182 "threadapi=win32"
8283 "binary-format=pe"
83− "address-model=${if hasPrefix "x86_64-" stdenv.cross.config then "64" else "32"}"
84+ "address-model=${toString hostPlatform.parsed.cpu.bits}"
8485 "architecture=x86"
8586 ];
8687 crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
@@ -110,8 +111,8 @@ let
110111 find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
111112 -exec sed '1i#line 1 "{}"' -i '{}' \;
112113 )
113− '' + optionalString (stdenv.cross.libc or null == "msvcrt") ''
114− ${stdenv.cross.config}-ranlib "$out/lib/"*.a
114+ '' + optionalString (hostPlatform.libc == "msvcrt") ''
115+ ${stdenv.cc.prefix}ranlib "$out/lib/"*.a
115116 '';
116117
117118in
@@ -147,13 +148,13 @@ stdenv.mkDerivation {
147148 enableParallelBuilding = true;
148149
149150 buildInputs = [ expat zlib bzip2 libiconv ]
150− ++ stdenv.lib.optionals (! stdenv ? cross) [ python icu ]
151+ ++ stdenv.lib.optionals (hostPlatform == buildPlatform) [ python icu ]
151152 ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
152153
153154 configureScript = "./bootstrap.sh";
154155 configureFlags = commonConfigureFlags
155156 ++ [ "--with-python=${python.interpreter}" ]
156− ++ optional (! stdenv ? cross) "--with-icu=${icu.dev}"
157+ ++ optional (hostPlatform == buildPlatform) "--with-icu=${icu.dev}"
157158 ++ optional (toolset != null) "--with-toolset=${toolset}";
158159
159160 buildPhase = builder nativeB2Args;
@@ -177,7 +178,7 @@ stdenv.mkDerivation {
177178 buildPhase = builder crossB2Args;
178179 installPhase = installer crossB2Args;
179180 postFixup = fixup;
180− } // optionalAttrs (stdenv.cross.libc == "msvcrt") {
181+ } // optionalAttrs (hostPlatform.libc == "msvcrt") {
181182 patches = fetchurl {
182183 url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
183184 + "boost-mingw.patch";
pkgs/development/libraries/ffmpeg-full/default.nix+5−21
@@ -1,4 +1,5 @@
11{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
2+, hostPlatform
23/*
34 * Licensing options (yes some are listed twice, filters and such are not listed)
45 */
@@ -428,30 +429,13 @@ stdenv.mkDerivation rec {
428429
429430 /* Cross-compilation is untested, consider this an outline, more work
430431 needs to be done to portions of the build to get it to work correctly */
431− crossAttrs = let
432− os = ''
433− if [ "${stdenv.cross.config}" = "*cygwin*" ] ; then
434− # Probably should look for mingw too
435− echo "cygwin"
436− elif [ "${stdenv.cross.config}" = "*darwin*" ] ; then
437− echo "darwin"
438− elif [ "${stdenv.cross.config}" = "*freebsd*" ] ; then
439− echo "freebsd"
440− elif [ "${stdenv.cross.config}" = "*linux*" ] ; then
441− echo "linux"
442− elif [ "${stdenv.cross.config}" = "*netbsd*" ] ; then
443− echo "netbsd"
444− elif [ "${stdenv.cross.config}" = "*openbsd*" ] ; then
445− echo "openbsd"
446− fi
447− '';
448− in {
432+ crossAttrs = {
449433 configurePlatforms = [];
450434 configureFlags = configureFlags ++ [
451− "--cross-prefix=${stdenv.cross.config}-"
435+ "--cross-prefix=${stdenv.cc.prefix}"
452436 "--enable-cross-compile"
453− "--target_os=${os}"
454− "--arch=${stdenv.cross.arch}"
437+ "--target_os=${hostPlatform.parsed.kernel.name}"
438+ "--arch=${hostPlatform.arch}"
455439 ];
456440 };
457441
pkgs/development/libraries/ffmpeg/generic.nix+5−21
@@ -2,6 +2,7 @@
22, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
33, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
44, x264, x265, xvidcore, zlib, libopus
5+, hostPlatform
56, openglSupport ? false, mesa ? null
67# Build options
78, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
@@ -169,30 +170,13 @@ stdenv.mkDerivation rec {
169170
170171 /* Cross-compilation is untested, consider this an outline, more work
171172 needs to be done to portions of the build to get it to work correctly */
172− crossAttrs = let
173− os = ''
174− if [ "${stdenv.cross.config}" = "*cygwin*" ] ; then
175− # Probably should look for mingw too
176− echo "cygwin"
177− elif [ "${stdenv.cross.config}" = "*darwin*" ] ; then
178− echo "darwin"
179− elif [ "${stdenv.cross.config}" = "*freebsd*" ] ; then
180− echo "freebsd"
181− elif [ "${stdenv.cross.config}" = "*linux*" ] ; then
182− echo "linux"
183− elif [ "${stdenv.cross.config}" = "*netbsd*" ] ; then
184− echo "netbsd"
185− elif [ "${stdenv.cross.config}" = "*openbsd*" ] ; then
186− echo "openbsd"
187− fi
188− '';
189− in {
173+ crossAttrs = {
190174 configurePlatforms = [];
191175 configureFlags = configureFlags ++ [
192− "--cross-prefix=${stdenv.cross.config}-"
176+ "--cross-prefix=${stdenv.cc.prefix}"
193177 "--enable-cross-compile"
194− "--target_os=${os}"
195− "--arch=${stdenv.cross.arch}"
178+ "--target_os=${hostPlatform.parsed.kernel}"
179+ "--arch=${hostPlatform.arch}"
196180 ];
197181 };
198182
pkgs/development/libraries/fontconfig/2.10.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, pkgconfig, freetype, expat }:
1+{ stdenv, fetchurl, pkgconfig, freetype, expat
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "fontconfig-2.10.2";
@@ -21,7 +23,7 @@ stdenv.mkDerivation rec {
2123 ];
2224
2325 # We should find a better way to access the arch reliably.
24− crossArch = stdenv.cross.arch or null;
26+ crossArch = hostPlatform.arch or null;
2527
2628 preConfigure = ''
2729 if test -n "$crossConfig"; then
pkgs/development/libraries/fontconfig/default.nix+5−3
@@ -1,5 +1,7 @@
1−{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, dejavu_fonts
2−, substituteAll }:
1+{ stdenv, substituteAll, fetchurl, fetchpatch
2+, pkgconfig, freetype, expat, libxslt, dejavu_fonts
3+, hostPlatform
4+}:
35
46/** Font configuration scheme
57 - ./config-compat.patch makes fontconfig try the following root configs, in order:
@@ -53,7 +55,7 @@ stdenv.mkDerivation rec {
5355 ];
5456
5557 # We should find a better way to access the arch reliably.
56− crossArch = stdenv.cross.arch or null;
58+ crossArch = hostPlatform.arch or null;
5759
5860 preConfigure = ''
5961 if test -n "$crossConfig"; then
pkgs/development/libraries/freetype/default.nix+7−7
@@ -1,12 +1,12 @@
1−{
2− stdenv, lib, fetchurl, copyPathsToStore,
3− pkgconfig, which,
4− zlib, bzip2, libpng, gnumake, glib,
1+{ stdenv, lib, fetchurl, copyPathsToStore
2+, hostPlatform
3+, pkgconfig, which
4+, zlib, bzip2, libpng, gnumake, glib
55
6− # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
6+, # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
77 # LCD filtering is also known as ClearType and covered by several Microsoft patents.
88 # This option allows it to be disabled. See http://www.freetype.org/patents.html.
9− useEncumberedCode ? true,
9+ useEncumberedCode ? true
1010}:
1111
1212let
@@ -67,7 +67,7 @@ in stdenv.mkDerivation {
6767
6868 postInstall = glib.flattenInclude;
6969
70− crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc or null != "msvcrt") {
70+ crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc or null != "msvcrt") {
7171 # Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
7272 # of gcc. I think it's due to the unwrapped gcc being in the PATH. I don't
7373 # know why it's on the PATH.
pkgs/development/libraries/glew/1.10.nix+7−9
@@ -1,5 +1,7 @@
11{ stdenv, fetchurl, mesa_glu, x11, libXmu, libXi
2−, AGL ? null }:
2+, buildPlatform, hostPlatform
3+, AGL ? null
4+}:
35
46with stdenv.lib;
57
@@ -17,7 +19,7 @@ stdenv.mkDerivation rec {
1719
1820 patchPhase = ''
1921 sed -i 's|lib64|lib|' config/Makefile.linux
20− ${optionalString (stdenv ? cross) ''
22+ ${optionalString (hostPlatform != buildPlatform) ''
2123 sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
2224 ''}
2325 '';
@@ -36,13 +38,9 @@ stdenv.mkDerivation rec {
3638 cp -r README.txt LICENSE.txt doc $out/share/doc/glew
3739 '';
3840
39− crossAttrs.makeFlags = [
40− "CC=${stdenv.cross.config}-gcc"
41− "LD=${stdenv.cross.config}-gcc"
42− "AR=${stdenv.cross.config}-ar"
43− "STRIP="
44− ] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"
45− ++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin";
41+ makeFlags = if hostPlatform == buildPlatform then null else [
42+ "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
43+ ];
4644
4745 meta = with stdenv.lib; {
4846 description = "An OpenGL extension loading library for C(++)";
pkgs/development/libraries/glew/default.nix+7−9
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi }:
1+{ stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi
2+, buildPlatform, hostPlatform
3+}:
24
35with stdenv.lib;
46
@@ -17,7 +19,7 @@ stdenv.mkDerivation rec {
1719
1820 patchPhase = ''
1921 sed -i 's|lib64|lib|' config/Makefile.linux
20− ${optionalString (stdenv ? cross) ''
22+ ${optionalString (hostPlatform != buildPlatform) ''
2123 sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
2224 ''}
2325 '';
@@ -37,13 +39,9 @@ stdenv.mkDerivation rec {
3739 rm $out/lib/*.a
3840 '';
3941
40− crossAttrs.makeFlags = [
41− "CC=${stdenv.cross.config}-gcc"
42− "LD=${stdenv.cross.config}-gcc"
43− "AR=${stdenv.cross.config}-ar"
44− "STRIP="
45− ] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"
46− ++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin";
42+ makeFlags = if hostPlatform == buildPlatform then null else [
43+ "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
44+ ];
4745
4846 meta = with stdenv.lib; {
4947 description = "An OpenGL extension loading library for C(++)";
pkgs/development/libraries/libav/default.nix+3−2
@@ -13,6 +13,7 @@
1313, SDL # only for avplay in $bin, adds nontrivial closure to it
1414, enableGPL ? true # ToDo: some additional default stuff may need GPL
1515, enableUnfree ? faacSupport
16+, hostPlatform
1617}:
1718
1819assert faacSupport -> enableUnfree;
@@ -107,10 +108,10 @@ let
107108 crossAttrs = {
108109 configurePlatforms = [];
109110 configureFlags = configureFlags ++ [
110− "--cross-prefix=${stdenv.cross.config}-"
111+ "--cross-prefix=${stdenv.cc.prefix}"
111112 "--enable-cross-compile"
112113 "--target_os=linux"
113− "--arch=${stdenv.cross.arch}"
114+ "--arch=${hostPlatform.arch}"
114115 ];
115116 };
116117
pkgs/development/libraries/libffi/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ fetchurl, stdenv, dejagnu, doCheck ? false }:
1+{ fetchurl, stdenv, dejagnu, doCheck ? false
2+, buildPlatform, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "libffi-3.2.1";
@@ -21,7 +23,7 @@ stdenv.mkDerivation rec {
2123
2224 inherit doCheck;
2325
24− dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling.
26+ dontStrip = hostPlatform != buildPlatform; # Don't run the native `strip' when cross-compiling.
2527
2628 # Install headers and libs in the right places.
2729 postFixup = ''
pkgs/development/libraries/libiconv/default.nix+5−3
@@ -1,6 +1,8 @@
1−{ fetchurl, stdenv, lib }:
1+{ fetchurl, stdenv, lib
2+, buildPlatform, hostPlatform
3+}:
24
3−assert !stdenv.isLinux || stdenv ? cross; # TODO: improve on cross
5+assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross
46
57stdenv.mkDerivation rec {
68 name = "libiconv-${version}";
@@ -12,7 +14,7 @@ stdenv.mkDerivation rec {
1214 };
1315
1416 postPatch =
15− lib.optionalString ((stdenv ? cross && stdenv.cross.libc == "msvcrt") || stdenv.cc.nativeLibc)
17+ lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
1618 ''
1719 sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
1820 '';
pkgs/development/libraries/libjpeg-turbo/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, nasm }:
1+{ stdenv, fetchurl, nasm
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "libjpeg-turbo-${version}";
@@ -10,7 +12,7 @@ stdenv.mkDerivation rec {
1012 }; # github releases still need autotools, surprisingly
1113
1214 patches =
13− stdenv.lib.optional (stdenv.cross.libc or null == "msvcrt")
15+ stdenv.lib.optional (hostPlatform.libc or null == "msvcrt")
1416 ./mingw-boolean.patch;
1517
1618 outputs = [ "bin" "dev" "out" "doc" ];
pkgs/development/libraries/libmsgpack/generic.nix+2−1
@@ -1,5 +1,6 @@
11{ stdenv, cmake
22, version, src, patches ? [ ]
3+, hostPlatform
34, ...
45}:
56
@@ -11,7 +12,7 @@ stdenv.mkDerivation rec {
1112 nativeBuildInputs = [ cmake ];
1213
1314 crossAttrs = {
14− } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
15+ } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
1516 cmakeFlags = "-DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_SYSTEM_NAME=Windows";
1617 };
1718
pkgs/development/libraries/libpng/12.nix+5−3
@@ -1,6 +1,8 @@
1−{ stdenv, fetchurl, zlib }:
1+{ stdenv, fetchurl, zlib
2+, buildPlatform, hostPlatform
3+}:
24
3−assert !(stdenv ? cross) -> zlib != null;
5+assert hostPlatform == buildPlatform -> zlib != null;
46
57stdenv.mkDerivation rec {
68 name = "libpng-1.2.57";
@@ -16,7 +18,7 @@ stdenv.mkDerivation rec {
1618
1719 passthru = { inherit zlib; };
1820
19− crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") {
21+ crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc == "libSystem") {
2022 propagatedBuildInputs = [];
2123 passthru = {};
2224 };
pkgs/development/libraries/libpng/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, zlib, apngSupport ? true }:
1+{ stdenv, fetchurl, zlib, apngSupport ? true
2+, buildPlatform, hostPlatform
3+}:
24
35assert zlib != null;
46
@@ -29,7 +31,7 @@ in stdenv.mkDerivation rec {
2931
3032 # it's hard to cross-run tests and some check programs didn't compile anyway
3133 makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS=";
32− doCheck = ! stdenv ? cross;
34+ doCheck = hostPlatform == buildPlatform;
3335
3436 passthru = { inherit zlib; };
3537
pkgs/development/libraries/libssh2/default.nix+4−2
@@ -1,4 +1,6 @@
1−{stdenv, fetchurlBoot, openssl, zlib, windows}:
1+{ stdenv, fetchurlBoot, openssl, zlib, windows
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "libssh2-1.8.0";
@@ -20,7 +22,7 @@ stdenv.mkDerivation rec {
2022 "--with-libz"
2123 "--with-libz-prefix=${zlib.crossDrv}"
2224 ];
23− } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
25+ } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
2426 # mingw needs import library of ws2_32 to build the shared library
2527 preConfigure = ''
2628 export LDFLAGS="-L${windows.mingw_w64}/lib $LDFLAGS"
pkgs/development/libraries/libvpx/default.nix+14−16
@@ -1,4 +1,5 @@
1−{stdenv, fetchFromGitHub, perl, yasm
1+{ stdenv, fetchFromGitHub, perl, yasm
2+, hostPlatform
23, vp8DecoderSupport ? true # VP8 decoder
34, vp8EncoderSupport ? true # VP8 encoder
45, vp9DecoderSupport ? true # VP9 decoder
@@ -144,10 +145,7 @@ stdenv.mkDerivation rec {
144145
145146 postInstall = ''moveToOutput bin "$bin" '';
146147
147− crossAttrs = let
148− isCygwin = stdenv.cross.libc == "msvcrt";
149− isDarwin = stdenv.cross.libc == "libSystem";
150− in {
148+ crossAttrs = {
151149 configurePlatforms = [];
152150 configureFlags = configureFlags ++ [
153151 #"--extra-cflags="
@@ -159,17 +157,17 @@ stdenv.mkDerivation rec {
159157 # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version)
160158 # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure
161159 # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14
162− "--force-target=${stdenv.cross.config}${(
163− if isDarwin then (
164− if stdenv.cross.osxMinVersion == "10.10" then "14"
165− else if stdenv.cross.osxMinVersion == "10.9" then "13"
166− else if stdenv.cross.osxMinVersion == "10.8" then "12"
167− else if stdenv.cross.osxMinVersion == "10.7" then "11"
168− else if stdenv.cross.osxMinVersion == "10.6" then "10"
169− else if stdenv.cross.osxMinVersion == "10.5" then "9"
170− else "8")
171− else "")}-gcc"
172− (if isCygwin then "--enable-static-msvcrt" else "")
160+ "--force-target=${hostPlatform.config}${
161+ if hostPlatform.isDarwin then
162+ if hostPlatform.osxMinVersion == "10.10" then "14"
163+ else if hostPlatform.osxMinVersion == "10.9" then "13"
164+ else if hostPlatform.osxMinVersion == "10.8" then "12"
165+ else if hostPlatform.osxMinVersion == "10.7" then "11"
166+ else if hostPlatform.osxMinVersion == "10.6" then "10"
167+ else if hostPlatform.osxMinVersion == "10.5" then "9"
168+ else "8"
169+ else ""}-gcc"
170+ (if hostPlatform.isCygwin then "--enable-static-msvcrt" else "")
173171 ];
174172 };
175173
pkgs/development/libraries/libvpx/git.nix+14−16
@@ -1,4 +1,5 @@
1−{stdenv, fetchgit, perl, yasm
1+{ stdenv, fetchgit, perl, yasm
2+, hostPlatform
23, vp8DecoderSupport ? true # VP8 decoder
34, vp8EncoderSupport ? true # VP8 encoder
45, vp9DecoderSupport ? true # VP9 decoder
@@ -152,10 +153,7 @@ stdenv.mkDerivation rec {
152153
153154 postInstall = ''moveToOutput bin "$bin" '';
154155
155− crossAttrs = let
156− isCygwin = stdenv.cross.libc == "msvcrt";
157− isDarwin = stdenv.cross.libc == "libSystem";
158− in {
156+ crossAttrs = {
159157 configurePlatforms = [];
160158 configureFlags = configureFlags ++ [
161159 #"--extra-cflags="
@@ -166,17 +164,17 @@ stdenv.mkDerivation rec {
166164 # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version)
167165 # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure
168166 # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14
169− "--force-target=${stdenv.cross.config}${(
170− if isDarwin then (
171− if stdenv.cross.osxMinVersion == "10.10" then "14"
172− else if stdenv.cross.osxMinVersion == "10.9" then "13"
173− else if stdenv.cross.osxMinVersion == "10.8" then "12"
174− else if stdenv.cross.osxMinVersion == "10.7" then "11"
175− else if stdenv.cross.osxMinVersion == "10.6" then "10"
176− else if stdenv.cross.osxMinVersion == "10.5" then "9"
177− else "8")
178− else "")}-gcc"
179− (if isCygwin then "--enable-static-msvcrt" else "")
167+ "--force-target=${hostPlatform.config}${
168+ if hostPlatform.isDarwin then
169+ if hostPlatform.osxMinVersion == "10.10" then "14"
170+ else if hostPlatform.osxMinVersion == "10.9" then "13"
171+ else if hostPlatform.osxMinVersion == "10.8" then "12"
172+ else if hostPlatform.osxMinVersion == "10.7" then "11"
173+ else if hostPlatform.osxMinVersion == "10.6" then "10"
174+ else if hostPlatform.osxMinVersion == "10.5" then "9"
175+ else "8"
176+ else ""}-gcc"
177+ (if hostPlatform.isCygwin then "--enable-static-msvcrt" else "")
180178 ];
181179 };
182180
pkgs/development/libraries/libxml2/default.nix+5−3
@@ -1,7 +1,9 @@
11{ stdenv, lib, fetchurl, fetchpatch
22, zlib, xz, python2, findXMLCatalogs, libiconv
3−, pythonSupport ? (! stdenv ? cross)
4−, icuSupport ? false, icu ? null }:
3+, buildPlatform, hostPlatform
4+, pythonSupport ? buildPlatform == hostPlatform
5+, icuSupport ? false, icu ? null
6+}:
57
68let
79 python = python2;
@@ -45,7 +47,7 @@ in stdenv.mkDerivation rec {
4547
4648 doCheck = !stdenv.isDarwin;
4749
48− crossAttrs = lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
50+ crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
4951 # creating the DLL is broken ATM
5052 dontDisableStatic = true;
5153 configureFlags = configureFlags ++ [ "--disable-shared" ];
pkgs/development/libraries/libxslt/default.nix+3−2
@@ -1,6 +1,7 @@
1−{ stdenv, hostPlatform, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2
1+{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2
2+, buildPlatform, hostPlatform
23, cryptoSupport ? false
3−, pythonSupport ? (! stdenv ? cross)
4+, pythonSupport ? buildPlatform == hostPlatform
45}:
56
67assert pythonSupport -> python2 != null;
pkgs/development/libraries/newt/default.nix+1−1
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
1717 NIX_LDFLAGS = "-lncurses";
1818
1919 crossAttrs = {
20− makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-";
20+ makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}";
2121 };
2222
2323 meta = with stdenv.lib; {
pkgs/development/libraries/nlohmann_json/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchFromGitHub, cmake }:
1+{ stdenv, fetchFromGitHub, cmake
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "nlohmann_json-${version}";
@@ -21,7 +23,7 @@ stdenv.mkDerivation rec {
2123 crossAttrs = {
2224 cmakeFlags = "-DBuildTests=OFF";
2325 doCheck = false;
24− } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
26+ } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
2527 cmakeFlags = "-DBuildTests=OFF -DCMAKE_SYSTEM_NAME=Windows";
2628 };
2729
pkgs/development/libraries/openssl/default.nix+5−8
@@ -1,12 +1,14 @@
11{ stdenv, fetchurl, buildPackages, perl
2+, hostPlatform
23, withCryptodev ? false, cryptodevHeaders
3−, enableSSL2 ? false }:
4+, enableSSL2 ? false
5+}:
46
57with stdenv.lib;
68
79let
810
9− opensslCrossSystem = stdenv.cross.openssl.system or
11+ opensslCrossSystem = hostPlatform.openssl.system or
1012 (throw "openssl needs its platform name cross building");
1113
1214 common = args@{ version, sha256, patches ? [] }: stdenv.mkDerivation rec {
@@ -22,8 +24,7 @@ let
2224 ++ [ ./nix-ssl-cert-file.patch ]
2325 ++ optional (versionOlder version "1.1.0")
2426 (if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch)
25− ++ optional
26− (versionOlder version "1.0.2" && (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")))
27+ ++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin)
2728 ./darwin-arch.patch;
2829
2930 outputs = [ "bin" "dev" "out" "man" ];
@@ -88,10 +89,6 @@ let
8889 preConfigure=''
8990 # It's configure does not like --build or --host
9091 export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}"
91− # WINDRES and RANLIB need to be prefixed when cross compiling;
92− # the openssl configure script doesn't do that for us
93− export WINDRES=${stdenv.cross.config}-windres
94− export RANLIB=${stdenv.cross.config}-ranlib
9592 '';
9693 configureScript = "./Configure";
9794 };
pkgs/development/libraries/poppler/default.nix+2−1
@@ -6,6 +6,7 @@
66, introspectionSupport ? false, gobjectIntrospection ? null
77, utils ? false
88, minimal ? false, suffix ? "glib"
9+, hostPlatform
910}:
1011
1112let # beware: updates often break cups-filters build
@@ -56,7 +57,7 @@ stdenv.mkDerivation rec {
5657
5758 crossAttrs.postPatch =
5859 # there are tests using `strXXX_s` functions that are missing apparently
59− stdenv.lib.optionalString (stdenv.cross.libc or null == "msvcrt")
60+ stdenv.lib.optionalString (hostPlatform.libc or null == "msvcrt")
6061 "sed '/^SUBDIRS =/s/ test / /' -i Makefile.in";
6162
6263 meta = with lib; {
pkgs/development/libraries/qt-4.x/4.8/default.nix+9−10
@@ -1,4 +1,5 @@
11{ stdenv, fetchurl, fetchpatch, substituteAll
2+, hostPlatform
23, libXrender, libXinerama, libXcursor, libXmu, libXv, libXext
34, libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
45, libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
@@ -182,9 +183,7 @@ stdenv.mkDerivation rec {
182183 rm -rf $out/tests
183184 '';
184185
185− crossAttrs = let
186− isMingw = stdenv.cross.libc == "msvcrt";
187− in {
186+ crossAttrs = {
188187 # I've not tried any case other than i686-pc-mingw32.
189188 # -nomake tools: it fails linking some asian language symbols
190189 # -no-svg: it fails to build on mingw64
@@ -194,14 +193,14 @@ stdenv.mkDerivation rec {
194193 -no-svg
195194 -make qmake -make libs -nomake tools
196195 -nomake demos -nomake examples -nomake docs
197− '' + optionalString isMingw " -xplatform win32-g++-4.6";
196+ '' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6";
198197 patches = [];
199198 preConfigure = ''
200− sed -i -e 's/ g++/ ${stdenv.cross.config}-g++/' \
201− -e 's/ gcc/ ${stdenv.cross.config}-gcc/' \
202− -e 's/ ar/ ${stdenv.cross.config}-ar/' \
203− -e 's/ strip/ ${stdenv.cross.config}-strip/' \
204− -e 's/ windres/ ${stdenv.cross.config}-windres/' \
199+ sed -i -e 's/ g++/ ${stdenv.cc.prefix}g++/' \
200+ -e 's/ gcc/ ${stdenv.cc.prefix}gcc/' \
201+ -e 's/ ar/ ${stdenv.cc.prefix}ar/' \
202+ -e 's/ strip/ ${stdenv.cc.prefix}strip/' \
203+ -e 's/ windres/ ${stdenv.cc.prefix}windres/' \
205204 mkspecs/win32-g++/qmake.conf
206205 '';
207206
@@ -211,7 +210,7 @@ stdenv.mkDerivation rec {
211210 '';
212211 configurePlatforms = [];
213212 dontStrip = true;
214− } // optionalAttrs isMingw {
213+ } // optionalAttrs hostPlatform.isMinGW {
215214 propagatedBuildInputs = [ ];
216215 };
217216
pkgs/development/libraries/readline/6.2.nix+4−2
@@ -1,4 +1,6 @@
1−{ fetchurl, stdenv, ncurses }:
1+{ fetchurl, stdenv, ncurses
2+, buildPlatform, hostPlatform
3+}:
24
35stdenv.mkDerivation (rec {
46 name = "readline-6.2";
@@ -57,6 +59,6 @@ stdenv.mkDerivation (rec {
5759//
5860
5961# Don't run the native `strip' when cross-compiling.
60−(if (stdenv ? cross)
62+(if hostPlatform != buildPlatform
6163 then { dontStrip = true; }
6264 else { }))
pkgs/development/libraries/readline/6.3.nix+4−2
@@ -1,4 +1,6 @@
1−{ fetchurl, stdenv, ncurses }:
1+{ fetchurl, stdenv, ncurses
2+, buildPlatform, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "readline-6.3p08";
@@ -29,7 +31,7 @@ stdenv.mkDerivation rec {
2931 import ./readline-6.3-patches.nix patch);
3032
3133 # Don't run the native `strip' when cross-compiling.
32− dontStrip = stdenv ? cross;
34+ dontStrip = hostPlatform != buildPlatform;
3335 bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
3436
3537 meta = with stdenv.lib; {
pkgs/development/libraries/readline/7.0.nix+4−2
@@ -1,4 +1,6 @@
1−{ fetchurl, stdenv, ncurses }:
1+{ fetchurl, stdenv, ncurses
2+, buildPlatform, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "readline-${version}";
@@ -33,7 +35,7 @@ stdenv.mkDerivation rec {
3335 */
3436
3537 # Don't run the native `strip' when cross-compiling.
36− dontStrip = stdenv ? cross;
38+ dontStrip = hostPlatform != buildPlatform;
3739 bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
3840
3941 meta = with stdenv.lib; {
pkgs/development/libraries/zlib/default.nix+2−4
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
6262 crossAttrs = {
6363 dontStrip = static;
6464 configurePlatforms = [];
65− } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
65+ } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
6666 installFlags = [
6767 "BINARY_PATH=$(out)/bin"
6868 "INCLUDE_PATH=$(dev)/include"
@@ -70,14 +70,12 @@ stdenv.mkDerivation rec {
7070 ];
7171 makeFlags = [
7272 "-f" "win32/Makefile.gcc"
73− "PREFIX=${stdenv.cross.config}-"
73+ "PREFIX=${stdenv.cc.prefix}"
7474 ] ++ stdenv.lib.optional (!static) "SHARED_MODE=1";
7575
7676 # Non-typical naming confuses libtool which then refuses to use zlib's DLL
7777 # in some cases, e.g. when compiling libpng.
7878 postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll";
79− } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") {
80− makeFlags = [ "RANLIB=${stdenv.cross.config}-ranlib" ];
8179 };
8280
8381 passthru.version = version;
pkgs/development/tools/build-managers/cmake/2.8.nix+2−1
@@ -1,5 +1,6 @@
11{ stdenv, fetchurl, fetchpatch, replace, curl, expat, zlib, bzip2
22, useNcurses ? false, ncurses, useQt4 ? false, qt4, wantPS ? false, ps ? null
3+, buildPlatform, hostPlatform
34}:
45
56with stdenv.lib;
@@ -35,7 +36,7 @@ stdenv.mkDerivation rec {
3536 })] ++
3637 # Don't search in non-Nix locations such as /usr, but do search in our libc.
3738 [ ./search-path.patch ] ++
38− optional (stdenv ? cross) (fetchurl {
39+ optional (hostPlatform != buildPlatform) (fetchurl {
3940 name = "fix-darwin-cross-compile.patch";
4041 url = "http://public.kitware.com/Bug/file_download.php?"
4142 + "file_id=4981&type=bug";
pkgs/development/tools/misc/libtool/libtool2.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, m4, perl, help2man }:
1+{ stdenv, fetchurl, m4, perl, help2man
2+, buildPlatform, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "libtool-2.4.6";
@@ -23,7 +25,7 @@ stdenv.mkDerivation rec {
2325
2426 # Don't run the native `strip' when cross-compiling. This breaks at least
2527 # with `.a' files for MinGW.
26− dontStrip = stdenv ? cross;
28+ dontStrip = hostPlatform != buildPlatform;
2729
2830 meta = {
2931 description = "GNU Libtool, a generic library support script";
pkgs/games/scummvm/default.nix+5−2
@@ -1,4 +1,7 @@
1−{ stdenv, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib, mesa }:
1+{ stdenv
2+, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib, mesa
3+, hostPlatform
4+}:
25
36stdenv.mkDerivation rec {
47 name = "scummvm-1.9.0";
@@ -16,7 +19,7 @@ stdenv.mkDerivation rec {
1619 preConfigure = ''
1720 # Remove the --build flag set by the gcc cross wrapper setup
1821 # hook
19− export configureFlags="--host=${stdenv.cross.config}"
22+ export configureFlags="--host=${hostPlatform.config}"
2023 '';
2124 postConfigure = ''
2225 # They use 'install -s', that calls the native strip instead of the cross
pkgs/misc/uboot/default.nix+5−3
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, bc, dtc, python2 }:
1+{ stdenv, fetchurl, bc, dtc, python2
2+, hostPlatform
3+}:
24
35let
46 buildUBoot = { targetPlatforms
@@ -43,8 +45,8 @@ let
4345
4446 crossAttrs = {
4547 makeFlags = [
46− "ARCH=${stdenv.cross.platform.kernelArch}"
47− "CROSS_COMPILE=${stdenv.cross.config}-"
48+ "ARCH=${hostPlatform.platform.kernelArch}"
49+ "CROSS_COMPILE=${stdenv.cc.prefix}"
4850 ];
4951 };
5052
pkgs/os-specific/linux/kernel-headers/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, kernel, perl }:
1+{ stdenv, kernel, perl
2+, hostPlatform
3+}:
24
35let
46 baseBuildFlags = [ "INSTALL_HDR_PATH=$(out)" "headers_install" ];
@@ -13,7 +15,7 @@ in stdenv.mkDerivation {
1315
1416 crossAttrs = {
1517 inherit (kernel.crossDrv) src patches;
16− buildFlags = [ "ARCH=${stdenv.cross.platform.kernelArch}" ] ++ baseBuildFlags;
18+ buildFlags = [ "ARCH=${hostPlatform.platform.kernelArch}" ] ++ baseBuildFlags;
1719 };
1820
1921 installPhase = ''
pkgs/os-specific/linux/kernel/generic.nix+3−2
@@ -25,6 +25,7 @@
2525 kernelPatches ? []
2626, ignoreConfigErrors ? stdenv.platform.name != "pc"
2727, extraMeta ? {}
28+, hostPlatform
2829, ...
2930}:
3031
@@ -59,7 +60,7 @@ let
5960 arch = stdenv.platform.kernelArch;
6061
6162 crossAttrs = let
62− cp = stdenv.cross.platform;
63+ cp = hostPlatform.platform;
6364 in {
6465 arch = cp.kernelArch;
6566 platformName = cp.name;
@@ -128,7 +129,7 @@ let
128129 };
129130
130131 config = configWithPlatform stdenv.platform;
131− configCross = configWithPlatform stdenv.cross.platform;
132+ configCross = configWithPlatform hostPlatform.platform;
132133
133134 nativeDrv = lib.addPassthru kernel.nativeDrv passthru;
134135
pkgs/os-specific/linux/kernel/linux-3.10.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
22
33import ./generic.nix (args // rec {
44 version = "3.10.105";
pkgs/os-specific/linux/kernel/linux-4.11.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
22
33import ./generic.nix (args // rec {
44 version = "4.11.7";
pkgs/os-specific/linux/kernel/linux-4.4.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
22
33import ./generic.nix (args // rec {
44 version = "4.4.73";
pkgs/os-specific/linux/kernel/linux-4.9.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
22
33import ./generic.nix (args // rec {
44 version = "4.9.34";
pkgs/os-specific/linux/kernel/linux-chromiumos-3.18.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchgit, perl, buildLinux, ncurses, ... } @ args:
1+{ stdenv, hostPlatform, fetchgit, perl, buildLinux, ncurses, ... } @ args:
22
33# ChromiumOS requires a 64bit build host
44assert stdenv.is64bit;
pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args:
22
33let
44 version = "4.11.7";
pkgs/os-specific/linux/kernel/linux-mptcp.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
22
33import ./generic.nix (args // rec {
44 mptcpVersion = "0.91.3";
pkgs/os-specific/linux/kernel/linux-rpi.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args:
22
33let
44 modDirVersion = "4.9.24";
pkgs/os-specific/linux/kernel/linux-testing.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
1+{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
22
33import ./generic.nix (args // rec {
44 version = "4.12-rc6";
pkgs/os-specific/linux/kernel/manual-config.nix+2−1
@@ -1,5 +1,6 @@
11{ stdenv, runCommand, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl
22, writeTextFile, ubootChooser
3+, hostPlatform
34}:
45
56let
@@ -232,7 +233,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.platform (kernelPatches ++ nativeKe
232233
233234 karch = stdenv.platform.kernelArch;
234235
235− crossAttrs = let cp = stdenv.cross.platform; in
236+ crossAttrs = let cp = hostPlatform.platform; in
236237 (drvAttrs crossConfig cp (kernelPatches ++ crossKernelPatches) crossConfigfile) // {
237238 makeFlags = commonMakeFlags ++ [
238239 "ARCH=${cp.kernelArch}"
pkgs/os-specific/linux/kernel/perf.nix+1−1
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
4949 /* I don't want cross-python or cross-perl -
5050 I don't know if cross-python even works */
5151 propagatedBuildInputs = [ elfutils.crossDrv newt.crossDrv ];
52− makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-";
52+ makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}";
5353 elfutils = elfutils.crossDrv;
5454 inherit (kernel.crossDrv) src patches;
5555 };
pkgs/os-specific/linux/klibc/default.nix+8−11
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, linuxHeaders, perl }:
1+{ stdenv, fetchurl, linuxHeaders, perl
2+, buildPlatform, hostPlatform
3+}:
24
35let
46 commonMakeFlags = [
@@ -23,17 +25,12 @@ stdenv.mkDerivation rec {
2325 hardeningDisable = [ "format" "stackprotector" ];
2426
2527 makeFlags = commonMakeFlags ++ [
26− "KLIBCARCH=${stdenv.platform.kernelArch}"
28+ "KLIBCARCH=${hostPlatform.platform.kernelArch}"
2729 "KLIBCKERNELSRC=${linuxHeaders}"
28− ] ++ stdenv.lib.optional (stdenv.platform.kernelArch == "arm") "CONFIG_AEABI=y";
29−
30− crossAttrs = {
31− makeFlags = commonMakeFlags ++ [
32− "KLIBCARCH=${stdenv.cross.platform.kernelArch}"
33− "KLIBCKERNELSRC=${linuxHeaders.crossDrv}"
34− "CROSS_COMPILE=${stdenv.cross.config}-"
35− ] ++ stdenv.lib.optional (stdenv.cross.platform.kernelArch == "arm") "CONFIG_AEABI=y";
36− };
30+ ] # TODO(@Ericson2314): We now can get the ABI from
31+ # `hostPlatform.parsed.abi`, is this still a good idea?
32+ ++ stdenv.lib.optional (hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
33+ ++ stdenv.lib.optional (hostPlatform != buildPlatform) "CROSS_COMPILE=${stdenv.cc.prefix}";
3734
3835 # Install static binaries as well.
3936 postInstall = ''
pkgs/os-specific/linux/mdadm/4.nix+6−3
@@ -1,4 +1,7 @@
1−{ stdenv, fetchurl, groff }:
1+{ stdenv
2+, fetchurl, groff
3+, buildPlatform, hostPlatform
4+}:
25
36assert stdenv.isLinux;
47
@@ -19,8 +22,8 @@ stdenv.mkDerivation rec {
1922 makeFlags = [
2023 "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
2124 "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
22− ] ++ stdenv.lib.optionals (stdenv ? cross) [
23− "CROSS_COMPILE=${stdenv.cross.config}-"
25+ ] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
26+ "CROSS_COMPILE=${stdenv.cc.prefix}"
2427 ];
2528
2629 nativeBuildInputs = [ groff ];
pkgs/os-specific/linux/mdadm/default.nix+6−3
@@ -1,4 +1,7 @@
1−{ stdenv, fetchurl, groff }:
1+{ stdenv
2+, fetchurl, groff
3+, buildPlatform, hostPlatform
4+}:
25
36assert stdenv.isLinux;
47
@@ -19,8 +22,8 @@ stdenv.mkDerivation rec {
1922 makeFlags = [
2023 "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
2124 "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
22− ] ++ stdenv.lib.optionals (stdenv ? cross) [
23− "CROSS_COMPILE=${stdenv.cross.config}-"
25+ ] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
26+ "CROSS_COMPILE=${stdenv.cc.prefix}"
2427 ];
2528
2629 nativeBuildInputs = [ groff ];
pkgs/os-specific/linux/mingetty/default.nix−4
@@ -8,10 +8,6 @@ stdenv.mkDerivation {
88 sha256 = "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g";
99 };
1010
11− crossAttrs = {
12− makeFlags = "CC=${stdenv.cross.config}-gcc";
13− };
14−
1511 preInstall = ''
1612 mkdir -p $out/sbin $out/share/man/man8
1713 makeFlagsArray=(SBINDIR=$out/sbin MANDIR=$out/share/man/man8)
pkgs/os-specific/linux/procps-ng/default.nix−4
@@ -15,10 +15,6 @@ stdenv.mkDerivation rec {
1515
1616 enableParallelBuilding = true;
1717
18− crossAttrs = {
19− CC = stdenv.cross.config + "-gcc";
20− };
21−
2218 # Too red
2319 configureFlags = [ "--disable-modern-top" ];
2420
pkgs/os-specific/linux/procps/watch.nix−4
@@ -15,10 +15,6 @@ stdenv.mkDerivation {
1515
1616 enableParallelBuilding = true;
1717
18− crossAttrs = {
19− CC = stdenv.cross.config + "-gcc";
20− };
21−
2218 installPhase = "mkdir $out; mkdir -p $out/bin; cp -p watch $out/bin";
2319
2420 meta = {
pkgs/os-specific/linux/shadow/default.nix+4−2
@@ -1,11 +1,13 @@
11{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt, libxml2
22, docbook_xml_dtd_412, docbook_xsl, gnome_doc_utils, flex, bison
3−, pam ? null, glibcCross ? null }:
3+, pam ? null, glibcCross ? null
4+, buildPlatform, hostPlatform
5+}:
46
57let
68
79 glibc =
8− if stdenv ? cross
10+ if hostPlatform != buildPlatform
911 then glibcCross
1012 else assert stdenv ? glibc; stdenv.glibc;
1113
pkgs/os-specific/linux/sysvinit/default.nix+1−5
@@ -15,11 +15,7 @@ stdenv.mkDerivation {
1515 sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h
1616 '';
1717
18− makeFlags = "SULOGINLIBS=-lcrypt ROOT=$(out) MANDIR=/share/man";
19−
20− crossAttrs = {
21− makeFlags = "SULOGINLIBS=-lcrypt ROOT=$(out) MANDIR=/share/man CC=${stdenv.cross.config}-gcc";
22− };
18+ makeFlags = [ "SULOGINLIBS=-lcrypt" "ROOT=$(out)" "MANDIR=/share/man" ];
2319
2420 preInstall =
2521 ''
pkgs/os-specific/windows/jom/default.nix+1−1
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
1818 QTDIR = qt48;
1919
2020 crossAttrs = {
21− # cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cross.config}-windres";
21+ # cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cc.prefix}windres";
2222 QTDIR = qt48.crossDrv;
2323 preBuild = ''
2424 export NIX_CROSS_CFLAGS_COMPILE=-fpermissive
pkgs/os-specific/windows/pthread-w32/default.nix+1−1
@@ -1,7 +1,7 @@
11{ fetchurl, stdenv, mingw_headers }:
22
33# This file is tweaked for cross-compilation only.
4−assert stdenv ? cross;
4+assert hostPlatform != buildPlatform;
55
66stdenv.mkDerivation {
77 name = "pthread-w32-1.10.0";
pkgs/os-specific/windows/wxMSW-2.8/default.nix+3−8
@@ -1,7 +1,8 @@
1−{ stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true,
1+{ stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true
2+, hostPlatform
23}:
34
4−assert stdenv ? cross -> stdenv.cross.libc == "msvcrt";
5+assert hostPlatform.isWindows;
56
67stdenv.mkDerivation {
78 name = "wxMSW-2.8.11";
@@ -19,12 +20,6 @@ stdenv.mkDerivation {
1920 "--with-opengl"
2021 ];
2122
22− # Cross build only tested for mingw32
23− checkCross = throw "This package can only be cross-built" false;
24− crossAttrs = {
25− checkCross = true;
26− };
27−
2823 preConfigure = "
2924 substituteInPlace configure --replace /usr /no-such-path
3025 ";
pkgs/tools/filesystems/mtdutils/default.nix−4
@@ -15,10 +15,6 @@ stdenv.mkDerivation rec {
1515
1616 buildInputs = [ libuuid lzo zlib acl ];
1717
18− crossAttrs = {
19− makeFlags = "CC=${stdenv.cross.config}-gcc";
20− };
21−
2218 meta = {
2319 description = "Tools for MTD filesystems";
2420 license = stdenv.lib.licenses.gpl2Plus;
pkgs/tools/graphics/optipng/default.nix+13−15
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, libpng, static ? false }:
1+{ stdenv, fetchurl, libpng, static ? false
2+, buildPlatform, hostPlatform
3+}:
24
35# This package comes with its own copy of zlib, libpng and pngxtern
46
@@ -15,20 +17,16 @@ stdenv.mkDerivation rec {
1517 buildInputs = [ libpng ];
1618
1719 LDFLAGS = optional static "-static";
18− configureFlags = "--with-system-zlib --with-system-libpng";
19−
20− crossAttrs = {
21− CC="${stdenv.cross.config}-gcc";
22− LD="${stdenv.cross.config}-gcc";
23− AR="${stdenv.cross.config}-ar";
24− RANLIB="${stdenv.cross.config}-ranlib";
25− configurePhase = ''
26− ./configure -prefix="$out" --with-system-zlib --with-system-libpng
27− '';
28− postInstall = optional (stdenv.cross.libc == "msvcrt") ''
29− mv "$out"/bin/optipng "$out"/bin/optipng.exe
30− '';
31− };
20+ configureFlags = [
21+ "--with-system-zlib"
22+ "--with-system-libpng"
23+ ] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
24+ #"-prefix=$out"
25+ ];
26+
27+ postInstall = if hostPlatform != buildPlatform && hostPlatform.isWindows then ''
28+ mv "$out"/bin/optipng{,.exe}
29+ '' else null;
3230
3331 meta = with stdenv.lib; {
3432 homepage = http://optipng.sourceforge.net/;
pkgs/tools/networking/tcpdump/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, libpcap, enableStatic ? false }:
1+{ stdenv, fetchurl, libpcap, enableStatic ? false
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "tcpdump-${version}";
@@ -15,7 +17,7 @@ stdenv.mkDerivation rec {
1517 crossAttrs = {
1618 LDFLAGS = if enableStatic then "-static" else "";
1719 configureFlags = [ "ac_cv_linux_vers=2" ] ++ (stdenv.lib.optional
18− (stdenv.cross.platform.kernelMajor == "2.4") "--disable-ipv6");
20+ (hostPlatform.platform.kernelMajor == "2.4") "--disable-ipv6");
1921 };
2022
2123 meta = {
pkgs/tools/package-management/nix/default.nix+3−2
@@ -2,6 +2,7 @@
22, pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli, readline
33, autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl
44, libseccomp, busybox
5+, hostPlatform
56, storeDir ? "/nix/store"
67, stateDir ? "/nix/var"
78, confDir ? "/etc"
@@ -95,8 +96,8 @@ let
9596 --disable-init-state
9697 --enable-gc
9798 '' + stdenv.lib.optionalString (
98− stdenv.cross ? nix && stdenv.cross.nix ? system
99− ) ''--with-system=${stdenv.cross.nix.system}'';
99+ hostPlatform ? nix && hostPlatform.nix ? system
100+ ) ''--with-system=${hostPlatform.nix.system}'';
100101
101102 doInstallCheck = false;
102103 };
pkgs/tools/system/tm/default.nix−4
@@ -10,10 +10,6 @@ stdenv.mkDerivation {
1010 sed -i 's@/usr/bin/install@install@g ; s/gcc/cc/g' Makefile
1111 '';
1212
13− crossAttrs = {
14− makeFlags = "CC=${stdenv.cross.config}-gcc";
15− };
16−
1713 src = fetchurl {
1814 url = http://vicerveza.homeunix.net/~viric/soft/tm/tm-0.4.1.tar.gz;
1915 sha256 = "3b389bc03b6964ad5ffa57a344b891fdbcf7c9b2604adda723a863f83657c4a0";
pkgs/tools/system/ts/default.nix+3−6
@@ -1,5 +1,6 @@
1−{stdenv, fetchurl,
2−sendmailPath ? "/run/wrappers/bin/sendmail" }:
1+{ stdenv, fetchurl
2+, sendmailPath ? "/run/wrappers/bin/sendmail"
3+}:
34
45stdenv.mkDerivation rec {
56
@@ -7,10 +8,6 @@ stdenv.mkDerivation rec {
78
89 installPhase=''make install "PREFIX=$out"'';
910
10− crossAttrs = {
11− makeFlags = "CC=${stdenv.cross.config}-gcc";
12− };
13−
1411 patchPhase = ''
1512 sed -i s,/usr/sbin/sendmail,${sendmailPath}, mail.c ts.1
1613 '';
pkgs/tools/text/html-tidy/default.nix+4−2
@@ -1,4 +1,6 @@
1−{ stdenv, fetchFromGitHub, cmake, libxslt }:
1+{ stdenv, fetchFromGitHub, cmake, libxslt
2+, hostPlatform
3+}:
24
35stdenv.mkDerivation rec {
46 name = "html-tidy-${version}";
@@ -14,7 +16,7 @@ stdenv.mkDerivation rec {
1416 nativeBuildInputs = [ cmake libxslt/*manpage*/ ];
1517
1618 cmakeFlags = stdenv.lib.optional
17− (stdenv.cross.libc or null == "msvcrt") "-DCMAKE_SYSTEM_NAME=Windows";
19+ (hostPlatform.libc or null == "msvcrt") "-DCMAKE_SYSTEM_NAME=Windows";
1820
1921 # ATM bin/tidy is statically linked, as upstream provides no other option yet.
2022 # https://github.com/htacg/tidy-html5/issues/326#issuecomment-160322107
pkgs/tools/text/replace/default.nix+1−5
@@ -1,4 +1,4 @@
1−{stdenv, fetchurl}:
1+{ stdenv, fetchurl }:
22
33stdenv.mkDerivation {
44 name = "replace-2.24";
@@ -10,10 +10,6 @@ stdenv.mkDerivation {
1010
1111 makeFlags = "TREE=\$(out) MANTREE=\$(TREE)/share/man";
1212
13− crossAttrs = {
14− makeFlags = "TREE=\$(out) MANTREE=\$(TREE)/share/man CC=${stdenv.cross.config}-gcc";
15− };
16−
1713 preBuild = ''
1814 sed -e "s@/bin/mv@$(type -P mv)@" -i replace.h
1915 '';
pkgs/top-level/stage.nix−2
@@ -110,8 +110,6 @@ let
110110 in {
111111 stdenv = super.stdenv // {
112112 inherit (buildPlatform) platform;
113− } // lib.optionalAttrs (hostPlatform != buildPlatform) {
114− cross = hostPlatform;
115113 };
116114 inherit (buildPlatform) system platform;
117115 };