[Nix-dev] Patch: New Expression: "Six - A Hex playing program for KDE"

james.cook at utoronto.ca james.cook at utoronto.ca
Sun Mar 14 03:51:32 CET 2010


Hi folks,

    Here is a Nix expression for six, which is a KDE implementation of
the board game Hex.  It's my first Nix expression.  It seems to work,
although it took me a while to figure out how to fix the
"impure path `/usr/lib' used in link" error.

James

-------------- next part --------------
Index: pkgs/games/six/default.nix
===================================================================
--- pkgs/games/six/default.nix	(revision 0)
+++ pkgs/games/six/default.nix	(revision 0)
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, arts, kdelibs, libX11, libXext, libXt, perl, qt, zlib }:
+
+let
+
+    versionNumber = "0.5.3";
+
+in
+
+stdenv.mkDerivation {
+
+  name = "six-${versionNumber}";
+
+  src = fetchurl {
+    url = "http://six.retes.hu/download/six-${versionNumber}.tar.gz";
+    sha256 = "0hialm0kxr11rp5z452whjmxp2vaqqj668d0dfs32fd10ggi8wj4";
+  };
+
+  meta = {
+    description = "Six - A Hex playing program for KDE";
+    homepage = http://six.retes.hu/;
+    license = "GPLv2";
+  };
+
+  buildInputs = [ arts kdelibs libX11 libXext libXt perl qt zlib ];
+
+  # Supress some warnings which are less useful to us when making packages.
+  NIX_CFLAGS_COMPILE = "-Wno-conversion -Wno-parentheses";
+
+  # Without "--x-libraries=", we get the error
+  # "impure path `/usr/lib' used in link".
+  configureFlags = "--x-libraries=";
+
+  patches = [ ./gcc43-includes.patch ];
+}
Index: pkgs/games/six/gcc43-includes.patch
===================================================================
--- pkgs/games/six/gcc43-includes.patch	(revision 0)
+++ pkgs/games/six/gcc43-includes.patch	(revision 0)
@@ -0,0 +1,38 @@
+This patch makes six compile with gcc 4.3 by including more header files.  It
+is based on the advice at <http://gcc.gnu.org/gcc-4.3/porting_to.html>.
+
+--- a/six/carrier.h
++++ b/six/carrier.h
+@@ -2,6 +2,7 @@
+ #ifndef CARRIER_H
+ #define CARRIER_H
+ 
++#include <cstring>
+ #include <iostream>
+ #include <vector>
+ 
+diff --git a/six/hexgame.cpp b/six/hexgame.cpp
+index 720e977..5d0dafe 100644
+--- a/six/hexgame.cpp
++++ b/six/hexgame.cpp
+@@ -3,6 +3,7 @@
+ #include <cassert>
+ #include <cctype>
+ #include <cstdio>
++#include <cstdlib>
+ 
+ #include <string>
+ 
+diff --git a/six/main.cpp b/six/main.cpp
+index 7fb5c21..b925a0c 100644
+--- a/six/main.cpp
++++ b/six/main.cpp
+@@ -4,6 +4,8 @@
+ #include "carrier.h"
+ #include "misc.h"
+ 
++#include <cstdlib>
++
+ #include <kapp.h>
+ #include <dcopclient.h>
+ #include <kaboutdata.h>
Index: pkgs/top-level/all-packages.nix
===================================================================
--- pkgs/top-level/all-packages.nix	(revision 20611)
+++ pkgs/top-level/all-packages.nix	(working copy)
@@ -8653,6 +8653,14 @@
     inherit (xlibs) libXt libX11 libXmu libXi libXext;
   };
 
+  six = import ../games/six {
+    inherit stdenv fetchurl;
+    inherit arts perl zlib;
+    inherit (xlibs) libX11 libXt libXext;
+    kdelibs = kde3.kdelibs;
+    qt = qt3;
+  };
+
   superTuxKart = import ../games/super-tux-kart {
     inherit fetchurl stdenv plib SDL openal freealut mesa
       libvorbis libogg gettext;


More information about the nix-dev mailing list