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, { 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 { stdenv.mkDerivation rec {
version = "0.C"; version = "0.C";
@ -13,36 +14,44 @@ stdenv.mkDerivation rec {
}; };
nativeBuildInputs = [ pkgconfig ] 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 ] buildInputs = with stdenv.lib; [ ncurses lua gettext ]
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ]; ++ optionals tiles [ SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype ]
++ optionals (tiles && stdenv.isDarwin) [ Cocoa ];
patches = [ ./patches/fix_locale_dir.patch ]; patches = [ ./patches/fix_locale_dir.patch ];
postPatch = '' postPatch = ''
patchShebangs . 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 = [ makeFlags = with stdenv.lib; [
"PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1" "PREFIX=$(out)"
"LUA=1"
"RELEASE=1"
"USE_HOME_DIR=1"
# "LANGUAGES=all" # vanilla C:DDA installs all translations even without this flag! # "LANGUAGES=all" # vanilla C:DDA installs all translations even without this flag!
] ++ stdenv.lib.optionals stdenv.isDarwin [ ] ++ optionals tiles [
"NATIVE=osx CLANG=1" "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 "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 # iconutil on macOS is not available in nixpkgs
png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/* 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 app=$out/Applications/Cataclysm.app
install -D -m 444 data/osx/Info.plist -t $app/Contents install -D -m 444 data/osx/Info.plist -t $app/Contents
install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources 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 substances or radiation, now more closely resemble insects, birds or fish
than their original form. than their original form.
''; '';
homepage = http://en.cataclysmdda.com/; homepage = http://cataclysmdda.org/;
license = licenses.cc-by-sa-30; license = licenses.cc-by-sa-30;
maintainers = [ maintainers.skeidel ]; maintainers = [ maintainers.skeidel ];
platforms = platforms.unix; platforms = platforms.unix;

View File

@ -1,5 +1,6 @@
{ fetchFromGitHub, stdenv, pkgconfig, ncurses, lua, SDL2, SDL2_image, SDL2_ttf, { 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 { stdenv.mkDerivation rec {
version = "2017-12-09"; version = "2017-12-09";
@ -14,28 +15,38 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ] buildInputs = with stdenv.lib; [ ncurses lua gettext ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa ]; ++ 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 ]; patches = [ ./patches/fix_locale_dir_git.patch ];
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
sed -i Makefile \ sed -i data/xdg/com.cataclysmdda.cataclysm-dda.desktop \
-e 's,-Werror,,g' -e "s,\(Exec=\)\(cataclysm-tiles\),\1$out/bin/\2,"
sed '1i#include <cmath>' \
-i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp
''; '';
makeFlags = [ makeFlags = with stdenv.lib; [
"PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1" "PREFIX=$(out)"
"LUA=1"
"RELEASE=1"
"USE_HOME_DIR=1"
"LANGUAGES=all" "LANGUAGES=all"
] ++ stdenv.lib.optionals stdenv.isDarwin [ "VERSION=git-${version}-${substring 0 8 src.rev}"
"NATIVE=osx CLANG=1" ] ++ 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 app=$out/Applications/Cataclysm.app
install -D -m 444 data/osx/Info.plist -t $app/Contents install -D -m 444 data/osx/Info.plist -t $app/Contents
install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources 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 substances or radiation, now more closely resemble insects, birds or fish
than their original form. than their original form.
''; '';
homepage = http://en.cataclysmdda.com/; homepage = http://cataclysmdda.org/;
license = licenses.cc-by-sa-30; license = licenses.cc-by-sa-30;
platforms = platforms.unix; platforms = platforms.unix;
}; };

View File

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