From b722a78968a33a9ac87f0f002d079a81fd351e75 Mon Sep 17 00:00:00 2001 From: Manuel Frischknecht Date: Sat, 24 May 2025 15:37:47 +0200 Subject: [PATCH 1/2] commandergenius: fix X11 includes The SDL2 compatibility layer still includes X11 libraries in some of its headers [1], which breaks the build of commandergenius if `xorg.libX11` is not included as build input. [1]: https://github.com/libsdl-org/sdl2-compat/blob/291749630d731d45f7a5ff3d4b2429fbeb58ac4c/include/SDL2/SDL_syswm.h#L68 --- pkgs/by-name/co/commandergenius/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/co/commandergenius/package.nix b/pkgs/by-name/co/commandergenius/package.nix index a9b0afe5d19d..d528beecca68 100644 --- a/pkgs/by-name/co/commandergenius/package.nix +++ b/pkgs/by-name/co/commandergenius/package.nix @@ -14,6 +14,7 @@ SDL2_mixer, SDL2_ttf, python3, + xorg, }: stdenv.mkDerivation rec { @@ -38,6 +39,7 @@ stdenv.mkDerivation rec { zlib curl python3 + xorg.libX11 ]; cmakeFlags = [ From 5cc6a9481cb8b7acea9a66621e593b7ffcfd5257 Mon Sep 17 00:00:00 2001 From: Manuel Frischknecht Date: Sat, 24 May 2025 16:26:53 +0200 Subject: [PATCH 2/2] commandergenius: fix broken build due to renamed `_TTF_Font` struct in SDL_ttf SDL_ttf renamed the internal `_TTF_Font` struct in v. 2.24 [^1] and 3.2.2 [^2], breaking current builds for commandergenius. Upstream already merged my pull request fixing the error [^3]. This pulls in the fix temporarily using `fetchpatch`; as soon as upstreams a new release, we'll likely be able to remove it again. [^1]: https://github.com/libsdl-org/SDL_ttf/commit/7185085beb39b9e8b17d18685a2a58a14b7c53ef [^2]: https://github.com/libsdl-org/SDL_ttf/commit/22347419ee08e49d77411c680f15e314ef870ab7 [^3]: https://github.com/gerstrong/Commander-Genius/pull/376 --- pkgs/by-name/co/commandergenius/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/co/commandergenius/package.nix b/pkgs/by-name/co/commandergenius/package.nix index d528beecca68..5c60cde73927 100644 --- a/pkgs/by-name/co/commandergenius/package.nix +++ b/pkgs/by-name/co/commandergenius/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitLab, + fetchpatch, SDL2, SDL2_image, pkg-config, @@ -56,6 +57,16 @@ stdenv.mkDerivation rec { pkg-config ]; + patches = [ + # Fixes a broken build due to a renamed inner struct of SDL_ttf. + # Should be removable as soon as upstream releases v. 3.5.3. + (fetchpatch { + name = "fix-sdl-ttf_font_rename.patch"; + url = "https://github.com/gerstrong/Commander-Genius/commit/e8af0d16970d75e94392f57de0992dfddc509bc3.patch"; + hash = "sha256-bcCzXzh9yDngwHMfQTrnvyDal4YBiBcMTtKTgt9BtDk="; + }) + ]; + postPatch = '' NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(sdl2-config --cflags)" sed -i 's,APPDIR games,APPDIR bin,' src/install.cmake