cataclysm-dda: fix build w/ glibc-2.39

Failing Hydra build: https://hydra.nixos.org/build/252068803

+31
+28
pkgs/games/cataclysm-dda/glibc-2.39.diff
··· 1 + diff --git a/src/debug.cpp b/src/debug.cpp 2 + index fa63a3b..1e8f554 100644 3 + --- a/src/debug.cpp 4 + +++ b/src/debug.cpp 5 + @@ -1494,6 +1494,14 @@ std::string game_info::operating_system() 6 + } 7 + 8 + #if !defined(__CYGWIN__) && !defined (__ANDROID__) && ( defined (__linux__) || defined(unix) || defined(__unix__) || defined(__unix) || ( defined(__APPLE__) && defined(__MACH__) ) || defined(BSD) ) // linux; unix; MacOs; BSD 9 + + // 10 + +class FILEDeleter 11 + +{ 12 + + public: 13 + + void operator()( FILE *f ) const noexcept { 14 + + pclose( f ); 15 + + } 16 + +}; 17 + /** Execute a command with the shell by using `popen()`. 18 + * @param command The full command to execute. 19 + * @note The output buffer is limited to 512 characters. 20 + @@ -1504,7 +1512,7 @@ static std::string shell_exec( const std::string &command ) 21 + std::vector<char> buffer( 512 ); 22 + std::string output; 23 + try { 24 + - std::unique_ptr<FILE, decltype( &pclose )> pipe( popen( command.c_str(), "r" ), pclose ); 25 + + std::unique_ptr<FILE, FILEDeleter> pipe( popen( command.c_str(), "r" ) ); 26 + if( pipe ) { 27 + while( fgets( buffer.data(), buffer.size(), pipe.get() ) != nullptr ) { 28 + output += buffer.data();
+3
pkgs/games/cataclysm-dda/stable.nix
··· 43 43 url = "https://sources.debian.org/data/main/c/cataclysm-dda/0.G-4/debian/patches/gcc13-keyword-requires.patch"; 44 44 hash = "sha256-8yvHh0YKC7AC/qzia7AZAfMewMC0RiSepMXpOkMXRd8="; 45 45 }) 46 + # Fix build w/ glibc-2.39 47 + # From https://github.com/BrettDong/Cataclysm-DDA/commit/9b206e2dc969ad79345596e03c3980bd155d2f48 48 + ./glibc-2.39.diff 46 49 ]; 47 50 48 51 makeFlags = common.makeFlags ++ [