public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
Date: Mon, 18 Jul 2022 00:26:28 +0000 (UTC)	[thread overview]
Message-ID: <1658103972.3c3c878c44cb226d776bd989b0206e543dd9ac46.sam@gentoo> (raw)

commit:     3c3c878c44cb226d776bd989b0206e543dd9ac46
Author:     brahmajit das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Sat Jul 16 04:36:45 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 18 00:26:12 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c3c878c

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 <AT> gentoo.org> for the patch idea.

Signed-off-by: brahmajit das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/26223
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/debugedit/debugedit-5.0-r1.ebuild         |  1 +
 .../files/debugedit-5.0-musl-error.h-fix.patch     | 50 ++++++++++++++++++++++
 2 files changed, 51 insertions(+)

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>
+


             reply	other threads:[~2022-07-18  0:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18  0:26 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-28 15:35 [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/ Sam James
2023-09-18  9:01 Sam James
2022-02-02  6:14 Sam James
2021-09-03  6:53 Michał Górny
2019-09-08  6:43 Michał Górny
2019-06-20  8:01 Michał Górny
2019-03-14 12:24 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1658103972.3c3c878c44cb226d776bd989b0206e543dd9ac46.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox