summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/editors/vim/default.nix15
-rw-r--r--pkgs/applications/networking/browsers/elinks/default.nix10
-rw-r--r--pkgs/applications/video/MPlayer/default.nix31
-rw-r--r--pkgs/build-support/gcc-cross-wrapper/builder.sh25
-rw-r--r--pkgs/build-support/gcc-cross-wrapper/setup-hook.sh8
-rw-r--r--pkgs/development/libraries/SDL/default.nix25
-rw-r--r--pkgs/games/prboom/default.nix20
-rw-r--r--pkgs/games/scummvm/default.nix12
-rw-r--r--pkgs/top-level/all-packages.nix5
9 files changed, 115 insertions, 36 deletions
diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix
index 6f6a592a02d..65811a3dc8f 100644
--- a/pkgs/applications/editors/vim/default.nix
+++ b/pkgs/applications/editors/vim/default.nix
@@ -11,6 +11,21 @@ stdenv.mkDerivation rec {
   buildInputs = [ ncurses ];
 
   postInstall = "ln -s $out/bin/vim $out/bin/vi";
+
+  crossAttrs = {
+    configureFlags = [
+      "vim_cv_toupper_broken=no"
+      "--with-tlib=ncurses"
+      "vim_cv_terminfo=yes"
+      "vim_cv_tty_group=tty"
+      "vim_cv_tty_mode=0660"
+      "vim_cv_getcwd_broken=no"
+      "vim_cv_stat_ignores_slash=yes"
+      "ac_cv_sizeof_int=4"
+      "vim_cv_memmove_handles_overlap=yes"
+      "STRIP=${stdenv.cross.config}-strip"
+    ];
+  };
   
   meta = {
     description = "The most popular clone of the VI editor";
diff --git a/pkgs/applications/networking/browsers/elinks/default.nix b/pkgs/applications/networking/browsers/elinks/default.nix
index 9fb59fcdb86..e06bfe538c0 100644
--- a/pkgs/applications/networking/browsers/elinks/default.nix
+++ b/pkgs/applications/networking/browsers/elinks/default.nix
@@ -18,6 +18,16 @@ stdenv.mkDerivation rec {
       --enable-nntp --with-openssl=${openssl}
     '';
 
+  crossAttrs = {
+    propagatedBuildInputs = [ ncurses.hostDrv zlib.hostDrv openssl.hostDrv ];
+    configureFlags = ''
+      --enable-finger --enable-html-highlight
+      --enable-gopher --enable-cgi --enable-bittorrent --enable-nntp
+      --with-openssl=${openssl.hostDrv}
+      --with-bzip2=${bzip2.hostDrv}
+    '';
+  };
+
   meta = {
     description = "Full-featured text-mode web browser";
     homepage = http://elinks.or.cz;
diff --git a/pkgs/applications/video/MPlayer/default.nix b/pkgs/applications/video/MPlayer/default.nix
index e2c25c3360c..e65ba86200b 100644
--- a/pkgs/applications/video/MPlayer/default.nix
+++ b/pkgs/applications/video/MPlayer/default.nix
@@ -1,10 +1,11 @@
 { alsaSupport ? false, xvSupport ? true, theoraSupport ? false, cacaSupport ? false
 , xineramaSupport ? false, randrSupport ? false, dvdnavSupport ? true
 , stdenv, fetchurl, x11, freetype, fontconfig, zlib
-, alsa ? null, libX11, libXv ? null, libtheora ? null, libcaca ? null
+, alsa ? null, libXv ? null, libtheora ? null, libcaca ? null
 , libXinerama ? null, libXrandr ? null, libdvdnav ? null
 , cdparanoia ? null, cddaSupport ? true
 , amrnb ? null, amrwb ? null, amrSupport ? false
+, x11Support ? true, libX11 ? null
 , jackaudioSupport ? false, jackaudio ? null
 , x264Support ? false, x264 ? null
 , xvidSupport ? false, xvidcore ? null
@@ -13,11 +14,12 @@
 }:
 
 assert alsaSupport -> alsa != null;
-assert xvSupport -> libXv != null;
+assert x11Support -> libX11 != null;
+assert xvSupport -> (libXv != null && x11Support);
 assert theoraSupport -> libtheora != null;
 assert cacaSupport -> libcaca != null;
-assert xineramaSupport -> libXinerama != null;
-assert randrSupport -> libXrandr != null;
+assert xineramaSupport -> (libXinerama != null && x11Support);
+assert randrSupport -> (libXrandr != null && x11Support);
 assert dvdnavSupport -> libdvdnav != null;
 assert cddaSupport -> cdparanoia != null;
 assert jackaudioSupport -> jackaudio != null;
@@ -54,7 +56,8 @@ stdenv.mkDerivation {
   };
 
   buildInputs =
-    [ x11 libXv freetype zlib mesa pkgconfig yasm ]
+    [ freetype zlib pkgconfig ]
+    ++ stdenv.lib.optional x11Support [ libX11 mesa ]
     ++ stdenv.lib.optional alsaSupport alsa
     ++ stdenv.lib.optional xvSupport libXv
     ++ stdenv.lib.optional theoraSupport libtheora
@@ -69,18 +72,32 @@ stdenv.mkDerivation {
     ++ stdenv.lib.optional xvidSupport xvidcore
     ++ stdenv.lib.optional lameSupport lame;
 
+  buildNativeInputs = [ yasm ];
+
   configureFlags = ''
     ${if cacaSupport then "--enable-caca" else "--disable-caca"}
     ${if dvdnavSupport then "--enable-dvdnav --enable-dvdread --disable-dvdread-internal" else ""}
     ${if x264Support then "--enable-x264 --extra-libs=-lx264" else ""}
     --codecsdir=${codecs}
     --enable-runtime-cpudetection
-    --enable-x11
+    ${if x11Support then "--enable-x11" else ""}
     --disable-xanim
     --disable-ivtv
   '';
 
-  NIX_LDFLAGS = "-lX11 -lXext";
+  NIX_LDFLAGS = if x11Support then "-lX11 -lXext" else "";
+
+  crossAttrs = {
+    preConfigure = ''
+      configureFlags="`echo $configureFlags |
+        sed -e 's/--build[^ ]\+//' \
+        -e 's/--host[^ ]\+//' \
+        -e 's/--codecsdir[^ ]\+//' \
+        -e 's/--enable-runtime-cpudetection//' `"
+      configureFlags="$configureFlags --target=${stdenv.cross.arch}-linux
+        --cc=$crossConfig-gcc --as=$crossConfig-as"
+    '';
+  };
 
   meta = {
     description = "A movie player that supports many video formats";
diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh
index 85d5f19fbc9..fae37342940 100644
--- a/pkgs/build-support/gcc-cross-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh
@@ -12,23 +12,18 @@ if test -z "$nativeLibc"; then
     ldflags="$ldflags -L$libc/lib"
     # Get the proper dynamic linker for glibc and uclibc. 
     dlinker=`eval 'echo $libc/lib/ld*.so.?'`
-    if [ -n "$dynamicLinker" ]; then
+    if [ -n "$dlinker" ]; then
       ldflagsBefore="-dynamic-linker $dlinker"
-    fi
-    # This trick is to avoid dependencies on the cross-toolchain gcc
-    # for libgcc, libstdc++, ...
-    # -L is for libtool's .la files, and -rpath for the usual fixupPhase
-    # shrinking rpaths.
-    if [ -n "$gccLibs" ]; then
-      ldflagsBefore="$ldflagsBefore -rpath $gccLibs/lib"
-    fi
-
-    # The same as above, but put into files, useful for the gcc builder.
-    dynamicLinker="$libc/lib/$dynamicLinker"
-    echo $dynamicLinker > $out/nix-support/dynamic-linker
 
-    if test -e $libc/lib/32/ld-linux.so.2; then
-        echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
+      # The same as above, but put into files, useful for the gcc builder.
+      echo $dlinker > $out/nix-support/dynamic-linker
+      # This trick is to avoid dependencies on the cross-toolchain gcc
+      # for libgcc, libstdc++, ...
+      # -L is for libtool's .la files, and -rpath for the usual fixupPhase
+      # shrinking rpaths.
+      if [ -n "$gccLibs" ]; then
+        ldflagsBefore="$ldflagsBefore -rpath $gccLibs/lib"
+      fi
     fi
 
     echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh
index 96498c0e246..a7be09283ee 100644
--- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh
+++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh
@@ -1,8 +1,6 @@
 NIX_CROSS_CFLAGS_COMPILE=""
 NIX_CROSS_LDFLAGS=""
 
-set -x
-
 crossAddCVars () {
     if test -d $1/include; then
         export NIX_CROSS_CFLAGS_COMPILE="$NIX_CROSS_CFLAGS_COMPILE -I$1/include"
@@ -70,7 +68,9 @@ if test -n "@libc@"; then
     crossAddCVars @libc@
 fi
 
-configureFlags="$configureFlags --build=$system --host=$crossConfig"
+if test "$dontSetConfigureCross" != "1"; then
+    configureFlags="$configureFlags --build=$system --host=$crossConfig"
+fi
 # Disabling the tests when cross compiling, as usually the tests are meant for
 # native compilations.
 doCheck=""
@@ -82,5 +82,3 @@ if test "$NIX_NO_SELF_RPATH" != "1"; then
         export NIX_CROSS_LDFLAGS="-rpath $out/lib64 -rpath-link $out/lib $NIX_CROSS_LDFLAGS"
     fi
 fi
-
-set +x
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix
index ca1b7086e39..7205e0fa7ea 100644
--- a/pkgs/development/libraries/SDL/default.nix
+++ b/pkgs/development/libraries/SDL/default.nix
@@ -1,6 +1,7 @@
-{ stdenv, fetchurl, x11, libXrandr, pkgconfig
+{ stdenv, fetchurl, pkgconfig
 , openglSupport ? false, mesa ? null
 , alsaSupport ? true, alsaLib ? null
+, x11Support ? true, x11 ? null, libXrandr ? null
 , pulseaudioSupport ? true, pulseaudio ? null
 }:
 
@@ -8,10 +9,18 @@
 # PulseAudio.
 assert alsaSupport || pulseaudioSupport;
 
-assert openglSupport -> mesa != null;
+assert openglSupport -> (mesa != null && x11Support);
+assert x11Support -> (x11 != null && libXrandr != null);
 assert alsaSupport -> alsaLib != null;
 assert pulseaudioSupport -> pulseaudio != null;
 
+let
+  configureFlagsFun = attrs: ''
+        --disable-oss
+        --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
+        ${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""}
+      '';
+in
 stdenv.mkDerivation rec {
   name = "SDL-1.2.14";
 
@@ -21,7 +30,7 @@ stdenv.mkDerivation rec {
   };
 
   # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
-  propagatedBuildInputs = [ x11 libXrandr ] ++
+  propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
     stdenv.lib.optional pulseaudioSupport pulseaudio;
 
   buildInputs = [ pkgconfig ] ++
@@ -31,11 +40,11 @@ stdenv.mkDerivation rec {
   # XXX: By default, SDL wants to dlopen() PulseAudio, in which case
   # we must arrange to add it to its RPATH; however, `patchelf' seems
   # to fail at doing this, hence `--disable-pulseaudio-shared'.
-  configureFlags = ''
-    --disable-oss
-    --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
-    ${if alsaSupport then "--with-alsa-prefix=${alsaLib}/lib" else ""}
-  '';
+  configureFlags = configureFlagsFun { inherit alsaLib; };
+
+  crossAttrs = {
+      configureFlags = configureFlagsFun { alsaLib = alsaLib.hostDrv; };
+  };
 
   passthru = {inherit openglSupport;};
 
diff --git a/pkgs/games/prboom/default.nix b/pkgs/games/prboom/default.nix
new file mode 100644
index 00000000000..f66e2295a22
--- /dev/null
+++ b/pkgs/games/prboom/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl, SDL, SDL_mixer, SDL_net, mesa}:
+
+stdenv.mkDerivation {
+  name = "prboom-2.5.0";
+  src = fetchurl {
+    url = mirror://sourceforge/prboom/prboom-2.5.0.tar.gz;
+    sha256 = "1bjb04q8dk232956k30qlpq6q0hxb904yh1nflr87jcc1x3iqv12";
+  };
+
+  buildInputs = [ SDL SDL_mixer SDL_net mesa ];
+  crossAttrs = {
+    propagatedBuildInputs = [ SDL.hostDrv SDL_mixer.hostDrv SDL_net.hostDrv ];
+    configureFlags = "--disable-gl --disable-cpu-opt --without-x --disable-sdltest
+      ac_cv_type_uid_t=yes ac_cv_type_gid_t=yes";
+
+    postInstall = ''
+      mv $out/games/ $out/bin
+    '';
+  };
+}
diff --git a/pkgs/games/scummvm/default.nix b/pkgs/games/scummvm/default.nix
index d6912d5c3c0..ad03906888c 100644
--- a/pkgs/games/scummvm/default.nix
+++ b/pkgs/games/scummvm/default.nix
@@ -10,6 +10,18 @@ stdenv.mkDerivation {
   
   buildInputs = [SDL zlib mpeg2dec];
 
+  crossAttrs = {
+    preConfigure = ''
+      # Remove the --build flag set by the gcc cross wrapper setup
+      # hook
+      export configureFlags="--host=${stdenv.cross.config}"
+    '';
+    postConfigure = ''
+      # They use 'install -s', that calls the native strip instead of the cross
+      sed -i 's/-c -s/-c/' ports.mk;
+    '';
+  };
+
   meta = {
     description = "Program to run certain classic graphical point-and-click adventure games (such as Monkey Island)";
     homepage = http://www.scummvm.org/;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c8c50626aeb..54f31dbb028 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3676,8 +3676,9 @@ let
   schroedinger = callPackage ../development/libraries/schroedinger { };
 
   SDL = callPackage ../development/libraries/SDL {
-    openglSupport = mesaSupported;
+    openglSupport = false; #mesaSupported;
     alsaSupport = true;
+    x11Support = false;
     pulseaudioSupport = false; # better go through ALSA
   };
 
@@ -6451,6 +6452,8 @@ let
     inherit (gtkLibs) gtk /*glib gtkmm*/;
   };
 
+  prboom = callPackage ../games/prboom { };
+
   quake3demo = callPackage ../games/quake3/wrapper {
     name = "quake3-demo-${quake3game.name}";
     description = "Demo of Quake 3 Arena, a classic first-person shooter";