about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2017-09-05 13:59:50 -0400
committerGitHub <noreply@github.com>2017-09-05 13:59:50 -0400
commit5b6d78194ccb26541b038358c4b81843d5424c2e (patch)
treee3360f562730f3f75531de178debd7a76224d922
parentabdd0bbf4e0b0fdb83b46e12275c03b5d0b97f9d (diff)
parent10b2bb82882b95dcc8683bf22b313b3c2db19931 (diff)
downloadnixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.tar
nixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.tar.gz
nixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.tar.bz2
nixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.tar.lz
nixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.tar.xz
nixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.tar.zst
nixlib-5b6d78194ccb26541b038358c4b81843d5424c2e.zip
Merge pull request #29028 from obsidiansystems/cross-cleanup
misc pkgs: Clean up cross
-rw-r--r--pkgs/applications/editors/zile/default.nix3
-rw-r--r--pkgs/applications/networking/browsers/elinks/default.nix51
-rw-r--r--pkgs/applications/networking/browsers/links2/default.nix6
-rw-r--r--pkgs/applications/video/mplayer/default.nix111
4 files changed, 87 insertions, 84 deletions
diff --git a/pkgs/applications/editors/zile/default.nix b/pkgs/applications/editors/zile/default.nix
index 58971b3199bf..936cde61ee85 100644
--- a/pkgs/applications/editors/zile/default.nix
+++ b/pkgs/applications/editors/zile/default.nix
@@ -11,9 +11,6 @@ stdenv.mkDerivation rec {
   buildInputs = [ pkgconfig ncurses boehmgc ];
   nativeBuildInputs = [ help2man perl ];
 
-  # `help2man' wants to run Zile, which fails when cross-compiling.
-  crossAttrs.nativeBuildInputs = [];
-
   # Tests can't be run because most of them rely on the ability to
   # fiddle with the terminal.
   doCheck = false;
diff --git a/pkgs/applications/networking/browsers/elinks/default.nix b/pkgs/applications/networking/browsers/elinks/default.nix
index cc34318edf3c..b60454c4a42d 100644
--- a/pkgs/applications/networking/browsers/elinks/default.nix
+++ b/pkgs/applications/networking/browsers/elinks/default.nix
@@ -1,7 +1,10 @@
-{ stdenv, fetchurl, perl, ncurses, xlibsWrapper, bzip2, zlib, openssl
-, spidermonkey_1_8_5, gpm
-, enableGuile ? false, guile ? null   # Incompatible licenses, LGPLv3 - GPLv2
-, enablePython ? false, python ? null
+{ stdenv, fetchurl, ncurses, xlibsWrapper, bzip2, zlib, openssl
+, gpm
+, # Incompatible licenses, LGPLv3 - GPLv2
+  enableGuile        ? false,                                         guile ? null
+, enablePython       ? false,                                         python ? null
+, enablePerl         ? (stdenv.hostPlatform == stdenv.buildPlatform), perl ? null
+, enableSpidermonkey ? (stdenv.hostPlatform == stdenv.buildPlatform), spidermonkey_1_8_5 ? null
 }:
 
 assert enableGuile -> guile != null;
@@ -17,28 +20,26 @@ stdenv.mkDerivation rec {
 
   patches = [ ./gc-init.patch ];
 
-  buildInputs = [ perl ncurses xlibsWrapper bzip2 zlib openssl spidermonkey_1_8_5 gpm ]
+  buildInputs = [ ncurses xlibsWrapper bzip2 zlib openssl spidermonkey_1_8_5 gpm ]
     ++ stdenv.lib.optional enableGuile guile
-    ++ stdenv.lib.optional enablePython python;
-
-  configureFlags =
-    ''
-      --enable-finger --enable-html-highlight
-      --with-perl --enable-gopher --enable-cgi --enable-bittorrent
-      --with-spidermonkey=${spidermonkey_1_8_5}
-      --enable-nntp --with-openssl=${openssl.dev}
-    '' + stdenv.lib.optionalString enableGuile " --with-guile"
-    + stdenv.lib.optionalString enablePython " --with-python";
-
-  crossAttrs = {
-    propagatedBuildInputs = [ ncurses.crossDrv zlib.crossDrv openssl.crossDrv ];
-    configureFlags = ''
-      --enable-finger --enable-html-highlight
-      --enable-gopher --enable-cgi --enable-bittorrent --enable-nntp
-      --with-openssl=${openssl.crossDrv}
-      --with-bzip2=${bzip2.crossDrv}
-    '';
-  };
+    ++ stdenv.lib.optional enablePython python
+    ++ stdenv.lib.optional enablePerl perl
+    ;
+
+  configureFlags = [
+    "--enable-finger"
+    "--enable-html-highlight"
+    "--enable-gopher"
+    "--enable-cgi"
+    "--enable-bittorrent"
+    "--enable-nntp"
+    "--with-openssl=${openssl.dev}"
+    "--with-bzip2=${bzip2.dev}"
+  ] ++ stdenv.lib.optional enableGuile        "--with-guile"
+    ++ stdenv.lib.optional enablePython       "--with-python"
+    ++ stdenv.lib.optional enablePerl         "--with-perl"
+    ++ stdenv.lib.optional enableSpidermonkey "--with-spidermonkey=${spidermonkey_1_8_5}"
+    ;
 
   meta = {
     description = "Full-featured text-mode web browser";
diff --git a/pkgs/applications/networking/browsers/links2/default.nix b/pkgs/applications/networking/browsers/links2/default.nix
index f504c3c2b333..f097d748d48c 100644
--- a/pkgs/applications/networking/browsers/links2/default.nix
+++ b/pkgs/applications/networking/browsers/links2/default.nix
@@ -30,12 +30,6 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional enableFB "--with-fb"
     ++ stdenv.lib.optional enableDirectFB "--with-directfb";
 
-  crossAttrs = {
-    preConfigure = ''
-      export CC=$crossConfig-gcc
-    '';
-  };
-
   meta = with stdenv.lib; {
     homepage = http://links.twibright.com/;
     description = "A small browser with some graphics support";
diff --git a/pkgs/applications/video/mplayer/default.nix b/pkgs/applications/video/mplayer/default.nix
index 8e28f77ffeed..fe6090c3230e 100644
--- a/pkgs/applications/video/mplayer/default.nix
+++ b/pkgs/applications/video/mplayer/default.nix
@@ -26,7 +26,7 @@
 , libjpegSupport ? true, libjpeg ? null
 , useUnfreeCodecs ? false
 , darwin ? null
-, hostPlatform
+, buildPackages
 }:
 
 assert fontconfigSupport -> (fontconfig != null);
@@ -84,6 +84,8 @@ let
     meta.license = stdenv.lib.licenses.unfree;
   } else null;
 
+  crossBuild = stdenv.hostPlatform != stdenv.buildPlatform;
+
 in
 
 stdenv.mkDerivation rec {
@@ -100,8 +102,10 @@ stdenv.mkDerivation rec {
     rm -rf ffmpeg
   '';
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ pkgconfig yasm ];
   buildInputs = with stdenv.lib;
-    [ pkgconfig freetype ffmpeg ]
+    [ freetype ffmpeg ]
     ++ optional aalibSupport aalib
     ++ optional fontconfigSupport fontconfig
     ++ optional fribidiSupport fribidi
@@ -129,45 +133,66 @@ stdenv.mkDerivation rec {
     ++ (with darwin.apple_sdk.frameworks; optionals stdenv.isDarwin [ Cocoa OpenGL ])
     ;
 
-  nativeBuildInputs = [ yasm ];
+  configurePlatforms = [ ];
+  configureFlags = with stdenv.lib; [
+    "--enable-freetype"
+    (if fontconfigSupport then "--enable-fontconfig" else "--disable-fontconfig")
+    (if x11Support then "--enable-x11 --enable-gl" else "--disable-x11 --disable-gl")
+    (if xineramaSupport then "--enable-xinerama" else "--disable-xinerama")
+    (if xvSupport then "--enable-xv" else "--disable-xv")
+    (if alsaSupport then "--enable-alsa" else "--disable-alsa")
+    (if screenSaverSupport then "--enable-xss" else "--disable-xss")
+    (if vdpauSupport then "--enable-vdpau" else "--disable-vdpau")
+    (if cddaSupport then "--enable-cdparanoia" else "--disable-cdparanoia")
+    (if dvdnavSupport then "--enable-dvdnav" else "--disable-dvdnav")
+    (if bluraySupport then "--enable-bluray" else "--disable-bluray")
+    (if amrSupport then "--enable-libopencore_amrnb" else "--disable-libopencore_amrnb")
+    (if cacaSupport then "--enable-caca" else "--disable-caca")
+    (if lameSupport then "--enable-mp3lame --disable-mp3lame-lavc" else "--disable-mp3lame --enable-mp3lame-lavc")
+    (if speexSupport then "--enable-speex" else "--disable-speex")
+    (if theoraSupport then "--enable-theora" else "--disable-theora")
+    (if x264Support then "--enable-x264 --disable-x264-lavc" else "--disable-x264 --enable-x264-lavc")
+    (if jackaudioSupport then "" else "--disable-jack")
+    (if pulseSupport then "--enable-pulse" else "--disable-pulse")
+    "--disable-xanim"
+    "--disable-ivtv"
+    "--disable-xvid --disable-xvid-lavc"
+    "--disable-ossaudio"
+    "--disable-ffmpeg_a"
+    "--yasm=${buildPackages.yasm}/bin/yasm"
+    # Note, the `target` vs `host` confusion is intensional.
+    "--target=${stdenv.hostPlatform.config}"
+  ] ++ optional
+         (useUnfreeCodecs && codecs != null && !crossBuild)
+         "--codecsdir=${codecs}"
+    ++ optional
+         ((stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) && !crossBuild)
+         "--enable-runtime-cpudetection"
+    ++ optional fribidiSupport "--enable-fribidi"
+    ++ optional stdenv.isLinux "--enable-vidix"
+    ++ optional stdenv.isLinux "--enable-fbdev"
+    ++ optionals (crossBuild) [
+    "--enable-cross-compile"
+    "--disable-vidix-pcidb"
+    "--with-vidix-drivers=no"
+  ];
+
+  preConfigure = ''
+    configureFlagsArray+=(
+      "--cc=$CC"
+      "--host-cc=$BUILD_CC"
+      "--as=$AS"
+      "--nm=$NM"
+      "--ar=$AR"
+      "--ranlib=$RANLIB"
+      "--windres=$WINDRES"
+    )
+  '';
 
   postConfigure = ''
     echo CONFIG_MPEGAUDIODSP=yes >> config.mak
   '';
 
-  configureFlags = with stdenv.lib;
-    ''
-      --enable-freetype
-      ${if fontconfigSupport then "--enable-fontconfig" else "--disable-fontconfig"}
-      ${if x11Support then "--enable-x11 --enable-gl" else "--disable-x11 --disable-gl"}
-      ${if xineramaSupport then "--enable-xinerama" else "--disable-xinerama"}
-      ${if xvSupport then "--enable-xv" else "--disable-xv"}
-      ${if alsaSupport then "--enable-alsa" else "--disable-alsa"}
-      ${if screenSaverSupport then "--enable-xss" else "--disable-xss"}
-      ${if vdpauSupport then "--enable-vdpau" else "--disable-vdpau"}
-      ${if cddaSupport then "--enable-cdparanoia" else "--disable-cdparanoia"}
-      ${if dvdnavSupport then "--enable-dvdnav" else "--disable-dvdnav"}
-      ${if bluraySupport then "--enable-bluray" else "--disable-bluray"}
-      ${if amrSupport then "--enable-libopencore_amrnb" else "--disable-libopencore_amrnb"}
-      ${if cacaSupport then "--enable-caca" else "--disable-caca"}
-      ${if lameSupport then "--enable-mp3lame --disable-mp3lame-lavc" else "--disable-mp3lame --enable-mp3lame-lavc"}
-      ${if speexSupport then "--enable-speex" else "--disable-speex"}
-      ${if theoraSupport then "--enable-theora" else "--disable-theora"}
-      ${if x264Support then "--enable-x264 --disable-x264-lavc" else "--disable-x264 --enable-x264-lavc"}
-      ${if jackaudioSupport then "" else "--disable-jack"}
-      ${if pulseSupport then "--enable-pulse" else "--disable-pulse"}
-      ${optionalString (useUnfreeCodecs && codecs != null) "--codecsdir=${codecs}"}
-      ${optionalString (stdenv.isi686 || stdenv.isx86_64) "--enable-runtime-cpudetection"}
-      ${optionalString fribidiSupport "--enable-fribidi"}
-      --disable-xanim
-      --disable-ivtv
-      --disable-xvid --disable-xvid-lavc
-      ${optionalString stdenv.isLinux "--enable-vidix"}
-      ${optionalString stdenv.isLinux "--enable-fbdev"}
-      --disable-ossaudio
-      --disable-ffmpeg_a
-    '';
-
   NIX_LDFLAGS = with stdenv.lib;
        optional  fontconfigSupport "-lfontconfig"
     ++ optional  fribidiSupport "-lfribidi"
@@ -188,20 +213,6 @@ stdenv.mkDerivation rec {
       fi
     '';
 
-  crossAttrs = {
-    configurePlatforms = [];
-    # Some things (vidix) are nanonote specific. Once someone cares, we can make options from them.
-    # Note, the `target` vs `host` confusion is intensional.
-    preConfigure = ''
-      configureFlags="`echo $configureFlags |
-        sed -e 's/--codecsdir[^ ]\+//' \
-        -e 's/--enable-runtime-cpudetection//' `"
-      configureFlags="$configureFlags --target=${hostPlatform.arch}-linux
-        --enable-cross-compile --cc=$crossConfig-gcc --as=$crossConfig-as
-        --disable-vidix-pcidb --with-vidix-drivers=no --host-cc=gcc"
-    '';
-  };
-
   meta = {
     description = "A movie player that supports many video formats";
     homepage = http://mplayerhq.hu;