2009-01-14 00:23:11 +00:00
|
|
|
{ fetchurl, stdenv, python, alsaLib, libX11, mesa, SDL }:
|
2009-01-13 19:44:11 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2010-01-28 15:50:04 +00:00
|
|
|
name = "teeworlds-0.5.2";
|
2009-01-13 19:44:11 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.teeworlds.com/files/${name}-src.tar.gz";
|
2010-01-28 15:50:04 +00:00
|
|
|
sha256 = "1h7likcqbyr3q8djzlgxmr8fiwwj8is3b01hd5x0qix1z4dsf48q";
|
2009-01-13 19:44:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Note: Teeworlds requires Python 2.x to compile. Python 3.0 will
|
|
|
|
# not work.
|
2009-01-14 00:23:11 +00:00
|
|
|
buildInputs = [ python alsaLib libX11 mesa SDL ];
|
2009-01-13 19:44:11 +00:00
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace "default.bam" \
|
|
|
|
--replace 'settings.linker.flags = ""' \
|
|
|
|
'settings.linker.flags = "-fstack-protector-all"'
|
|
|
|
'';
|
|
|
|
configurePhase = ''
|
|
|
|
# Fetch and build BAM, the home-made build system.
|
2009-01-14 00:23:11 +00:00
|
|
|
# FIXME: Move BAM outside of here. See http://www.teeworlds.com/trac/bam .
|
|
|
|
tar xzvf ${fetchurl {
|
|
|
|
url = "http://teeworlds.com/trac/bam/browser/releases/bam-0.2.0.tar.gz?format=raw";
|
|
|
|
sha256 = "0n077iiidw7xsyna4y92pz5dwqaywps3w0v5c88dic27vz0xsv7g";
|
2009-01-13 19:44:11 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-14 00:23:11 +00:00
|
|
|
( cd bam-* && ./make_unix.sh )
|
2009-01-13 19:44:11 +00:00
|
|
|
|
|
|
|
# Build Teeworlds.
|
2009-01-14 00:23:11 +00:00
|
|
|
./bam-*/src/bam release
|
2009-01-13 19:44:11 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2009-01-13 20:36:09 +00:00
|
|
|
# Copy the graphics, sounds, etc.
|
2009-01-13 19:44:11 +00:00
|
|
|
ensureDir "$out/share/${name}"
|
2009-01-13 20:36:09 +00:00
|
|
|
cp -rv data other/icons "$out/share/${name}"
|
2009-01-13 19:44:11 +00:00
|
|
|
|
2009-01-13 20:36:09 +00:00
|
|
|
# Copy the executables (client, server, etc.).
|
2009-01-13 19:44:11 +00:00
|
|
|
ensureDir "$out/bin"
|
2009-01-13 20:36:09 +00:00
|
|
|
executables=""
|
|
|
|
for file in *
|
|
|
|
do
|
|
|
|
if [ -f "$file" ] && [ -x "$file" ]
|
|
|
|
then
|
|
|
|
executables="$file $executables"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cp -v $executables "$out/bin"
|
2009-01-13 19:44:11 +00:00
|
|
|
|
2009-01-13 20:36:09 +00:00
|
|
|
# Make sure the programs are executed from the right directory so
|
|
|
|
# that they can access the graphics and sounds.
|
|
|
|
for program in $executables
|
|
|
|
do
|
|
|
|
mv -v "$out/bin/$program" "$out/bin/.wrapped-$program"
|
|
|
|
cat > "$out/bin/$program" <<EOF
|
2009-01-13 19:44:11 +00:00
|
|
|
#!/bin/sh
|
2009-01-13 20:36:09 +00:00
|
|
|
cd "$out/share/${name}" && exec "$out/bin/.wrapped-$program"
|
2009-01-13 19:44:11 +00:00
|
|
|
EOF
|
2009-01-13 20:36:09 +00:00
|
|
|
chmod -v +x "$out/bin/$program"
|
|
|
|
done
|
2009-01-13 19:44:11 +00:00
|
|
|
|
2009-01-13 20:36:09 +00:00
|
|
|
# Copy the documentation.
|
2009-01-13 19:44:11 +00:00
|
|
|
ensureDir "$out/doc/${name}"
|
|
|
|
cp -v *.txt "$out/doc/${name}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Teeworlds, a retro multiplayer shooter game";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Teeworlds is a free online multiplayer game, available for all
|
|
|
|
major operating systems. Battle with up to 12 players in a
|
|
|
|
variety of game modes, including Team Deathmatch and Capture The
|
|
|
|
Flag. You can even design your own maps!
|
|
|
|
'';
|
|
|
|
|
|
|
|
homepage = http://teeworlds.com/;
|
|
|
|
license = "BSD-style, see `license.txt'";
|
|
|
|
};
|
|
|
|
}
|