diff --git a/pkgs/by-name/mr/mrtg/configure-long-long-format-gcc14.patch b/pkgs/by-name/mr/mrtg/configure-long-long-format-gcc14.patch new file mode 100644 index 000000000000..6159854d4d91 --- /dev/null +++ b/pkgs/by-name/mr/mrtg/configure-long-long-format-gcc14.patch @@ -0,0 +1,10 @@ +--- mrtg-2.17.10/configure.bak 2025-10-17 20:44:24.878718603 +0100 ++++ mrtg-2.17-10/configure 2025-10-17 20:44:40.343747835 +0100 +@@ -3664,6 +3664,7 @@ + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include ++#include + int main() + { + long long b, a = -0x3AFAFAFAFAFAFAFALL; diff --git a/pkgs/by-name/mr/mrtg/package.nix b/pkgs/by-name/mr/mrtg/package.nix index 9c5e89f7bd74..7cc2b9095fa4 100644 --- a/pkgs/by-name/mr/mrtg/package.nix +++ b/pkgs/by-name/mr/mrtg/package.nix @@ -1,6 +1,7 @@ { lib, stdenv, + makeWrapper, fetchurl, perl, gd, @@ -24,6 +25,8 @@ stdenv.mkDerivation rec { sha256 = "sha256-x/EcteIXpQDYfuO10mxYqGUu28DTKRaIu3krAQ+uQ6w="; }; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ # add support for ipv6 snmp: # https://github.com/oetiker/mrtg/blob/433ebfa5fc043971b46a5cd975fb642c76e3e49d/src/bin/mrtg#L331-L341 @@ -32,6 +35,20 @@ stdenv.mkDerivation rec { rrdtool ]; + patches = [ + # gcc14 broke detection of printf format specifiers + # building from master seems to be fixed upstream, so next release can (likely) drop the patch + # just keep the CFLAGS below + ./configure-long-long-format-gcc14.patch + ]; + env.NIX_CFLAGS_COMPILE = "-Werror"; + env.NIX_CFLAGS_LINK = "-lm"; + + postInstall = '' + # mrtg wants plain C locale + wrapProgram $out/bin/mrtg --set LANG C + ''; + meta = with lib; { description = "Multi Router Traffic Grapher"; homepage = "https://oss.oetiker.ch/mrtg/";