teeworlds: use wrapProgram

Replace custom wrapper by wrapProgram tool.
This commit is contained in:
Robert Helgesson 2016-09-03 18:41:13 +02:00
parent 8d977ead38
commit f144887ba0
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -1,4 +1,6 @@
{ fetchurl, stdenv, python, alsaLib, libX11, mesa_glu, SDL, lua5, zlib, bam, freetype }:
{ fetchurl, stdenv, makeWrapper, python, alsaLib
, libX11, mesa_glu, SDL, lua5, zlib, bam, freetype
}:
stdenv.mkDerivation rec {
name = "teeworlds-0.6.3";
@ -11,7 +13,9 @@ stdenv.mkDerivation rec {
# we always want to use system libs instead of these
postPatch = "rm -r other/{freetype,sdl}/{include,lib32,lib64}";
buildInputs = [ python alsaLib libX11 mesa_glu SDL lua5 zlib bam freetype ];
buildInputs = [
python makeWrapper alsaLib libX11 mesa_glu SDL lua5 zlib bam freetype
];
buildPhase = ''
bam -a -v release
@ -38,12 +42,8 @@ stdenv.mkDerivation rec {
# 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
#!/bin/sh
cd "$out/share/${name}" && exec "$out/bin/.wrapped-$program" "\$@"
EOF
chmod -v +x "$out/bin/$program"
wrapProgram $out/bin/$program \
--run "cd $out/share/${name}"
done
# Copy the documentation.