From ac77be992132bc074fabeda1e2b5259e6d64e7e0 Mon Sep 17 00:00:00 2001 From: oreo639 Date: Fri, 18 Apr 2025 14:32:32 -0700 Subject: [PATCH] mcpp: don't undefine libc feature macros --- .../mcpp/patches/libc-feature-macros.patch | 59 +++++++++++++++++++ srcpkgs/mcpp/template | 1 - 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/mcpp/patches/libc-feature-macros.patch diff --git a/srcpkgs/mcpp/patches/libc-feature-macros.patch b/srcpkgs/mcpp/patches/libc-feature-macros.patch new file mode 100644 index 00000000000..e6538e7955f --- /dev/null +++ b/srcpkgs/mcpp/patches/libc-feature-macros.patch @@ -0,0 +1,59 @@ +Florian Weimer's c99 patch from https://sourceforge.net/p/mcpp/patches/7/ + +Do not define and undefine _*_SOURCE macros. These have special +semantics to glibc. may include , and which +point the feature configuration gets frozen. Without this change, +when system.c includes , the feature macros are hard-coded +as baseline POSIX, which does not include readlink. This will lead to +compilation errors with future compilers. + +diff --git a/src/configed.H b/src/configed.H +index b4d1ebf3a6bfa280..bde16fc8db38a2c4 100644 +--- a/src/configed.H ++++ b/src/configed.H +@@ -295,20 +295,7 @@ + * ULONGMAX should be defined to the ULONG_MAX in . + */ + +-/* _POSIX_* only to get PATH_MAX */ +-#define _POSIX_ 1 +-#define _POSIX_SOURCE 1 +-#ifndef _POSIX_C_SOURCE +-#define _POSIX_C_SOURCE 1 +-#define _POSIX_C_SOURCE_defined 1 +-#endif + #include "limits.h" +-#undef _POSIX_ +-#undef _POSIX_SOURCE +-#ifdef _POSIX_C_SOURCE_defined +-#undef _POSIX_C_SOURCE +-#undef _POSIX_C_SOURCE_defined +-#endif + #define CHARBIT CHAR_BIT + #define UCHARMAX UCHAR_MAX + #define USHRTMAX USHRT_MAX +diff --git a/src/noconfig.H b/src/noconfig.H +index 6b634fe0b32ff67c..7c923c900c8865dd 100644 +--- a/src/noconfig.H ++++ b/src/noconfig.H +@@ -570,20 +570,7 @@ + #include "stdio.h" + + /* PATHMAX is the maximum length of path-list on the host system. */ +-/* _POSIX_* only to get PATH_MAX */ +-#define _POSIX_ 1 +-#define _POSIX_SOURCE 1 +-#ifndef _POSIX_C_SOURCE +-#define _POSIX_C_SOURCE 1 +-#define _POSIX_C_SOURCE_defined 1 +-#endif + #include "limits.h" +-#undef _POSIX_ +-#undef _POSIX_SOURCE +-#ifdef _POSIX_C_SOURCE_defined +-#undef _POSIX_C_SOURCE +-#undef _POSIX_C_SOURCE_defined +-#endif + #ifdef PATH_MAX + #define PATHMAX PATH_MAX /* Posix macro */ + #else diff --git a/srcpkgs/mcpp/template b/srcpkgs/mcpp/template index f2820056917..397f35657fe 100644 --- a/srcpkgs/mcpp/template +++ b/srcpkgs/mcpp/template @@ -10,7 +10,6 @@ license="BSD-2-Clause" homepage="https://mcpp.sourceforge.net/" distfiles="${SOURCEFORGE_SITE}/mcpp/mcpp-${version}.tar.gz" checksum=3b9b4421888519876c4fc68ade324a3bbd81ceeb7092ecdbbc2055099fcb8864 -CFLAGS="-D_GNU_SOURCE" # readlink on glibc post_install() { vlicense LICENSE