summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrahmajit das <brahmajit.xyz@gmail.com>2022-07-16 10:06:45 +0530
committerSam James <sam@gentoo.org>2022-07-18 00:26:12 +0000
commit3c3c878c44cb226d776bd989b0206e543dd9ac46 (patch)
tree01629e574c0e0f383a174dd39c9701355f3b39a4 /dev-util/debugedit
parentnet-fs/samba: Fix undefined innetgr on musl (diff)
downloadgentoo-3c3c878c44cb226d776bd989b0206e543dd9ac46.tar.gz
gentoo-3c3c878c44cb226d776bd989b0206e543dd9ac46.tar.bz2
gentoo-3c3c878c44cb226d776bd989b0206e543dd9ac46.zip
dev-util/debugedit: Fix build on musl
musl doesn't provide error.h as a result debugedit is failing to build on musl. So we're creating a error define that redefines the err function and takes precedence over it. Thanks to gentoo developer Anthony G. Basile <blueness@gentoo.org> for the patch idea. Signed-off-by: brahmajit das <brahmajit.xyz@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/26223 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-util/debugedit')
-rw-r--r--dev-util/debugedit/debugedit-5.0-r1.ebuild1
-rw-r--r--dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch50
2 files changed, 51 insertions, 0 deletions
diff --git a/dev-util/debugedit/debugedit-5.0-r1.ebuild b/dev-util/debugedit/debugedit-5.0-r1.ebuild
index 18f1e7b7cde5..f510f92c003b 100644
--- a/dev-util/debugedit/debugedit-5.0-r1.ebuild
+++ b/dev-util/debugedit/debugedit-5.0-r1.ebuild
@@ -34,6 +34,7 @@ PATCHES=(
"${FILESDIR}"/${P}-readelf.patch
"${FILESDIR}"/${P}-zero-dir-entry.patch
"${FILESDIR}"/${P}-hppa.patch
+ "${FILESDIR}"/${P}-musl-error.h-fix.patch
)
src_prepare() {
diff --git a/dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch b/dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch
new file mode 100644
index 000000000000..4c7f23911108
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch
@@ -0,0 +1,50 @@
+# musl doesn't provide error.h as a result debugedit is failing to build on
+# musl.
+#
+# With advice from developer Anthony G. Basile <blueness@gentoo.org> I went
+# with creating a define that redefines the err function. The major
+# improvements over the previous implementation is that this time the patch is
+# smaller and more readable compared to previous implementation.
+#
+# Closes: https://bugs.gentoo.org/714206
+--- a/configure.ac
++++ b/configure.ac
+@@ -57,6 +57,8 @@ PKG_CHECK_MODULES([LIBDW], [libdw])
+
+ # Checks for header files.
+ AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h])
++AC_CHECK_HEADERS([error.h],
++ [AC_DEFINE(HAVE_ERROR_H, 1, [has error.h -- non musl system])])
+
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_CHECK_HEADER_STDBOOL
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -25,7 +25,12 @@
+ #include <byteswap.h>
+ #include <endian.h>
+ #include <errno.h>
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#else
++#include <err.h>
++#define error(status, errno, ...) err(status, __VA_ARGS__)
++#endif
+ #include <limits.h>
+ #include <string.h>
+ #include <stdlib.h>
+--- a/tools/sepdebugcrcfix.c
++++ b/tools/sepdebugcrcfix.c
+@@ -29,7 +29,12 @@
+ #include <endian.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#else
++#include <err.h>
++#define error(status, errno, ...) err(status, __VA_ARGS__)
++#endif
+ #include <libelf.h>
+ #include <gelf.h>
+