ut2004demo: refactor, 3120 -> 3334
This commit is contained in:
parent
a38476a32e
commit
2551d9717e
7 changed files with 98 additions and 77 deletions
9
pkgs/games/ut2004/default.nix
Normal file
9
pkgs/games/ut2004/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ callPackage }:
|
||||
|
||||
{
|
||||
ut2004-demo = callPackage ./demo.nix { };
|
||||
|
||||
ut2004 = gamePacks: callPackage ./wrapper.nix {
|
||||
inherit gamePacks;
|
||||
};
|
||||
}
|
40
pkgs/games/ut2004/demo.nix
Normal file
40
pkgs/games/ut2004/demo.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ stdenv, fetchurl }:
|
||||
|
||||
let
|
||||
arch =
|
||||
if stdenv.system == "x86_64-linux" then "amd64"
|
||||
else if stdenv.system == "i686-linux" then "x86"
|
||||
else throw "Unsupported architecture";
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "ut2004-demo-${version}";
|
||||
version = "3334";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://treefort.icculus.org/ut2004/UT2004-LNX-Demo${version}.run.gz";
|
||||
sha256 = "0d5f84qz8l1rg16yzx2k4ikr46n9iwj68na1bqi87wrww7ck6jh7";
|
||||
};
|
||||
|
||||
buildCommand = ''
|
||||
cat $src | gunzip > setup.run
|
||||
chmod +x setup.run
|
||||
./setup.run --noexec --target .
|
||||
mkdir $out
|
||||
tar -xaf ut2004demo.tar.bz2 -C $out
|
||||
tar -xaf linux-${arch}.tar.bz2 -C $out
|
||||
|
||||
rm $out/System/libSDL-1.2.so.0
|
||||
rm $out/System/openal.so
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A first-person shooter video game developed by Epic Games and Digital Extreme -- demo version";
|
||||
homepage = "http://www.unrealtournament2004.com";
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ abbradar ];
|
||||
platforms = [ "x86_64-linux" "i686-linux" ];
|
||||
};
|
||||
}
|
46
pkgs/games/ut2004/wrapper.nix
Normal file
46
pkgs/games/ut2004/wrapper.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ stdenv, lib, runCommand, buildEnv, makeWrapper, makeDesktopItem, gamePacks, libstdcxx5, SDL, openal }:
|
||||
|
||||
let
|
||||
game = buildEnv {
|
||||
name = "ut2004-game";
|
||||
paths = gamePacks;
|
||||
ignoreCollisions = true;
|
||||
pathsToLink = [ "/" "/System" ];
|
||||
postBuild = ''
|
||||
ln -s ${lib.getLib SDL}/lib/libSDL-1.2.so.0 $out/System
|
||||
ln -s ${lib.getLib openal}/lib/libopenal.so $out/System/openal.so
|
||||
for i in $out/System/*-bin; do
|
||||
path="$(readlink -f "$i")"
|
||||
rm "$i"
|
||||
cp "$path" "$i"
|
||||
chmod +w "$i"
|
||||
patchelf \
|
||||
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
|
||||
--set-rpath "$out/System:${lib.makeLibraryPath [ libstdcxx5 ]}" \
|
||||
"$i"
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
desktop = makeDesktopItem {
|
||||
name = "ut2004";
|
||||
desktopName = "Unreal Tournament 2004";
|
||||
comment = "A first-person shooter video game developed by Epic Games and Digital Extreme";
|
||||
genericName = "First-person shooter";
|
||||
categories = "Application;Game;";
|
||||
exec = "ut2004";
|
||||
};
|
||||
|
||||
in runCommand "ut2004" {
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
for i in ${game}/System/*-bin; do
|
||||
name="$(basename "$i")"
|
||||
makeWrapper $i $out/bin/''${name%-bin} \
|
||||
--run "cd ${game}/System"
|
||||
done
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
ln -s ${desktop}/share/applications/* $out/share/applications
|
||||
''
|
|
@ -1,29 +0,0 @@
|
|||
source $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))
|
||||
|
||||
|
||||
# Set the ELF interpreter to our own Glibc.
|
||||
for i in "$out/System/ucc-bin" "$out/System/ut2004-bin"; do
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"
|
||||
done
|
|
@ -1,34 +0,0 @@
|
|||
{stdenv, fetchurl, xorg, mesa}:
|
||||
|
||||
assert stdenv.system == "i686-linux";
|
||||
|
||||
let {
|
||||
|
||||
raw = stdenv.mkDerivation {
|
||||
name = "ut2004-demo-3120";
|
||||
src = fetchurl {
|
||||
urls = [
|
||||
("http://store.node-10.ds-servers.com/file/BcFLgoIgAADQA7kw0qZctDAF+4cj"
|
||||
+ "mbnDMFOJTAyM0-cejkEIuDvQ6Uv9ZbvcWMnRmXXxhA0LyvzoKdvsnXne0D1DGTLiR0"
|
||||
+ "I1CmM2M-E5ryH-tD3yweCXyNyH1WGI3Wh09ja29mHtzGF1rxEyhRfQ7ggCKdfCrhvz"
|
||||
+ "H9oTJXSCAtGuSKdVDhe6tNtrqa151MIircZtRLPxQcGmJ+n3-iUeWYgHuqbmrK4ur7"
|
||||
+ "Qcy6QrAhYa+e5jcfYjgPF3VGsw4qx+0ilxJUCiuYCX2H8A6X3rxJILa26w3O425W2G"
|
||||
+ "kHPiQWrhFT8cIOyqSr8+dMO5Xi5-/ut2004-lnx-demo-3120.run.bz2")
|
||||
http://ftp.gameaholic.com/pub/demos/ut2004-lnx-demo-3120.run.bz2
|
||||
];
|
||||
sha256 = "1lravfkb1gsallqqird5dcbz42vwjg36m1qk76nmmnyyyghwqnli";
|
||||
};
|
||||
builder = ./builder.sh;
|
||||
};
|
||||
|
||||
body = stdenv.mkDerivation {
|
||||
name = raw.name;
|
||||
builder = ./make-wrapper.sh;
|
||||
inherit raw mesa;
|
||||
inherit (xorg) libX11 libXext;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
# http://mirror1.icculus.org/ut2004/ut2004-lnxpatch3204.tar.bz2
|
||||
# 5f659552095b878a029b917d216d9664
|
|
@ -1,13 +0,0 @@
|
|||
source $stdenv/setup
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
cat > $out/bin/ut2004demo <<EOF
|
||||
#! $SHELL -e
|
||||
|
||||
cd $raw/System
|
||||
|
||||
LD_LIBRARY_PATH=$libX11/lib:$libXext/lib\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ./ut2004-bin "\$@"
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/ut2004demo
|
|
@ -16199,7 +16199,9 @@ in
|
|||
|
||||
ue4demos = recurseIntoAttrs (callPackage ../games/ue4demos { });
|
||||
|
||||
ut2004demo = callPackage_i686 ../games/ut2004demo { };
|
||||
ut2004Packages = callPackage ../games/ut2004 { };
|
||||
|
||||
ut2004demo = self.ut2004Packages.ut2004 [ self.ut2004Packages.ut2004-demo ];
|
||||
|
||||
vapor = callPackage ../games/vapor { love = love_0_8; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue