From 8e22f2f58bcaa90594feb252e2df11d90a34bc33 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 9 Jun 2004 18:06:29 +0000 Subject: [PATCH] * Unreal Tournament 2004 Demo. Also a binary-only component. An interesting complication is that we have to change the ELF type of the executable from `Linux' to `SVR4', otherwise the `ld-linux.so.2' trick to override the glibc used doesn't work (apparently `Linux' is not a recognised ELF type!). UT doesn't work with software Mesa, so right now we impurily use `/usr/lib/libGL.so'. I cannot really test whether it works with hardware Mesa, since it barfs with an error about missing OpenGL extensions. But that's probably because I'm testing this on an iBook over an SSH connection to a Linux machine. svn path=/nixpkgs/trunk/; revision=1047 --- pkgs/BUGS | 17 ++++++++++++++++- pkgs/TODO | 1 + pkgs/games/ut2004demo/builder.sh | 22 ++++++++++++++++++++++ pkgs/games/ut2004demo/default.nix | 26 ++++++++++++++++++++++++++ pkgs/games/ut2004demo/make-wrapper.sh | 16 ++++++++++++++++ pkgs/system/all-packages-generic.nix | 6 +++++- 6 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 pkgs/games/ut2004demo/builder.sh create mode 100644 pkgs/games/ut2004demo/default.nix create mode 100644 pkgs/games/ut2004demo/make-wrapper.sh diff --git a/pkgs/BUGS b/pkgs/BUGS index 31cb7dc51ea..48eb204703c 100644 --- a/pkgs/BUGS +++ b/pkgs/BUGS @@ -47,4 +47,19 @@ In file included from IntrinsicI.h:55, from ActionHook.c:69: include/X11/IntrinsicP.h:202:25: X11/ObjectP.h: No such file or directory -(moved to include/X11; should edit include/Makefile.am) \ No newline at end of file +(moved to include/X11; should edit include/Makefile.am) + + +* Doesn't parse: + +{stdenv, fetchurl /* pkgconfig, libX11 */ }: + +stdenv.mkDerivation { + name = "libXi-6.0.1"; + src = fetchurl { + url = http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2; + md5 = "7e935a42428d63a387b3c048be0f2756"; + }; +/* buildInputs = [pkgconfig]; + propagatedBuildInputs = [libX11]; */ +} diff --git a/pkgs/TODO b/pkgs/TODO index abbd58ddb5a..37b84588ba4 100644 --- a/pkgs/TODO +++ b/pkgs/TODO @@ -14,3 +14,4 @@ * diffutils retains a dependency on coreutils/bin/pr; causes stdenv to depend on 2 copies of coreutils (the first one impure in stdenv-nix-linux!) + diff --git a/pkgs/games/ut2004demo/builder.sh b/pkgs/games/ut2004demo/builder.sh new file mode 100644 index 00000000000..a5c8e1735b1 --- /dev/null +++ b/pkgs/games/ut2004demo/builder.sh @@ -0,0 +1,22 @@ +. $stdenv/setup + +skip=7976 + +bunzip2 < $src | (dd bs=1 count=$skip of=/dev/null && dd bs=1M) | tar xvf - ut2004demo.tar + +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 +# is, when we do `ld-linux.so.2 $out/System/ut2004-bin', which we need +# to override the hardcoded ELF interpreter with our own. + +# This is a horrible hack, of course. A better solution would be to +# 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)) + diff --git a/pkgs/games/ut2004demo/default.nix b/pkgs/games/ut2004demo/default.nix new file mode 100644 index 00000000000..e079e7819be --- /dev/null +++ b/pkgs/games/ut2004demo/default.nix @@ -0,0 +1,26 @@ +{stdenv, fetchurl, xlibs, mesa}: + +assert stdenv.system == "i686-linux"; + +let { + + raw = stdenv.mkDerivation { + name = "ut2004demo-3120"; + src = fetchurl { + url = ftp://ftp.infogrames.net/demos/ut2004/ut2004-lnx-demo-3120.run.bz2; + md5 = "da200b043add9d083f6aa7581e6829f0"; + }; + builder = ./builder.sh; + }; + + body = stdenv.mkDerivation { + name = raw.name; + builder = ./make-wrapper.sh; + inherit raw mesa; + inherit (xlibs) libX11 libXext; + }; + +} + +# http://mirror1.icculus.org/ut2004/ut2004-lnxpatch3204.tar.bz2 +# 5f659552095b878a029b917d216d9664 diff --git a/pkgs/games/ut2004demo/make-wrapper.sh b/pkgs/games/ut2004demo/make-wrapper.sh new file mode 100644 index 00000000000..0df8b9c6e82 --- /dev/null +++ b/pkgs/games/ut2004demo/make-wrapper.sh @@ -0,0 +1,16 @@ +. $stdenv/setup + +mkdir $out +mkdir $out/bin + +glibc=$(cat $NIX_GCC/nix-support/orig-glibc) + +cat > $out/bin/ut2004demo <