glob2: Refactor to use mkDerivation

This commit is contained in:
William A. Kennington III 2014-10-31 15:50:15 -07:00
parent b94f27b846
commit 47ef7b4508

View File

@ -1,80 +1,50 @@
x@{builderDefsPackage { stdenv, fetchurl, mesa, SDL, scons, SDL_ttf, SDL_image, zlib, SDL_net
, mesa, SDL, scons, SDL_ttf, SDL_image, zlib, SDL_net, speex, libvorbis , speex, libvorbis, libogg, boost, fribidi, bsdiff
, libogg, boost, fribidi, bsdiff }:
, ...}:
builderDefsPackage
(a :
let let
helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ version = "0.9.4";
[]; patchlevel = "4";
tutorial4patch = fetchurl {
buildInputs = [ ]
++ map (n: builtins.getAttr n x)
(builtins.attrNames (builtins.removeAttrs x helperArgNames));
sourceInfo = rec {
baseName="glob2";
version="0.9.4";
patchlevel="4";
name="${baseName}-${version}.${patchlevel}";
url="mirror://savannah/glob2/${version}/${name}.tar.gz";
hash="1f0l2cqp2g3llhr9jl6jj15k0wb5q8n29vqj99xy4p5hqs78jk8g";
};
in
rec {
src = a.fetchurl {
url = sourceInfo.url;
sha256 = sourceInfo.hash;
};
tutorial4patch = a.fetchurl {
url = "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=34;filename=tutorial-part4.map.bspatch;att=1;bug=595448"; url = "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=34;filename=tutorial-part4.map.bspatch;att=1;bug=595448";
name = "globulation2-tutorial4-map-patch-debian.bspatch"; name = "globulation2-tutorial4-map-patch-debian.bspatch";
sha256 = "d3511ac0f822d512c42abd34b3122f2990862d3d0af6ce464ff372f5bd7f35e9"; sha256 = "d3511ac0f822d512c42abd34b3122f2990862d3d0af6ce464ff372f5bd7f35e9";
}; };
in
stdenv.mkDerivation rec {
name = "glob2-${version}.${patchlevel}";
inherit (sourceInfo) name version; src = fetchurl {
inherit buildInputs; url = "mirror://savannah/glob2/${version}/${name}.tar.gz";
sha256 = "1f0l2cqp2g3llhr9jl6jj15k0wb5q8n29vqj99xy4p5hqs78jk8g";
};
/* doConfigure should be removed if not needed */ patches = [ ./header-order.patch ];
phaseNames = ["doUnpack" "doPatch" "doBspatch" "workaroundScons" "doScons"];
patches = [./header-order.patch]; postPatch = ''
doBspatch = a.fullDepEntry ''
cp campaigns/tutorial-part4.map{,.orig} cp campaigns/tutorial-part4.map{,.orig}
bspatch campaigns/tutorial-part4.map{.orig,} ${tutorial4patch} bspatch campaigns/tutorial-part4.map{.orig,} ${tutorial4patch}
'' ["minInit" "doUnpack" "addInputs"]; sed -i -e "s@env = Environment()@env = Environment( ENV = os.environ )@" SConstruct
'';
# FIXME buildInputs = [ mesa SDL scons SDL_ttf SDL_image zlib SDL_net speex libvorbis libogg boost fribidi bsdiff ];
# I officially fail to understand what goes on, but that seems to work
# too well not to use. Yes, it is ugly, I know...
workaroundScons = a.fullDepEntry ''
echo '#! ${a.stdenv.shell}' >> o
echo 'g++ -o "$@"' >> o
chmod a+x o
export PATH="$PATH:$PWD"
'' ["minInit"];
sconsFlags = [ buildPhase = ''
"DATADIR=$out/share/globulation2/glob2" scons
"BINDIR=$out/bin" '';
"INSTALLDIR=$out/share/globulation2"
];
meta = { installPhase = ''
scons install \
BINDIR=$out/bin \
INSTALLDIR=$out/share/globulation2 \
DATADIR=$out/share/globulation2/glob2
'';
meta = with stdenv.lib; {
description = "RTS without micromanagement"; description = "RTS without micromanagement";
maintainers = with a.lib.maintainers; maintainers = with maintainers; [ raskin ];
[ platforms = platforms.linux;
raskin license = licenses.gpl3;
];
platforms = with a.lib.platforms;
linux;
license = a.lib.licenses.gpl3;
}; };
passthru = { passthru.updateInfo.downloadPage = "http://globulation2.org/wiki/Download_and_Install";
updateInfo = { }
downloadPage = "http://globulation2.org/wiki/Download_and_Install";
};
};
}) x