cataclysm-dda-{,git}: support the console (no tiles) version

You can install the console version with `cataclysm-dda{,-git}.override { tiles = false; }`.
This commit is contained in:
Mitsuhiro Nakamura 2018-01-26 17:58:19 +09:00
parent f3014ad8cc
commit 289c8df4e5
2 changed files with 20 additions and 13 deletions

View file

@ -1,5 +1,5 @@
{ 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,10 +13,11 @@ 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 = [ ncurses lua gettext ]
++ stdenv.lib.optionals tiles [ SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype ]
++ stdenv.lib.optionals (tiles && stdenv.isDarwin) [ Cocoa ];
patches = [ ./patches/fix_locale_dir.patch ];
@ -25,8 +26,10 @@ stdenv.mkDerivation rec {
'';
makeFlags = [
"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!
] ++ stdenv.lib.optionals tiles [
"TILES=1 SOUND=1"
] ++ stdenv.lib.optionals stdenv.isDarwin [
"NATIVE=osx CLANG=1"
"OSX_MIN=10.6" # SDL for macOS only supports deploying on 10.6 and above
@ -37,12 +40,12 @@ stdenv.mkDerivation rec {
"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

View file

@ -1,5 +1,5 @@
{ 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,8 +14,10 @@ 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 = [ ncurses lua gettext ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation ]
++ stdenv.lib.optionals tiles [ SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype ]
++ stdenv.lib.optionals (tiles && stdenv.isDarwin) [ Cocoa ];
patches = [ ./patches/fix_locale_dir_git.patch ];
@ -26,17 +28,19 @@ stdenv.mkDerivation rec {
'';
makeFlags = [
"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"
"VERSION=git-${version}-${stdenv.lib.substring 0 8 src.rev}"
] ++ stdenv.lib.optionals tiles [
"TILES=1 SOUND=1"
] ++ stdenv.lib.optionals stdenv.isDarwin [
"NATIVE=osx CLANG=1"
];
postInstall = stdenv.lib.optionalString (!stdenv.isDarwin) ''
postInstall = 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
'' + stdenv.lib.optionalString stdenv.isDarwin ''
'' + 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