From 91d85fb0e654a1d187e39fd2460df78fb09628ce Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 22 Mar 2024 22:55:27 +0100 Subject: [PATCH] cataclysm-dda: fix build w/ glibc-2.39 Failing Hydra build: https://hydra.nixos.org/build/252068803 --- pkgs/games/cataclysm-dda/glibc-2.39.diff | 28 ++++++++++++++++++++++++ pkgs/games/cataclysm-dda/stable.nix | 3 +++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/games/cataclysm-dda/glibc-2.39.diff diff --git a/pkgs/games/cataclysm-dda/glibc-2.39.diff b/pkgs/games/cataclysm-dda/glibc-2.39.diff new file mode 100644 index 000000000000..edc79ce76d79 --- /dev/null +++ b/pkgs/games/cataclysm-dda/glibc-2.39.diff @@ -0,0 +1,28 @@ +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/stable.nix b/pkgs/games/cataclysm-dda/stable.nix index 90eab89a8349..5c3ccb4bf287 100644 --- a/pkgs/games/cataclysm-dda/stable.nix +++ b/pkgs/games/cataclysm-dda/stable.nix @@ -43,6 +43,9 @@ let 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 ++ [