summary refs log tree commit diff
path: root/pkgs/games/xconq/default.nix
blob: b9266cb88af7b09d32c77255e722d677f937801c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
x@{builderDefsPackage
  , rpm, cpio, xproto, libX11, libXmu, libXaw, libXt, tcl, tk, libXext
  , 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;
  };

  inherit (sourceInfo) name version;
  inherit buildInputs;

  /* doConfigure should be removed if not needed */
  phaseNames = ["addInputs" "doUnpack" "fixMakefiles" "fixCfiles" "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"];

  configureFlags = [
    "--enable-alternate-scoresdir=scores"
    "--with-tclconfig=${tcl}/lib"
    "--with-tkconfig=${tk}/lib"
  ];

  meta = {
    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 = {
  };
}) x