From 2e7d7a72a15863499c979d06db0fa9e1b4bace74 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com> Date: Thu, 19 Dec 2024 00:56:18 +0300 Subject: [PATCH 1/5] manaplus: fix build --- ...ibxml2-const-ptr-and-missing-include.patch | 25 +++++++++++ .../manaplus/0002-missing-ctime-include.patch | 30 ++++++++++++++ pkgs/games/manaplus/default.nix | 41 ++++++++++++------- pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 pkgs/games/manaplus/0001-libxml2-const-ptr-and-missing-include.patch create mode 100644 pkgs/games/manaplus/0002-missing-ctime-include.patch diff --git a/pkgs/games/manaplus/0001-libxml2-const-ptr-and-missing-include.patch b/pkgs/games/manaplus/0001-libxml2-const-ptr-and-missing-include.patch new file mode 100644 index 000000000000..2d31c730dddc --- /dev/null +++ b/pkgs/games/manaplus/0001-libxml2-const-ptr-and-missing-include.patch @@ -0,0 +1,25 @@ +diff --git a/src/utils/dumplibs.cpp b/src/utils/dumplibs.cpp +index 4215d6183..2d410f150 100644 +--- a/src/utils/dumplibs.cpp ++++ b/src/utils/dumplibs.cpp +@@ -140,7 +140,7 @@ void dumpLibs() + LIBXML_TEST_VERSION + #endif // LIBXML_TEST_VERSION + #ifdef ENABLE_LIBXML +- const char **xmlVersion = __xmlParserVersion(); ++ const char * const *xmlVersion = __xmlParserVersion(); + if (xmlVersion != nullptr) + logger->log(" libxml2: %s", *xmlVersion); + #endif // ENABLE_LIBXML +diff --git a/src/utils/xml/libxml.inc b/src/utils/xml/libxml.inc +index c60abd095..cf4c845a9 100644 +--- a/src/utils/xml/libxml.inc ++++ b/src/utils/xml/libxml.inc +@@ -24,6 +24,7 @@ + + #ifdef ENABLE_LIBXML + ++#include + #include + + __XML_XMLWRITER_H__ diff --git a/pkgs/games/manaplus/0002-missing-ctime-include.patch b/pkgs/games/manaplus/0002-missing-ctime-include.patch new file mode 100644 index 000000000000..1b3b0d385758 --- /dev/null +++ b/pkgs/games/manaplus/0002-missing-ctime-include.patch @@ -0,0 +1,30 @@ +diff --git a/src/progs/dyecmd/client.cpp b/src/progs/dyecmd/client.cpp +index 6321da0d2..bb655519b 100644 +--- a/src/progs/dyecmd/client.cpp ++++ b/src/progs/dyecmd/client.cpp +@@ -86,9 +86,7 @@ PRAGMA48(GCC diagnostic pop) + #include + #include "fs/specialfolder.h" + #undef ERROR +-#endif // WIN32 +- +-#ifdef __clang__ ++#else + #include + #endif // __clang__ + +diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp +index 2df412b7d..1658e3d4a 100644 +--- a/src/resources/wallpaper.cpp ++++ b/src/resources/wallpaper.cpp +@@ -37,9 +37,7 @@ + + #ifdef WIN32 + #include +-#endif // WIN32 +- +-#ifdef __clang__ ++#else + #include + #endif // __clang__ + diff --git a/pkgs/games/manaplus/default.nix b/pkgs/games/manaplus/default.nix index 865a027503e9..6696826436c4 100644 --- a/pkgs/games/manaplus/default.nix +++ b/pkgs/games/manaplus/default.nix @@ -1,7 +1,7 @@ { stdenv, lib, - fetchurl, + fetchFromGitLab, SDL2, SDL2_image, SDL2_ttf, @@ -17,35 +17,48 @@ libGL, autoreconfHook, }: -stdenv.mkDerivation rec { - pname = "manaplus"; - version = "2.1.3.17"; - src = fetchurl { - url = "https://download.evolonline.org/manaplus/download/${version}/manaplus-${version}.tar.xz"; - sha256 = "sha256-6NFqxUjEAp7aiIScyTOFh2tT7PfuTCKH1vTgPpTm+j0="; +stdenv.mkDerivation (finalAttrs: { + pname = "manaplus"; + version = "2.1.3.17-unstable-2024-08-15"; + + src = fetchFromGitLab { + owner = "manaplus"; + repo = "manaplus"; + rev = "40ebe02e81b34f5b02ea682d2d470a20e7e63cfc"; + sha256 = "sha256-OVmCqK8undrBKgY5bB2spezmYwWXnmrPlSpV5euortc="; }; + patches = [ + # https://gitlab.com/manaplus/manaplus/-/issues/33 + ./0001-libxml2-const-ptr-and-missing-include.patch + # https://gitlab.com/manaplus/manaplus/-/issues/32 + ./0002-missing-ctime-include.patch + ]; + nativeBuildInputs = [ + SDL2 autoreconfHook pkg-config ]; buildInputs = [ SDL2 + SDL2_gfx SDL2_image - SDL2_ttf SDL2_mixer SDL2_net - SDL2_gfx - zlib - physfs + SDL2_ttf curl - libxml2 - libpng libGL + libpng + libxml2 + physfs + zlib ]; + strictDeps = true; + configureFlags = [ "--with-sdl2" "--without-dyecmd" @@ -60,4 +73,4 @@ stdenv.mkDerivation rec { license = lib.licenses.gpl2Plus; broken = stdenv.hostPlatform.isDarwin; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d06a95254e4d..d6154119914d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16772,7 +16772,7 @@ with pkgs; openjfx = openjfx21; }; - manaplus = callPackage ../games/manaplus { stdenv = gcc11Stdenv; }; + manaplus = callPackage ../games/manaplus { }; mindustry-wayland = callPackage ../by-name/mi/mindustry/package.nix { enableWayland = true; From 67b4a819d2d2fa0cd4d6bd975e40141ca0594900 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com> Date: Thu, 19 Dec 2024 01:04:08 +0300 Subject: [PATCH 2/5] manaplus: build without internalsdlgfx --- pkgs/games/manaplus/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/games/manaplus/default.nix b/pkgs/games/manaplus/default.nix index 6696826436c4..e9ce75c4b051 100644 --- a/pkgs/games/manaplus/default.nix +++ b/pkgs/games/manaplus/default.nix @@ -29,6 +29,8 @@ stdenv.mkDerivation (finalAttrs: { sha256 = "sha256-OVmCqK8undrBKgY5bB2spezmYwWXnmrPlSpV5euortc="; }; + # The unstable version has this commit that fixes missing include: + # https://gitlab.com/manaplus/manaplus/-/commit/63912a8a6bfaecdb6b40d2a89191a2fb5af32906 patches = [ # https://gitlab.com/manaplus/manaplus/-/issues/33 ./0001-libxml2-const-ptr-and-missing-include.patch @@ -60,8 +62,9 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; configureFlags = [ - "--with-sdl2" - "--without-dyecmd" + (lib.withFeature true "sdl2") + (lib.withFeature false "dyecmd") + (lib.withFeature false "internalsdlgfx") ]; enableParallelBuilding = true; From 31bd9d69ebf703640f18e610088d724d9367b1e2 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com> Date: Thu, 19 Dec 2024 01:08:16 +0300 Subject: [PATCH 3/5] manaplus: move to pkgs/by-name --- .../manaplus/0001-libxml2-const-ptr-and-missing-include.patch | 0 .../ma}/manaplus/0002-missing-ctime-include.patch | 0 .../manaplus/default.nix => by-name/ma/manaplus/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 4 files changed, 2 deletions(-) rename pkgs/{games => by-name/ma}/manaplus/0001-libxml2-const-ptr-and-missing-include.patch (100%) rename pkgs/{games => by-name/ma}/manaplus/0002-missing-ctime-include.patch (100%) rename pkgs/{games/manaplus/default.nix => by-name/ma/manaplus/package.nix} (100%) diff --git a/pkgs/games/manaplus/0001-libxml2-const-ptr-and-missing-include.patch b/pkgs/by-name/ma/manaplus/0001-libxml2-const-ptr-and-missing-include.patch similarity index 100% rename from pkgs/games/manaplus/0001-libxml2-const-ptr-and-missing-include.patch rename to pkgs/by-name/ma/manaplus/0001-libxml2-const-ptr-and-missing-include.patch diff --git a/pkgs/games/manaplus/0002-missing-ctime-include.patch b/pkgs/by-name/ma/manaplus/0002-missing-ctime-include.patch similarity index 100% rename from pkgs/games/manaplus/0002-missing-ctime-include.patch rename to pkgs/by-name/ma/manaplus/0002-missing-ctime-include.patch diff --git a/pkgs/games/manaplus/default.nix b/pkgs/by-name/ma/manaplus/package.nix similarity index 100% rename from pkgs/games/manaplus/default.nix rename to pkgs/by-name/ma/manaplus/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d6154119914d..d3231b8e063c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16772,8 +16772,6 @@ with pkgs; openjfx = openjfx21; }; - manaplus = callPackage ../games/manaplus { }; - mindustry-wayland = callPackage ../by-name/mi/mindustry/package.nix { enableWayland = true; }; From 3b60aae3bf381d5f7bdf22fcee9ccb4df19ff46a Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com> Date: Fri, 20 Dec 2024 18:37:10 +0300 Subject: [PATCH 4/5] manaplus: don't use sdl-config This unbreaks cross-compilation when SDL2 itself can cross-compile, which is currently blocked by timidity cross. --- pkgs/by-name/ma/manaplus/package.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/by-name/ma/manaplus/package.nix b/pkgs/by-name/ma/manaplus/package.nix index e9ce75c4b051..e78f6fc08a02 100644 --- a/pkgs/by-name/ma/manaplus/package.nix +++ b/pkgs/by-name/ma/manaplus/package.nix @@ -39,7 +39,6 @@ stdenv.mkDerivation (finalAttrs: { ]; nativeBuildInputs = [ - SDL2 autoreconfHook pkg-config ]; From e888c89b283c7067ff15bc425a7979358f92afef Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com> Date: Wed, 25 Dec 2024 23:20:16 +0300 Subject: [PATCH 5/5] manaplus: use badPlatforms instead of broken --- pkgs/by-name/ma/manaplus/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ma/manaplus/package.nix b/pkgs/by-name/ma/manaplus/package.nix index e78f6fc08a02..f6390f2f0f92 100644 --- a/pkgs/by-name/ma/manaplus/package.nix +++ b/pkgs/by-name/ma/manaplus/package.nix @@ -73,6 +73,7 @@ stdenv.mkDerivation (finalAttrs: { description = "Free OpenSource 2D MMORPG client"; homepage = "https://manaplus.org/"; license = lib.licenses.gpl2Plus; - broken = stdenv.hostPlatform.isDarwin; + platforms = lib.platforms.all; + badPlatforms = [ lib.systems.inspect.patterns.isDarwin ]; }; })