diff --git a/pkgs/tools/text/gawk/gawkextlib.nix b/pkgs/tools/text/gawk/gawkextlib.nix index c567b39b07d7..d89e1c7a2ac2 100644 --- a/pkgs/tools/text/gawk/gawkextlib.nix +++ b/pkgs/tools/text/gawk/gawkextlib.nix @@ -34,6 +34,9 @@ let extraBuildInputs ? [ ], doCheck ? true, patches ? [ ], + extraPostPatch ? "", + env ? { }, + broken ? null, }: let is_extension = gawkextlib != null; @@ -50,9 +53,11 @@ let inherit patches; - postPatch = '' - cd ${name} - ''; + postPatch = + '' + cd ${name} + '' + + extraPostPatch; nativeBuildInputs = [ autoconf @@ -70,10 +75,12 @@ let setupHook = if is_extension then ./setup-hook.sh else null; inherit gawk; + inherit env; + inherit doCheck; nativeCheckInputs = [ more ]; - meta = with lib; { + meta = { homepage = "https://sourceforge.net/projects/gawkextlib/"; description = "Dynamically loaded extension libraries for GNU AWK"; mainProgram = "xmlgawk"; @@ -85,10 +92,10 @@ let database, use the GD graphics library, and perform unlimited precision MPFR calculations. ''; - license = licenses.gpl3Plus; - platforms = platforms.unix; - maintainers = with maintainers; [ tomberek ]; - }; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ tomberek ]; + } // lib.optionalAttrs (broken != null) { inherit broken; }; } ); gawkextlib = buildExtension { @@ -112,11 +119,16 @@ let errno = buildExtension { inherit gawkextlib; name = "errno"; + extraPostPatch = '' + substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M' + ''; }; gd = buildExtension { inherit gawkextlib; name = "gd"; extraBuildInputs = [ gd ]; + # GCC 14 makes this an error by default, remove when fixed upstream + env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; }; haru = buildExtension { inherit gawkextlib; @@ -127,6 +139,8 @@ let # https://github.com/libharu/libharu/commit/88271b73c68c521a49a15e3555ef00395aa40810 ./fix-typos-corrected-in-libharu-2.4.4.patch ]; + # GCC 14 makes this an error by default, remove when fixed upstream + env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; }; json = buildExtension { inherit gawkextlib; @@ -136,6 +150,9 @@ let lmdb = buildExtension { inherit gawkextlib; name = "lmdb"; + extraPostPatch = '' + substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M' + ''; extraBuildInputs = [ lmdb ]; # mdb_env_open(env, /dev/null) #! No such device @@ -175,6 +192,9 @@ let select = buildExtension { inherit gawkextlib; name = "select"; + extraPostPatch = '' + substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M' + ''; }; timex = buildExtension { inherit gawkextlib; @@ -187,6 +207,8 @@ let expat libiconv ]; + # gawk: xmlbase:14: fatal: load_ext: cannot open library `../.libs/xml.so` + broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform; }; }; in