diff --git a/pkgs/build-support/builder-defs/builder-defs.nix b/pkgs/build-support/builder-defs/builder-defs.nix index 322d8f615e55..60b1f98e33fd 100644 --- a/pkgs/build-support/builder-defs/builder-defs.nix +++ b/pkgs/build-support/builder-defs/builder-defs.nix @@ -26,6 +26,7 @@ let inherit (builtins) head tail trace; in else if (hasSuffixHack ".zip" s) || (hasSuffixHack ".ZIP" s) then "zip" else if (hasSuffixHack "-cvs-export" s) then "cvs-dir" else if (hasSuffixHack ".nar.bz2" s) then "narbz2" + else if (hasSuffixHack ".rpm" s) then "rpm" # Mostly for manually specified directories.. else if (hasSuffixHack "/" s) then "dir" @@ -234,7 +235,12 @@ let inherit (builtins) head tail trace; in " else if (archiveType s) == "narbz2" then " bzip2 <${s} | nix-store --restore \$PWD/\$(basename ${s} .nar.bz2) cd \$(basename ${s} .nar.bz2) - " else if (archiveType s) == "plain-bz2" then " + " else if (archiveType s) == "rpm" then '' + rpm2cpio ${s} > ${s}.cpio + cpio -iv < ${s}.cpio + test -f *.tar.* && tar -xvf *.tar.* + test -d */ && cd */ + '' else if (archiveType s) == "plain-bz2" then " mkdir \$PWD/\$(basename ${s} .bz2) NAME=\$(basename ${s} .bz2) bzip2 -d <${s} > \$PWD/\$(basename ${s} .bz2)/\${NAME#*-} diff --git a/pkgs/games/xconq/default.nix b/pkgs/games/xconq/default.nix new file mode 100644 index 000000000000..16169c767bfa --- /dev/null +++ b/pkgs/games/xconq/default.nix @@ -0,0 +1,67 @@ +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 + '' ["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 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e5f789ab32b0..db6f61910238 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7456,6 +7456,8 @@ let inherit gnuchess texinfo; }; + xconq = callPackage ../games/xconq {}; + xsokoban = builderDefsPackage (import ../games/xsokoban) { inherit (xlibs) libX11 xproto libXpm libXt; };