···7979 </listitem>
8080 </varlistentry>
8181 </variablelist>
8282- <note><para>
8383- If you dig around nixpkgs, you may notice there is also <varname>stdenv.cross</varname>.
8484- This field defined as <varname>hostPlatform</varname> when the host and build platforms differ, but otherwise not defined at all.
8585- This field is obsolete and will soon disappear—please do not use it.
8686- </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.
···71717272 '' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) ''
7373 cat << 'EOF' >> $out
7474- for CMD in ar as nm objcopy ranlib strip strings size ld
7474+ 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
+16-10
pkgs/build-support/gcc-wrapper-old/default.nix
···88{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
99, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
1010, zlib ? null
1111+, hostPlatform, targetPlatform
1112}:
12131314assert nativeTools -> nativePrefix != "";
···6970 # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
7071 # do this sufficient if/else.
7172 dynamicLinker =
7272- (if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
7373- if stdenv.cross.arch == "mips" then "ld.so.1" else
7474- if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
7373+ (if hostPlatform.arch == "arm" then "ld-linux.so.3" else
7474+ if hostPlatform.arch == "mips" then "ld.so.1" else
7575+ 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···8586 + " (wrapper script)";
8687 };
87888888- # The dynamic linker has different names on different Linux platforms.
8989+ # The dynamic linker has different names on different platforms.
8990 dynamicLinker =
9091 if !nativeLibc then
9191- (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
9292- if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
9292+ (if targetPlatform.system == "i686-linux" then "ld-linux.so.2" else
9393+ if targetPlatform.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
9394 # ARM with a wildcard, which can be "" or "-armhf".
9494- if stdenv.isArm then "ld-linux*.so.3" else
9595- if stdenv.system == "powerpc-linux" then "ld.so.1" else
9696- if stdenv.system == "mips64el-linux" then "ld.so.1" else
9797- abort "don't know the name of the dynamic linker for this platform")
9595+ if targetPlatform.isArm32 then "ld-linux*.so.3" else
9696+ if targetPlatform.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else
9797+ if targetPlatform.system == "powerpc-linux" then "ld.so.1" else
9898+ if targetPlatform.system == "mips64el-linux" then "ld.so.1" else
9999+ if targetPlatform.system == "x86_64-darwin" then "/usr/lib/dyld" else
100100+ if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else
101101+ builtins.trace
102102+ "Don't know the name of the dynamic linker for platform ${targetPlatform.config}, so guessing instead."
103103+ null)
98104 else "";
99105}
···11{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
22+, hostPlatform
23/*
34 * Licensing options (yes some are listed twice, filters and such are not listed)
45 */
···428429429430 /* 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 */
431431- crossAttrs = let
432432- os = ''
433433- if [ "${stdenv.cross.config}" = "*cygwin*" ] ; then
434434- # Probably should look for mingw too
435435- echo "cygwin"
436436- elif [ "${stdenv.cross.config}" = "*darwin*" ] ; then
437437- echo "darwin"
438438- elif [ "${stdenv.cross.config}" = "*freebsd*" ] ; then
439439- echo "freebsd"
440440- elif [ "${stdenv.cross.config}" = "*linux*" ] ; then
441441- echo "linux"
442442- elif [ "${stdenv.cross.config}" = "*netbsd*" ] ; then
443443- echo "netbsd"
444444- elif [ "${stdenv.cross.config}" = "*openbsd*" ] ; then
445445- echo "openbsd"
446446- fi
447447- '';
448448- in {
432432+ crossAttrs = {
449433 configurePlatforms = [];
450434 configureFlags = configureFlags ++ [
451451- "--cross-prefix=${stdenv.cross.config}-"
435435+ "--cross-prefix=${stdenv.cc.prefix}"
452436 "--enable-cross-compile"
453453- "--target_os=${os}"
454454- "--arch=${stdenv.cross.arch}"
437437+ "--target_os=${hostPlatform.parsed.kernel.name}"
438438+ "--arch=${hostPlatform.arch}"
455439 ];
456440 };
457441
+5-21
pkgs/development/libraries/ffmpeg/generic.nix
···22, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
33, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
44, x264, x265, xvidcore, zlib, libopus
55+, hostPlatform
56, openglSupport ? false, mesa ? null
67# Build options
78, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
···169170170171 /* 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 */
172172- crossAttrs = let
173173- os = ''
174174- if [ "${stdenv.cross.config}" = "*cygwin*" ] ; then
175175- # Probably should look for mingw too
176176- echo "cygwin"
177177- elif [ "${stdenv.cross.config}" = "*darwin*" ] ; then
178178- echo "darwin"
179179- elif [ "${stdenv.cross.config}" = "*freebsd*" ] ; then
180180- echo "freebsd"
181181- elif [ "${stdenv.cross.config}" = "*linux*" ] ; then
182182- echo "linux"
183183- elif [ "${stdenv.cross.config}" = "*netbsd*" ] ; then
184184- echo "netbsd"
185185- elif [ "${stdenv.cross.config}" = "*openbsd*" ] ; then
186186- echo "openbsd"
187187- fi
188188- '';
189189- in {
173173+ crossAttrs = {
190174 configurePlatforms = [];
191175 configureFlags = configureFlags ++ [
192192- "--cross-prefix=${stdenv.cross.config}-"
176176+ "--cross-prefix=${stdenv.cc.prefix}"
193177 "--enable-cross-compile"
194194- "--target_os=${os}"
195195- "--arch=${stdenv.cross.arch}"
178178+ "--target_os=${hostPlatform.parsed.kernel}"
179179+ "--arch=${hostPlatform.arch}"
196180 ];
197181 };
198182
+4-2
pkgs/development/libraries/fontconfig/2.10.nix
···11-{ stdenv, fetchurl, pkgconfig, freetype, expat }:
11+{ stdenv, fetchurl, pkgconfig, freetype, expat
22+, hostPlatform
33+}:
2435stdenv.mkDerivation rec {
46 name = "fontconfig-2.10.2";
···2123 ];
22242325 # We should find a better way to access the arch reliably.
2424- crossArch = stdenv.cross.arch or null;
2626+ crossArch = hostPlatform.arch or null;
25272628 preConfigure = ''
2729 if test -n "$crossConfig"; then
+5-3
pkgs/development/libraries/fontconfig/default.nix
···11-{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, dejavu_fonts
22-, substituteAll }:
11+{ stdenv, substituteAll, fetchurl, fetchpatch
22+, pkgconfig, freetype, expat, libxslt, dejavu_fonts
33+, hostPlatform
44+}:
3546/** Font configuration scheme
57 - ./config-compat.patch makes fontconfig try the following root configs, in order:
···5355 ];
54565557 # We should find a better way to access the arch reliably.
5656- crossArch = stdenv.cross.arch or null;
5858+ crossArch = hostPlatform.arch or null;
57595860 preConfigure = ''
5961 if test -n "$crossConfig"; then
+7-7
pkgs/development/libraries/freetype/default.nix
···11-{
22- stdenv, lib, fetchurl, copyPathsToStore,
33- pkgconfig, which,
44- zlib, bzip2, libpng, gnumake, glib,
11+{ stdenv, lib, fetchurl, copyPathsToStore
22+, hostPlatform
33+, pkgconfig, which
44+, zlib, bzip2, libpng, gnumake, glib
5566- # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
66+, # 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.
99- useEncumberedCode ? true,
99+ useEncumberedCode ? true
1010}:
11111212let
···67676868 postInstall = glib.flattenInclude;
69697070- crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc or null != "msvcrt") {
7070+ 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.