From ce53f3736e9d55f5bb64b25089c40e9dda7231ac Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 9 Jun 2004 17:59:46 +0000 Subject: [PATCH] * Quake 3 Arena Demo. The goal is to show that Nix can also be used to deploy existing binary-only components. We use the `ld-linux.so.2 PROGRAM' trick to force the use of our own glibc, and set LD_LIBRARY_PATH to point to the required libraries (X11, Mesa). Since Mesa is software-only, Q3A is rather slow. I'll have to figure out how to use the Mesa from XFree86 (X.Org), since it knows how to use DRI (or at least speak the GLX protocol). Unfortunately the xlibs people haven't modularised that part of XFree86 yet. Also, the flag `+set s_initsound 0' has to be passed to Quake to disable sound, otherwise it segfaults on startup. It doesn't do this with the normal glibc, which is strange. Maybe it tries to dynamically load some sound library or something. svn path=/nixpkgs/trunk/; revision=1046 --- pkgs/games/quake3demo/builder.sh | 9 +++++++++ pkgs/games/quake3demo/default.nix | 23 +++++++++++++++++++++++ pkgs/games/quake3demo/make-wrapper.sh | 17 +++++++++++++++++ pkgs/system/all-packages-generic.nix | 4 ++++ 4 files changed, 53 insertions(+) create mode 100644 pkgs/games/quake3demo/builder.sh create mode 100644 pkgs/games/quake3demo/default.nix create mode 100644 pkgs/games/quake3demo/make-wrapper.sh diff --git a/pkgs/games/quake3demo/builder.sh b/pkgs/games/quake3demo/builder.sh new file mode 100644 index 00000000000..e2349144faa --- /dev/null +++ b/pkgs/games/quake3demo/builder.sh @@ -0,0 +1,9 @@ +. $stdenv/setup + +skip=165 + +mkdir $out + +cd $out + +tail +165 $src | tar xvfz - diff --git a/pkgs/games/quake3demo/default.nix b/pkgs/games/quake3demo/default.nix new file mode 100644 index 00000000000..34105c6124e --- /dev/null +++ b/pkgs/games/quake3demo/default.nix @@ -0,0 +1,23 @@ +{stdenv, fetchurl, xlibs, mesa}: + +assert stdenv.system == "i686-linux"; + +let { + + raw = stdenv.mkDerivation { + name = "quake3demo-1.11-6"; + src = fetchurl { + url = ftp://ftp.idsoftware.com/idstuff/quake3/linux/linuxq3ademo-1.11-6.x86.gz.sh; + md5 = "484610c1ce34272223a52ec331c99d5d"; + }; + builder = ./builder.sh; + }; + + body = stdenv.mkDerivation { + name = raw.name; + builder = ./make-wrapper.sh; + inherit raw mesa; + inherit (xlibs) libX11 libXext; + }; + +} diff --git a/pkgs/games/quake3demo/make-wrapper.sh b/pkgs/games/quake3demo/make-wrapper.sh new file mode 100644 index 00000000000..c7cf0a9308b --- /dev/null +++ b/pkgs/games/quake3demo/make-wrapper.sh @@ -0,0 +1,17 @@ +. $stdenv/setup + +mkdir $out +mkdir $out/bin +mkdir $out/links + +ln -s $raw/* $out/links +ln -s $out/links/bin/x86/glibc-2.1/q3demo $out/links/q3demo + +glibc=$(cat $NIX_GCC/nix-support/orig-glibc) + +cat > $out/bin/q3ademo <