···79 </listitem>
80 </varlistentry>
81 </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>
87 <para>
88 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.
89 You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent.
···79 </listitem>
80 </varlistentry>
81 </variablelist>
0000082 <para>
83 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.
84 You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent.
···7172 '' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) ''
73 cat << 'EOF' >> $out
74- for CMD in ar as nm objcopy ranlib strip strings size ld
75 do
76 # which is not part of stdenv, but compgen will do for now
77 if
···7172 '' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) ''
73 cat << 'EOF' >> $out
74+ for CMD in ar as nm objcopy ranlib strip strings size ld windres
75 do
76 # which is not part of stdenv, but compgen will do for now
77 if
+16-10
pkgs/build-support/gcc-wrapper-old/default.nix
···8{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
9, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
10, zlib ? null
011}:
1213assert nativeTools -> nativePrefix != "";
···69 # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
70 # do this sufficient if/else.
71 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
75 abort "don't know the name of the dynamic linker for this platform");
76 };
77···85 + " (wrapper script)";
86 };
8788- # The dynamic linker has different names on different Linux platforms.
89 dynamicLinker =
90 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
93 # 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")
0000098 else "";
99}
···8{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
9, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
10, zlib ? null
11+, hostPlatform, targetPlatform
12}:
1314assert nativeTools -> nativePrefix != "";
···70 # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
71 # do this sufficient if/else.
72 dynamicLinker =
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
76 abort "don't know the name of the dynamic linker for this platform");
77 };
78···86 + " (wrapper script)";
87 };
8889+ # The dynamic linker has different names on different platforms.
90 dynamicLinker =
91 if !nativeLibc then
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
94 # ARM with a wildcard, which can be "" or "-armhf".
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)
104 else "";
105}
···1{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2-, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }:
0034# Do either a coverage analysis build or a standard build.
5(if coverageAnalysis != null
···84 setupHook = ./setup-hook-2.0.sh;
8586 crossAttrs.preConfigure =
87- stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
88 # On GNU, libgc depends on libpthread, but the cross linker doesn't
89 # know where to find libpthread, which leads to erroneous test failures
90 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
···1{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2+, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
3+, hostPlatform
4+}:
56# Do either a coverage analysis build or a standard build.
7(if coverageAnalysis != null
···86 setupHook = ./setup-hook-2.0.sh;
8788 crossAttrs.preConfigure =
89+ stdenv.lib.optionalString (hostPlatform.isHurd)
90 # On GNU, libgc depends on libpthread, but the cross linker doesn't
91 # know where to find libpthread, which leads to erroneous test failures
92 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
+4-2
pkgs/development/interpreters/guile/default.nix
···1{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2-, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }:
0034# Do either a coverage analysis build or a standard build.
5(if coverageAnalysis != null
···80 setupHook = ./setup-hook-2.2.sh;
8182 crossAttrs.preConfigure =
83- stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
84 # On GNU, libgc depends on libpthread, but the cross linker doesn't
85 # know where to find libpthread, which leads to erroneous test failures
86 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
···1{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2+, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
3+, hostPlatform
4+}:
56# Do either a coverage analysis build or a standard build.
7(if coverageAnalysis != null
···82 setupHook = ./setup-hook-2.2.sh;
8384 crossAttrs.preConfigure =
85+ stdenv.lib.optionalString (hostPlatform.isHurd)
86 # On GNU, libgc depends on libpthread, but the cross linker doesn't
87 # know where to find libpthread, which leads to erroneous test failures
88 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
···1{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
02/*
3 * Licensing options (yes some are listed twice, filters and such are not listed)
4 */
···428429 /* Cross-compilation is untested, consider this an outline, more work
430 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 {
449 configurePlatforms = [];
450 configureFlags = configureFlags ++ [
451- "--cross-prefix=${stdenv.cross.config}-"
452 "--enable-cross-compile"
453- "--target_os=${os}"
454- "--arch=${stdenv.cross.arch}"
455 ];
456 };
457
···1{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
2+, hostPlatform
3/*
4 * Licensing options (yes some are listed twice, filters and such are not listed)
5 */
···429430 /* Cross-compilation is untested, consider this an outline, more work
431 needs to be done to portions of the build to get it to work correctly */
432+ crossAttrs = {
00000000000000000433 configurePlatforms = [];
434 configureFlags = configureFlags ++ [
435+ "--cross-prefix=${stdenv.cc.prefix}"
436 "--enable-cross-compile"
437+ "--target_os=${hostPlatform.parsed.kernel.name}"
438+ "--arch=${hostPlatform.arch}"
439 ];
440 };
441
+5-21
pkgs/development/libraries/ffmpeg/generic.nix
···2, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
3, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
4, x264, x265, xvidcore, zlib, libopus
05, openglSupport ? false, mesa ? null
6# Build options
7, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
···169170 /* Cross-compilation is untested, consider this an outline, more work
171 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 {
190 configurePlatforms = [];
191 configureFlags = configureFlags ++ [
192- "--cross-prefix=${stdenv.cross.config}-"
193 "--enable-cross-compile"
194- "--target_os=${os}"
195- "--arch=${stdenv.cross.arch}"
196 ];
197 };
198
···2, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
3, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
4, x264, x265, xvidcore, zlib, libopus
5+, hostPlatform
6, openglSupport ? false, mesa ? null
7# Build options
8, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
···170171 /* Cross-compilation is untested, consider this an outline, more work
172 needs to be done to portions of the build to get it to work correctly */
173+ crossAttrs = {
00000000000000000174 configurePlatforms = [];
175 configureFlags = configureFlags ++ [
176+ "--cross-prefix=${stdenv.cc.prefix}"
177 "--enable-cross-compile"
178+ "--target_os=${hostPlatform.parsed.kernel}"
179+ "--arch=${hostPlatform.arch}"
180 ];
181 };
182
+4-2
pkgs/development/libraries/fontconfig/2.10.nix
···1-{ stdenv, fetchurl, pkgconfig, freetype, expat }:
0023stdenv.mkDerivation rec {
4 name = "fontconfig-2.10.2";
···21 ];
2223 # We should find a better way to access the arch reliably.
24- crossArch = stdenv.cross.arch or null;
2526 preConfigure = ''
27 if test -n "$crossConfig"; then
···1+{ stdenv, fetchurl, pkgconfig, freetype, expat
2+, hostPlatform
3+}:
45stdenv.mkDerivation rec {
6 name = "fontconfig-2.10.2";
···23 ];
2425 # We should find a better way to access the arch reliably.
26+ crossArch = hostPlatform.arch or null;
2728 preConfigure = ''
29 if test -n "$crossConfig"; then
+5-3
pkgs/development/libraries/fontconfig/default.nix
···1-{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, dejavu_fonts
2-, substituteAll }:
0034/** Font configuration scheme
5 - ./config-compat.patch makes fontconfig try the following root configs, in order:
···53 ];
5455 # We should find a better way to access the arch reliably.
56- crossArch = stdenv.cross.arch or null;
5758 preConfigure = ''
59 if test -n "$crossConfig"; then
···1+{ stdenv, substituteAll, fetchurl, fetchpatch
2+, pkgconfig, freetype, expat, libxslt, dejavu_fonts
3+, hostPlatform
4+}:
56/** Font configuration scheme
7 - ./config-compat.patch makes fontconfig try the following root configs, in order:
···55 ];
5657 # We should find a better way to access the arch reliably.
58+ crossArch = hostPlatform.arch or null;
5960 preConfigure = ''
61 if test -n "$crossConfig"; then
+7-7
pkgs/development/libraries/freetype/default.nix
···1-{
2- stdenv, lib, fetchurl, copyPathsToStore,
3- pkgconfig, which,
4- zlib, bzip2, libpng, gnumake, glib,
56- # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
7 # LCD filtering is also known as ClearType and covered by several Microsoft patents.
8 # This option allows it to be disabled. See http://www.freetype.org/patents.html.
9- useEncumberedCode ? true,
10}:
1112let
···6768 postInstall = glib.flattenInclude;
6970- crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc or null != "msvcrt") {
71 # Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
72 # of gcc. I think it's due to the unwrapped gcc being in the PATH. I don't
73 # know why it's on the PATH.
···1+{ stdenv, lib, fetchurl, copyPathsToStore
2+, hostPlatform
3+, pkgconfig, which
4+, zlib, bzip2, libpng, gnumake, glib
56+, # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
7 # LCD filtering is also known as ClearType and covered by several Microsoft patents.
8 # This option allows it to be disabled. See http://www.freetype.org/patents.html.
9+ useEncumberedCode ? true
10}:
1112let
···6768 postInstall = glib.flattenInclude;
6970+ crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc or null != "msvcrt") {
71 # Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
72 # of gcc. I think it's due to the unwrapped gcc being in the PATH. I don't
73 # know why it's on the PATH.
···1-{ stdenv, fetchurl, m4, perl, help2man }:
0023stdenv.mkDerivation rec {
4 name = "libtool-2.4.6";
···2324 # Don't run the native `strip' when cross-compiling. This breaks at least
25 # with `.a' files for MinGW.
26- dontStrip = stdenv ? cross;
2728 meta = {
29 description = "GNU Libtool, a generic library support script";
···1+{ stdenv, fetchurl, m4, perl, help2man
2+, buildPlatform, hostPlatform
3+}:
45stdenv.mkDerivation rec {
6 name = "libtool-2.4.6";
···2526 # Don't run the native `strip' when cross-compiling. This breaks at least
27 # with `.a' files for MinGW.
28+ dontStrip = hostPlatform != buildPlatform;
2930 meta = {
31 description = "GNU Libtool, a generic library support script";
+5-2
pkgs/games/scummvm/default.nix
···1-{ stdenv, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib, mesa }:
00023stdenv.mkDerivation rec {
4 name = "scummvm-1.9.0";
···16 preConfigure = ''
17 # Remove the --build flag set by the gcc cross wrapper setup
18 # hook
19- export configureFlags="--host=${stdenv.cross.config}"
20 '';
21 postConfigure = ''
22 # They use 'install -s', that calls the native strip instead of the cross
···1+{ stdenv
2+, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib, mesa
3+, hostPlatform
4+}:
56stdenv.mkDerivation rec {
7 name = "scummvm-1.9.0";
···19 preConfigure = ''
20 # Remove the --build flag set by the gcc cross wrapper setup
21 # hook
22+ export configureFlags="--host=${hostPlatform.config}"
23 '';
24 postConfigure = ''
25 # They use 'install -s', that calls the native strip instead of the cross