Merge accepted cross compilation PRs into staging

This commit is contained in:
John Ericson 2017-06-28 23:17:21 -04:00
commit 16be434b0b
83 changed files with 307 additions and 346 deletions

View File

@ -79,11 +79,6 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
<note><para>
If you dig around nixpkgs, you may notice there is also <varname>stdenv.cross</varname>.
This field defined as <varname>hostPlatform</varname> when the host and build platforms differ, but otherwise not defined at all.
This field is obsolete and will soon disappear—please do not use it.
</para></note>
<para> <para>
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. 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.
You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent. You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent.

View File

@ -36,9 +36,6 @@ stdenv.mkDerivation rec {
"ac_cv_sizeof_int=4" "ac_cv_sizeof_int=4"
"vim_cv_memmove_handles_overlap=yes" "vim_cv_memmove_handles_overlap=yes"
"vim_cv_memmove_handles_overlap=yes" "vim_cv_memmove_handles_overlap=yes"
# TODO(@Ericson2314): wont' be needed soon.
"STRIP=${hostPlatform.config}-strip"
]; ];
postInstall = '' postInstall = ''

View File

@ -2,6 +2,7 @@
, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg , bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg
, lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp , lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp
, ApplicationServices , ApplicationServices
, buildPlatform, hostPlatform
}: }:
let let
@ -47,7 +48,7 @@ stdenv.mkDerivation rec {
[ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts" [ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts"
"--with-gslib" "--with-gslib"
] ]
++ lib.optionals (stdenv.cross.libc or null == "msvcrt") ++ lib.optionals hostPlatform.isMinGW
[ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM [ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM
; ;
@ -57,13 +58,13 @@ stdenv.mkDerivation rec {
[ zlib fontconfig freetype ghostscript [ zlib fontconfig freetype ghostscript
libpng libtiff libxml2 libpng libtiff libxml2
] ]
++ lib.optionals (stdenv.cross.libc or null != "msvcrt") ++ lib.optionals (!hostPlatform.isMinGW)
[ openexr librsvg openjpeg ] [ openexr librsvg openjpeg ]
++ lib.optional stdenv.isDarwin ApplicationServices; ++ lib.optional stdenv.isDarwin ApplicationServices;
propagatedBuildInputs = propagatedBuildInputs =
[ bzip2 freetype libjpeg lcms2 ] [ bzip2 freetype libjpeg lcms2 ]
++ lib.optionals (stdenv.cross.libc or null != "msvcrt") ++ lib.optionals (!hostPlatform.isMinGW)
[ libX11 libXext libXt libwebp ] [ libX11 libXext libXt libwebp ]
; ;

View File

@ -2,6 +2,7 @@
, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg , bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg
, lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp , lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp
, ApplicationServices , ApplicationServices
, buildPlatform, hostPlatform
}: }:
let let
@ -18,7 +19,7 @@ let
} }
# Freeze version on mingw so we don't need to port the patch too often. # Freeze version on mingw so we don't need to port the patch too often.
# FIXME: This version has multiple security vulnerabilities # FIXME: This version has multiple security vulnerabilities
// lib.optionalAttrs (stdenv.cross.libc or null == "msvcrt") { // lib.optionalAttrs (hostPlatform.isMinGW) {
version = "6.9.2-0"; version = "6.9.2-0";
sha256 = "17ir8bw1j7g7srqmsz3rx780sgnc21zfn0kwyj78iazrywldx8h7"; sha256 = "17ir8bw1j7g7srqmsz3rx780sgnc21zfn0kwyj78iazrywldx8h7";
patches = [(fetchpatch { patches = [(fetchpatch {
@ -59,7 +60,7 @@ stdenv.mkDerivation rec {
[ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts" [ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts"
"--with-gslib" "--with-gslib"
] ]
++ lib.optionals (stdenv.cross.libc or null == "msvcrt") ++ lib.optionals (hostPlatform.isMinGW)
[ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM [ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM
; ;
@ -69,13 +70,13 @@ stdenv.mkDerivation rec {
[ zlib fontconfig freetype ghostscript [ zlib fontconfig freetype ghostscript
libpng libtiff libxml2 libpng libtiff libxml2
] ]
++ lib.optionals (stdenv.cross.libc or null != "msvcrt") ++ lib.optionals (!hostPlatform.isMinGW)
[ openexr librsvg openjpeg ] [ openexr librsvg openjpeg ]
++ lib.optional stdenv.isDarwin ApplicationServices; ++ lib.optional stdenv.isDarwin ApplicationServices;
propagatedBuildInputs = propagatedBuildInputs =
[ bzip2 freetype libjpeg lcms2 ] [ bzip2 freetype libjpeg lcms2 ]
++ lib.optionals (stdenv.cross.libc or null != "msvcrt") ++ lib.optionals (!hostPlatform.isMinGW)
[ libX11 libXext libXt libwebp ] [ libX11 libXext libXt libwebp ]
; ;

View File

@ -21,10 +21,6 @@ stdenv.mkDerivation rec {
sed -e 's@ cpp\>@ gcc -E -@' -i GNUmakefile sed -e 's@ cpp\>@ gcc -E -@' -i GNUmakefile
''; '';
crossAttrs = {
makeFlags = makeFlags ++ [ "CC=${stdenv.cross.config}-gcc" "STRIP=" ];
};
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Image viewing and manipulation programs"; description = "Image viewing and manipulation programs";
homepage = https://www.kraxel.org/blog/linux/fbida/; homepage = https://www.kraxel.org/blog/linux/fbida/;

View File

@ -13,7 +13,6 @@ stdenv.mkDerivation {
preConfigure = '' preConfigure = ''
sed 's/^PDF/#PDF/' -i Makefile sed 's/^PDF/#PDF/' -i Makefile
''; '';
makeFlags = "CC=${stdenv.cross.config}-gcc";
}; };
buildInputs = [ curl libmrss podofo ] buildInputs = [ curl libmrss podofo ]

View File

@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
crossAttrs = { crossAttrs = {
doCheck = false; doCheck = false;
makeFlagsArray = [ "TCC=${stdenv.cross.config}-gcc" ]; makeFlags = [ "TCC=$CC" ];
}; };
meta = { meta = {

View File

@ -1,4 +1,7 @@
{ stdenv, fetchurl, raspberrypifw, pcre, boost, freetype, zlib }: { stdenv, fetchurl
, raspberrypifw, pcre, boost, freetype, zlib
, hostPlatform
}:
let let
ffmpeg = stdenv.mkDerivation rec { ffmpeg = stdenv.mkDerivation rec {
@ -46,10 +49,10 @@ let
crossAttrs = { crossAttrs = {
configurePlatforms = []; configurePlatforms = [];
configureFlags = configureFlags ++ [ configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-" "--cross-prefix=${stdenv.cc.prefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=linux" "--target_os=linux"
"--arch=${stdenv.cross.arch}" "--arch=${hostPlatform.arch}"
]; ];
}; };

View File

@ -71,7 +71,7 @@ let
'' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) '' '' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) ''
cat << 'EOF' >> $out cat << 'EOF' >> $out
for CMD in ar as nm objcopy ranlib strip strings size ld for CMD in ar as nm objcopy ranlib strip strings size ld windres
do do
# which is not part of stdenv, but compgen will do for now # which is not part of stdenv, but compgen will do for now
if if

View File

@ -8,6 +8,7 @@
{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? "" { name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" , gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
, zlib ? null , zlib ? null
, hostPlatform, targetPlatform
}: }:
assert nativeTools -> nativePrefix != ""; assert nativeTools -> nativePrefix != "";
@ -69,9 +70,9 @@ stdenv.mkDerivation {
# the style in the gcc-cross-wrapper, but to keep a stable stdenv now I # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
# do this sufficient if/else. # do this sufficient if/else.
dynamicLinker = dynamicLinker =
(if stdenv.cross.arch == "arm" then "ld-linux.so.3" else (if hostPlatform.arch == "arm" then "ld-linux.so.3" else
if stdenv.cross.arch == "mips" then "ld.so.1" else if hostPlatform.arch == "mips" then "ld.so.1" else
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else if stdenv.lib.hasSuffix "pc-gnu" hostPlatform.config then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform"); abort "don't know the name of the dynamic linker for this platform");
}; };
@ -85,15 +86,20 @@ stdenv.mkDerivation {
+ " (wrapper script)"; + " (wrapper script)";
}; };
# The dynamic linker has different names on different Linux platforms. # The dynamic linker has different names on different platforms.
dynamicLinker = dynamicLinker =
if !nativeLibc then if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else (if targetPlatform.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else if targetPlatform.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
# ARM with a wildcard, which can be "" or "-armhf". # ARM with a wildcard, which can be "" or "-armhf".
if stdenv.isArm then "ld-linux*.so.3" else if targetPlatform.isArm32 then "ld-linux*.so.3" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else if targetPlatform.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else
if stdenv.system == "mips64el-linux" then "ld.so.1" else if targetPlatform.system == "powerpc-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform") if targetPlatform.system == "mips64el-linux" then "ld.so.1" else
if targetPlatform.system == "x86_64-darwin" then "/usr/lib/dyld" else
if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else
builtins.trace
"Don't know the name of the dynamic linker for platform ${targetPlatform.config}, so guessing instead."
null)
else ""; else "";
} }

View File

@ -12,7 +12,9 @@
# `contents = {object = ...; symlink = /init;}' is a typical # `contents = {object = ...; symlink = /init;}' is a typical
# argument. # argument.
{ stdenv, perl, cpio, contents, ubootChooser, compressor, prepend }: { stdenv, perl, cpio, contents, ubootChooser, compressor, prepend
, hostPlatform
}:
let let
inputsFun = ubootName : [ perl cpio ] inputsFun = ubootName : [ perl cpio ]
@ -22,9 +24,9 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "initrd"; name = "initrd";
builder = ./make-initrd.sh; builder = ./make-initrd.sh;
nativeBuildInputs = inputsFun stdenv.platform.uboot; nativeBuildInputs = inputsFun hostPlatform.platform.uboot;
makeUInitrd = makeUInitrdFun stdenv.platform.uboot; makeUInitrd = makeUInitrdFun hostPlatform.platform.uboot;
# !!! should use XML. # !!! should use XML.
objects = map (x: x.object) contents; objects = map (x: x.object) contents;
@ -36,9 +38,5 @@ stdenv.mkDerivation {
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
pathsFromGraph = ./paths-from-graph.pl; pathsFromGraph = ./paths-from-graph.pl;
crossAttrs = {
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
};
inherit compressor prepend; inherit compressor prepend;
} }

View File

@ -1,5 +1,7 @@
{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring { fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }: , libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
, hostPlatform
}:
# Do either a coverage analysis build or a standard build. # Do either a coverage analysis build or a standard build.
(if coverageAnalysis != null (if coverageAnalysis != null
@ -84,7 +86,7 @@
setupHook = ./setup-hook-2.0.sh; setupHook = ./setup-hook-2.0.sh;
crossAttrs.preConfigure = crossAttrs.preConfigure =
stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu") stdenv.lib.optionalString (hostPlatform.isHurd)
# On GNU, libgc depends on libpthread, but the cross linker doesn't # On GNU, libgc depends on libpthread, but the cross linker doesn't
# know where to find libpthread, which leads to erroneous test failures # know where to find libpthread, which leads to erroneous test failures
# in `configure', where `-pthread' and `-lpthread' aren't explicitly # in `configure', where `-pthread' and `-lpthread' aren't explicitly

View File

@ -1,5 +1,7 @@
{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring { fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }: , libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
, hostPlatform
}:
# Do either a coverage analysis build or a standard build. # Do either a coverage analysis build or a standard build.
(if coverageAnalysis != null (if coverageAnalysis != null
@ -80,7 +82,7 @@
setupHook = ./setup-hook-2.2.sh; setupHook = ./setup-hook-2.2.sh;
crossAttrs.preConfigure = crossAttrs.preConfigure =
stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu") stdenv.lib.optionalString (hostPlatform.isHurd)
# On GNU, libgc depends on libpthread, but the cross linker doesn't # On GNU, libgc depends on libpthread, but the cross linker doesn't
# know where to find libpthread, which leads to erroneous test failures # know where to find libpthread, which leads to erroneous test failures
# in `configure', where `-pthread' and `-lpthread' aren't explicitly # in `configure', where `-pthread' and `-lpthread' aren't explicitly

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, readline, compat ? false }: { stdenv, fetchurl, readline, compat ? false
, hostPlatform
}:
let let
dsoPatch = fetchurl { dsoPatch = fetchurl {
@ -55,21 +57,15 @@ stdenv.mkDerivation rec {
''; '';
crossAttrs = let crossAttrs = let
isMingw = stdenv.cross.libc == "msvcrt"; inherit (hostPlatform) isDarwin isMingw;
isDarwin = stdenv.cross.libc == "libSystem";
in { in {
configurePhase = '' configurePhase = ''
makeFlagsArray=( makeFlagsArray=(
INSTALL_TOP=$out INSTALL_TOP=$out
INSTALL_MAN=$out/share/man/man1 INSTALL_MAN=$out/share/man/man1
CC=${stdenv.cross.config}-gcc
STRIP=:
RANLIB=${stdenv.cross.config}-ranlib
V=${luaversion} V=${luaversion}
R=${version} R=${version}
${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin '' ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
AR="${stdenv.cross.config}-ar rcu"
macosx
''} ''}
) )
'' + stdenv.lib.optionalString isMingw '' '' + stdenv.lib.optionalString isMingw ''

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, readline, compat ? false }: { stdenv, fetchurl, readline, compat ? false
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "lua-${version}"; name = "lua-${version}";
@ -54,21 +56,15 @@ stdenv.mkDerivation rec {
''; '';
crossAttrs = let crossAttrs = let
isMingw = stdenv.cross.libc == "msvcrt"; inherit (hostPlatform) isDarwin isMingw;
isDarwin = stdenv.cross.libc == "libSystem";
in { in {
configurePhase = '' configurePhase = ''
makeFlagsArray=( makeFlagsArray=(
INSTALL_TOP=$out INSTALL_TOP=$out
INSTALL_MAN=$out/share/man/man1 INSTALL_MAN=$out/share/man/man1
CC=${stdenv.cross.config}-gcc
STRIP=:
RANLIB=${stdenv.cross.config}-ranlib
V=${luaversion} V=${luaversion}
R=${version} R=${version}
${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin '' ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
AR="${stdenv.cross.config}-ar rcu"
macosx
''} ''}
) )
'' + stdenv.lib.optionalString isMingw '' '' + stdenv.lib.optionalString isMingw ''

View File

@ -1,14 +1,15 @@
{ stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap { stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap
, openglSupport ? false, mesa_noglu, mesa_glu , openglSupport ? false, mesa_noglu, mesa_glu
, alsaSupport ? true, alsaLib , alsaSupport ? true, alsaLib
, x11Support ? true, libXext, libICE, libXrandr , x11Support ? hostPlatform == buildPlatform, libXext, libICE, libXrandr
, pulseaudioSupport ? true, libpulseaudio , pulseaudioSupport ? true, libpulseaudio
, OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa , OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa
, hostPlatform, buildPlatform
}: }:
# OSS is no longer supported, for it's much crappier than ALSA and # OSS is no longer supported, for it's much crappier than ALSA and
# PulseAudio. # PulseAudio.
assert (stdenv.isLinux && !(stdenv ? cross)) -> alsaSupport || pulseaudioSupport; assert hostPlatform.isLinux -> alsaSupport || pulseaudioSupport;
let let
inherit (stdenv.lib) optional optionals; inherit (stdenv.lib) optional optionals;
@ -37,7 +38,7 @@ stdenv.mkDerivation rec {
optional stdenv.isDarwin Cocoa; optional stdenv.isDarwin Cocoa;
buildInputs = let buildInputs = let
notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt"; notMingw = !hostPlatform.isMinGW;
in optional notMingw audiofile in optional notMingw audiofile
++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ]; ++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ];
@ -52,9 +53,8 @@ stdenv.mkDerivation rec {
"--enable-rpath" "--enable-rpath"
"--disable-pulseaudio-shared" "--disable-pulseaudio-shared"
"--disable-osmesa-shared" "--disable-osmesa-shared"
] ++ optionals (stdenv ? cross) ([ ] ++ optional (!x11Support) "--without-x"
"--without-x" ++ optional (alsaSupport && hostPlatform != buildPlatform) "--with-alsa-prefix=${alsaLib.out}/lib";
] ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib");
patches = [ patches = [
# Fix window resizing issues, e.g. for xmonad # Fix window resizing issues, e.g. for xmonad

View File

@ -1,4 +1,6 @@
{ lib, stdenv, fetchurl, pkgconfig, libatomic_ops, enableLargeConfig ? false }: { lib, stdenv, fetchurl, pkgconfig, libatomic_ops, enableLargeConfig ? false
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "boehm-gc-7.6.0"; name = "boehm-gc-7.6.0";
@ -20,7 +22,7 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
# Don't run the native `strip' when cross-compiling. # Don't run the native `strip' when cross-compiling.
dontStrip = stdenv ? cross; dontStrip = hostPlatform != buildPlatform;
postInstall = postInstall =
'' ''

View File

@ -1,10 +1,11 @@
{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv { stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
, buildPlatform, hostPlatform
, toolset ? if stdenv.cc.isClang then "clang" else null , toolset ? if stdenv.cc.isClang then "clang" else null
, enableRelease ? true , enableRelease ? true
, enableDebug ? false , enableDebug ? false
, enableSingleThreaded ? false , enableSingleThreaded ? false
, enableMultiThreaded ? true , enableMultiThreaded ? true
, enableShared ? !(stdenv.cross.libc or null == "msvcrt") # problems for now , enableShared ? !(hostPlatform.libc == "msvcrt") # problems for now
, enableStatic ? !enableShared , enableStatic ? !enableShared
, enablePIC ? false , enablePIC ? false
, enableExceptions ? false , enableExceptions ? false
@ -76,11 +77,11 @@ let
"--user-config=user-config.jam" "--user-config=user-config.jam"
"toolset=gcc-cross" "toolset=gcc-cross"
"--without-python" "--without-python"
] ++ optionals (stdenv.cross.libc == "msvcrt") [ ] ++ optionals (hostPlatform.libc == "msvcrt") [
"target-os=windows" "target-os=windows"
"threadapi=win32" "threadapi=win32"
"binary-format=pe" "binary-format=pe"
"address-model=${if hasPrefix "x86_64-" stdenv.cross.config then "64" else "32"}" "address-model=${toString hostPlatform.parsed.cpu.bits}"
"architecture=x86" "architecture=x86"
]; ];
crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
@ -110,8 +111,8 @@ let
find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
-exec sed '1i#line 1 "{}"' -i '{}' \; -exec sed '1i#line 1 "{}"' -i '{}' \;
) )
'' + optionalString (stdenv.cross.libc or null == "msvcrt") '' '' + optionalString (hostPlatform.libc == "msvcrt") ''
${stdenv.cross.config}-ranlib "$out/lib/"*.a ${stdenv.cc.prefix}ranlib "$out/lib/"*.a
''; '';
in in
@ -147,13 +148,13 @@ stdenv.mkDerivation {
enableParallelBuilding = true; enableParallelBuilding = true;
buildInputs = [ expat zlib bzip2 libiconv ] buildInputs = [ expat zlib bzip2 libiconv ]
++ stdenv.lib.optionals (! stdenv ? cross) [ python icu ] ++ stdenv.lib.optionals (hostPlatform == buildPlatform) [ python icu ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
configureScript = "./bootstrap.sh"; configureScript = "./bootstrap.sh";
configureFlags = commonConfigureFlags configureFlags = commonConfigureFlags
++ [ "--with-python=${python.interpreter}" ] ++ [ "--with-python=${python.interpreter}" ]
++ optional (! stdenv ? cross) "--with-icu=${icu.dev}" ++ optional (hostPlatform == buildPlatform) "--with-icu=${icu.dev}"
++ optional (toolset != null) "--with-toolset=${toolset}"; ++ optional (toolset != null) "--with-toolset=${toolset}";
buildPhase = builder nativeB2Args; buildPhase = builder nativeB2Args;
@ -177,7 +178,7 @@ stdenv.mkDerivation {
buildPhase = builder crossB2Args; buildPhase = builder crossB2Args;
installPhase = installer crossB2Args; installPhase = installer crossB2Args;
postFixup = fixup; postFixup = fixup;
} // optionalAttrs (stdenv.cross.libc == "msvcrt") { } // optionalAttrs (hostPlatform.libc == "msvcrt") {
patches = fetchurl { patches = fetchurl {
url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/" url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
+ "boost-mingw.patch"; + "boost-mingw.patch";

View File

@ -1,4 +1,5 @@
{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm { stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
, hostPlatform
/* /*
* Licensing options (yes some are listed twice, filters and such are not listed) * Licensing options (yes some are listed twice, filters and such are not listed)
*/ */
@ -428,30 +429,13 @@ stdenv.mkDerivation rec {
/* Cross-compilation is untested, consider this an outline, more work /* Cross-compilation is untested, consider this an outline, more work
needs to be done to portions of the build to get it to work correctly */ needs to be done to portions of the build to get it to work correctly */
crossAttrs = let crossAttrs = {
os = ''
if [ "${stdenv.cross.config}" = "*cygwin*" ] ; then
# Probably should look for mingw too
echo "cygwin"
elif [ "${stdenv.cross.config}" = "*darwin*" ] ; then
echo "darwin"
elif [ "${stdenv.cross.config}" = "*freebsd*" ] ; then
echo "freebsd"
elif [ "${stdenv.cross.config}" = "*linux*" ] ; then
echo "linux"
elif [ "${stdenv.cross.config}" = "*netbsd*" ] ; then
echo "netbsd"
elif [ "${stdenv.cross.config}" = "*openbsd*" ] ; then
echo "openbsd"
fi
'';
in {
configurePlatforms = []; configurePlatforms = [];
configureFlags = configureFlags ++ [ configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-" "--cross-prefix=${stdenv.cc.prefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=${os}" "--target_os=${hostPlatform.parsed.kernel.name}"
"--arch=${stdenv.cross.arch}" "--arch=${hostPlatform.arch}"
]; ];
}; };

View File

@ -2,6 +2,7 @@
, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr , libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
, x264, x265, xvidcore, zlib, libopus , x264, x265, xvidcore, zlib, libopus
, hostPlatform
, openglSupport ? false, mesa ? null , openglSupport ? false, mesa ? null
# Build options # Build options
, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime , runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
@ -169,30 +170,13 @@ stdenv.mkDerivation rec {
/* Cross-compilation is untested, consider this an outline, more work /* Cross-compilation is untested, consider this an outline, more work
needs to be done to portions of the build to get it to work correctly */ needs to be done to portions of the build to get it to work correctly */
crossAttrs = let crossAttrs = {
os = ''
if [ "${stdenv.cross.config}" = "*cygwin*" ] ; then
# Probably should look for mingw too
echo "cygwin"
elif [ "${stdenv.cross.config}" = "*darwin*" ] ; then
echo "darwin"
elif [ "${stdenv.cross.config}" = "*freebsd*" ] ; then
echo "freebsd"
elif [ "${stdenv.cross.config}" = "*linux*" ] ; then
echo "linux"
elif [ "${stdenv.cross.config}" = "*netbsd*" ] ; then
echo "netbsd"
elif [ "${stdenv.cross.config}" = "*openbsd*" ] ; then
echo "openbsd"
fi
'';
in {
configurePlatforms = []; configurePlatforms = [];
configureFlags = configureFlags ++ [ configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-" "--cross-prefix=${stdenv.cc.prefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=${os}" "--target_os=${hostPlatform.parsed.kernel}"
"--arch=${stdenv.cross.arch}" "--arch=${hostPlatform.arch}"
]; ];
}; };

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, pkgconfig, freetype, expat }: { stdenv, fetchurl, pkgconfig, freetype, expat
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "fontconfig-2.10.2"; name = "fontconfig-2.10.2";
@ -21,7 +23,7 @@ stdenv.mkDerivation rec {
]; ];
# We should find a better way to access the arch reliably. # We should find a better way to access the arch reliably.
crossArch = stdenv.cross.arch or null; crossArch = hostPlatform.arch or null;
preConfigure = '' preConfigure = ''
if test -n "$crossConfig"; then if test -n "$crossConfig"; then

View File

@ -1,5 +1,7 @@
{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, dejavu_fonts { stdenv, substituteAll, fetchurl, fetchpatch
, substituteAll }: , pkgconfig, freetype, expat, libxslt, dejavu_fonts
, hostPlatform
}:
/** Font configuration scheme /** Font configuration scheme
- ./config-compat.patch makes fontconfig try the following root configs, in order: - ./config-compat.patch makes fontconfig try the following root configs, in order:
@ -53,7 +55,7 @@ stdenv.mkDerivation rec {
]; ];
# We should find a better way to access the arch reliably. # We should find a better way to access the arch reliably.
crossArch = stdenv.cross.arch or null; crossArch = hostPlatform.arch or null;
preConfigure = '' preConfigure = ''
if test -n "$crossConfig"; then if test -n "$crossConfig"; then

View File

@ -1,12 +1,12 @@
{ { stdenv, lib, fetchurl, copyPathsToStore
stdenv, lib, fetchurl, copyPathsToStore, , hostPlatform
pkgconfig, which, , pkgconfig, which
zlib, bzip2, libpng, gnumake, glib, , zlib, bzip2, libpng, gnumake, glib
# FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering). , # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
# LCD filtering is also known as ClearType and covered by several Microsoft patents. # LCD filtering is also known as ClearType and covered by several Microsoft patents.
# This option allows it to be disabled. See http://www.freetype.org/patents.html. # This option allows it to be disabled. See http://www.freetype.org/patents.html.
useEncumberedCode ? true, useEncumberedCode ? true
}: }:
let let
@ -67,7 +67,7 @@ in stdenv.mkDerivation {
postInstall = glib.flattenInclude; postInstall = glib.flattenInclude;
crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc or null != "msvcrt") { crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc or null != "msvcrt") {
# Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead # Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
# of gcc. I think it's due to the unwrapped gcc being in the PATH. I don't # of gcc. I think it's due to the unwrapped gcc being in the PATH. I don't
# know why it's on the PATH. # know why it's on the PATH.

View File

@ -1,5 +1,7 @@
{ stdenv, fetchurl, mesa_glu, x11, libXmu, libXi { stdenv, fetchurl, mesa_glu, x11, libXmu, libXi
, AGL ? null }: , buildPlatform, hostPlatform
, AGL ? null
}:
with stdenv.lib; with stdenv.lib;
@ -17,7 +19,7 @@ stdenv.mkDerivation rec {
patchPhase = '' patchPhase = ''
sed -i 's|lib64|lib|' config/Makefile.linux sed -i 's|lib64|lib|' config/Makefile.linux
${optionalString (stdenv ? cross) '' ${optionalString (hostPlatform != buildPlatform) ''
sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
''} ''}
''; '';
@ -36,13 +38,9 @@ stdenv.mkDerivation rec {
cp -r README.txt LICENSE.txt doc $out/share/doc/glew cp -r README.txt LICENSE.txt doc $out/share/doc/glew
''; '';
crossAttrs.makeFlags = [ makeFlags = if hostPlatform == buildPlatform then null else [
"CC=${stdenv.cross.config}-gcc" "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
"LD=${stdenv.cross.config}-gcc" ];
"AR=${stdenv.cross.config}-ar"
"STRIP="
] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"
++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "An OpenGL extension loading library for C(++)"; description = "An OpenGL extension loading library for C(++)";

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi }: { stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi
, buildPlatform, hostPlatform
}:
with stdenv.lib; with stdenv.lib;
@ -17,7 +19,7 @@ stdenv.mkDerivation rec {
patchPhase = '' patchPhase = ''
sed -i 's|lib64|lib|' config/Makefile.linux sed -i 's|lib64|lib|' config/Makefile.linux
${optionalString (stdenv ? cross) '' ${optionalString (hostPlatform != buildPlatform) ''
sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
''} ''}
''; '';
@ -37,13 +39,9 @@ stdenv.mkDerivation rec {
rm $out/lib/*.a rm $out/lib/*.a
''; '';
crossAttrs.makeFlags = [ makeFlags = if hostPlatform == buildPlatform then null else [
"CC=${stdenv.cross.config}-gcc" "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
"LD=${stdenv.cross.config}-gcc" ];
"AR=${stdenv.cross.config}-ar"
"STRIP="
] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"
++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "An OpenGL extension loading library for C(++)"; description = "An OpenGL extension loading library for C(++)";

View File

@ -13,6 +13,7 @@
, SDL # only for avplay in $bin, adds nontrivial closure to it , SDL # only for avplay in $bin, adds nontrivial closure to it
, enableGPL ? true # ToDo: some additional default stuff may need GPL , enableGPL ? true # ToDo: some additional default stuff may need GPL
, enableUnfree ? faacSupport , enableUnfree ? faacSupport
, hostPlatform
}: }:
assert faacSupport -> enableUnfree; assert faacSupport -> enableUnfree;
@ -107,10 +108,10 @@ let
crossAttrs = { crossAttrs = {
configurePlatforms = []; configurePlatforms = [];
configureFlags = configureFlags ++ [ configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-" "--cross-prefix=${stdenv.cc.prefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=linux" "--target_os=linux"
"--arch=${stdenv.cross.arch}" "--arch=${hostPlatform.arch}"
]; ];
}; };

View File

@ -1,4 +1,6 @@
{ fetchurl, stdenv, dejagnu, doCheck ? false }: { fetchurl, stdenv, dejagnu, doCheck ? false
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libffi-3.2.1"; name = "libffi-3.2.1";
@ -21,7 +23,7 @@ stdenv.mkDerivation rec {
inherit doCheck; inherit doCheck;
dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling. dontStrip = hostPlatform != buildPlatform; # Don't run the native `strip' when cross-compiling.
# Install headers and libs in the right places. # Install headers and libs in the right places.
postFixup = '' postFixup = ''

View File

@ -1,6 +1,8 @@
{ fetchurl, stdenv, lib }: { fetchurl, stdenv, lib
, buildPlatform, hostPlatform
}:
assert !stdenv.isLinux || stdenv ? cross; # TODO: improve on cross assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libiconv-${version}"; name = "libiconv-${version}";
@ -12,7 +14,7 @@ stdenv.mkDerivation rec {
}; };
postPatch = postPatch =
lib.optionalString ((stdenv ? cross && stdenv.cross.libc == "msvcrt") || stdenv.cc.nativeLibc) lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
'' ''
sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
''; '';

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, nasm }: { stdenv, fetchurl, nasm
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libjpeg-turbo-${version}"; name = "libjpeg-turbo-${version}";
@ -10,7 +12,7 @@ stdenv.mkDerivation rec {
}; # github releases still need autotools, surprisingly }; # github releases still need autotools, surprisingly
patches = patches =
stdenv.lib.optional (stdenv.cross.libc or null == "msvcrt") stdenv.lib.optional (hostPlatform.libc or null == "msvcrt")
./mingw-boolean.patch; ./mingw-boolean.patch;
outputs = [ "bin" "dev" "out" "doc" ]; outputs = [ "bin" "dev" "out" "doc" ];

View File

@ -1,5 +1,6 @@
{ stdenv, cmake { stdenv, cmake
, version, src, patches ? [ ] , version, src, patches ? [ ]
, hostPlatform
, ... , ...
}: }:
@ -11,7 +12,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
crossAttrs = { crossAttrs = {
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
cmakeFlags = "-DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_SYSTEM_NAME=Windows"; cmakeFlags = "-DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_SYSTEM_NAME=Windows";
}; };

View File

@ -1,6 +1,8 @@
{ stdenv, fetchurl, zlib }: { stdenv, fetchurl, zlib
, buildPlatform, hostPlatform
}:
assert !(stdenv ? cross) -> zlib != null; assert hostPlatform == buildPlatform -> zlib != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libpng-1.2.57"; name = "libpng-1.2.57";
@ -16,7 +18,7 @@ stdenv.mkDerivation rec {
passthru = { inherit zlib; }; passthru = { inherit zlib; };
crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc == "libSystem") {
propagatedBuildInputs = []; propagatedBuildInputs = [];
passthru = {}; passthru = {};
}; };

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, zlib, apngSupport ? true }: { stdenv, fetchurl, zlib, apngSupport ? true
, buildPlatform, hostPlatform
}:
assert zlib != null; assert zlib != null;
@ -29,7 +31,7 @@ in stdenv.mkDerivation rec {
# it's hard to cross-run tests and some check programs didn't compile anyway # it's hard to cross-run tests and some check programs didn't compile anyway
makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS="; makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS=";
doCheck = ! stdenv ? cross; doCheck = hostPlatform == buildPlatform;
passthru = { inherit zlib; }; passthru = { inherit zlib; };

View File

@ -1,4 +1,6 @@
{stdenv, fetchurlBoot, openssl, zlib, windows}: { stdenv, fetchurlBoot, openssl, zlib, windows
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libssh2-1.8.0"; name = "libssh2-1.8.0";
@ -20,7 +22,7 @@ stdenv.mkDerivation rec {
"--with-libz" "--with-libz"
"--with-libz-prefix=${zlib.crossDrv}" "--with-libz-prefix=${zlib.crossDrv}"
]; ];
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
# mingw needs import library of ws2_32 to build the shared library # mingw needs import library of ws2_32 to build the shared library
preConfigure = '' preConfigure = ''
export LDFLAGS="-L${windows.mingw_w64}/lib $LDFLAGS" export LDFLAGS="-L${windows.mingw_w64}/lib $LDFLAGS"

View File

@ -1,4 +1,5 @@
{stdenv, fetchFromGitHub, perl, yasm { stdenv, fetchFromGitHub, perl, yasm
, hostPlatform
, vp8DecoderSupport ? true # VP8 decoder , vp8DecoderSupport ? true # VP8 decoder
, vp8EncoderSupport ? true # VP8 encoder , vp8EncoderSupport ? true # VP8 encoder
, vp9DecoderSupport ? true # VP9 decoder , vp9DecoderSupport ? true # VP9 decoder
@ -144,10 +145,7 @@ stdenv.mkDerivation rec {
postInstall = ''moveToOutput bin "$bin" ''; postInstall = ''moveToOutput bin "$bin" '';
crossAttrs = let crossAttrs = {
isCygwin = stdenv.cross.libc == "msvcrt";
isDarwin = stdenv.cross.libc == "libSystem";
in {
configurePlatforms = []; configurePlatforms = [];
configureFlags = configureFlags ++ [ configureFlags = configureFlags ++ [
#"--extra-cflags=" #"--extra-cflags="
@ -159,17 +157,17 @@ stdenv.mkDerivation rec {
# libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version) # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version)
# See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure
# Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14 # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14
"--force-target=${stdenv.cross.config}${( "--force-target=${hostPlatform.config}${
if isDarwin then ( if hostPlatform.isDarwin then
if stdenv.cross.osxMinVersion == "10.10" then "14" if hostPlatform.osxMinVersion == "10.10" then "14"
else if stdenv.cross.osxMinVersion == "10.9" then "13" else if hostPlatform.osxMinVersion == "10.9" then "13"
else if stdenv.cross.osxMinVersion == "10.8" then "12" else if hostPlatform.osxMinVersion == "10.8" then "12"
else if stdenv.cross.osxMinVersion == "10.7" then "11" else if hostPlatform.osxMinVersion == "10.7" then "11"
else if stdenv.cross.osxMinVersion == "10.6" then "10" else if hostPlatform.osxMinVersion == "10.6" then "10"
else if stdenv.cross.osxMinVersion == "10.5" then "9" else if hostPlatform.osxMinVersion == "10.5" then "9"
else "8") else "8"
else "")}-gcc" else ""}-gcc"
(if isCygwin then "--enable-static-msvcrt" else "") (if hostPlatform.isCygwin then "--enable-static-msvcrt" else "")
]; ];
}; };

View File

@ -1,4 +1,5 @@
{stdenv, fetchgit, perl, yasm { stdenv, fetchgit, perl, yasm
, hostPlatform
, vp8DecoderSupport ? true # VP8 decoder , vp8DecoderSupport ? true # VP8 decoder
, vp8EncoderSupport ? true # VP8 encoder , vp8EncoderSupport ? true # VP8 encoder
, vp9DecoderSupport ? true # VP9 decoder , vp9DecoderSupport ? true # VP9 decoder
@ -152,10 +153,7 @@ stdenv.mkDerivation rec {
postInstall = ''moveToOutput bin "$bin" ''; postInstall = ''moveToOutput bin "$bin" '';
crossAttrs = let crossAttrs = {
isCygwin = stdenv.cross.libc == "msvcrt";
isDarwin = stdenv.cross.libc == "libSystem";
in {
configurePlatforms = []; configurePlatforms = [];
configureFlags = configureFlags ++ [ configureFlags = configureFlags ++ [
#"--extra-cflags=" #"--extra-cflags="
@ -166,17 +164,17 @@ stdenv.mkDerivation rec {
# libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version) # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version)
# See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure
# Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14 # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14
"--force-target=${stdenv.cross.config}${( "--force-target=${hostPlatform.config}${
if isDarwin then ( if hostPlatform.isDarwin then
if stdenv.cross.osxMinVersion == "10.10" then "14" if hostPlatform.osxMinVersion == "10.10" then "14"
else if stdenv.cross.osxMinVersion == "10.9" then "13" else if hostPlatform.osxMinVersion == "10.9" then "13"
else if stdenv.cross.osxMinVersion == "10.8" then "12" else if hostPlatform.osxMinVersion == "10.8" then "12"
else if stdenv.cross.osxMinVersion == "10.7" then "11" else if hostPlatform.osxMinVersion == "10.7" then "11"
else if stdenv.cross.osxMinVersion == "10.6" then "10" else if hostPlatform.osxMinVersion == "10.6" then "10"
else if stdenv.cross.osxMinVersion == "10.5" then "9" else if hostPlatform.osxMinVersion == "10.5" then "9"
else "8") else "8"
else "")}-gcc" else ""}-gcc"
(if isCygwin then "--enable-static-msvcrt" else "") (if hostPlatform.isCygwin then "--enable-static-msvcrt" else "")
]; ];
}; };

View File

@ -1,7 +1,9 @@
{ stdenv, lib, fetchurl, fetchpatch { stdenv, lib, fetchurl, fetchpatch
, zlib, xz, python2, findXMLCatalogs, libiconv , zlib, xz, python2, findXMLCatalogs, libiconv
, pythonSupport ? (! stdenv ? cross) , buildPlatform, hostPlatform
, icuSupport ? false, icu ? null }: , pythonSupport ? buildPlatform == hostPlatform
, icuSupport ? false, icu ? null
}:
let let
python = python2; python = python2;
@ -45,7 +47,7 @@ in stdenv.mkDerivation rec {
doCheck = !stdenv.isDarwin; doCheck = !stdenv.isDarwin;
crossAttrs = lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
# creating the DLL is broken ATM # creating the DLL is broken ATM
dontDisableStatic = true; dontDisableStatic = true;
configureFlags = configureFlags ++ [ "--disable-shared" ]; configureFlags = configureFlags ++ [ "--disable-shared" ];

View File

@ -1,6 +1,7 @@
{ stdenv, hostPlatform, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2 { stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2
, buildPlatform, hostPlatform
, cryptoSupport ? false , cryptoSupport ? false
, pythonSupport ? (! stdenv ? cross) , pythonSupport ? buildPlatform == hostPlatform
}: }:
assert pythonSupport -> python2 != null; assert pythonSupport -> python2 != null;

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
NIX_LDFLAGS = "-lncurses"; NIX_LDFLAGS = "-lncurses";
crossAttrs = { crossAttrs = {
makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-"; makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}";
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,4 +1,6 @@
{ stdenv, fetchFromGitHub, cmake }: { stdenv, fetchFromGitHub, cmake
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "nlohmann_json-${version}"; name = "nlohmann_json-${version}";
@ -21,7 +23,7 @@ stdenv.mkDerivation rec {
crossAttrs = { crossAttrs = {
cmakeFlags = "-DBuildTests=OFF"; cmakeFlags = "-DBuildTests=OFF";
doCheck = false; doCheck = false;
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
cmakeFlags = "-DBuildTests=OFF -DCMAKE_SYSTEM_NAME=Windows"; cmakeFlags = "-DBuildTests=OFF -DCMAKE_SYSTEM_NAME=Windows";
}; };

View File

@ -1,12 +1,14 @@
{ stdenv, fetchurl, buildPackages, perl { stdenv, fetchurl, buildPackages, perl
, hostPlatform
, withCryptodev ? false, cryptodevHeaders , withCryptodev ? false, cryptodevHeaders
, enableSSL2 ? false }: , enableSSL2 ? false
}:
with stdenv.lib; with stdenv.lib;
let let
opensslCrossSystem = stdenv.cross.openssl.system or opensslCrossSystem = hostPlatform.openssl.system or
(throw "openssl needs its platform name cross building"); (throw "openssl needs its platform name cross building");
common = args@{ version, sha256, patches ? [] }: stdenv.mkDerivation rec { common = args@{ version, sha256, patches ? [] }: stdenv.mkDerivation rec {
@ -22,8 +24,7 @@ let
++ [ ./nix-ssl-cert-file.patch ] ++ [ ./nix-ssl-cert-file.patch ]
++ optional (versionOlder version "1.1.0") ++ optional (versionOlder version "1.1.0")
(if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch) (if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch)
++ optional ++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin)
(versionOlder version "1.0.2" && (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")))
./darwin-arch.patch; ./darwin-arch.patch;
outputs = [ "bin" "dev" "out" "man" ]; outputs = [ "bin" "dev" "out" "man" ];
@ -88,10 +89,6 @@ let
preConfigure='' preConfigure=''
# It's configure does not like --build or --host # It's configure does not like --build or --host
export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}" export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}"
# WINDRES and RANLIB need to be prefixed when cross compiling;
# the openssl configure script doesn't do that for us
export WINDRES=${stdenv.cross.config}-windres
export RANLIB=${stdenv.cross.config}-ranlib
''; '';
configureScript = "./Configure"; configureScript = "./Configure";
}; };

View File

@ -6,6 +6,7 @@
, introspectionSupport ? false, gobjectIntrospection ? null , introspectionSupport ? false, gobjectIntrospection ? null
, utils ? false , utils ? false
, minimal ? false, suffix ? "glib" , minimal ? false, suffix ? "glib"
, hostPlatform
}: }:
let # beware: updates often break cups-filters build let # beware: updates often break cups-filters build
@ -56,7 +57,7 @@ stdenv.mkDerivation rec {
crossAttrs.postPatch = crossAttrs.postPatch =
# there are tests using `strXXX_s` functions that are missing apparently # there are tests using `strXXX_s` functions that are missing apparently
stdenv.lib.optionalString (stdenv.cross.libc or null == "msvcrt") stdenv.lib.optionalString (hostPlatform.libc or null == "msvcrt")
"sed '/^SUBDIRS =/s/ test / /' -i Makefile.in"; "sed '/^SUBDIRS =/s/ test / /' -i Makefile.in";
meta = with lib; { meta = with lib; {

View File

@ -1,4 +1,5 @@
{ stdenv, fetchurl, fetchpatch, substituteAll { stdenv, fetchurl, fetchpatch, substituteAll
, hostPlatform
, libXrender, libXinerama, libXcursor, libXmu, libXv, libXext , libXrender, libXinerama, libXcursor, libXmu, libXv, libXext
, libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng , libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
, libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig , libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
@ -182,9 +183,7 @@ stdenv.mkDerivation rec {
rm -rf $out/tests rm -rf $out/tests
''; '';
crossAttrs = let crossAttrs = {
isMingw = stdenv.cross.libc == "msvcrt";
in {
# I've not tried any case other than i686-pc-mingw32. # I've not tried any case other than i686-pc-mingw32.
# -nomake tools: it fails linking some asian language symbols # -nomake tools: it fails linking some asian language symbols
# -no-svg: it fails to build on mingw64 # -no-svg: it fails to build on mingw64
@ -194,14 +193,14 @@ stdenv.mkDerivation rec {
-no-svg -no-svg
-make qmake -make libs -nomake tools -make qmake -make libs -nomake tools
-nomake demos -nomake examples -nomake docs -nomake demos -nomake examples -nomake docs
'' + optionalString isMingw " -xplatform win32-g++-4.6"; '' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6";
patches = []; patches = [];
preConfigure = '' preConfigure = ''
sed -i -e 's/ g++/ ${stdenv.cross.config}-g++/' \ sed -i -e 's/ g++/ ${stdenv.cc.prefix}g++/' \
-e 's/ gcc/ ${stdenv.cross.config}-gcc/' \ -e 's/ gcc/ ${stdenv.cc.prefix}gcc/' \
-e 's/ ar/ ${stdenv.cross.config}-ar/' \ -e 's/ ar/ ${stdenv.cc.prefix}ar/' \
-e 's/ strip/ ${stdenv.cross.config}-strip/' \ -e 's/ strip/ ${stdenv.cc.prefix}strip/' \
-e 's/ windres/ ${stdenv.cross.config}-windres/' \ -e 's/ windres/ ${stdenv.cc.prefix}windres/' \
mkspecs/win32-g++/qmake.conf mkspecs/win32-g++/qmake.conf
''; '';
@ -211,7 +210,7 @@ stdenv.mkDerivation rec {
''; '';
configurePlatforms = []; configurePlatforms = [];
dontStrip = true; dontStrip = true;
} // optionalAttrs isMingw { } // optionalAttrs hostPlatform.isMinGW {
propagatedBuildInputs = [ ]; propagatedBuildInputs = [ ];
}; };

View File

@ -1,4 +1,6 @@
{ fetchurl, stdenv, ncurses }: { fetchurl, stdenv, ncurses
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
name = "readline-6.2"; name = "readline-6.2";
@ -57,6 +59,6 @@ stdenv.mkDerivation (rec {
// //
# Don't run the native `strip' when cross-compiling. # Don't run the native `strip' when cross-compiling.
(if (stdenv ? cross) (if hostPlatform != buildPlatform
then { dontStrip = true; } then { dontStrip = true; }
else { })) else { }))

View File

@ -1,4 +1,6 @@
{ fetchurl, stdenv, ncurses }: { fetchurl, stdenv, ncurses
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "readline-6.3p08"; name = "readline-6.3p08";
@ -29,7 +31,7 @@ stdenv.mkDerivation rec {
import ./readline-6.3-patches.nix patch); import ./readline-6.3-patches.nix patch);
# Don't run the native `strip' when cross-compiling. # Don't run the native `strip' when cross-compiling.
dontStrip = stdenv ? cross; dontStrip = hostPlatform != buildPlatform;
bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null; bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,4 +1,6 @@
{ fetchurl, stdenv, ncurses }: { fetchurl, stdenv, ncurses
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "readline-${version}"; name = "readline-${version}";
@ -33,7 +35,7 @@ stdenv.mkDerivation rec {
*/ */
# Don't run the native `strip' when cross-compiling. # Don't run the native `strip' when cross-compiling.
dontStrip = stdenv ? cross; dontStrip = hostPlatform != buildPlatform;
bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null; bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
crossAttrs = { crossAttrs = {
dontStrip = static; dontStrip = static;
configurePlatforms = []; configurePlatforms = [];
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
installFlags = [ installFlags = [
"BINARY_PATH=$(out)/bin" "BINARY_PATH=$(out)/bin"
"INCLUDE_PATH=$(dev)/include" "INCLUDE_PATH=$(dev)/include"
@ -70,14 +70,12 @@ stdenv.mkDerivation rec {
]; ];
makeFlags = [ makeFlags = [
"-f" "win32/Makefile.gcc" "-f" "win32/Makefile.gcc"
"PREFIX=${stdenv.cross.config}-" "PREFIX=${stdenv.cc.prefix}"
] ++ stdenv.lib.optional (!static) "SHARED_MODE=1"; ] ++ stdenv.lib.optional (!static) "SHARED_MODE=1";
# Non-typical naming confuses libtool which then refuses to use zlib's DLL # Non-typical naming confuses libtool which then refuses to use zlib's DLL
# in some cases, e.g. when compiling libpng. # in some cases, e.g. when compiling libpng.
postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll"; postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll";
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") {
makeFlags = [ "RANLIB=${stdenv.cross.config}-ranlib" ];
}; };
passthru.version = version; passthru.version = version;

View File

@ -1,5 +1,6 @@
{ stdenv, fetchurl, fetchpatch, replace, curl, expat, zlib, bzip2 { stdenv, fetchurl, fetchpatch, replace, curl, expat, zlib, bzip2
, useNcurses ? false, ncurses, useQt4 ? false, qt4, wantPS ? false, ps ? null , useNcurses ? false, ncurses, useQt4 ? false, qt4, wantPS ? false, ps ? null
, buildPlatform, hostPlatform
}: }:
with stdenv.lib; with stdenv.lib;
@ -35,7 +36,7 @@ stdenv.mkDerivation rec {
})] ++ })] ++
# Don't search in non-Nix locations such as /usr, but do search in our libc. # Don't search in non-Nix locations such as /usr, but do search in our libc.
[ ./search-path.patch ] ++ [ ./search-path.patch ] ++
optional (stdenv ? cross) (fetchurl { optional (hostPlatform != buildPlatform) (fetchurl {
name = "fix-darwin-cross-compile.patch"; name = "fix-darwin-cross-compile.patch";
url = "http://public.kitware.com/Bug/file_download.php?" url = "http://public.kitware.com/Bug/file_download.php?"
+ "file_id=4981&type=bug"; + "file_id=4981&type=bug";

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, m4, perl, help2man }: { stdenv, fetchurl, m4, perl, help2man
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libtool-2.4.6"; name = "libtool-2.4.6";
@ -23,7 +25,7 @@ stdenv.mkDerivation rec {
# Don't run the native `strip' when cross-compiling. This breaks at least # Don't run the native `strip' when cross-compiling. This breaks at least
# with `.a' files for MinGW. # with `.a' files for MinGW.
dontStrip = stdenv ? cross; dontStrip = hostPlatform != buildPlatform;
meta = { meta = {
description = "GNU Libtool, a generic library support script"; description = "GNU Libtool, a generic library support script";

View File

@ -1,4 +1,7 @@
{ stdenv, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib, mesa }: { stdenv
, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib, mesa
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "scummvm-1.9.0"; name = "scummvm-1.9.0";
@ -16,7 +19,7 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
# Remove the --build flag set by the gcc cross wrapper setup # Remove the --build flag set by the gcc cross wrapper setup
# hook # hook
export configureFlags="--host=${stdenv.cross.config}" export configureFlags="--host=${hostPlatform.config}"
''; '';
postConfigure = '' postConfigure = ''
# They use 'install -s', that calls the native strip instead of the cross # They use 'install -s', that calls the native strip instead of the cross

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, bc, dtc, python2 }: { stdenv, fetchurl, bc, dtc, python2
, hostPlatform
}:
let let
buildUBoot = { targetPlatforms buildUBoot = { targetPlatforms
@ -43,8 +45,8 @@ let
crossAttrs = { crossAttrs = {
makeFlags = [ makeFlags = [
"ARCH=${stdenv.cross.platform.kernelArch}" "ARCH=${hostPlatform.platform.kernelArch}"
"CROSS_COMPILE=${stdenv.cross.config}-" "CROSS_COMPILE=${stdenv.cc.prefix}"
]; ];
}; };

View File

@ -1,4 +1,6 @@
{ stdenv, kernel, perl }: { stdenv, kernel, perl
, hostPlatform
}:
let let
baseBuildFlags = [ "INSTALL_HDR_PATH=$(out)" "headers_install" ]; baseBuildFlags = [ "INSTALL_HDR_PATH=$(out)" "headers_install" ];
@ -13,7 +15,7 @@ in stdenv.mkDerivation {
crossAttrs = { crossAttrs = {
inherit (kernel.crossDrv) src patches; inherit (kernel.crossDrv) src patches;
buildFlags = [ "ARCH=${stdenv.cross.platform.kernelArch}" ] ++ baseBuildFlags; buildFlags = [ "ARCH=${hostPlatform.platform.kernelArch}" ] ++ baseBuildFlags;
}; };
installPhase = '' installPhase = ''

View File

@ -25,6 +25,7 @@
kernelPatches ? [] kernelPatches ? []
, ignoreConfigErrors ? stdenv.platform.name != "pc" , ignoreConfigErrors ? stdenv.platform.name != "pc"
, extraMeta ? {} , extraMeta ? {}
, hostPlatform
, ... , ...
}: }:
@ -59,7 +60,7 @@ let
arch = stdenv.platform.kernelArch; arch = stdenv.platform.kernelArch;
crossAttrs = let crossAttrs = let
cp = stdenv.cross.platform; cp = hostPlatform.platform;
in { in {
arch = cp.kernelArch; arch = cp.kernelArch;
platformName = cp.name; platformName = cp.name;
@ -128,7 +129,7 @@ let
}; };
config = configWithPlatform stdenv.platform; config = configWithPlatform stdenv.platform;
configCross = configWithPlatform stdenv.cross.platform; configCross = configWithPlatform hostPlatform.platform;
nativeDrv = lib.addPassthru kernel.nativeDrv passthru; nativeDrv = lib.addPassthru kernel.nativeDrv passthru;

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
import ./generic.nix (args // rec { import ./generic.nix (args // rec {
version = "3.10.105"; version = "3.10.105";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
import ./generic.nix (args // rec { import ./generic.nix (args // rec {
version = "4.11.7"; version = "4.11.7";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
import ./generic.nix (args // rec { import ./generic.nix (args // rec {
version = "4.4.73"; version = "4.4.73";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
import ./generic.nix (args // rec { import ./generic.nix (args // rec {
version = "4.9.34"; version = "4.9.34";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchgit, perl, buildLinux, ncurses, ... } @ args: { stdenv, hostPlatform, fetchgit, perl, buildLinux, ncurses, ... } @ args:
# ChromiumOS requires a 64bit build host # ChromiumOS requires a 64bit build host
assert stdenv.is64bit; assert stdenv.is64bit;

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args:
let let
version = "4.11.7"; version = "4.11.7";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
import ./generic.nix (args // rec { import ./generic.nix (args // rec {
mptcpVersion = "0.91.3"; mptcpVersion = "0.91.3";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args:
let let
modDirVersion = "4.9.24"; modDirVersion = "4.9.24";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, buildLinux, ... } @ args: { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
import ./generic.nix (args // rec { import ./generic.nix (args // rec {
version = "4.12-rc6"; version = "4.12-rc6";

View File

@ -1,5 +1,6 @@
{ stdenv, runCommand, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl { stdenv, runCommand, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl
, writeTextFile, ubootChooser , writeTextFile, ubootChooser
, hostPlatform
}: }:
let let
@ -232,7 +233,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.platform (kernelPatches ++ nativeKe
karch = stdenv.platform.kernelArch; karch = stdenv.platform.kernelArch;
crossAttrs = let cp = stdenv.cross.platform; in crossAttrs = let cp = hostPlatform.platform; in
(drvAttrs crossConfig cp (kernelPatches ++ crossKernelPatches) crossConfigfile) // { (drvAttrs crossConfig cp (kernelPatches ++ crossKernelPatches) crossConfigfile) // {
makeFlags = commonMakeFlags ++ [ makeFlags = commonMakeFlags ++ [
"ARCH=${cp.kernelArch}" "ARCH=${cp.kernelArch}"

View File

@ -49,7 +49,7 @@ stdenv.mkDerivation {
/* I don't want cross-python or cross-perl - /* I don't want cross-python or cross-perl -
I don't know if cross-python even works */ I don't know if cross-python even works */
propagatedBuildInputs = [ elfutils.crossDrv newt.crossDrv ]; propagatedBuildInputs = [ elfutils.crossDrv newt.crossDrv ];
makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-"; makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}";
elfutils = elfutils.crossDrv; elfutils = elfutils.crossDrv;
inherit (kernel.crossDrv) src patches; inherit (kernel.crossDrv) src patches;
}; };

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, linuxHeaders, perl }: { stdenv, fetchurl, linuxHeaders, perl
, buildPlatform, hostPlatform
}:
let let
commonMakeFlags = [ commonMakeFlags = [
@ -23,17 +25,12 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" "stackprotector" ]; hardeningDisable = [ "format" "stackprotector" ];
makeFlags = commonMakeFlags ++ [ makeFlags = commonMakeFlags ++ [
"KLIBCARCH=${stdenv.platform.kernelArch}" "KLIBCARCH=${hostPlatform.platform.kernelArch}"
"KLIBCKERNELSRC=${linuxHeaders}" "KLIBCKERNELSRC=${linuxHeaders}"
] ++ stdenv.lib.optional (stdenv.platform.kernelArch == "arm") "CONFIG_AEABI=y"; ] # TODO(@Ericson2314): We now can get the ABI from
# `hostPlatform.parsed.abi`, is this still a good idea?
crossAttrs = { ++ stdenv.lib.optional (hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
makeFlags = commonMakeFlags ++ [ ++ stdenv.lib.optional (hostPlatform != buildPlatform) "CROSS_COMPILE=${stdenv.cc.prefix}";
"KLIBCARCH=${stdenv.cross.platform.kernelArch}"
"KLIBCKERNELSRC=${linuxHeaders.crossDrv}"
"CROSS_COMPILE=${stdenv.cross.config}-"
] ++ stdenv.lib.optional (stdenv.cross.platform.kernelArch == "arm") "CONFIG_AEABI=y";
};
# Install static binaries as well. # Install static binaries as well.
postInstall = '' postInstall = ''

View File

@ -1,4 +1,7 @@
{ stdenv, fetchurl, groff }: { stdenv
, fetchurl, groff
, buildPlatform, hostPlatform
}:
assert stdenv.isLinux; assert stdenv.isLinux;
@ -19,8 +22,8 @@ stdenv.mkDerivation rec {
makeFlags = [ makeFlags = [
"NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin" "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm" "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
] ++ stdenv.lib.optionals (stdenv ? cross) [ ] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
"CROSS_COMPILE=${stdenv.cross.config}-" "CROSS_COMPILE=${stdenv.cc.prefix}"
]; ];
nativeBuildInputs = [ groff ]; nativeBuildInputs = [ groff ];

View File

@ -1,4 +1,7 @@
{ stdenv, fetchurl, groff }: { stdenv
, fetchurl, groff
, buildPlatform, hostPlatform
}:
assert stdenv.isLinux; assert stdenv.isLinux;
@ -19,8 +22,8 @@ stdenv.mkDerivation rec {
makeFlags = [ makeFlags = [
"NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin" "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm" "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
] ++ stdenv.lib.optionals (stdenv ? cross) [ ] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
"CROSS_COMPILE=${stdenv.cross.config}-" "CROSS_COMPILE=${stdenv.cc.prefix}"
]; ];
nativeBuildInputs = [ groff ]; nativeBuildInputs = [ groff ];

View File

@ -8,10 +8,6 @@ stdenv.mkDerivation {
sha256 = "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g"; sha256 = "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g";
}; };
crossAttrs = {
makeFlags = "CC=${stdenv.cross.config}-gcc";
};
preInstall = '' preInstall = ''
mkdir -p $out/sbin $out/share/man/man8 mkdir -p $out/sbin $out/share/man/man8
makeFlagsArray=(SBINDIR=$out/sbin MANDIR=$out/share/man/man8) makeFlagsArray=(SBINDIR=$out/sbin MANDIR=$out/share/man/man8)

View File

@ -15,10 +15,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
crossAttrs = {
CC = stdenv.cross.config + "-gcc";
};
# Too red # Too red
configureFlags = [ "--disable-modern-top" ]; configureFlags = [ "--disable-modern-top" ];

View File

@ -15,10 +15,6 @@ stdenv.mkDerivation {
enableParallelBuilding = true; enableParallelBuilding = true;
crossAttrs = {
CC = stdenv.cross.config + "-gcc";
};
installPhase = "mkdir $out; mkdir -p $out/bin; cp -p watch $out/bin"; installPhase = "mkdir $out; mkdir -p $out/bin; cp -p watch $out/bin";
meta = { meta = {

View File

@ -1,11 +1,13 @@
{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt, libxml2 { stdenv, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt, libxml2
, docbook_xml_dtd_412, docbook_xsl, gnome_doc_utils, flex, bison , docbook_xml_dtd_412, docbook_xsl, gnome_doc_utils, flex, bison
, pam ? null, glibcCross ? null }: , pam ? null, glibcCross ? null
, buildPlatform, hostPlatform
}:
let let
glibc = glibc =
if stdenv ? cross if hostPlatform != buildPlatform
then glibcCross then glibcCross
else assert stdenv ? glibc; stdenv.glibc; else assert stdenv ? glibc; stdenv.glibc;

View File

@ -15,11 +15,7 @@ stdenv.mkDerivation {
sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h
''; '';
makeFlags = "SULOGINLIBS=-lcrypt ROOT=$(out) MANDIR=/share/man"; makeFlags = [ "SULOGINLIBS=-lcrypt" "ROOT=$(out)" "MANDIR=/share/man" ];
crossAttrs = {
makeFlags = "SULOGINLIBS=-lcrypt ROOT=$(out) MANDIR=/share/man CC=${stdenv.cross.config}-gcc";
};
preInstall = preInstall =
'' ''

View File

@ -18,7 +18,7 @@ stdenv.mkDerivation {
QTDIR = qt48; QTDIR = qt48;
crossAttrs = { crossAttrs = {
# cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cross.config}-windres"; # cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cc.prefix}windres";
QTDIR = qt48.crossDrv; QTDIR = qt48.crossDrv;
preBuild = '' preBuild = ''
export NIX_CROSS_CFLAGS_COMPILE=-fpermissive export NIX_CROSS_CFLAGS_COMPILE=-fpermissive

View File

@ -1,7 +1,7 @@
{ fetchurl, stdenv, mingw_headers }: { fetchurl, stdenv, mingw_headers }:
# This file is tweaked for cross-compilation only. # This file is tweaked for cross-compilation only.
assert stdenv ? cross; assert hostPlatform != buildPlatform;
stdenv.mkDerivation { stdenv.mkDerivation {
name = "pthread-w32-1.10.0"; name = "pthread-w32-1.10.0";

View File

@ -1,7 +1,8 @@
{ stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true, { stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true
, hostPlatform
}: }:
assert stdenv ? cross -> stdenv.cross.libc == "msvcrt"; assert hostPlatform.isWindows;
stdenv.mkDerivation { stdenv.mkDerivation {
name = "wxMSW-2.8.11"; name = "wxMSW-2.8.11";
@ -19,12 +20,6 @@ stdenv.mkDerivation {
"--with-opengl" "--with-opengl"
]; ];
# Cross build only tested for mingw32
checkCross = throw "This package can only be cross-built" false;
crossAttrs = {
checkCross = true;
};
preConfigure = " preConfigure = "
substituteInPlace configure --replace /usr /no-such-path substituteInPlace configure --replace /usr /no-such-path
"; ";

View File

@ -15,10 +15,6 @@ stdenv.mkDerivation rec {
buildInputs = [ libuuid lzo zlib acl ]; buildInputs = [ libuuid lzo zlib acl ];
crossAttrs = {
makeFlags = "CC=${stdenv.cross.config}-gcc";
};
meta = { meta = {
description = "Tools for MTD filesystems"; description = "Tools for MTD filesystems";
license = stdenv.lib.licenses.gpl2Plus; license = stdenv.lib.licenses.gpl2Plus;

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, libpng, static ? false }: { stdenv, fetchurl, libpng, static ? false
, buildPlatform, hostPlatform
}:
# This package comes with its own copy of zlib, libpng and pngxtern # This package comes with its own copy of zlib, libpng and pngxtern
@ -15,20 +17,16 @@ stdenv.mkDerivation rec {
buildInputs = [ libpng ]; buildInputs = [ libpng ];
LDFLAGS = optional static "-static"; LDFLAGS = optional static "-static";
configureFlags = "--with-system-zlib --with-system-libpng"; configureFlags = [
"--with-system-zlib"
"--with-system-libpng"
] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
#"-prefix=$out"
];
crossAttrs = { postInstall = if hostPlatform != buildPlatform && hostPlatform.isWindows then ''
CC="${stdenv.cross.config}-gcc"; mv "$out"/bin/optipng{,.exe}
LD="${stdenv.cross.config}-gcc"; '' else null;
AR="${stdenv.cross.config}-ar";
RANLIB="${stdenv.cross.config}-ranlib";
configurePhase = ''
./configure -prefix="$out" --with-system-zlib --with-system-libpng
'';
postInstall = optional (stdenv.cross.libc == "msvcrt") ''
mv "$out"/bin/optipng "$out"/bin/optipng.exe
'';
};
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://optipng.sourceforge.net/; homepage = http://optipng.sourceforge.net/;

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, libpcap, enableStatic ? false }: { stdenv, fetchurl, libpcap, enableStatic ? false
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "tcpdump-${version}"; name = "tcpdump-${version}";
@ -15,7 +17,7 @@ stdenv.mkDerivation rec {
crossAttrs = { crossAttrs = {
LDFLAGS = if enableStatic then "-static" else ""; LDFLAGS = if enableStatic then "-static" else "";
configureFlags = [ "ac_cv_linux_vers=2" ] ++ (stdenv.lib.optional configureFlags = [ "ac_cv_linux_vers=2" ] ++ (stdenv.lib.optional
(stdenv.cross.platform.kernelMajor == "2.4") "--disable-ipv6"); (hostPlatform.platform.kernelMajor == "2.4") "--disable-ipv6");
}; };
meta = { meta = {

View File

@ -2,6 +2,7 @@
, pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli, readline , pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli, readline
, autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl
, libseccomp, busybox , libseccomp, busybox
, hostPlatform
, storeDir ? "/nix/store" , storeDir ? "/nix/store"
, stateDir ? "/nix/var" , stateDir ? "/nix/var"
, confDir ? "/etc" , confDir ? "/etc"
@ -95,8 +96,8 @@ let
--disable-init-state --disable-init-state
--enable-gc --enable-gc
'' + stdenv.lib.optionalString ( '' + stdenv.lib.optionalString (
stdenv.cross ? nix && stdenv.cross.nix ? system hostPlatform ? nix && hostPlatform.nix ? system
) ''--with-system=${stdenv.cross.nix.system}''; ) ''--with-system=${hostPlatform.nix.system}'';
doInstallCheck = false; doInstallCheck = false;
}; };

View File

@ -10,10 +10,6 @@ stdenv.mkDerivation {
sed -i 's@/usr/bin/install@install@g ; s/gcc/cc/g' Makefile sed -i 's@/usr/bin/install@install@g ; s/gcc/cc/g' Makefile
''; '';
crossAttrs = {
makeFlags = "CC=${stdenv.cross.config}-gcc";
};
src = fetchurl { src = fetchurl {
url = http://vicerveza.homeunix.net/~viric/soft/tm/tm-0.4.1.tar.gz; url = http://vicerveza.homeunix.net/~viric/soft/tm/tm-0.4.1.tar.gz;
sha256 = "3b389bc03b6964ad5ffa57a344b891fdbcf7c9b2604adda723a863f83657c4a0"; sha256 = "3b389bc03b6964ad5ffa57a344b891fdbcf7c9b2604adda723a863f83657c4a0";

View File

@ -1,5 +1,6 @@
{stdenv, fetchurl, { stdenv, fetchurl
sendmailPath ? "/run/wrappers/bin/sendmail" }: , sendmailPath ? "/run/wrappers/bin/sendmail"
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -7,10 +8,6 @@ stdenv.mkDerivation rec {
installPhase=''make install "PREFIX=$out"''; installPhase=''make install "PREFIX=$out"'';
crossAttrs = {
makeFlags = "CC=${stdenv.cross.config}-gcc";
};
patchPhase = '' patchPhase = ''
sed -i s,/usr/sbin/sendmail,${sendmailPath}, mail.c ts.1 sed -i s,/usr/sbin/sendmail,${sendmailPath}, mail.c ts.1
''; '';

View File

@ -1,4 +1,6 @@
{ stdenv, fetchFromGitHub, cmake, libxslt }: { stdenv, fetchFromGitHub, cmake, libxslt
, hostPlatform
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "html-tidy-${version}"; name = "html-tidy-${version}";
@ -14,7 +16,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake libxslt/*manpage*/ ]; nativeBuildInputs = [ cmake libxslt/*manpage*/ ];
cmakeFlags = stdenv.lib.optional cmakeFlags = stdenv.lib.optional
(stdenv.cross.libc or null == "msvcrt") "-DCMAKE_SYSTEM_NAME=Windows"; (hostPlatform.libc or null == "msvcrt") "-DCMAKE_SYSTEM_NAME=Windows";
# ATM bin/tidy is statically linked, as upstream provides no other option yet. # ATM bin/tidy is statically linked, as upstream provides no other option yet.
# https://github.com/htacg/tidy-html5/issues/326#issuecomment-160322107 # https://github.com/htacg/tidy-html5/issues/326#issuecomment-160322107

View File

@ -1,4 +1,4 @@
{stdenv, fetchurl}: { stdenv, fetchurl }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "replace-2.24"; name = "replace-2.24";
@ -10,10 +10,6 @@ stdenv.mkDerivation {
makeFlags = "TREE=\$(out) MANTREE=\$(TREE)/share/man"; makeFlags = "TREE=\$(out) MANTREE=\$(TREE)/share/man";
crossAttrs = {
makeFlags = "TREE=\$(out) MANTREE=\$(TREE)/share/man CC=${stdenv.cross.config}-gcc";
};
preBuild = '' preBuild = ''
sed -e "s@/bin/mv@$(type -P mv)@" -i replace.h sed -e "s@/bin/mv@$(type -P mv)@" -i replace.h
''; '';

View File

@ -110,8 +110,6 @@ let
in { in {
stdenv = super.stdenv // { stdenv = super.stdenv // {
inherit (buildPlatform) platform; inherit (buildPlatform) platform;
} // lib.optionalAttrs (hostPlatform != buildPlatform) {
cross = hostPlatform;
}; };
inherit (buildPlatform) system platform; inherit (buildPlatform) system platform;
}; };