Merge pull request #34144 from mnacamura/cdda-fix-share-dir

cataclysm-dda{,-git}: fix share directory
This commit is contained in:
Jörg Thalheim 2018-01-24 17:39:51 +00:00 committed by GitHub
commit bb7e244531
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 16 deletions

View file

@ -1,4 +1,4 @@
{ fetchFromGitHub, stdenv, makeWrapper, 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 }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
sha256 = "03sdzsk4qdq99qckq0axbsvg1apn6xizscd8pwp5w6kq2fyj5xkv"; sha256 = "03sdzsk4qdq99qckq0axbsvg1apn6xizscd8pwp5w6kq2fyj5xkv";
}; };
nativeBuildInputs = [ makeWrapper pkgconfig ] nativeBuildInputs = [ pkgconfig ]
++ stdenv.lib.optionals stdenv.isDarwin [ libicns ]; ++ stdenv.lib.optionals stdenv.isDarwin [ libicns ];
buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ] buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
@ -23,8 +23,7 @@ stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
sed -i Makefile \ sed -i Makefile \
-e 's,-Werror,,g' \ -e 's,-Werror,,g'
-e 's,\(DATA_PREFIX=$(PREFIX)/share/\)cataclysm-dda/,\1,g'
sed '1i#include <cmath>' \ sed '1i#include <cmath>' \
-i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp -i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp
@ -32,6 +31,7 @@ stdenv.mkDerivation rec {
makeFlags = [ makeFlags = [
"PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1" "PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1"
# "LANGUAGES=all" # vanilla C:DDA installs all translations even without this flag!
] ++ stdenv.lib.optionals stdenv.isDarwin [ ] ++ stdenv.lib.optionals stdenv.isDarwin [
"NATIVE=osx CLANG=1" "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
@ -42,10 +42,7 @@ stdenv.mkDerivation rec {
png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/* png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/*
''; '';
postInstall = '' postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
wrapProgram $out/bin/cataclysm-tiles \
--add-flags "--datadir $out/share/"
'' + stdenv.lib.optionalString 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

View file

@ -1,4 +1,4 @@
{ fetchFromGitHub, stdenv, makeWrapper, 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 }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
sha256 = "1a7kdmx76na4g65zra01qaq98lxp9j2dl9ddv09r0p5yxaizw68z"; sha256 = "1a7kdmx76na4g65zra01qaq98lxp9j2dl9ddv09r0p5yxaizw68z";
}; };
nativeBuildInputs = [ makeWrapper pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ] buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa ]; ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa ];
@ -22,8 +22,7 @@ stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
sed -i Makefile \ sed -i Makefile \
-e 's,-Werror,,g' \ -e 's,-Werror,,g'
-e 's,\(DATA_PREFIX=$(PREFIX)/share/\)cataclysm-dda/,\1,g'
sed '1i#include <cmath>' \ sed '1i#include <cmath>' \
-i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp -i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp
@ -31,14 +30,12 @@ stdenv.mkDerivation rec {
makeFlags = [ makeFlags = [
"PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1" "PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1"
"LANGUAGES=all"
] ++ stdenv.lib.optionals stdenv.isDarwin [ ] ++ stdenv.lib.optionals stdenv.isDarwin [
"NATIVE=osx CLANG=1" "NATIVE=osx CLANG=1"
]; ];
postInstall = '' postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
wrapProgram $out/bin/cataclysm-tiles \
--add-flags "--datadir $out/share/cataclysm-dda/"
'' + stdenv.lib.optionalString 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