From 5612ed0305cdb3a7d1c51557e010520441fe5ee0 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 29 Nov 2024 19:08:45 -0500 Subject: [PATCH 1/3] ldmud: use libxcrypt-legacy The LDMud game driver defaults to using a legacy DES hash that is (sensibly) only enabled in the libxcrypt-legacy derivation, not libxcrypt. This commit switches LDMud to that build input instead of libxcrypt. This fixes a runtime error when calling `efun::crypt()` from LPC that would print a confusing error message like "crypt() is not available.". --- pkgs/games/ldmud/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/games/ldmud/default.nix b/pkgs/games/ldmud/default.nix index 8287b3274c7d9..7d60927520666 100644 --- a/pkgs/games/ldmud/default.nix +++ b/pkgs/games/ldmud/default.nix @@ -7,7 +7,7 @@ , libiconv , pcre , libgcrypt -, libxcrypt +, libxcrypt-legacy , json_c , libxml2 , ipv6Support ? false @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook pkg-config bison ]; - buildInputs = [ libgcrypt libxcrypt pcre json_c libxml2 ] + buildInputs = [ libgcrypt libxcrypt-legacy pcre json_c libxml2 ] ++ lib.optional mccpSupport zlib ++ lib.optional mysqlSupport libmysqlclient ++ lib.optional postgresSupport libpq ++ lib.optional sqliteSupport sqlite ++ lib.optional tlsSupport openssl From 321754aaab31d549efcff43789da6f2ddfa3750a Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Thu, 20 Mar 2025 11:09:41 -0400 Subject: [PATCH 2/3] ldmud: apply patch for libxml2 2.12+ compat A fix is underway upstream, but the release cadence is such that we should expect to fix this locally for some time. --- pkgs/games/ldmud/default.nix | 2 ++ pkgs/games/ldmud/libxml2-2.12.0-compat.patch | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 pkgs/games/ldmud/libxml2-2.12.0-compat.patch diff --git a/pkgs/games/ldmud/default.nix b/pkgs/games/ldmud/default.nix index 7d60927520666..a1c66918a690f 100644 --- a/pkgs/games/ldmud/default.nix +++ b/pkgs/games/ldmud/default.nix @@ -37,6 +37,8 @@ stdenv.mkDerivation rec { sha256 = "sha256-PkrjP7tSZMaj61Hsn++7+CumhqFPLbf0+eAI6afP9HA="; }; + patches = [ ./libxml2-2.12.0-compat.patch ]; + sourceRoot = "${src.name}/src"; nativeBuildInputs = diff --git a/pkgs/games/ldmud/libxml2-2.12.0-compat.patch b/pkgs/games/ldmud/libxml2-2.12.0-compat.patch new file mode 100644 index 0000000000000..372bdc8cafbd8 --- /dev/null +++ b/pkgs/games/ldmud/libxml2-2.12.0-compat.patch @@ -0,0 +1,18 @@ +diff --git src/pkg-xml2.c src/pkg-xml2.c +index 048ca38c..9ea4de35 100644 +--- src/pkg-xml2.c ++++ src/pkg-xml2.c +@@ -507,8 +507,13 @@ f_xml_generate (svalue_t *sp) + return sp; + } + ++#if LIBXML_VERSION >= 21200 ++static void ++xml_pkg_error_handler(void * userData, const xmlError *error) ++#else + static void + xml_pkg_error_handler(void * userData, xmlErrorPtr error) ++#endif + { + if (error) + { From 04704adcd6dea22bec5a9583186ca56f78923738 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Thu, 20 Mar 2025 12:18:50 -0400 Subject: [PATCH 3/3] ldmud: patch mysql configure script detection The upstream `configure.ac`'s `AC_LANG_PROGRAM` for mysql feature detection seems to be incompatible with the `mariadb-connector-c` package, resulting in support not being detected. Digging in to the `config.log` we can see it's a type mismatch error from the test program `.c`: ``` configure:11661: checking for mySQL configure:11694: gcc -c -g -O2 -fwrapv -I/usr/inet6/include -I/nix/store/ya8wpj6dqz39024v6xrv504i9kyidpil-mariadb-connector-c-3.1.21-dev/include/mysql conftest.c >&5 conftest.c: In function 'foo': conftest.c:90:12: error: returning 'MYSQL *' {aka 'struct st_mysql *'} from a function with incompatible return type 'struct MYSQL *' [-Wincompatible-pointer-types] 90 | return &var; | ^~~~ ``` This commit resolves the issue locally by applying a small patch. --- pkgs/games/ldmud/default.nix | 2 +- pkgs/games/ldmud/mysql-compat.patch | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 pkgs/games/ldmud/mysql-compat.patch diff --git a/pkgs/games/ldmud/default.nix b/pkgs/games/ldmud/default.nix index a1c66918a690f..5dcd6dfbc80e8 100644 --- a/pkgs/games/ldmud/default.nix +++ b/pkgs/games/ldmud/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-PkrjP7tSZMaj61Hsn++7+CumhqFPLbf0+eAI6afP9HA="; }; - patches = [ ./libxml2-2.12.0-compat.patch ]; + patches = [ ./libxml2-2.12.0-compat.patch ./mysql-compat.patch ]; sourceRoot = "${src.name}/src"; diff --git a/pkgs/games/ldmud/mysql-compat.patch b/pkgs/games/ldmud/mysql-compat.patch new file mode 100644 index 0000000000000..36aabfc08cef6 --- /dev/null +++ b/pkgs/games/ldmud/mysql-compat.patch @@ -0,0 +1,13 @@ +diff --git src/autoconf/configure.ac src/autoconf/configure.ac +index 156e97f4..6d70bf33 100644 +--- src/autoconf/configure.ac ++++ src/autoconf/configure.ac +@@ -1410,7 +1410,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include + #include + +-struct MYSQL * foo(void) ++struct st_mysql * foo(void) + { + static MYSQL var; +