Merge pull request #34729 from mnacamura/cdda-misc-updates

cataclysm-dda{,-git}: miscellaneous updates
This commit is contained in:
Joachim F 2018-02-17 09:16:26 +00:00 committed by GitHub
commit f010a68260
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 30 deletions

View file

@ -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;

View file

@ -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;
};

View file

@ -18361,6 +18361,7 @@ with pkgs;
cataclysm-dda = callPackage ../games/cataclysm-dda {
inherit (darwin.apple_sdk.frameworks) Cocoa;
ncurses = ncurses5;
};
cataclysm-dda-git = callPackage ../games/cataclysm-dda/git.nix {