xconq: fix build and refactor

This commit is contained in:
Pascal Wittmann 2015-07-01 22:06:39 +02:00
parent 0cc53d0711
commit 5f462f0eae

View File

@ -1,55 +1,18 @@
x@{builderDefsPackage { stdenv, fetchurl, cpio, xproto, libX11, libXmu, libXaw, libXt, tcl, tk
, rpm, cpio, xproto, libX11, libXmu, libXaw, libXt, tcl, tk, libXext , libXext, fontconfig, makeWrapper }:
, fontconfig
, makeWrapper
, ...}:
builderDefsPackage
(a :
let
helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
[];
buildInputs = map (n: builtins.getAttr n x) stdenv.mkDerivation rec {
(builtins.attrNames (builtins.removeAttrs x helperArgNames)); name = "${baseName}-${version}";
sourceInfo = rec { baseName="xconq";
baseName="xconq"; version = "7.5.0-0pre.0.20050612";
version="7.5.0-0pre.0.20050612";
name="${baseName}-${version}"; src = fetchurl {
extension="src.rpm"; url = "mirror://sourceforge/project/${baseName}/${baseName}/${name}/${name}.tar.gz";
project="${baseName}"; sha256 = "1za78yx57mgwcmmi33wx3533yz1x093dnqis8q2qmqivxav51lca";
url="mirror://sourceforge/project/${project}/${baseName}/${name}/${baseName}-${version}.${extension}";
hash="0i41dz95af2pzmmjz0sc1n0wdxy7gjqlfcl503hw1xd5zza2lw2j";
};
in
rec {
src = a.fetchurl {
url = sourceInfo.url;
sha256 = sourceInfo.hash;
}; };
inherit (sourceInfo) name version; buildInputs = [ cpio xproto libX11 libXmu libXaw libXt tcl tk libXext
inherit buildInputs; fontconfig makeWrapper ];
/* doConfigure should be removed if not needed */
phaseNames = ["addInputs" "doUnpack" "fixMakefiles" "fixCfiles" "fixTCLfiles"
"doConfigure" "doMakeInstall" "doWrap"];
doWrap = a.makeManyWrappers ''$out/bin/*'' ''--prefix TCLLIBPATH ' ' "${tk}/lib"'';
fixMakefiles = a.fullDepEntry ''
find . -name 'Makefile.in' -exec sed -re 's@^ ( *)(cd|[&][&])@ \1\2@' -i '{}' ';'
find . -name 'Makefile.in' -exec sed -e '/chown/d; /chgrp/d' -i '{}' ';'
sed -e '/^ * *[$][(]tcltkdir[)]\/[*][.][*]/d' -i tcltk/Makefile.in
'' ["minInit" "doUnpack"];
fixCfiles = a.fullDepEntry ''
sed -re 's@[(]int[)]color@(long)color@' -i tcltk/tkmap.c
sed -re '/unitp = view_unit[(]uview[)]/aelse *unitp = NULL\;' -i tcltk/tkmap.c
'' ["minInit" "doUnpack"];
fixTCLfiles = a.fullDepEntry ''
sed -re 's@MediumBlue@LightBlue@g' -i tcltk/tkconq.tcl
'' ["minInit" "doUnpack"];
configureFlags = [ configureFlags = [
"--enable-alternate-scoresdir=scores" "--enable-alternate-scoresdir=scores"
@ -57,17 +20,30 @@ rec {
"--with-tkconfig=${tk}/lib" "--with-tkconfig=${tk}/lib"
]; ];
meta = { patchPhase = ''
description = "A programmable turn-based strategy game"; # Fix Makefiles
maintainers = with a.lib.maintainers; find . -name 'Makefile.in' -exec sed -re 's@^ ( *)(cd|[&][&])@ \1\2@' -i '{}' ';'
[ find . -name 'Makefile.in' -exec sed -e '/chown/d; /chgrp/d' -i '{}' ';'
raskin sed -e '/^ * *[$][(]tcltkdir[)]\/[*][.][*]/d' -i tcltk/Makefile.in
];
platforms = with a.lib.platforms;
linux;
license = a.lib.licenses.gpl2;
};
passthru = {
};
}) x
# Fix C files
sed -re 's@[(]int[)]color@(long)color@' -i tcltk/tkmap.c
sed -re '/unitp = view_unit[(]uview[)]/aelse *unitp = NULL\;' -i tcltk/tkmap.c
# Fix TCL files
sed -re 's@MediumBlue@LightBlue@g' -i tcltk/tkconq.tcl
'';
postInstall = ''
for file in $out/bin/*; do
wrapProgram $file --prefix TCLLIBPATH ' ' "${tk}/lib"
done
'';
meta = with stdenv.lib; {
description = "A programmable turn-based strategy game";
maintainers = with maintainers; [ raskin ];
platforms = platforms.linux;
license = licenses.gpl2;
};
}