sauerbraten: use stdenv
This replaces use of builderDefsPackage (#4210).
This commit is contained in:
parent
aca3851b88
commit
a04916cdc4
|
@ -1,77 +1,56 @@
|
||||||
x@{builderDefsPackage
|
{ stdenv, fetchsvn, mesa, SDL, SDL_image, SDL_mixer
|
||||||
, fetchsvn, mesa, SDL, SDL_image, SDL_mixer
|
, libpng, zlib, libjpeg, imagemagick, libX11
|
||||||
, libpng, zlib, libjpeg, imagemagick, libX11
|
}:
|
||||||
, ...}:
|
|
||||||
builderDefsPackage
|
|
||||||
(a :
|
|
||||||
let
|
|
||||||
helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
|
|
||||||
["fetchsvn"];
|
|
||||||
|
|
||||||
buildInputs = map (n: builtins.getAttr n x)
|
stdenv.mkDerivation rec {
|
||||||
(builtins.attrNames (builtins.removeAttrs x helperArgNames));
|
name = "sauerbraten-r${version}";
|
||||||
sourceInfo = rec {
|
version = "5000";
|
||||||
baseName="sauerbraten";
|
|
||||||
version="5000";
|
src = fetchsvn {
|
||||||
name="${baseName}-r${version}";
|
url = "https://svn.code.sf.net/p/sauerbraten/code";
|
||||||
url="https://svn.code.sf.net/p/sauerbraten/code";
|
sha256 = "17libj7dslprlwppdk3vyxdcigbsa4czln8gdyz9j264m11z1cbh";
|
||||||
hash="17libj7dslprlwppdk3vyxdcigbsa4czln8gdyz9j264m11z1cbh";
|
rev = version;
|
||||||
};
|
|
||||||
in
|
|
||||||
rec {
|
|
||||||
srcDrv = a.fetchsvn {
|
|
||||||
url = sourceInfo.url;
|
|
||||||
sha256 = sourceInfo.hash;
|
|
||||||
rev = sourceInfo.version;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
src = srcDrv + "/";
|
buildInputs = [
|
||||||
|
mesa SDL SDL_image SDL_mixer libpng zlib libjpeg imagemagick
|
||||||
|
libX11
|
||||||
|
];
|
||||||
|
|
||||||
inherit (sourceInfo) name version;
|
preBuild = ''
|
||||||
inherit buildInputs;
|
|
||||||
|
|
||||||
phaseNames = ["setVars" "doMakeInstall" "doCreateScripts"];
|
|
||||||
|
|
||||||
setVars = a.noDepEntry ''
|
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -lX11"
|
export NIX_LDFLAGS="$NIX_LDFLAGS -lX11"
|
||||||
|
pushd src
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doUnpack = a.fullDepEntry ''
|
installPhase = ''
|
||||||
mkdir -p $out/share/sauerbraten/build-dir
|
popd
|
||||||
ln -s $out/share/sauerbraten/build-dir
|
mkdir -p $out/bin $out/share/sauerbraten $out/share/doc/sauerbraten
|
||||||
cd $out/share/sauerbraten/build-dir
|
cp -rv "docs/"* $out/share/doc/sauerbraten/
|
||||||
(cd ${src}; find . -type d) | tail -n +2 | xargs -L 1 mkdir
|
cp -v src/sauer_client src/sauer_server $out/share/sauerbraten/
|
||||||
(cd ${src}; find . -type f) | while read; do ln -s ${src}/"$REPLY" "$(dirname "$REPLY")"; done
|
cp -rv packages $out/share/sauerbraten/
|
||||||
cd src
|
cp -rv data $out/share/sauerbraten/
|
||||||
ls
|
cat > $out/bin/sauerbraten_server <<EOF
|
||||||
make clean
|
#!${stdenv.shell}
|
||||||
sed -e '/[.]h[.]gch/,/-o/s@-o@-x c++-header -o@' -i Makefile
|
cd $out/share/sauerbraten
|
||||||
'' ["minInit" "addInputs" "defEnsureDir"];
|
./sauer_server "\$@"
|
||||||
|
EOF
|
||||||
doCreateScripts = a.fullDepEntry ''
|
cat > $out/bin/sauerbraten_client <<EOF
|
||||||
cd ..
|
#!${stdenv.shell}
|
||||||
mkdir -p $out/bin
|
cd $out/share/sauerbraten
|
||||||
echo '#! /bin/sh' >> $out/bin/sauerbraten_server
|
./sauer_client "\$@"
|
||||||
echo 'cd "'"$out"'/share/sauerbraten/build-dir"' >> $out/bin/sauerbraten_server
|
EOF
|
||||||
echo './bin_unix/native_server "$@"' >> $out/bin/sauerbraten_server
|
|
||||||
echo '#! /bin/sh' >> $out/bin/sauerbraten_client
|
|
||||||
echo 'cd "'"$out"'/share/sauerbraten/build-dir"' >> $out/bin/sauerbraten_client
|
|
||||||
echo './bin_unix/native_client "$@"' >> $out/bin/sauerbraten_client
|
|
||||||
chmod a+x $out/bin/sauerbraten_*
|
chmod a+x $out/bin/sauerbraten_*
|
||||||
'' ["minInit" "defEnsureDir"];
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with stdenv.lib; {
|
||||||
description = "";
|
description = "";
|
||||||
maintainers = with a.lib.maintainers;
|
maintainers = [ maintainers.raskin ];
|
||||||
[
|
|
||||||
raskin
|
|
||||||
];
|
|
||||||
hydraPlatforms =
|
hydraPlatforms =
|
||||||
# raskin: tested amd64-linux;
|
# raskin: tested amd64-linux;
|
||||||
# not setting platforms because it is 0.5+ GiB of game data
|
# not setting platforms because it is 0.5+ GiB of game data
|
||||||
[];
|
[];
|
||||||
license = "freeware"; # as an aggregate - data files have different licenses
|
license = "freeware"; # as an aggregate - data files have different licenses
|
||||||
# code is under zlib license
|
# code is under zlib license
|
||||||
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}) x
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue