From ed7c31f8944f4f16f45fcff382a1728c7ffa4062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Oth=C3=B3n=20Mart=C3=ADnez=20Vera?= Date: Fri, 11 Apr 2025 11:48:21 -0600 Subject: [PATCH] app-shells/smrsh: fix compilation for musl, c23/gcc-15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The value ```-DXDEBUG=0``` was fixed in the ```site.config.m4``` file, and now it's in the ebuild file. In order to support musl, we need to add a new value to the ```confENVDEF``` define. Closes: https://bugs.gentoo.org/715280 Closes: https://bugs.gentoo.org/944460 Signed-off-by: Cristian Othón Martínez Vera Part-of: https://github.com/gentoo/gentoo/pull/41538 Closes: https://github.com/gentoo/gentoo/pull/41538 Signed-off-by: Sam James --- app-shells/smrsh/files/site.config.m4 | 2 +- .../files/smrsh-8.18.1-c23-sm_strtoll.patch | 29 +++++++++++++++++++ .../files/smrsh-musl-disable-cdefs.patch | 11 +++++++ app-shells/smrsh/smrsh-8.15.2-r1.ebuild | 10 +++++++ app-shells/smrsh/smrsh-8.18.1.ebuild | 10 +++++++ 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 app-shells/smrsh/files/smrsh-8.18.1-c23-sm_strtoll.patch create mode 100644 app-shells/smrsh/files/smrsh-musl-disable-cdefs.patch diff --git a/app-shells/smrsh/files/site.config.m4 b/app-shells/smrsh/files/site.config.m4 index 24ef462ba2eb8..1b7b0db958215 100644 --- a/app-shells/smrsh/files/site.config.m4 +++ b/app-shells/smrsh/files/site.config.m4 @@ -1,6 +1,6 @@ define(`confCCOPTS', `@@confCCOPTS@@') define(`confSTDIO_TYPE', `portable') -define(`confENVDEF', `-DXDEBUG=0') +define(`confENVDEF', `@@confENVDEF@@') define(`confLDOPTS', `@@confLDOPTS@@') define(`confMANOWN', `root') define(`confMANGRP', `root') diff --git a/app-shells/smrsh/files/smrsh-8.18.1-c23-sm_strtoll.patch b/app-shells/smrsh/files/smrsh-8.18.1-c23-sm_strtoll.patch new file mode 100644 index 0000000000000..63d64b0164cec --- /dev/null +++ b/app-shells/smrsh/files/smrsh-8.18.1-c23-sm_strtoll.patch @@ -0,0 +1,29 @@ +Bug: https://bugs.gentoo.org/944460 + +--- a/libsm/vfscanf.c ++++ b/libsm/vfscanf.c +@@ -240,13 +240,13 @@ + /* FALLTHROUGH */ + case 'd': + c = CT_INT; +- ccfn = (ULONGLONG_T (*)())sm_strtoll; ++ ccfn = (ULONGLONG_T (*)(const char *, char **, int))sm_strtoll; + base = 10; + break; + + case 'i': + c = CT_INT; +- ccfn = (ULONGLONG_T (*)())sm_strtoll; ++ ccfn = (ULONGLONG_T (*)(const char *, char **, int))sm_strtoll; + base = 0; + break; + +@@ -324,7 +324,7 @@ + if (isupper(c)) + flags |= LONG; + c = CT_INT; +- ccfn = (ULONGLONG_T (*)()) sm_strtoll; ++ ccfn = (ULONGLONG_T (*)(const char *, char **, int)) sm_strtoll; + base = 10; + break; + } diff --git a/app-shells/smrsh/files/smrsh-musl-disable-cdefs.patch b/app-shells/smrsh/files/smrsh-musl-disable-cdefs.patch new file mode 100644 index 0000000000000..6dc4ac63105e2 --- /dev/null +++ b/app-shells/smrsh/files/smrsh-musl-disable-cdefs.patch @@ -0,0 +1,11 @@ +--- a/include/sm/os/sm_os_linux.h 2020-06-09 11:57:46.789786561 +0200 ++++ b/include/sm/os/sm_os_linux.h 2020-06-09 11:57:49.174781812 +0200 +@@ -33,7 +33,7 @@ + # endif /* LINUX_VERSION_CODE */ + #endif /* SM_CONF_SHM */ + +-#define SM_CONF_SYS_CDEFS_H 1 ++#define SM_CONF_SYS_CDEFS_H 0 + #ifndef SM_CONF_SEM + # define SM_CONF_SEM 2 + #endif /* SM_CONF_SEM */ diff --git a/app-shells/smrsh/smrsh-8.15.2-r1.ebuild b/app-shells/smrsh/smrsh-8.15.2-r1.ebuild index bada1d80ba8b3..e634c33f2ab71 100644 --- a/app-shells/smrsh/smrsh-8.15.2-r1.ebuild +++ b/app-shells/smrsh/smrsh-8.15.2-r1.ebuild @@ -26,6 +26,15 @@ DEPEND="${RDEPEND} sys-devel/m4" src_prepare() { + local confENVDEF="-DXDEBUG=0" + + eapply "${FILESDIR}"/${PN}-8.18.1-c23-sm_strtoll.patch + + if use elibc_musl; then + eapply "${FILESDIR}"/${PN}-musl-disable-cdefs.patch + confENVDEF+=" -DHASSTRERROR" + fi + cd "${S}/${PN}" || die default @@ -36,6 +45,7 @@ src_prepare() { sed -e "s|@@confCCOPTS@@|${CFLAGS}|" \ -e "s|@@confLDOPTS@@|${LDFLAGS}|" \ + -e "s|@@confENVDEF@@|${confENVDEF}|" \ -e "s:@@confCC@@:$(tc-getCC):" "${FILESDIR}/site.config.m4" \ > "${S}/devtools/Site/site.config.m4" || die "sed failed" } diff --git a/app-shells/smrsh/smrsh-8.18.1.ebuild b/app-shells/smrsh/smrsh-8.18.1.ebuild index bada1d80ba8b3..e634c33f2ab71 100644 --- a/app-shells/smrsh/smrsh-8.18.1.ebuild +++ b/app-shells/smrsh/smrsh-8.18.1.ebuild @@ -26,6 +26,15 @@ DEPEND="${RDEPEND} sys-devel/m4" src_prepare() { + local confENVDEF="-DXDEBUG=0" + + eapply "${FILESDIR}"/${PN}-8.18.1-c23-sm_strtoll.patch + + if use elibc_musl; then + eapply "${FILESDIR}"/${PN}-musl-disable-cdefs.patch + confENVDEF+=" -DHASSTRERROR" + fi + cd "${S}/${PN}" || die default @@ -36,6 +45,7 @@ src_prepare() { sed -e "s|@@confCCOPTS@@|${CFLAGS}|" \ -e "s|@@confLDOPTS@@|${LDFLAGS}|" \ + -e "s|@@confENVDEF@@|${confENVDEF}|" \ -e "s:@@confCC@@:$(tc-getCC):" "${FILESDIR}/site.config.m4" \ > "${S}/devtools/Site/site.config.m4" || die "sed failed" }