diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix index 268f5d5256d2..3388db143852 100644 --- a/pkgs/games/cataclysm-dda/common.nix +++ b/pkgs/games/cataclysm-dda/common.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, runtimeShell, pkg-config, gettext, ncurses, CoreFoundation -, tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa +{ lib, stdenv, runtimeShell, pkg-config, gettext, ncurses +, tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, zlib , debug , useXdgDir }: @@ -7,15 +7,26 @@ let inherit (lib) optionals optionalString; - cursesDeps = [ gettext ncurses ] - ++ optionals stdenv.hostPlatform.isDarwin [ CoreFoundation ]; + commonDeps = [ + gettext + zlib + ]; - tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ] - ++ optionals stdenv.hostPlatform.isDarwin [ Cocoa ]; + cursesDeps = commonDeps ++ [ ncurses ]; + + tilesDeps = + commonDeps + ++ [ + SDL2 + SDL2_image + SDL2_mixer + SDL2_ttf + freetype + ]; patchDesktopFile = '' substituteInPlace $out/share/applications/org.cataclysmdda.CataclysmDDA.desktop \ - --replace "Exec=cataclysm-tiles" "Exec=$out/bin/cataclysm-tiles" + --replace-fail "Exec=cataclysm-tiles" "Exec=$out/bin/cataclysm-tiles" ''; installMacOSAppLauncher = '' @@ -37,7 +48,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ pkg-config ]; - buildInputs = cursesDeps ++ optionals tiles tilesDeps; + buildInputs = if tiles then tilesDeps else cursesDeps; postPatch = '' patchShebangs lang/compile_mo.sh diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix index a42d4bf87f4d..3502d7c0fb54 100644 --- a/pkgs/games/cataclysm-dda/default.nix +++ b/pkgs/games/cataclysm-dda/default.nix @@ -1,20 +1,16 @@ -{ newScope, darwin }: +{ newScope }: let callPackage = newScope self; stable = rec { - tiles = callPackage ./stable.nix { - inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa; - }; + tiles = callPackage ./stable.nix { }; curses = tiles.override { tiles = false; }; }; git = rec { - tiles = callPackage ./git.nix { - inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa; - }; + tiles = callPackage ./git.nix { }; curses = tiles.override { tiles = false; }; }; diff --git a/pkgs/games/cataclysm-dda/git.nix b/pkgs/games/cataclysm-dda/git.nix index 495d5f97fb09..cc79728f2961 100644 --- a/pkgs/games/cataclysm-dda/git.nix +++ b/pkgs/games/cataclysm-dda/git.nix @@ -1,15 +1,15 @@ -{ lib, callPackage, CoreFoundation, fetchFromGitHub, fetchpatch, pkgs, wrapCDDA, attachPkgs -, tiles ? true, Cocoa +{ lib, callPackage, fetchFromGitHub, fetchpatch, pkgs, wrapCDDA, attachPkgs +, tiles ? true , debug ? false , useXdgDir ? false -, version ? "2024-07-28" -, rev ? "bfeb1fffc4179fed242a042f24b1c97f6cfaff3d" -, sha256 ? "sha256-IodXEA+pWfDdR9huRXieP3+J3WZJO19C8PUPT18dFBw=" +, version ? "2024-12-11" +, rev ? "b871679a2d54dbc6bf3e6566033fadd2dc651592" +, sha256 ? "sha256-t9R0QPky7zvjgGMq4kV8DdQFToJ/qngbJCw+8FlQztM=" }: let common = callPackage ./common.nix { - inherit CoreFoundation tiles Cocoa debug useXdgDir; + inherit tiles debug useXdgDir; }; self = common.overrideAttrs (common: rec { diff --git a/pkgs/games/cataclysm-dda/glibc-2.39.diff b/pkgs/games/cataclysm-dda/glibc-2.39.diff deleted file mode 100644 index edc79ce76d79..000000000000 --- a/pkgs/games/cataclysm-dda/glibc-2.39.diff +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/debug.cpp b/src/debug.cpp -index fa63a3b..1e8f554 100644 ---- a/src/debug.cpp -+++ b/src/debug.cpp -@@ -1494,6 +1494,14 @@ std::string game_info::operating_system() - } - - #if !defined(__CYGWIN__) && !defined (__ANDROID__) && ( defined (__linux__) || defined(unix) || defined(__unix__) || defined(__unix) || ( defined(__APPLE__) && defined(__MACH__) ) || defined(BSD) ) // linux; unix; MacOs; BSD -+ // -+class FILEDeleter -+{ -+ public: -+ void operator()( FILE *f ) const noexcept { -+ pclose( f ); -+ } -+}; - /** Execute a command with the shell by using `popen()`. - * @param command The full command to execute. - * @note The output buffer is limited to 512 characters. -@@ -1504,7 +1512,7 @@ static std::string shell_exec( const std::string &command ) - std::vector buffer( 512 ); - std::string output; - try { -- std::unique_ptr pipe( popen( command.c_str(), "r" ), pclose ); -+ std::unique_ptr pipe( popen( command.c_str(), "r" ) ); - if( pipe ) { - while( fgets( buffer.data(), buffer.size(), pipe.get() ) != nullptr ) { - output += buffer.data(); diff --git a/pkgs/games/cataclysm-dda/locale-path-git.patch b/pkgs/games/cataclysm-dda/locale-path-git.patch index 8f18b0ffb71e..480f7107946e 100644 --- a/pkgs/games/cataclysm-dda/locale-path-git.patch +++ b/pkgs/games/cataclysm-dda/locale-path-git.patch @@ -4,10 +4,10 @@ diff --git a/src/translations.cpp b/src/translations.cpp @@ -52,13 +52,11 @@ std::string locale_dir() #define CATA_IS_ON_BSD #endif - + -#if !defined(__ANDROID__) && ((defined(__linux__) || defined(CATA_IS_ON_BSD) || (defined(MACOSX) && !defined(TILES)))) - if( !PATH_INFO::base_path().empty() ) { - loc_dir = PATH_INFO::base_path() + "share/locale"; + if( !PATH_INFO::base_path().get_logical_root_path().empty() ) { + loc_dir = ( PATH_INFO::base_path() / "share" / "locale" ).generic_u8string(); } else { loc_dir = PATH_INFO::langdir(); } diff --git a/pkgs/games/cataclysm-dda/locale-path.patch b/pkgs/games/cataclysm-dda/locale-path.patch index 03f103a548fd..8f18b0ffb71e 100644 --- a/pkgs/games/cataclysm-dda/locale-path.patch +++ b/pkgs/games/cataclysm-dda/locale-path.patch @@ -1,12 +1,11 @@ diff --git a/src/translations.cpp b/src/translations.cpp -index 76bdfd0..6dd6109 100644 --- a/src/translations.cpp +++ b/src/translations.cpp -@@ -61,13 +61,11 @@ std::string locale_dir() - #define BSD +@@ -52,13 +52,11 @@ std::string locale_dir() + #define CATA_IS_ON_BSD #endif - --#if !defined(__ANDROID__) && ((defined(__linux__) || defined(BSD) || (defined(MACOSX) && !defined(TILES)))) + +-#if !defined(__ANDROID__) && ((defined(__linux__) || defined(CATA_IS_ON_BSD) || (defined(MACOSX) && !defined(TILES)))) if( !PATH_INFO::base_path().empty() ) { loc_dir = PATH_INFO::base_path() + "share/locale"; } else { diff --git a/pkgs/games/cataclysm-dda/stable.nix b/pkgs/games/cataclysm-dda/stable.nix index 5c3ccb4bf287..105d30346dbd 100644 --- a/pkgs/games/cataclysm-dda/stable.nix +++ b/pkgs/games/cataclysm-dda/stable.nix @@ -1,66 +1,42 @@ { lib , callPackage -, CoreFoundation , fetchFromGitHub , fetchpatch , pkgs , wrapCDDA , attachPkgs , tiles ? true -, Cocoa , debug ? false , useXdgDir ? false }: let common = callPackage ./common.nix { - inherit CoreFoundation tiles Cocoa debug useXdgDir; + inherit tiles debug useXdgDir; }; self = common.overrideAttrs (common: rec { - version = "0.G"; + version = "0.H"; src = fetchFromGitHub { owner = "CleverRaven"; repo = "Cataclysm-DDA"; - rev = version; - sha256 = "sha256-Hda0dVVHNeZ8MV5CaCbSpdOCG2iqQEEmXdh16vwIBXk="; + tag = "${version}-RELEASE"; + sha256 = "sha256-ZCD5qgqYSX7sS+Tc1oNYq9soYwNUUuWamY2uXfLjGoY="; }; patches = [ + # fix compilation of the vendored flatbuffers under gcc14 + (fetchpatch { + name = "fix-flatbuffers-with-gcc14"; + url = "https://github.com/CleverRaven/Cataclysm-DDA/commit/1400b1018ff37196bd24ba4365bd50beb571ac14.patch"; + hash = "sha256-H0jct6lSQxu48eOZ4f8HICxo89qX49Ksw+Xwwtp7iFM="; + }) # Unconditionally look for translation files in $out/share/locale ./locale-path.patch - # Fixes for failing build with GCC 13, remove on updating next release after 0.G - (fetchpatch { - url = "https://sources.debian.org/data/main/c/cataclysm-dda/0.G-4/debian/patches/gcc13-dangling-reference-warning.patch"; - hash = "sha256-9nPbyz49IYBOVHqr7jzCIyS8z/SQgpK4EjEz1fruIPE="; - }) - (fetchpatch { - url = "https://sources.debian.org/data/main/c/cataclysm-dda/0.G-4/debian/patches/gcc13-cstdint.patch"; - hash = "sha256-8IBW2OzAHVgEJZoViQ490n37sl31hA55ePuqDL/lil0="; - }) - (fetchpatch { - url = "https://sources.debian.org/data/main/c/cataclysm-dda/0.G-4/debian/patches/gcc13-keyword-requires.patch"; - hash = "sha256-8yvHh0YKC7AC/qzia7AZAfMewMC0RiSepMXpOkMXRd8="; - }) - # Fix build w/ glibc-2.39 - # From https://github.com/BrettDong/Cataclysm-DDA/commit/9b206e2dc969ad79345596e03c3980bd155d2f48 - ./glibc-2.39.diff - ]; - - makeFlags = common.makeFlags ++ [ - # Makefile declares version as 0.F, with no minor release number - "VERSION=${version}" - ]; - - env.NIX_CFLAGS_COMPILE = toString [ - # Needed with GCC 12 - "-Wno-error=array-bounds" ]; meta = common.meta // { - maintainers = with lib.maintainers; - common.meta.maintainers; changelog = "https://github.com/CleverRaven/Cataclysm-DDA/blob/${version}/data/changelog.txt"; }; });