about summary refs log tree commit diff
path: root/pkgs/games/xconq/default.nix
diff options
context:
space:
mode:
authorPascal Wittmann <mail@pascal-wittmann.de>2015-07-01 22:06:39 +0200
committerPascal Wittmann <mail@pascal-wittmann.de>2015-07-01 22:06:39 +0200
commit5f462f0eae09402cbd06603c0094cbe58c5881e0 (patch)
tree2b8426247a3d26c90856b08a203c9886d779d029 /pkgs/games/xconq/default.nix
parent0cc53d07110ee4cb4600a66b345eb4db4cd3d2e6 (diff)
xconq: fix build and refactor
Diffstat (limited to 'pkgs/games/xconq/default.nix')
-rw-r--r--pkgs/games/xconq/default.nix90
1 files changed, 33 insertions, 57 deletions
diff --git a/pkgs/games/xconq/default.nix b/pkgs/games/xconq/default.nix
index 413ecccc76efc..53c3ec7dec855 100644
--- a/pkgs/games/xconq/default.nix
+++ b/pkgs/games/xconq/default.nix
@@ -1,73 +1,49 @@
-x@{builderDefsPackage
-  , rpm, cpio, xproto, libX11, libXmu, libXaw, libXt, tcl, tk, libXext
-  , fontconfig
-  , makeWrapper
-  , ...}:
-builderDefsPackage
-(a :  
-let 
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 
-    [];
-
-  buildInputs = map (n: builtins.getAttr n x)
-    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
-  sourceInfo = rec {
-    baseName="xconq";
-    version="7.5.0-0pre.0.20050612";
-    name="${baseName}-${version}";
-    extension="src.rpm";
-    project="${baseName}";
-    url="mirror://sourceforge/project/${project}/${baseName}/${name}/${baseName}-${version}.${extension}";
-    hash="0i41dz95af2pzmmjz0sc1n0wdxy7gjqlfcl503hw1xd5zza2lw2j";
-  };
-in
-rec {
-  src = a.fetchurl {
-    url = sourceInfo.url;
-    sha256 = sourceInfo.hash;
+{ stdenv, fetchurl, cpio, xproto, libX11, libXmu, libXaw, libXt, tcl, tk
+, libXext, fontconfig, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "${baseName}-${version}";
+  baseName="xconq";
+  version = "7.5.0-0pre.0.20050612";
+  
+  src = fetchurl {
+    url = "mirror://sourceforge/project/${baseName}/${baseName}/${name}/${name}.tar.gz";
+    sha256 = "1za78yx57mgwcmmi33wx3533yz1x093dnqis8q2qmqivxav51lca";
   };
 
-  inherit (sourceInfo) name version;
-  inherit buildInputs;
+  buildInputs = [ cpio xproto libX11 libXmu libXaw libXt tcl tk libXext
+    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"'';
+  configureFlags = [
+    "--enable-alternate-scoresdir=scores"
+    "--with-tclconfig=${tcl}/lib"
+    "--with-tkconfig=${tk}/lib"
+  ];
 
-  fixMakefiles = a.fullDepEntry ''
+  patchPhase = ''
+    # Fix Makefiles
     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 ''
+    # 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
-  '' ["minInit" "doUnpack"];
 
-  fixTCLfiles = a.fullDepEntry ''
+    # Fix TCL files
     sed -re 's@MediumBlue@LightBlue@g' -i tcltk/tkconq.tcl
-  '' ["minInit" "doUnpack"];
+  '';
 
-  configureFlags = [
-    "--enable-alternate-scoresdir=scores"
-    "--with-tclconfig=${tcl}/lib"
-    "--with-tkconfig=${tk}/lib"
-  ];
+  postInstall = ''
+    for file in $out/bin/*; do
+      wrapProgram $file --prefix TCLLIBPATH ' ' "${tk}/lib"
+    done
+  '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A programmable turn-based strategy game";
-    maintainers = with a.lib.maintainers;
-    [
-      raskin
-    ];
-    platforms = with a.lib.platforms;
-      linux;
-    license = a.lib.licenses.gpl2;
-  };
-  passthru = {
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    license = licenses.gpl2;
   };
-}) x
-
+}