summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakuya Wakazono <pastalian46@gmail.com>2024-01-19 00:00:44 +0900
committerSam James <sam@gentoo.org>2024-02-02 03:56:56 +0000
commit191bd72e6913e1c56736e801e0fb9e1f7262cfb2 (patch)
treec8c2914f4dd781862a530a9754d4c60517cd2548 /app-arch/rpm
parentsci-libs/gklib: Stabilize 5.1.1_p20230327-r1 ppc64, #923550 (diff)
downloadgentoo-191bd72e6913e1c56736e801e0fb9e1f7262cfb2.tar.gz
gentoo-191bd72e6913e1c56736e801e0fb9e1f7262cfb2.tar.bz2
gentoo-191bd72e6913e1c56736e801e0fb9e1f7262cfb2.zip
app-arch/rpm: fix musl build
Closes: https://bugs.gentoo.org/888954 Closes: https://bugs.gentoo.org/922286 Signed-off-by: Takuya Wakazono <pastalian46@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-arch/rpm')
-rw-r--r--app-arch/rpm/files/rpm-4.18.1-musl-nls.patch42
-rw-r--r--app-arch/rpm/files/rpm-4.19.1-musl-compat.patch59
-rw-r--r--app-arch/rpm/rpm-4.18.1.ebuild1
-rw-r--r--app-arch/rpm/rpm-4.19.1.ebuild2
4 files changed, 104 insertions, 0 deletions
diff --git a/app-arch/rpm/files/rpm-4.18.1-musl-nls.patch b/app-arch/rpm/files/rpm-4.18.1-musl-nls.patch
new file mode 100644
index 000000000000..7d1fde28bacf
--- /dev/null
+++ b/app-arch/rpm/files/rpm-4.18.1-musl-nls.patch
@@ -0,0 +1,42 @@
+https://bugs.gentoo.org/888954
+https://github.com/rpm-software-management/rpm/commit/f401979a4c4829d68e9614860644bdb74b6dda66
+
+From da222f0d82721d17e57d491d2749a4bc44754b9d Mon Sep 17 00:00:00 2001
+From: Takuya Wakazono <pastalian46@gmail.com>
+Date: Thu, 18 Jan 2024 18:41:11 +0900
+Subject: [PATCH] Don't use _nl_msg_cat_cntr if __GLIC__ is not defined
+
+musl doesn't need to use libintl from GNU gettext because it has its
+own NLS implementation. Assuming _nl_msg_cat_cntr exists breaks the
+build against the musl system.
+--- a/lib/tagexts.c
++++ b/lib/tagexts.c
+@@ -532,7 +532,7 @@ static int filerequireTag(Header h, rpmtd td, headerGetFlags hgflags)
+
+ /* I18N look aside diversions */
+
+-#if defined(ENABLE_NLS)
++#if defined(ENABLE_NLS) && (defined(__GLIBC__) || !defined(__linux__))
+ extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
+ #endif
+ static const char * const language = "LANGUAGE";
+@@ -569,7 +569,9 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
+ /* change to en_US for msgkey -> msgid resolution */
+ langval = getenv(language);
+ (void) setenv(language, "en_US", 1);
++#if defined(__GLIBC__) || !defined(__linux__)
+ ++_nl_msg_cat_cntr;
++#endif
+
+ msgid = NULL;
+ for (domain = dstring; domain != NULL; domain = de) {
+@@ -584,7 +586,9 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
+ (void) setenv(language, langval, 1);
+ else
+ unsetenv(language);
++#if defined(__GLIBC__) || !defined(__linux__)
+ ++_nl_msg_cat_cntr;
++#endif
+
+ if (domain && msgid) {
+ td->data = dgettext(domain, msgid);
diff --git a/app-arch/rpm/files/rpm-4.19.1-musl-compat.patch b/app-arch/rpm/files/rpm-4.19.1-musl-compat.patch
new file mode 100644
index 000000000000..ca9f97257c70
--- /dev/null
+++ b/app-arch/rpm/files/rpm-4.19.1-musl-compat.patch
@@ -0,0 +1,59 @@
+musl doesn't implement GLOB_BRACE, simply disable it.
+
+https://bugs.gentoo.org/922286
+https://github.com/rpm-software-management/rpm/issues/2844
+--- a/rpmio/rpmglob.c
++++ b/rpmio/rpmglob.c
+@@ -33,6 +33,10 @@
+
+ #include "debug.h"
+
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ /* Return 1 if pattern contains a magic char, see glob(7) for a list */
+ static int ismagic(const char *pattern)
+ {
+
+From 57f3711846f44da0f37cbc5dd66e8fba80a3bee1 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 18 Dec 2023 12:25:04 +0200
+Subject: [PATCH] Fix unconditional dependency on non-POSIX GLOB_ONLYDIR flag
+
+This regressed when we axed our internal glob copy in commit
+66fa46c006bae0f28d93238b8f7f1c923645eee5. Luckily GLOB_ONLYDIR is only
+an optimization so we can just skip it if not available.
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -350,6 +350,7 @@ if (LIBDW_FOUND)
+ set(HAVE_LIBDW 1)
+ endif()
+
++check_symbol_exists(GLOB_ONLYDIR "glob.h" HAVE_GLOB_ONLYDIR)
+ check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
+ if (NOT MAJOR_IN_SYSMACROS)
+ check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
+--- a/config.h.in
++++ b/config.h.in
+@@ -100,6 +100,7 @@
+ #cmakedefine HAVE_ZSTD @HAVE_ZSTD@
+ #cmakedefine HAVE___PROGNAME @HAVE___PROGNAME@
+ #cmakedefine HAVE___SECURE_GETENV @HAVE___SECURE_GETENV@
++#cmakedefine HAVE_GLOB_ONLYDIR @HAVE_GLOB_ONLYDIR@
+ #cmakedefine MAJOR_IN_MKDEV @MAJOR_IN_MKDEV@
+ #cmakedefine MAJOR_IN_SYSMACROS @MAJOR_IN_SYSMACROS@
+ #cmakedefine RUNDIR @rundir@
+--- a/rpmio/rpmglob.c
++++ b/rpmio/rpmglob.c
+@@ -84,8 +84,10 @@ int rpmGlobPath(const char * pattern, rpmglobFlags flags,
+ gflags |= GLOB_BRACE;
+ if (home != NULL && strlen(home) > 0)
+ gflags |= GLOB_TILDE;
++#if HAVE_GLOB_ONLYDIR
+ if (dir_only)
+ gflags |= GLOB_ONLYDIR;
++#endif
+ if (flags & RPMGLOB_NOCHECK)
+ gflags |= GLOB_NOCHECK;
+
diff --git a/app-arch/rpm/rpm-4.18.1.ebuild b/app-arch/rpm/rpm-4.18.1.ebuild
index 8695d7cf06c8..5054bab122a8 100644
--- a/app-arch/rpm/rpm-4.18.1.ebuild
+++ b/app-arch/rpm/rpm-4.18.1.ebuild
@@ -65,6 +65,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-4.8.1-db-path.patch
"${FILESDIR}"/${PN}-4.8.1-clang.patch
"${FILESDIR}"/${PN}-4.17.0-libdir.patch
+ "${FILESDIR}"/${PN}-4.18.1-musl-nls.patch
)
pkg_pretend() {
diff --git a/app-arch/rpm/rpm-4.19.1.ebuild b/app-arch/rpm/rpm-4.19.1.ebuild
index 3459be5ac5f3..a011006febb8 100644
--- a/app-arch/rpm/rpm-4.19.1.ebuild
+++ b/app-arch/rpm/rpm-4.19.1.ebuild
@@ -62,7 +62,9 @@ RDEPEND="
"
PATCHES=(
+ "${FILESDIR}"/${PN}-4.18.1-musl-nls.patch
"${FILESDIR}"/${PN}-4.19.0-libdir.patch
+ "${FILESDIR}"/${PN}-4.19.1-musl-compat.patch
)
pkg_pretend() {