diff --git a/pkgs/by-name/li/libmpeg2/getopt-getenv-signatures.patch b/pkgs/by-name/li/libmpeg2/getopt-getenv-signatures.patch new file mode 100644 index 000000000000..881f11882371 --- /dev/null +++ b/pkgs/by-name/li/libmpeg2/getopt-getenv-signatures.patch @@ -0,0 +1,26 @@ +diff --git a/src/getopt.c b/src/getopt.c +index 4744e43..19776f3 100644 +--- a/src/getopt.c ++++ b/src/getopt.c +@@ -208,7 +208,7 @@ static char *posixly_correct; + whose names are inconsistent. */ + + #ifndef getenv +-extern char *getenv (); ++extern char *getenv (const char *); + #endif + + static char * +diff --git a/src/getopt.h b/src/getopt.h +index b0147e9..6f1e784 100644 +--- a/src/getopt.h ++++ b/src/getopt.h +@@ -133,7 +133,7 @@ struct option + errors, only prototype getopt for the GNU C library. */ + extern int getopt (int __argc, char *const *__argv, const char *__shortopts); + # else /* not __GNU_LIBRARY__ */ +-extern int getopt (); ++extern int getopt (int, char *const*, const char *); + # endif /* __GNU_LIBRARY__ */ + + # ifndef __need_getopt diff --git a/pkgs/by-name/li/libmpeg2/package.nix b/pkgs/by-name/li/libmpeg2/package.nix index 7860056707ca..4242f5c2edd5 100644 --- a/pkgs/by-name/li/libmpeg2/package.nix +++ b/pkgs/by-name/li/libmpeg2/package.nix @@ -13,6 +13,11 @@ stdenv.mkDerivation rec { sha256 = "1m3i322n2fwgrvbs1yck7g5md1dbg22bhq5xdqmjpz5m7j4jxqny"; }; + patches = [ + # Fixes mismatching definitions with C23 / GCC15 on non-glibc platforms + ./getopt-getenv-signatures.patch + ]; + # Otherwise clang fails with 'duplicate symbol ___sputc' buildFlags = lib.optional stdenv.hostPlatform.isDarwin "CFLAGS=-std=gnu89";