From 775a161a7f787ae101537abd4eda61eec9d0d67a Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Mon, 13 Apr 2026 23:04:34 +0200 Subject: [PATCH] plotutils: Fix build with a C23 compiler The configure script auto-enables -std=gnu23 when it's available, but the header that defines the boolean constants doesn't support C23, breaking compilation. Drop the unnecessary platforms line as suggested by 'port lint'. --- graphics/plotutils/Portfile | 4 +-- .../files/patch-sys-defines.h-c23-compat.diff | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 graphics/plotutils/files/patch-sys-defines.h-c23-compat.diff diff --git a/graphics/plotutils/Portfile b/graphics/plotutils/Portfile index 866d38056ab..395c9273207 100644 --- a/graphics/plotutils/Portfile +++ b/graphics/plotutils/Portfile @@ -8,7 +8,6 @@ version 2.6 revision 5 conflicts bsd-plotutils categories graphics -platforms darwin maintainers {snc @nerdling} openmaintainer license GPL-3+ @@ -30,7 +29,8 @@ checksums rmd160 2a32244eb20e00b82a0742dde7b690f688e82774 \ size 3657562 patchfiles patch-configure.ac.diff \ - patch-libpng-1.5.diff + patch-libpng-1.5.diff \ + patch-sys-defines.h-c23-compat.diff use_autoreconf yes diff --git a/graphics/plotutils/files/patch-sys-defines.h-c23-compat.diff b/graphics/plotutils/files/patch-sys-defines.h-c23-compat.diff new file mode 100644 index 00000000000..844d711e188 --- /dev/null +++ b/graphics/plotutils/files/patch-sys-defines.h-c23-compat.diff @@ -0,0 +1,27 @@ +Do not redefine bool constants in C23 + +C23 now includes predefined constants for the boolean values true and +false, and attempting to redefine them ends with a compiler error. Avoid +doing that by adjusting the preprocessor guard around that. + +Upstream-Status: Submitted [email] +--- include/sys-defines.h.orig 2026-04-13 22:50:46 ++++ include/sys-defines.h 2026-04-13 22:53:57 +@@ -253,7 +253,7 @@ + /* Support the `bool' datatype, which is used widely in this package. */ + /**************************************************************************/ + +-#ifndef __cplusplus ++#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L) + #ifdef __STDC__ + typedef enum { false = 0, true = 1 } bool; + #else /* not __STDC__, do things the old-fashioned way */ +@@ -261,7 +261,7 @@ + #define false 0 + #define true 1 + #endif /* not __STDC__ */ +-#endif /* not __cplusplus */ ++#endif /* not __cplusplus and (not __STDC_VERSION__ or __STDC_VERSION__ < 202311L) */ + + /**************************************************************************/ + /* Define numerical constants (unofficial, so may not be in math.h). */