3
0
Fork 0
forked from mirrors/nixpkgs

Castle-Combat: Start fixing; rewrite using `buildPythonPackage'.

svn path=/nixpkgs/trunk/; revision=23225
This commit is contained in:
Ludovic Courtès 2010-08-18 14:25:07 +00:00
parent e7dd6dcc6a
commit 904c8cfa0a
3 changed files with 33 additions and 32 deletions

View file

@ -1,54 +1,53 @@
{ fetchurl, stdenv, python, pygame, twisted, numeric, lib, makeWrapper }: { fetchurl, stdenv, buildPythonPackage, pygame, twisted, numeric, makeWrapper }:
stdenv.mkDerivation rec { buildPythonPackage rec {
name = "castle-combat-0.8.1"; name = "castle-combat-0.8.1";
namePrefix = "";
src = fetchurl { src = fetchurl {
url = "mirror://sourceforge/castle-combat/${name}.tar.gz"; url = "mirror://sourceforge/castle-combat/${name}.tar.gz";
sha256 = "1hp4y5dgj88j9g44h4dqiakrgj8lip1krlrdl2qpffin08agrvik"; sha256 = "1hp4y5dgj88j9g44h4dqiakrgj8lip1krlrdl2qpffin08agrvik";
}; };
buildInputs = [ python pygame twisted makeWrapper ]; buildInputs = [ makeWrapper ];
propagatedBuildInputs =
[ pygame twisted
# XXX: `Numeric.pth' should be found by Python but it's not.
# Gobolinux has the same problem:
# http://bugs.python.org/issue1431 .
numeric
];
patchPhase = '' patchPhase = ''
sed -i "src/common.py" \ sed -i "src/common.py" \
-e "s|^data_path *=.*$|data_path = \"$out/share/${name}\"|g" -e "s|^data_path *=.*$|data_path = \"$out/share/${name}\"|g"
'';
buildPhase = ''python setup.py build --build-base "$out"''; mv -v "src/"*.py .
installPhase = '' sed -i "setup.py" -e's/"src"/""/g'
python setup.py install --prefix "$out"
ensureDir "$out/share/${name}"
cp -rv data/* "$out/share/${name}"
${postInstall}
''; '';
postInstall = '' postInstall = ''
mv "$out/bin/castle-combat.py" "$out/bin/castle-combat" ensureDir "$out/share/${name}"
wrapProgram "$out/bin/castle-combat" \ cp -rv "data/"* "$out/share/${name}"
--prefix PYTHONPATH ":" \
${lib.concatStringsSep ":"
([ "$out/lib/python2.5/site-packages/src"
# XXX: `Numeric.pth' should be found by Python but it's not. mv -v "$out/bin/castle-combat.py" "$out/bin/castle-combat"
# Gobolinux has the same problem: '';
# http://bugs.python.org/issue1431 .
"${numeric}/lib/python2.5/site-packages/Numeric" ] ++
(map (path: path + "/lib/python2.5/site-packages")
([ "${pygame}" "${twisted}" ]
++ twisted.propagatedBuildInputs)))} \
\
--prefix LD_LIBRARY_PATH ":" \
"$(cat ${stdenv.gcc}/nix-support/orig-gcc)/lib"
postPhases = "fixLoaderPath";
fixLoaderPath =
let dollar = "\$"; in
'' sed -i "$out/bin/castle-combat" \
-e "/^exec/ iexport LD_LIBRARY_PATH=\"$(cat ${stdenv.gcc}/nix-support/orig-gcc)/lib\:"'${dollar}'"LD_LIBRARY_PATH\"\\
export LD_LIBRARY_PATH=\"$(cat ${stdenv.gcc}/nix-support/orig-gcc)/lib64\:"'${dollar}'"LD_LIBRARY_PATH\""
'';
# ^ # ^
# `--- The run-time says: "libgcc_s.so.1 must be installed for # `--- The run-time says: "libgcc_s.so.1 must be installed for
# pthread_cancel to work", which means it need help to find it. # pthread_cancel to work", which means it needs help to find it.
rm -rf "$out/lib/src" # No test suite.
''; doCheck = false;
meta = { meta = {
description = "Castle-Combat, a clone of the old arcade game Rampart"; description = "Castle-Combat, a clone of the old arcade game Rampart";
@ -64,5 +63,7 @@ stdenv.mkDerivation rec {
homepage = http://www.linux-games.com/castle-combat/; homepage = http://www.linux-games.com/castle-combat/;
license = "unknown"; license = "unknown";
maintainers = [ stdenv.lib.maintainers.ludo ];
}; };
} }

View file

@ -6395,7 +6395,7 @@ let
bsdgames = callPackage ../games/bsdgames { }; bsdgames = callPackage ../games/bsdgames { };
castleCombat = callPackage ../games/castle-combat { }; castle_combat = callPackage ../games/castle-combat { };
construoBase = callPackage ../games/construo { construoBase = callPackage ../games/construo {
mesa = null; mesa = null;

View file

@ -48,7 +48,7 @@ with (import ./release-lib.nix);
bvi = all; bvi = all;
bzip2 = all; bzip2 = all;
cabextract = all; cabextract = all;
castleCombat = linux; castle_combat = linux;
cdrkit = linux; cdrkit = linux;
chatzilla = linux; chatzilla = linux;
cksfv = all; cksfv = all;