diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2017-06-28 23:17:21 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2017-06-28 23:17:21 -0400 |
commit | 16be434b0bec4d14a893010b46f56a64cab74cc1 (patch) | |
tree | 25e77807d55c76d42817197d576349478ff500a5 /pkgs/development/libraries | |
parent | d76bc8ed15cfa21d9f1cc47a06ee1fe8ac86d6d3 (diff) | |
parent | b0ada07f36abc21c990000b5cdbe780157d6b92b (diff) |
Merge accepted cross compilation PRs into staging
Diffstat (limited to 'pkgs/development/libraries')
31 files changed, 161 insertions, 174 deletions
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index 8330dada4d35b..e71ad14b11fd1 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -1,14 +1,15 @@ { stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap , openglSupport ? false, mesa_noglu, mesa_glu , alsaSupport ? true, alsaLib -, x11Support ? true, libXext, libICE, libXrandr +, x11Support ? hostPlatform == buildPlatform, libXext, libICE, libXrandr , pulseaudioSupport ? true, libpulseaudio , OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa +, hostPlatform, buildPlatform }: # OSS is no longer supported, for it's much crappier than ALSA and # PulseAudio. -assert (stdenv.isLinux && !(stdenv ? cross)) -> alsaSupport || pulseaudioSupport; +assert hostPlatform.isLinux -> alsaSupport || pulseaudioSupport; let inherit (stdenv.lib) optional optionals; @@ -37,7 +38,7 @@ stdenv.mkDerivation rec { optional stdenv.isDarwin Cocoa; buildInputs = let - notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt"; + notMingw = !hostPlatform.isMinGW; in optional notMingw audiofile ++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ]; @@ -52,9 +53,8 @@ stdenv.mkDerivation rec { "--enable-rpath" "--disable-pulseaudio-shared" "--disable-osmesa-shared" - ] ++ optionals (stdenv ? cross) ([ - "--without-x" - ] ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib"); + ] ++ optional (!x11Support) "--without-x" + ++ optional (alsaSupport && hostPlatform != buildPlatform) "--with-alsa-prefix=${alsaLib.out}/lib"; patches = [ # Fix window resizing issues, e.g. for xmonad diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix index 96e41790aac89..d32ec6cbf58b4 100644 --- a/pkgs/development/libraries/boehm-gc/default.nix +++ b/pkgs/development/libraries/boehm-gc/default.nix @@ -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 { name = "boehm-gc-7.6.0"; @@ -20,7 +22,7 @@ stdenv.mkDerivation rec { doCheck = true; # Don't run the native `strip' when cross-compiling. - dontStrip = stdenv ? cross; + dontStrip = hostPlatform != buildPlatform; postInstall = '' diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 174e9fe47769f..9a6c5d7b413a8 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -1,10 +1,11 @@ { stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv +, buildPlatform, hostPlatform , toolset ? if stdenv.cc.isClang then "clang" else null , enableRelease ? true , enableDebug ? false , enableSingleThreaded ? false , enableMultiThreaded ? true -, enableShared ? !(stdenv.cross.libc or null == "msvcrt") # problems for now +, enableShared ? !(hostPlatform.libc == "msvcrt") # problems for now , enableStatic ? !enableShared , enablePIC ? false , enableExceptions ? false @@ -76,11 +77,11 @@ let "--user-config=user-config.jam" "toolset=gcc-cross" "--without-python" - ] ++ optionals (stdenv.cross.libc == "msvcrt") [ + ] ++ optionals (hostPlatform.libc == "msvcrt") [ "target-os=windows" "threadapi=win32" "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" ]; crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); @@ -110,8 +111,8 @@ let find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ -exec sed '1i#line 1 "{}"' -i '{}' \; ) - '' + optionalString (stdenv.cross.libc or null == "msvcrt") '' - ${stdenv.cross.config}-ranlib "$out/lib/"*.a + '' + optionalString (hostPlatform.libc == "msvcrt") '' + ${stdenv.cc.prefix}ranlib "$out/lib/"*.a ''; in @@ -147,13 +148,13 @@ stdenv.mkDerivation { enableParallelBuilding = true; 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; configureScript = "./bootstrap.sh"; configureFlags = commonConfigureFlags ++ [ "--with-python=${python.interpreter}" ] - ++ optional (! stdenv ? cross) "--with-icu=${icu.dev}" + ++ optional (hostPlatform == buildPlatform) "--with-icu=${icu.dev}" ++ optional (toolset != null) "--with-toolset=${toolset}"; buildPhase = builder nativeB2Args; @@ -177,7 +178,7 @@ stdenv.mkDerivation { buildPhase = builder crossB2Args; installPhase = installer crossB2Args; postFixup = fixup; - } // optionalAttrs (stdenv.cross.libc == "msvcrt") { + } // optionalAttrs (hostPlatform.libc == "msvcrt") { patches = fetchurl { url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/" + "boost-mingw.patch"; diff --git a/pkgs/development/libraries/ffmpeg-full/default.nix b/pkgs/development/libraries/ffmpeg-full/default.nix index 3f847bc752f04..6246026e9ea7b 100644 --- a/pkgs/development/libraries/ffmpeg-full/default.nix +++ b/pkgs/development/libraries/ffmpeg-full/default.nix @@ -1,4 +1,5 @@ { stdenv, fetchurl, pkgconfig, perl, texinfo, yasm +, hostPlatform /* * 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 needs to be done to portions of the build to get it to work correctly */ - crossAttrs = let - 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 { + crossAttrs = { configurePlatforms = []; configureFlags = configureFlags ++ [ - "--cross-prefix=${stdenv.cross.config}-" + "--cross-prefix=${stdenv.cc.prefix}" "--enable-cross-compile" - "--target_os=${os}" - "--arch=${stdenv.cross.arch}" + "--target_os=${hostPlatform.parsed.kernel.name}" + "--arch=${hostPlatform.arch}" ]; }; diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 762a4c9503fb5..a34b378552a00 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -2,6 +2,7 @@ , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg , libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr , x264, x265, xvidcore, zlib, libopus +, hostPlatform , openglSupport ? false, mesa ? null # Build options , runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime @@ -169,30 +170,13 @@ stdenv.mkDerivation rec { /* 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 */ - crossAttrs = let - 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 { + crossAttrs = { configurePlatforms = []; configureFlags = configureFlags ++ [ - "--cross-prefix=${stdenv.cross.config}-" + "--cross-prefix=${stdenv.cc.prefix}" "--enable-cross-compile" - "--target_os=${os}" - "--arch=${stdenv.cross.arch}" + "--target_os=${hostPlatform.parsed.kernel}" + "--arch=${hostPlatform.arch}" ]; }; diff --git a/pkgs/development/libraries/fontconfig/2.10.nix b/pkgs/development/libraries/fontconfig/2.10.nix index 302992fc8c8a1..7eaba8f75ec4b 100644 --- a/pkgs/development/libraries/fontconfig/2.10.nix +++ b/pkgs/development/libraries/fontconfig/2.10.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, pkgconfig, freetype, expat }: +{ stdenv, fetchurl, pkgconfig, freetype, expat +, hostPlatform +}: stdenv.mkDerivation rec { name = "fontconfig-2.10.2"; @@ -21,7 +23,7 @@ stdenv.mkDerivation rec { ]; # We should find a better way to access the arch reliably. - crossArch = stdenv.cross.arch or null; + crossArch = hostPlatform.arch or null; preConfigure = '' if test -n "$crossConfig"; then diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix index 14983b744df95..f176aa0878c89 100644 --- a/pkgs/development/libraries/fontconfig/default.nix +++ b/pkgs/development/libraries/fontconfig/default.nix @@ -1,5 +1,7 @@ -{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, dejavu_fonts -, substituteAll }: +{ stdenv, substituteAll, fetchurl, fetchpatch +, pkgconfig, freetype, expat, libxslt, dejavu_fonts +, hostPlatform +}: /** Font configuration scheme - ./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. - crossArch = stdenv.cross.arch or null; + crossArch = hostPlatform.arch or null; preConfigure = '' if test -n "$crossConfig"; then diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 9b2c6fe11e150..8f16f85cabf76 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -1,12 +1,12 @@ -{ - stdenv, lib, fetchurl, copyPathsToStore, - pkgconfig, which, - zlib, bzip2, libpng, gnumake, glib, +{ stdenv, lib, fetchurl, copyPathsToStore +, hostPlatform +, pkgconfig, which +, 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. # This option allows it to be disabled. See http://www.freetype.org/patents.html. - useEncumberedCode ? true, + useEncumberedCode ? true }: let @@ -67,7 +67,7 @@ in stdenv.mkDerivation { 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 # 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. diff --git a/pkgs/development/libraries/glew/1.10.nix b/pkgs/development/libraries/glew/1.10.nix index 9d5ded5be15e4..b2e1b26704f3d 100644 --- a/pkgs/development/libraries/glew/1.10.nix +++ b/pkgs/development/libraries/glew/1.10.nix @@ -1,5 +1,7 @@ { stdenv, fetchurl, mesa_glu, x11, libXmu, libXi -, AGL ? null }: +, buildPlatform, hostPlatform +, AGL ? null +}: with stdenv.lib; @@ -17,7 +19,7 @@ stdenv.mkDerivation rec { patchPhase = '' sed -i 's|lib64|lib|' config/Makefile.linux - ${optionalString (stdenv ? cross) '' + ${optionalString (hostPlatform != buildPlatform) '' 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 ''; - crossAttrs.makeFlags = [ - "CC=${stdenv.cross.config}-gcc" - "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"; + makeFlags = if hostPlatform == buildPlatform then null else [ + "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}" + ]; meta = with stdenv.lib; { description = "An OpenGL extension loading library for C(++)"; diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index 02c87cf709a74..ecf1e914a7b1f 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi }: +{ stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi +, buildPlatform, hostPlatform +}: with stdenv.lib; @@ -17,7 +19,7 @@ stdenv.mkDerivation rec { patchPhase = '' sed -i 's|lib64|lib|' config/Makefile.linux - ${optionalString (stdenv ? cross) '' + ${optionalString (hostPlatform != buildPlatform) '' sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile ''} ''; @@ -37,13 +39,9 @@ stdenv.mkDerivation rec { rm $out/lib/*.a ''; - crossAttrs.makeFlags = [ - "CC=${stdenv.cross.config}-gcc" - "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"; + makeFlags = if hostPlatform == buildPlatform then null else [ + "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}" + ]; meta = with stdenv.lib; { description = "An OpenGL extension loading library for C(++)"; diff --git a/pkgs/development/libraries/libav/default.nix b/pkgs/development/libraries/libav/default.nix index 785e3599bf174..3d4fbab3e4220 100644 --- a/pkgs/development/libraries/libav/default.nix +++ b/pkgs/development/libraries/libav/default.nix @@ -13,6 +13,7 @@ , SDL # only for avplay in $bin, adds nontrivial closure to it , enableGPL ? true # ToDo: some additional default stuff may need GPL , enableUnfree ? faacSupport +, hostPlatform }: assert faacSupport -> enableUnfree; @@ -107,10 +108,10 @@ let crossAttrs = { configurePlatforms = []; configureFlags = configureFlags ++ [ - "--cross-prefix=${stdenv.cross.config}-" + "--cross-prefix=${stdenv.cc.prefix}" "--enable-cross-compile" "--target_os=linux" - "--arch=${stdenv.cross.arch}" + "--arch=${hostPlatform.arch}" ]; }; diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix index b203f6346476b..ca149bd3db357 100644 --- a/pkgs/development/libraries/libffi/default.nix +++ b/pkgs/development/libraries/libffi/default.nix @@ -1,4 +1,6 @@ -{ fetchurl, stdenv, dejagnu, doCheck ? false }: +{ fetchurl, stdenv, dejagnu, doCheck ? false +, buildPlatform, hostPlatform +}: stdenv.mkDerivation rec { name = "libffi-3.2.1"; @@ -21,7 +23,7 @@ stdenv.mkDerivation rec { 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. postFixup = '' diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix index c23fd57e5149c..8994651241001 100644 --- a/pkgs/development/libraries/libiconv/default.nix +++ b/pkgs/development/libraries/libiconv/default.nix @@ -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 { name = "libiconv-${version}"; @@ -12,7 +14,7 @@ stdenv.mkDerivation rec { }; 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 ''; diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix index a59a1702e173d..cd8484170bdb5 100644 --- a/pkgs/development/libraries/libjpeg-turbo/default.nix +++ b/pkgs/development/libraries/libjpeg-turbo/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, nasm }: +{ stdenv, fetchurl, nasm +, hostPlatform +}: stdenv.mkDerivation rec { name = "libjpeg-turbo-${version}"; @@ -10,7 +12,7 @@ stdenv.mkDerivation rec { }; # github releases still need autotools, surprisingly patches = - stdenv.lib.optional (stdenv.cross.libc or null == "msvcrt") + stdenv.lib.optional (hostPlatform.libc or null == "msvcrt") ./mingw-boolean.patch; outputs = [ "bin" "dev" "out" "doc" ]; diff --git a/pkgs/development/libraries/libmsgpack/generic.nix b/pkgs/development/libraries/libmsgpack/generic.nix index 2da703da4cfd9..c6870f77f1f3f 100644 --- a/pkgs/development/libraries/libmsgpack/generic.nix +++ b/pkgs/development/libraries/libmsgpack/generic.nix @@ -1,5 +1,6 @@ { stdenv, cmake , version, src, patches ? [ ] +, hostPlatform , ... }: @@ -11,7 +12,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; crossAttrs = { - } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { + } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") { cmakeFlags = "-DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_SYSTEM_NAME=Windows"; }; diff --git a/pkgs/development/libraries/libpng/12.nix b/pkgs/development/libraries/libpng/12.nix index b3f7f96e93620..457f99ef13bde 100644 --- a/pkgs/development/libraries/libpng/12.nix +++ b/pkgs/development/libraries/libpng/12.nix @@ -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 { name = "libpng-1.2.57"; @@ -16,7 +18,7 @@ stdenv.mkDerivation rec { passthru = { inherit zlib; }; - crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { + crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc == "libSystem") { propagatedBuildInputs = []; passthru = {}; }; diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix index 92e0fa339b247..c2f50af84ca80 100644 --- a/pkgs/development/libraries/libpng/default.nix +++ b/pkgs/development/libraries/libpng/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, zlib, apngSupport ? true }: +{ stdenv, fetchurl, zlib, apngSupport ? true +, buildPlatform, hostPlatform +}: 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 makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS="; - doCheck = ! stdenv ? cross; + doCheck = hostPlatform == buildPlatform; passthru = { inherit zlib; }; diff --git a/pkgs/development/libraries/libssh2/default.nix b/pkgs/development/libraries/libssh2/default.nix index 4320cacc590a1..4d754dc808669 100644 --- a/pkgs/development/libraries/libssh2/default.nix +++ b/pkgs/development/libraries/libssh2/default.nix @@ -1,4 +1,6 @@ -{stdenv, fetchurlBoot, openssl, zlib, windows}: +{ stdenv, fetchurlBoot, openssl, zlib, windows +, hostPlatform +}: stdenv.mkDerivation rec { name = "libssh2-1.8.0"; @@ -20,7 +22,7 @@ stdenv.mkDerivation rec { "--with-libz" "--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 preConfigure = '' export LDFLAGS="-L${windows.mingw_w64}/lib $LDFLAGS" diff --git a/pkgs/development/libraries/libvpx/default.nix b/pkgs/development/libraries/libvpx/default.nix index 09fc3a2a9da9d..4b50fe090e386 100644 --- a/pkgs/development/libraries/libvpx/default.nix +++ b/pkgs/development/libraries/libvpx/default.nix @@ -1,4 +1,5 @@ -{stdenv, fetchFromGitHub, perl, yasm +{ stdenv, fetchFromGitHub, perl, yasm +, hostPlatform , vp8DecoderSupport ? true # VP8 decoder , vp8EncoderSupport ? true # VP8 encoder , vp9DecoderSupport ? true # VP9 decoder @@ -144,10 +145,7 @@ stdenv.mkDerivation rec { postInstall = ''moveToOutput bin "$bin" ''; - crossAttrs = let - isCygwin = stdenv.cross.libc == "msvcrt"; - isDarwin = stdenv.cross.libc == "libSystem"; - in { + crossAttrs = { configurePlatforms = []; configureFlags = configureFlags ++ [ #"--extra-cflags=" @@ -159,17 +157,17 @@ stdenv.mkDerivation rec { # 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 # 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}${( - if isDarwin then ( - if stdenv.cross.osxMinVersion == "10.10" then "14" - else if stdenv.cross.osxMinVersion == "10.9" then "13" - else if stdenv.cross.osxMinVersion == "10.8" then "12" - else if stdenv.cross.osxMinVersion == "10.7" then "11" - else if stdenv.cross.osxMinVersion == "10.6" then "10" - else if stdenv.cross.osxMinVersion == "10.5" then "9" - else "8") - else "")}-gcc" - (if isCygwin then "--enable-static-msvcrt" else "") + "--force-target=${hostPlatform.config}${ + if hostPlatform.isDarwin then + if hostPlatform.osxMinVersion == "10.10" then "14" + else if hostPlatform.osxMinVersion == "10.9" then "13" + else if hostPlatform.osxMinVersion == "10.8" then "12" + else if hostPlatform.osxMinVersion == "10.7" then "11" + else if hostPlatform.osxMinVersion == "10.6" then "10" + else if hostPlatform.osxMinVersion == "10.5" then "9" + else "8" + else ""}-gcc" + (if hostPlatform.isCygwin then "--enable-static-msvcrt" else "") ]; }; diff --git a/pkgs/development/libraries/libvpx/git.nix b/pkgs/development/libraries/libvpx/git.nix index ceda1c2638935..824449a347afa 100644 --- a/pkgs/development/libraries/libvpx/git.nix +++ b/pkgs/development/libraries/libvpx/git.nix @@ -1,4 +1,5 @@ -{stdenv, fetchgit, perl, yasm +{ stdenv, fetchgit, perl, yasm +, hostPlatform , vp8DecoderSupport ? true # VP8 decoder , vp8EncoderSupport ? true # VP8 encoder , vp9DecoderSupport ? true # VP9 decoder @@ -152,10 +153,7 @@ stdenv.mkDerivation rec { postInstall = ''moveToOutput bin "$bin" ''; - crossAttrs = let - isCygwin = stdenv.cross.libc == "msvcrt"; - isDarwin = stdenv.cross.libc == "libSystem"; - in { + crossAttrs = { configurePlatforms = []; configureFlags = configureFlags ++ [ #"--extra-cflags=" @@ -166,17 +164,17 @@ stdenv.mkDerivation rec { # 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 # 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}${( - if isDarwin then ( - if stdenv.cross.osxMinVersion == "10.10" then "14" - else if stdenv.cross.osxMinVersion == "10.9" then "13" - else if stdenv.cross.osxMinVersion == "10.8" then "12" - else if stdenv.cross.osxMinVersion == "10.7" then "11" - else if stdenv.cross.osxMinVersion == "10.6" then "10" - else if stdenv.cross.osxMinVersion == "10.5" then "9" - else "8") - else "")}-gcc" - (if isCygwin then "--enable-static-msvcrt" else "") + "--force-target=${hostPlatform.config}${ + if hostPlatform.isDarwin then + if hostPlatform.osxMinVersion == "10.10" then "14" + else if hostPlatform.osxMinVersion == "10.9" then "13" + else if hostPlatform.osxMinVersion == "10.8" then "12" + else if hostPlatform.osxMinVersion == "10.7" then "11" + else if hostPlatform.osxMinVersion == "10.6" then "10" + else if hostPlatform.osxMinVersion == "10.5" then "9" + else "8" + else ""}-gcc" + (if hostPlatform.isCygwin then "--enable-static-msvcrt" else "") ]; }; diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index fb397ace79414..10dd4ee5dbe4f 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -1,7 +1,9 @@ { stdenv, lib, fetchurl, fetchpatch , zlib, xz, python2, findXMLCatalogs, libiconv -, pythonSupport ? (! stdenv ? cross) -, icuSupport ? false, icu ? null }: +, buildPlatform, hostPlatform +, pythonSupport ? buildPlatform == hostPlatform +, icuSupport ? false, icu ? null +}: let python = python2; @@ -45,7 +47,7 @@ in stdenv.mkDerivation rec { doCheck = !stdenv.isDarwin; - crossAttrs = lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { + crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") { # creating the DLL is broken ATM dontDisableStatic = true; configureFlags = configureFlags ++ [ "--disable-shared" ]; diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix index 9e2c05575ece0..118b8af5a6f92 100644 --- a/pkgs/development/libraries/libxslt/default.nix +++ b/pkgs/development/libraries/libxslt/default.nix @@ -1,6 +1,7 @@ -{ stdenv, hostPlatform, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2 +{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2 +, buildPlatform, hostPlatform , cryptoSupport ? false -, pythonSupport ? (! stdenv ? cross) +, pythonSupport ? buildPlatform == hostPlatform }: assert pythonSupport -> python2 != null; diff --git a/pkgs/development/libraries/newt/default.nix b/pkgs/development/libraries/newt/default.nix index 8a4b793cad797..9002d06693e5a 100644 --- a/pkgs/development/libraries/newt/default.nix +++ b/pkgs/development/libraries/newt/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { NIX_LDFLAGS = "-lncurses"; crossAttrs = { - makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-"; + makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}"; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/nlohmann_json/default.nix b/pkgs/development/libraries/nlohmann_json/default.nix index a5a808c1f615b..9fb614cd071ac 100644 --- a/pkgs/development/libraries/nlohmann_json/default.nix +++ b/pkgs/development/libraries/nlohmann_json/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchFromGitHub, cmake }: +{ stdenv, fetchFromGitHub, cmake +, hostPlatform +}: stdenv.mkDerivation rec { name = "nlohmann_json-${version}"; @@ -21,7 +23,7 @@ stdenv.mkDerivation rec { crossAttrs = { cmakeFlags = "-DBuildTests=OFF"; doCheck = false; - } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { + } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") { cmakeFlags = "-DBuildTests=OFF -DCMAKE_SYSTEM_NAME=Windows"; }; diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index 0d07513634fb4..2120e60ec6aae 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -1,12 +1,14 @@ { stdenv, fetchurl, buildPackages, perl +, hostPlatform , withCryptodev ? false, cryptodevHeaders -, enableSSL2 ? false }: +, enableSSL2 ? false +}: with stdenv.lib; let - opensslCrossSystem = stdenv.cross.openssl.system or + opensslCrossSystem = hostPlatform.openssl.system or (throw "openssl needs its platform name cross building"); common = args@{ version, sha256, patches ? [] }: stdenv.mkDerivation rec { @@ -22,8 +24,7 @@ let ++ [ ./nix-ssl-cert-file.patch ] ++ optional (versionOlder version "1.1.0") (if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch) - ++ optional - (versionOlder version "1.0.2" && (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem"))) + ++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin) ./darwin-arch.patch; outputs = [ "bin" "dev" "out" "man" ]; @@ -88,10 +89,6 @@ let preConfigure='' # It's configure does not like --build or --host 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"; }; diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix index 20e35fa3e089e..856c7bac8ce14 100644 --- a/pkgs/development/libraries/poppler/default.nix +++ b/pkgs/development/libraries/poppler/default.nix @@ -6,6 +6,7 @@ , introspectionSupport ? false, gobjectIntrospection ? null , utils ? false , minimal ? false, suffix ? "glib" +, hostPlatform }: let # beware: updates often break cups-filters build @@ -56,7 +57,7 @@ stdenv.mkDerivation rec { crossAttrs.postPatch = # 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"; meta = with lib; { diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix index dee83306cc6e8..d3eaeed2f1e02 100644 --- a/pkgs/development/libraries/qt-4.x/4.8/default.nix +++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix @@ -1,4 +1,5 @@ { stdenv, fetchurl, fetchpatch, substituteAll +, hostPlatform , libXrender, libXinerama, libXcursor, libXmu, libXv, libXext , libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng , libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig @@ -182,9 +183,7 @@ stdenv.mkDerivation rec { rm -rf $out/tests ''; - crossAttrs = let - isMingw = stdenv.cross.libc == "msvcrt"; - in { + crossAttrs = { # I've not tried any case other than i686-pc-mingw32. # -nomake tools: it fails linking some asian language symbols # -no-svg: it fails to build on mingw64 @@ -194,14 +193,14 @@ stdenv.mkDerivation rec { -no-svg -make qmake -make libs -nomake tools -nomake demos -nomake examples -nomake docs - '' + optionalString isMingw " -xplatform win32-g++-4.6"; + '' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6"; patches = []; preConfigure = '' - sed -i -e 's/ g++/ ${stdenv.cross.config}-g++/' \ - -e 's/ gcc/ ${stdenv.cross.config}-gcc/' \ - -e 's/ ar/ ${stdenv.cross.config}-ar/' \ - -e 's/ strip/ ${stdenv.cross.config}-strip/' \ - -e 's/ windres/ ${stdenv.cross.config}-windres/' \ + sed -i -e 's/ g++/ ${stdenv.cc.prefix}g++/' \ + -e 's/ gcc/ ${stdenv.cc.prefix}gcc/' \ + -e 's/ ar/ ${stdenv.cc.prefix}ar/' \ + -e 's/ strip/ ${stdenv.cc.prefix}strip/' \ + -e 's/ windres/ ${stdenv.cc.prefix}windres/' \ mkspecs/win32-g++/qmake.conf ''; @@ -211,7 +210,7 @@ stdenv.mkDerivation rec { ''; configurePlatforms = []; dontStrip = true; - } // optionalAttrs isMingw { + } // optionalAttrs hostPlatform.isMinGW { propagatedBuildInputs = [ ]; }; diff --git a/pkgs/development/libraries/readline/6.2.nix b/pkgs/development/libraries/readline/6.2.nix index 65ab4ed24cecc..2c800e23b27fb 100644 --- a/pkgs/development/libraries/readline/6.2.nix +++ b/pkgs/development/libraries/readline/6.2.nix @@ -1,4 +1,6 @@ -{ fetchurl, stdenv, ncurses }: +{ fetchurl, stdenv, ncurses +, buildPlatform, hostPlatform +}: stdenv.mkDerivation (rec { name = "readline-6.2"; @@ -57,6 +59,6 @@ stdenv.mkDerivation (rec { // # Don't run the native `strip' when cross-compiling. -(if (stdenv ? cross) +(if hostPlatform != buildPlatform then { dontStrip = true; } else { })) diff --git a/pkgs/development/libraries/readline/6.3.nix b/pkgs/development/libraries/readline/6.3.nix index 80cc7e923b834..822ce7b0055d3 100644 --- a/pkgs/development/libraries/readline/6.3.nix +++ b/pkgs/development/libraries/readline/6.3.nix @@ -1,4 +1,6 @@ -{ fetchurl, stdenv, ncurses }: +{ fetchurl, stdenv, ncurses +, buildPlatform, hostPlatform +}: stdenv.mkDerivation rec { name = "readline-6.3p08"; @@ -29,7 +31,7 @@ stdenv.mkDerivation rec { import ./readline-6.3-patches.nix patch); # 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; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/readline/7.0.nix b/pkgs/development/libraries/readline/7.0.nix index 9d1c1c57f8c1c..7cc76e0876858 100644 --- a/pkgs/development/libraries/readline/7.0.nix +++ b/pkgs/development/libraries/readline/7.0.nix @@ -1,4 +1,6 @@ -{ fetchurl, stdenv, ncurses }: +{ fetchurl, stdenv, ncurses +, buildPlatform, hostPlatform +}: stdenv.mkDerivation rec { name = "readline-${version}"; @@ -33,7 +35,7 @@ stdenv.mkDerivation rec { */ # 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; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index 2278453c492c8..eab36c21dc2b1 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { crossAttrs = { dontStrip = static; configurePlatforms = []; - } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { + } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") { installFlags = [ "BINARY_PATH=$(out)/bin" "INCLUDE_PATH=$(dev)/include" @@ -70,14 +70,12 @@ stdenv.mkDerivation rec { ]; makeFlags = [ "-f" "win32/Makefile.gcc" - "PREFIX=${stdenv.cross.config}-" + "PREFIX=${stdenv.cc.prefix}" ] ++ stdenv.lib.optional (!static) "SHARED_MODE=1"; # Non-typical naming confuses libtool which then refuses to use zlib's DLL # in some cases, e.g. when compiling libpng. 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; |