summary refs log tree commit diff
path: root/pkgs/games/globulation
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-10-31 15:50:15 -0700
committerWilliam A. Kennington III <william@wkennington.com>2014-11-02 17:22:27 -0800
commit47ef7b45086acba818f56551af206aa64c4c3071 (patch)
treef4036ea714d68c2c487ef4d363384551104e4b51 /pkgs/games/globulation
parentb94f27b846dd5573ce02e37de0157b9fc440e3b4 (diff)
downloadnixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.tar
nixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.tar.gz
nixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.tar.bz2
nixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.tar.lz
nixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.tar.xz
nixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.tar.zst
nixpkgs-47ef7b45086acba818f56551af206aa64c4c3071.zip
glob2: Refactor to use mkDerivation
Diffstat (limited to 'pkgs/games/globulation')
-rw-r--r--pkgs/games/globulation/default.nix100
1 files changed, 35 insertions, 65 deletions
diff --git a/pkgs/games/globulation/default.nix b/pkgs/games/globulation/default.nix
index bd2a671afc9..ed134bcf3c9 100644
--- a/pkgs/games/globulation/default.nix
+++ b/pkgs/games/globulation/default.nix
@@ -1,80 +1,50 @@
-x@{builderDefsPackage
-  , mesa, SDL, scons, SDL_ttf, SDL_image, zlib, SDL_net, speex, libvorbis
-  , libogg, boost, fribidi, bsdiff
-  , ...}:
-builderDefsPackage
-(a :  
-let 
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 
-    [];
-
-  buildInputs = [ ]
-    ++ map (n: builtins.getAttr n x)
-     (builtins.attrNames (builtins.removeAttrs x helperArgNames));
-  sourceInfo = rec {
-   baseName="glob2";
-    version="0.9.4";
-    patchlevel="4";
-    name="${baseName}-${version}.${patchlevel}";
-    url="mirror://savannah/glob2/${version}/${name}.tar.gz";
-    hash="1f0l2cqp2g3llhr9jl6jj15k0wb5q8n29vqj99xy4p5hqs78jk8g";
-  };
-in
-rec {
-  src = a.fetchurl {
-    url = sourceInfo.url;
-    sha256 = sourceInfo.hash;
-  };
-
-  tutorial4patch = a.fetchurl {
+{ stdenv, fetchurl, mesa, SDL, scons, SDL_ttf, SDL_image, zlib, SDL_net
+, speex, libvorbis, libogg, boost, fribidi, bsdiff
+}:
+let
+  version = "0.9.4";
+  patchlevel = "4";
+  tutorial4patch = fetchurl {
     url = "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=34;filename=tutorial-part4.map.bspatch;att=1;bug=595448";
     name = "globulation2-tutorial4-map-patch-debian.bspatch";
     sha256 = "d3511ac0f822d512c42abd34b3122f2990862d3d0af6ce464ff372f5bd7f35e9";
   };
+in
+stdenv.mkDerivation rec {
+  name = "glob2-${version}.${patchlevel}";
 
-  inherit (sourceInfo) name version;
-  inherit buildInputs;
-
-  /* doConfigure should be removed if not needed */
-  phaseNames = ["doUnpack" "doPatch" "doBspatch" "workaroundScons" "doScons"];
+  src = fetchurl {
+    url = "mirror://savannah/glob2/${version}/${name}.tar.gz";
+    sha256 = "1f0l2cqp2g3llhr9jl6jj15k0wb5q8n29vqj99xy4p5hqs78jk8g";
+  };
 
-  patches = [./header-order.patch];
+  patches = [ ./header-order.patch ];
 
-  doBspatch = a.fullDepEntry ''
+  postPatch = ''
     cp campaigns/tutorial-part4.map{,.orig}
     bspatch  campaigns/tutorial-part4.map{.orig,} ${tutorial4patch}
-  '' ["minInit" "doUnpack" "addInputs"];
+    sed -i -e "s@env = Environment()@env = Environment( ENV = os.environ )@" SConstruct
+  '';
 
-  # FIXME
-  # I officially fail to understand what goes on, but that seems to work
-  # too well not to use. Yes, it is ugly, I know...
-  workaroundScons = a.fullDepEntry ''
-    echo '#! ${a.stdenv.shell}' >> o
-    echo 'g++ -o "$@"' >> o
-    chmod a+x o
-    export PATH="$PATH:$PWD"
-  '' ["minInit"];
+  buildInputs = [ mesa SDL scons SDL_ttf SDL_image zlib SDL_net speex libvorbis libogg boost fribidi bsdiff ];
 
-  sconsFlags = [
-    "DATADIR=$out/share/globulation2/glob2"
-    "BINDIR=$out/bin"
-    "INSTALLDIR=$out/share/globulation2"
-  ];
+  buildPhase = ''
+    scons
+  '';
+
+  installPhase = ''
+    scons install \
+      BINDIR=$out/bin \
+      INSTALLDIR=$out/share/globulation2 \
+      DATADIR=$out/share/globulation2/glob2
+  '';
       
-  meta = {
+  meta = with stdenv.lib; {
     description = "RTS without micromanagement";
-    maintainers = with a.lib.maintainers;
-    [
-      raskin
-    ];
-    platforms = with a.lib.platforms;
-      linux;
-    license = a.lib.licenses.gpl3;
-  };
-  passthru = {
-    updateInfo = {
-      downloadPage = "http://globulation2.org/wiki/Download_and_Install";
-    };
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    license = licenses.gpl3;
   };
-}) x
+  passthru.updateInfo.downloadPage = "http://globulation2.org/wiki/Download_and_Install";
+}