summary refs log tree commit diff
path: root/pkgs/games/ut2004demo
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-01-30 11:44:39 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-01-30 11:44:39 +0000
commit3ba77c1b4031f84602f597e4b993bd614d915c8f (patch)
tree9e85a8f42ae755cd4b363cc4a72e29ab31df0150 /pkgs/games/ut2004demo
parent70c36821c6140ac0e61b66fab917395aea7950e0 (diff)
downloadnixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.tar
nixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.tar.gz
nixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.tar.bz2
nixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.tar.lz
nixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.tar.xz
nixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.tar.zst
nixlib-3ba77c1b4031f84602f597e4b993bd614d915c8f.zip
* Get the Unreal Tournament 2004 demo to work with the new scheme for
  handling OpenGL.

svn path=/nixpkgs/trunk/; revision=4616
Diffstat (limited to 'pkgs/games/ut2004demo')
-rw-r--r--pkgs/games/ut2004demo/builder.sh11
-rw-r--r--pkgs/games/ut2004demo/default.nix5
-rw-r--r--pkgs/games/ut2004demo/make-wrapper.sh9
3 files changed, 19 insertions, 6 deletions
diff --git a/pkgs/games/ut2004demo/builder.sh b/pkgs/games/ut2004demo/builder.sh
index 0e7e3ed50721..d4c45fa9d14f 100644
--- a/pkgs/games/ut2004demo/builder.sh
+++ b/pkgs/games/ut2004demo/builder.sh
@@ -8,6 +8,7 @@ mkdir $out
 
 (cd $out && tar xvf -) < ut2004demo.tar
 
+
 # Patch the executable from ELF OS/ABI type `Linux' (3) to `SVR4' (0).
 # This doesn't seem to matter to ld-linux.so.2 at all, except that it
 # refuses to load `Linux' executables when invokes explicitly, that
@@ -18,5 +19,13 @@ mkdir $out
 # patch Glibc so it accepts the `Linux' ELF type as well (why doesn't
 # it?); or to use FreeBSD's `brandelf' program to set to ELF type
 # (which is a bit cleaner than patching using `dd' :-) ).
-(cd $out/System && (echo -en "\000" | dd bs=1 seek=7 of=ut2004-bin conv=notrunc))
 
+#(cd $out/System && (echo -en "\000" | dd bs=1 seek=7 of=ut2004-bin conv=notrunc))
+
+
+# Set the ELF interpreter to our own Glibc.
+glibc=$(cat $NIX_GCC/nix-support/orig-glibc)
+
+for i in "$out/System/ucc-bin" "$out/System/ut2004-bin"; do
+    patchelf --set-interpreter "$glibc/lib/ld-linux.so.2" "$i"
+done
diff --git a/pkgs/games/ut2004demo/default.nix b/pkgs/games/ut2004demo/default.nix
index e079e7819be1..1c8b42891a4b 100644
--- a/pkgs/games/ut2004demo/default.nix
+++ b/pkgs/games/ut2004demo/default.nix
@@ -5,9 +5,9 @@ assert stdenv.system == "i686-linux";
 let {
 
   raw = stdenv.mkDerivation {
-    name = "ut2004demo-3120";
+    name = "ut2004-demo-3120";
     src = fetchurl {
-      url = ftp://ftp.infogrames.net/demos/ut2004/ut2004-lnx-demo-3120.run.bz2;
+      url = http://ftp.gameaholic.com/pub/demos/ut2004-lnx-demo-3120.run.bz2;
       md5 = "da200b043add9d083f6aa7581e6829f0";
     };
     builder = ./builder.sh;
@@ -18,6 +18,7 @@ let {
     builder = ./make-wrapper.sh;
     inherit raw mesa;
     inherit (xlibs) libX11 libXext;
+    mesaSwitch = ../../build-support/opengl/mesa-switch.sh;
   };
 
 }
diff --git a/pkgs/games/ut2004demo/make-wrapper.sh b/pkgs/games/ut2004demo/make-wrapper.sh
index d165127f0a6e..06a809d4cbdc 100644
--- a/pkgs/games/ut2004demo/make-wrapper.sh
+++ b/pkgs/games/ut2004demo/make-wrapper.sh
@@ -1,16 +1,19 @@
 source $stdenv/setup
 
-mkdir $out
-mkdir $out/bin
+ensureDir $out/bin
 
 glibc=$(cat $NIX_GCC/nix-support/orig-glibc)
 
 cat > $out/bin/ut2004demo <<EOF
 #! $SHELL -e
 
+mesa=$mesa
+
+$(cat $mesaSwitch)
+
 cd $raw/System
 
-LD_LIBRARY_PATH=$libX11/lib:$libXext/lib:/usr/lib:$mesa/lib $glibc/lib/ld-linux.so.2 ./ut2004-bin "\$@"
+LD_LIBRARY_PATH=$libX11/lib:$libXext/lib\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ./ut2004-bin "\$@"
 EOF
 
 chmod +x $out/bin/ut2004demo