commit: e572c88554dd14921c39809f3b780cea49ce9c56 Author: Eli Schwartz <eschwartz93 <AT> gmail <DOT> com> AuthorDate: Tue Mar 19 00:31:31 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Mar 19 03:20:51 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e572c885
dev-cpp/libmcpp: add patches to build with Modern C Closes: https://bugs.gentoo.org/919186 Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com> Signed-off-by: Sam James <sam <AT> gentoo.org> .../libmcpp-2.7.2-incompatible-pointer-types.patch | 26 ++++++++++ dev-cpp/libmcpp/files/mcpp-c99.patch | 59 ++++++++++++++++++++++ dev-cpp/libmcpp/libmcpp-2.7.2_p5-r2.ebuild | 48 ++++++++++++++++++ 3 files changed, 133 insertions(+) diff --git a/dev-cpp/libmcpp/files/libmcpp-2.7.2-incompatible-pointer-types.patch b/dev-cpp/libmcpp/files/libmcpp-2.7.2-incompatible-pointer-types.patch new file mode 100644 index 000000000000..fc84009d4366 --- /dev/null +++ b/dev-cpp/libmcpp/files/libmcpp-2.7.2-incompatible-pointer-types.patch @@ -0,0 +1,26 @@ +https://github.com/jbrandwood/mcpp/commit/3b274fe8f31d61996343b17402f30408a6e447cf + +From 3b274fe8f31d61996343b17402f30408a6e447cf Mon Sep 17 00:00:00 2001 +From: John Brandwood <john.brandw...@telzey.com> +Date: Fri, 15 Mar 2024 15:15:53 -0400 +Subject: [PATCH] Fix build with GCC 14.x by splitting a NULL assignment into 2 + lines. + +--- + src/expand.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/expand.c b/src/expand.c +index 08f829a..ea2d2a9 100644 +--- a/src/expand.c ++++ b/src/expand.c +@@ -710,7 +710,8 @@ static char * replace( + } else { + m_inf->locs.start_col = m_inf->locs.start_line = 0L; + } +- m_inf->args = m_inf->loc_args = NULL; /* Default args */ ++ m_inf->args = NULL; /* Default args */ ++ m_inf->loc_args = NULL; + for (num = 1, recurs = 0; num < m_num; num++) + if (mac_inf[ num].defp == defp) + recurs++; /* Recursively nested macro */ diff --git a/dev-cpp/libmcpp/files/mcpp-c99.patch b/dev-cpp/libmcpp/files/mcpp-c99.patch new file mode 100644 index 000000000000..e6538e7955f4 --- /dev/null +++ b/dev-cpp/libmcpp/files/mcpp-c99.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. <limits.h> may include <features.h>, and which +point the feature configuration gets frozen. Without this change, +when system.c includes <unistd.h>, 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 <limits.h>. + */ + +-/* _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/dev-cpp/libmcpp/libmcpp-2.7.2_p5-r2.ebuild b/dev-cpp/libmcpp/libmcpp-2.7.2_p5-r2.ebuild new file mode 100644 index 000000000000..3d410d6d4019 --- /dev/null +++ b/dev-cpp/libmcpp/libmcpp-2.7.2_p5-r2.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools + +MY_PN=${PN/lib/} +MY_P=$(ver_cut 1-4 ${MY_PN}-${PV}) + +DESCRIPTION="A portable C++ preprocessor" +HOMEPAGE="http://mcpp.sourceforge.net" +SRC_URI="mirror://sourceforge/mcpp/${MY_P}.tar.gz" +SRC_URI+=" mirror://debian/pool/main/m/${MY_PN}/${MY_PN}_${PV/_p/-}.debian.tar.xz" +S="${WORKDIR}"/${MY_P} + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc64 ~riscv ~x86 ~x86-linux ~x64-macos" + +PATCHES=( + # bug #718808 + "${WORKDIR}"/debian/patches/ + + "${FILESDIR}"/${PN}-2.7.2-fix-build-system.patch + "${FILESDIR}"/${PN}-2.7.2-fix-configure-checks.patch + "${FILESDIR}"/${PN}-2.7.2-incompatible-pointer-types.patch + "${FILESDIR}"/mcpp-c99.patch +) + +src_prepare() { + default + + # bug #778461 + sed -i 's/-lmcpp/libmcpp.la/' src/Makefile.am || die + + eautoreconf +} + +src_configure() { + econf --enable-mcpplib +} + +src_install() { + default + + find "${ED}" -name '*.la' -delete || die +}