about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorJoachim F <joachifm@users.noreply.github.com>2018-02-17 09:16:26 +0000
committerGitHub <noreply@github.com>2018-02-17 09:16:26 +0000
commitf010a682608176e96f6ec4ac1cc8536a00a90bbc (patch)
treeddd696bcecb114e58f26a1a4f6b9d367e5de61fa /pkgs/games
parent5a332cc18f62dfa2af8c63bde16031496298f9a8 (diff)
parenta2df3ee29340cff2a92dd9dd9540f2761c806fc4 (diff)
downloadnixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.tar
nixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.tar.gz
nixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.tar.bz2
nixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.tar.lz
nixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.tar.xz
nixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.tar.zst
nixlib-f010a682608176e96f6ec4ac1cc8536a00a90bbc.zip
Merge pull request #34729 from mnacamura/cdda-misc-updates
cataclysm-dda{,-git}: miscellaneous updates
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/cataclysm-dda/default.nix41
-rw-r--r--pkgs/games/cataclysm-dda/git.nix39
2 files changed, 50 insertions, 30 deletions
diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix
index be6f32654305..a3adec384015 100644
--- a/pkgs/games/cataclysm-dda/default.nix
+++ b/pkgs/games/cataclysm-dda/default.nix
@@ -1,5 +1,6 @@
 { fetchFromGitHub, stdenv, pkgconfig, ncurses, lua, SDL2, SDL2_image, SDL2_ttf,
-SDL2_mixer, freetype, gettext, Cocoa, libicns }:
+SDL2_mixer, freetype, gettext, Cocoa, libicns,
+tiles ? true }:
 
 stdenv.mkDerivation rec {
   version = "0.C";
@@ -13,36 +14,44 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ libicns ];
+    ++ stdenv.lib.optionals (tiles && stdenv.isDarwin) [ libicns ];
 
-  buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
+  buildInputs = with stdenv.lib; [ ncurses lua gettext ]
+    ++ optionals tiles [ SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype ]
+    ++ optionals (tiles && stdenv.isDarwin) [ Cocoa ];
 
   patches = [ ./patches/fix_locale_dir.patch ];
 
   postPatch = ''
     patchShebangs .
-    sed -i Makefile \
-      -e 's,-Werror,,g'
-
-    sed '1i#include <cmath>' \
-      -i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp
   '';
 
-  makeFlags = [
-    "PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1"
+  makeFlags = with stdenv.lib; [
+    "PREFIX=$(out)"
+    "LUA=1"
+    "RELEASE=1"
+    "USE_HOME_DIR=1"
     # "LANGUAGES=all"  # vanilla C:DDA installs all translations even without this flag!
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
-    "NATIVE=osx CLANG=1"
+  ] ++ optionals tiles [
+    "TILES=1"
+    "SOUND=1"
+  ] ++ optionals stdenv.isDarwin [
+    "NATIVE=osx"
+    "CLANG=1"
     "OSX_MIN=10.6"  # SDL for macOS only supports deploying on 10.6 and above
+  ] ++ optionals stdenv.cc.isGNU [
+    "WARNINGS+=-Wno-deprecated-declarations"
+    "WARNINGS+=-Wno-ignored-attributes"
+  ] ++ optionals stdenv.cc.isClang [
+    "WARNINGS+=-Wno-inconsistent-missing-override"
   ];
 
-  postBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+  postBuild = stdenv.lib.optionalString (tiles && stdenv.isDarwin) ''
     # iconutil on macOS is not available in nixpkgs
     png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/*
   '';
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  postInstall = stdenv.lib.optionalString (tiles && stdenv.isDarwin) ''
     app=$out/Applications/Cataclysm.app
     install -D -m 444 data/osx/Info.plist -t $app/Contents
     install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources
@@ -83,7 +92,7 @@ stdenv.mkDerivation rec {
       substances or radiation, now more closely resemble insects, birds or fish
       than their original form.
     '';
-    homepage = http://en.cataclysmdda.com/;
+    homepage = http://cataclysmdda.org/;
     license = licenses.cc-by-sa-30;
     maintainers = [ maintainers.skeidel ];
     platforms = platforms.unix;
diff --git a/pkgs/games/cataclysm-dda/git.nix b/pkgs/games/cataclysm-dda/git.nix
index 3d8ec7d68448..fcc2481cb695 100644
--- a/pkgs/games/cataclysm-dda/git.nix
+++ b/pkgs/games/cataclysm-dda/git.nix
@@ -1,5 +1,6 @@
 { fetchFromGitHub, stdenv, pkgconfig, ncurses, lua, SDL2, SDL2_image, SDL2_ttf,
-SDL2_mixer, freetype, gettext, CoreFoundation, Cocoa }:
+SDL2_mixer, freetype, gettext, CoreFoundation, Cocoa,
+tiles ? true }:
 
 stdenv.mkDerivation rec {
   version = "2017-12-09";
@@ -14,28 +15,38 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
 
-  buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa ];
+  buildInputs = with stdenv.lib; [ ncurses lua gettext ]
+    ++ optionals stdenv.isDarwin [ CoreFoundation ]
+    ++ optionals tiles [ SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype ]
+    ++ optionals (tiles && stdenv.isDarwin) [ Cocoa ];
 
   patches = [ ./patches/fix_locale_dir_git.patch ];
 
   postPatch = ''
     patchShebangs .
-    sed -i Makefile \
-      -e 's,-Werror,,g'
-
-    sed '1i#include <cmath>' \
-      -i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp
+    sed -i data/xdg/com.cataclysmdda.cataclysm-dda.desktop \
+        -e "s,\(Exec=\)\(cataclysm-tiles\),\1$out/bin/\2,"
   '';
 
-  makeFlags = [
-    "PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1"
+  makeFlags = with stdenv.lib; [
+    "PREFIX=$(out)"
+    "LUA=1"
+    "RELEASE=1"
+    "USE_HOME_DIR=1"
     "LANGUAGES=all"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
-    "NATIVE=osx CLANG=1"
+    "VERSION=git-${version}-${substring 0 8 src.rev}"
+  ] ++ optionals tiles [
+    "TILES=1"
+    "SOUND=1"
+  ] ++ optionals stdenv.isDarwin [
+    "NATIVE=osx"
+    "CLANG=1"
   ];
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  postInstall = with stdenv.lib; optionalString (tiles && !stdenv.isDarwin) ''
+    install -D -m 444 data/xdg/com.cataclysmdda.cataclysm-dda.desktop -T $out/share/applications/cataclysm-dda.desktop
+    install -D -m 444 data/xdg/cataclysm-dda.svg -t $out/share/icons/hicolor/scalable/apps
+  '' + optionalString (tiles && stdenv.isDarwin) ''
     app=$out/Applications/Cataclysm.app
     install -D -m 444 data/osx/Info.plist -t $app/Contents
     install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources
@@ -78,7 +89,7 @@ stdenv.mkDerivation rec {
       substances or radiation, now more closely resemble insects, birds or fish
       than their original form.
     '';
-    homepage = http://en.cataclysmdda.com/;
+    homepage = http://cataclysmdda.org/;
     license = licenses.cc-by-sa-30;
     platforms = platforms.unix;
   };