commit:     20dc1a7757bbe3576f39ba7cf8a57049c75ba1ba
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 25 20:00:12 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jan 25 20:00:57 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20dc1a77

app-admin/rasdaemon-0.6.7-r1: fix build for musl

Closes: https://bugs.gentoo.org/713386
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../rasdaemon/files/rasdaemon-0.6.7-musl.patch     | 34 ++++++++++
 app-admin/rasdaemon/rasdaemon-0.6.7-r1.ebuild      | 79 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/app-admin/rasdaemon/files/rasdaemon-0.6.7-musl.patch 
b/app-admin/rasdaemon/files/rasdaemon-0.6.7-musl.patch
new file mode 100644
index 000000000000..9df9eff6d947
--- /dev/null
+++ b/app-admin/rasdaemon/files/rasdaemon-0.6.7-musl.patch
@@ -0,0 +1,34 @@
+From c450d2334d59c2441d9b4fcee1284afb55b9639c Mon Sep 17 00:00:00 2001
+From: Stijn Tintel <st...@linux-ipv6.be>
+Date: Wed, 1 Sep 2021 03:32:18 +0300
+Subject: [PATCH] rasdaemon: fix compile against musl libc
+
+Fix the following compile errors that occurs when building against musl:
+
+ras-events.c: In function 'read_ras_event_all_cpus':
+ras-events.c:366:16: error: 'PATH_MAX' undeclared (first use in this function)
+  366 |  char pipe_raw[PATH_MAX];
+      |                ^~~~~~~~
+
+ras-events.c: In function 'handle_ras_events_cpu':
+ras-events.c:564:16: error: 'PATH_MAX' undeclared (first use in this function)
+  564 |  char pipe_raw[PATH_MAX];
+      |
+
+Signed-off-by: Stijn Tintel <st...@linux-ipv6.be>
+---
+ ras-events.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/ras-events.c b/ras-events.c
+index fe4bd26..39cab20 100644
+--- a/ras-events.c
++++ b/ras-events.c
+@@ -18,6 +18,7 @@
+ #include <dirent.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>

diff --git a/app-admin/rasdaemon/rasdaemon-0.6.7-r1.ebuild 
b/app-admin/rasdaemon/rasdaemon-0.6.7-r1.ebuild
new file mode 100644
index 000000000000..7a8d2aa43192
--- /dev/null
+++ b/app-admin/rasdaemon/rasdaemon-0.6.7-r1.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic linux-info systemd
+
+DESCRIPTION="Reliability, Availability and Serviceability logging tool"
+HOMEPAGE="http://www.infradead.org/~mchehab/rasdaemon/";
+SRC_URI="http://www.infradead.org/~mchehab/${PN}/${P}.tar.bz2";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="sqlite"
+
+DEPEND=""
+RDEPEND="
+       ${DEPEND}
+       sys-devel/gettext
+       sys-apps/dmidecode
+       sqlite? (
+               dev-db/sqlite
+               dev-perl/DBD-SQLite
+       )
+       elibc_musl? ( sys-libs/argp-standalone )
+"
+
+PATCHES=(
+       "${FILESDIR}/sysconfig-fix-0.6.7.patch"
+       "${FILESDIR}"/${P}-musl.patch
+)
+
+pkg_setup() {
+       linux-info_pkg_setup
+       local CONFIG_CHECK="~ACPI_EXTLOG"
+       check_extra_config
+}
+
+src_prepare() {
+       default
+
+       # avoid re-configure due to automake trigger
+       eautoreconf
+}
+
+src_configure() {
+       local myconf=(
+               $(use_enable sqlite sqlite3)
+               --enable-abrt-report
+               --enable-aer
+               --enable-arm
+               --enable-extlog
+               --enable-hisi-ns-decode
+               --enable-mce
+               --enable-non-standard
+               --enable-devlink
+               --enable-diskerror
+               --enable-memory-ce-pfa
+               --includedir="/usr/include/${PN}"
+               --localstatedir=/var
+       )
+
+       use elibc_musl && append-libs argp
+
+       econf "${myconf[@]}"
+}
+
+src_install() {
+       default
+
+       keepdir "/var/lib/${PN}"
+
+       systemd_dounit misc/*.service
+
+       newinitd "${FILESDIR}/rasdaemon.openrc-r2" rasdaemon
+       newinitd "${FILESDIR}/ras-mc-ctl.openrc-r1" ras-mc-ctl
+       newconfd "${FILESDIR}"/rasdaemon.confd rasdaemon
+}

Reply via email to