1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-20 12:42:24 +00:00
nixpkgs/pkgs/games/ut2004demo/builder.sh
Eelco Dolstra 8e22f2f58b * 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
2004-06-09 18:06:29 +00:00

23 lines
858 B
Bash

. $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))