2021-01-17 05:49:22 +00:00
|
|
|
{ lib, stdenv, runtimeShell, pkg-config, gettext, ncurses, CoreFoundation
|
2018-07-05 16:47:43 +00:00
|
|
|
, tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa
|
2020-04-09 07:11:51 +00:00
|
|
|
, debug
|
2020-04-09 08:16:25 +00:00
|
|
|
, useXdgDir
|
2018-07-05 16:47:43 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-01-15 04:31:39 +00:00
|
|
|
inherit (lib) optionals optionalString;
|
2018-07-05 16:47:43 +00:00
|
|
|
|
2019-05-03 08:00:23 +00:00
|
|
|
cursesDeps = [ gettext ncurses ]
|
2019-05-02 16:50:40 +00:00
|
|
|
++ optionals stdenv.isDarwin [ CoreFoundation ];
|
2018-07-05 16:47:43 +00:00
|
|
|
|
|
|
|
tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ]
|
|
|
|
++ optionals stdenv.isDarwin [ Cocoa ];
|
|
|
|
|
2021-07-03 11:30:19 +00:00
|
|
|
patchDesktopFile = ''
|
|
|
|
substituteInPlace $out/share/applications/org.cataclysmdda.CataclysmDDA.desktop \
|
|
|
|
--replace "Exec=cataclysm-tiles" "Exec=$out/bin/cataclysm-tiles"
|
2020-04-09 07:11:51 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installMacOSAppLauncher = ''
|
|
|
|
app=$out/Applications/Cataclysm.app
|
2021-07-03 11:30:19 +00:00
|
|
|
install -D -m 444 build-data/osx/Info.plist -t $app/Contents
|
|
|
|
install -D -m 444 build-data/osx/AppIcon.icns -t $app/Contents/Resources
|
2020-04-09 07:11:51 +00:00
|
|
|
mkdir $app/Contents/MacOS
|
|
|
|
launcher=$app/Contents/MacOS/Cataclysm.sh
|
|
|
|
cat << EOF > $launcher
|
|
|
|
#!${runtimeShell}
|
|
|
|
$out/bin/cataclysm-tiles
|
|
|
|
EOF
|
|
|
|
chmod 555 $launcher
|
|
|
|
'';
|
|
|
|
in
|
2020-04-07 05:13:08 +00:00
|
|
|
|
2020-04-09 07:11:51 +00:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "cataclysm-dda";
|
2018-07-05 16:47:43 +00:00
|
|
|
|
2021-01-17 05:49:22 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2018-07-05 16:47:43 +00:00
|
|
|
|
2020-04-09 07:11:51 +00:00
|
|
|
buildInputs = cursesDeps ++ optionals tiles tilesDeps;
|
2020-04-08 01:54:28 +00:00
|
|
|
|
2020-04-09 07:11:51 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
2018-07-05 16:47:43 +00:00
|
|
|
|
2020-04-09 07:11:51 +00:00
|
|
|
# Locale patch required for Darwin builds, see:
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970
|
|
|
|
sed -i src/translations.cpp \
|
|
|
|
-e 's@#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))@#elif 1@'
|
|
|
|
'';
|
2018-07-05 16:47:43 +00:00
|
|
|
|
2020-04-09 07:11:51 +00:00
|
|
|
makeFlags = [
|
2020-04-09 08:16:25 +00:00
|
|
|
"PREFIX=$(out)" "LANGUAGES=all"
|
|
|
|
(if useXdgDir then "USE_XDG_DIR=1" else "USE_HOME_DIR=1")
|
2020-04-09 07:11:51 +00:00
|
|
|
] ++ optionals (!debug) [
|
|
|
|
"RELEASE=1"
|
|
|
|
] ++ optionals tiles [
|
|
|
|
"TILES=1" "SOUND=1"
|
|
|
|
] ++ optionals stdenv.isDarwin [
|
2021-07-03 11:30:19 +00:00
|
|
|
"NATIVE=osx"
|
|
|
|
"CLANG=1"
|
|
|
|
"OSX_MIN=${stdenv.targetPlatform.darwinMinVersion}"
|
2020-04-09 07:11:51 +00:00
|
|
|
];
|
2018-07-05 16:47:43 +00:00
|
|
|
|
2020-04-09 07:11:51 +00:00
|
|
|
postInstall = optionalString tiles
|
|
|
|
( if !stdenv.isDarwin
|
2021-07-03 11:30:19 +00:00
|
|
|
then patchDesktopFile
|
2020-04-09 07:11:51 +00:00
|
|
|
else installMacOSAppLauncher
|
|
|
|
);
|
|
|
|
|
|
|
|
dontStrip = debug;
|
2022-02-27 06:43:56 +00:00
|
|
|
enableParallelBuilding = true;
|
2020-04-09 07:11:51 +00:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
isTiles = tiles;
|
|
|
|
isCurses = !tiles;
|
2018-07-05 16:47:43 +00:00
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-09 07:11:51 +00:00
|
|
|
description = "A free, post apocalyptic, zombie infested rogue-like";
|
|
|
|
longDescription = ''
|
|
|
|
Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world.
|
|
|
|
Surviving is difficult: you have been thrown, ill-equipped, into a
|
|
|
|
landscape now riddled with monstrosities of which flesh eating zombies are
|
|
|
|
neither the strangest nor the deadliest.
|
|
|
|
|
|
|
|
Yet with care and a little luck, many things are possible. You may try to
|
|
|
|
eke out an existence in the forests silently executing threats and
|
|
|
|
providing sustenance with your longbow. You can ride into town in a
|
|
|
|
jerry-rigged vehicle, all guns blazing, to settle matters in a fug of
|
|
|
|
smoke from your molotovs. You could take a more measured approach and
|
|
|
|
construct an impregnable fortress, surrounded by traps to protect you from
|
|
|
|
the horrors without. The longer you survive, the more skilled and adapted
|
|
|
|
you will get and the better equipped and armed to deal with the threats
|
|
|
|
you are presented with.
|
|
|
|
|
|
|
|
In the course of your ordeal there will be opportunities and temptations
|
|
|
|
to improve or change your very nature. There are tales of survivors fitted
|
|
|
|
with extraordinary cybernetics giving great power and stories too of
|
|
|
|
gravely mutated survivors who, warped by their ingestion of exotic
|
|
|
|
substances or radiation, now more closely resemble insects, birds or fish
|
|
|
|
than their original form.
|
|
|
|
'';
|
|
|
|
homepage = "https://cataclysmdda.org/";
|
|
|
|
license = licenses.cc-by-sa-30;
|
2021-08-18 22:52:26 +00:00
|
|
|
maintainers = with maintainers; [ mnacamura DeeUnderscore ];
|
2020-04-09 07:11:51 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|