commit:     945e3017cf74a4c200b9c6ba19290e44751953e8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  9 19:48:52 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep  9 19:49:34 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=945e3017

dev-build/make: fix C23 compat (w/ musl)

Closes: https://bugs.gentoo.org/945968
Thanks-to: Bobby Bingham <koorogi <AT> koorogi.info>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-build/make/files/make-4.4.1-c23.patch |  58 +++++++++++++++++
 dev-build/make/make-4.4.1-r101.ebuild     | 103 ++++++++++++++++++++++++++++++
 2 files changed, 161 insertions(+)

diff --git a/dev-build/make/files/make-4.4.1-c23.patch 
b/dev-build/make/files/make-4.4.1-c23.patch
new file mode 100644
index 000000000000..88481a15ae2f
--- /dev/null
+++ b/dev-build/make/files/make-4.4.1-c23.patch
@@ -0,0 +1,58 @@
+From 31bc8976fb7bfdde8b9293e6a4eb2becb29a73bc Mon Sep 17 00:00:00 2001
+From: Bobby Bingham <[email protected]>
+Date: Wed, 2 Jul 2025 18:09:28 -0500
+Subject: [PATCH] fix compilation on musl with gcc15
+
+---
+ lib/fnmatch.c | 2 +-
+ src/getopt.c  | 2 +-
+ src/getopt.h  | 7 -------
+ 3 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/lib/fnmatch.c b/lib/fnmatch.c
+index 01da376..9b54022 100644
+--- a/lib/fnmatch.c
++++ b/lib/fnmatch.c
+@@ -121,7 +121,7 @@ USA.  */
+    whose names are inconsistent.  */
+ 
+ # if !defined _LIBC && !defined getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ # endif
+ 
+ # ifndef errno
+diff --git a/src/getopt.c b/src/getopt.c
+index 7a792de..9b56abe 100644
+--- a/src/getopt.c
++++ b/src/getopt.c
+@@ -202,7 +202,7 @@ static char *posixly_correct;
+    whose names are inconsistent.  */
+ 
+ #ifndef getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ #endif
+ 
+ static char *
+diff --git a/src/getopt.h b/src/getopt.h
+index df18cee..a6cc621 100644
+--- a/src/getopt.h
++++ b/src/getopt.h
+@@ -96,14 +96,7 @@ struct option
+ #define optional_argument     2
+ 
+ #if defined (__STDC__) && __STDC__
+-#ifdef __GNU_LIBRARY__
+-/* Many other libraries have conflicting prototypes for getopt, with
+-   differences in the consts, in stdlib.h.  To avoid compilation
+-   errors, only prototype getopt for the GNU C library.  */
+ extern int getopt (int argc, char *const *argv, const char *shortopts);
+-#else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
+-#endif /* __GNU_LIBRARY__ */
+ extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+                       const struct option *longopts, int *longind);
+ extern int getopt_long_only (int argc, char *const *argv,
+-- 
+2.50.0

diff --git a/dev-build/make/make-4.4.1-r101.ebuild 
b/dev-build/make/make-4.4.1-r101.ebuild
new file mode 100644
index 000000000000..2f36b8939cdc
--- /dev/null
+++ b/dev-build/make/make-4.4.1-r101.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/make.asc
+GUILE_COMPAT=( 2-2 3-0 )
+inherit flag-o-matic unpacker verify-sig guile-single
+
+DESCRIPTION="Standard tool to compile source trees"
+HOMEPAGE="https://www.gnu.org/software/make/make.html";
+if [[ ${PV} == 9999 ]] ; then
+       EGIT_REPO_URI="https://git.savannah.gnu.org/git/make.git";
+       inherit autotools git-r3
+elif [[ $(ver_cut 3) -ge 90 || $(ver_cut 4) -ge 90 ]] ; then
+       SRC_URI="https://alpha.gnu.org/gnu/make/${P}.tar.lz";
+       SRC_URI+=" verify-sig? ( https://alpha.gnu.org/gnu/make/${P}.tar.lz.sig 
)"
+else
+       SRC_URI="mirror://gnu/make/${P}.tar.lz"
+       SRC_URI+=" verify-sig? ( mirror://gnu/make/${P}.tar.lz.sig )"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos 
~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+IUSE="doc guile nls static test"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="guile? ( ${GUILE_REQUIRED_USE} )"
+
+DEPEND="
+       guile? ( ${GUILE_DEPS} )
+"
+RDEPEND="
+       ${DEPEND}
+       nls? ( virtual/libintl )
+"
+BDEPEND="
+       $(unpacker_src_uri_depends)
+       doc? ( virtual/texi2dvi )
+       nls? ( sys-devel/gettext )
+       verify-sig? ( sec-keys/openpgp-keys-make )
+       test? ( dev-lang/perl )
+"
+
+DOCS="AUTHORS NEWS README*"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-4.4-default-cxx.patch
+       "${FILESDIR}"/${PN}-4.4.1-c23.patch
+)
+
+src_unpack() {
+       if [[ ${PV} == 9999 ]] ; then
+               git-r3_src_unpack
+
+               cd "${S}" || die
+               ./bootstrap || die
+       else
+               use verify-sig && verify-sig_verify_detached 
"${DISTDIR}"/${P}.tar.lz{,.sig}
+               unpacker ${P}.tar.lz
+       fi
+}
+
+src_prepare() {
+       default
+
+       if [[ ${PV} == 9999 ]] ; then
+               eautoreconf
+       fi
+
+       if use guile; then
+               guile_bump_sources
+       fi
+}
+
+pkg_setup() {
+       if use guile; then
+               guile-single_pkg_setup
+       fi
+}
+
+src_configure() {
+       use static && append-ldflags -static
+       local myeconfargs=(
+               --program-prefix=g
+               $(use_with guile)
+               $(use_enable nls)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+       emake all $(usev doc 'pdf html')
+}
+
+src_install() {
+       use doc && HTML_DOCS=( doc/make.html/. ) DOCS="${DOCS} doc/make.pdf"
+       default
+
+       dosym gmake /usr/bin/make
+       dosym gmake.1 /usr/share/man/man1/make.1
+       guile_unstrip_ccache
+}

Reply via email to