commit:     ed4d598b5ebe5eabaa7e07f3be76bd12b8c3a4d7
Author:     Brahmajit Das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Tue Jun 13 14:58:18 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Jun 18 12:16:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed4d598b

sys-apps/cinit: Fix call to undeclared library function

And another build error on musl

Closes: https://bugs.gentoo.org/898542
Signed-off-by: Brahmajit Das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/31417
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 sys-apps/cinit/cinit-0.2.1-r1.ebuild               | 42 +++++++++++++++++++++
 .../files/cinit-0.2.1-musl-clang16-build-fix.patch | 43 ++++++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/sys-apps/cinit/cinit-0.2.1-r1.ebuild 
b/sys-apps/cinit/cinit-0.2.1-r1.ebuild
new file mode 100644
index 000000000000..22cbed1f0264
--- /dev/null
+++ b/sys-apps/cinit/cinit-0.2.1-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="a fast, small and simple init with support for profiles"
+HOMEPAGE="http://linux.schottelius.org/cinit/";
+SRC_URI="http://linux.schottelius.org/${PN}/archives/${P}.tar.bz2";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~x86"
+IUSE="doc"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.2.1-musl-clang16-build-fix.patch
+)
+
+src_prepare() {
+       sed -i "/contrib+tools/d" Makefile || die
+       sed -i "/^STRIP/s/strip.*/true/" Makefile.include || die
+       default
+}
+
+src_compile() {
+       emake \
+               CC="$(tc-getCC)" \
+               LD="$(tc-getCC)" \
+               CFLAGS="${CFLAGS} -I." \
+               LDFLAGS="${LDFLAGS}" \
+               STRIP=/bin/true \
+               all
+}
+
+src_install() {
+       emake LD="$(tc-getCC)" DESTDIR="${D}" install
+       rm -f "${D}"/sbin/{init,shutdown,reboot} || die
+       dodoc Changelog CHANGES CREDITS README TODO
+       use doc && dodoc -r doc
+}

diff --git a/sys-apps/cinit/files/cinit-0.2.1-musl-clang16-build-fix.patch 
b/sys-apps/cinit/files/cinit-0.2.1-musl-clang16-build-fix.patch
new file mode 100644
index 000000000000..832e0590b5c6
--- /dev/null
+++ b/sys-apps/cinit/files/cinit-0.2.1-musl-clang16-build-fix.patch
@@ -0,0 +1,43 @@
+With musl and clang16 the following build error occurs:
+
+client/run_run_svcs.c:24:17: error: use of undeclared identifier 'PATH_MAX'
+   char pathbuf[PATH_MAX+1];
+                ^
+client/run_run_svcs.c:28:21: warning: if statement has empty body 
[-Wempty-body]
+   D_PRINTF(abspath);
+                    ^
+client/run_run_svcs.c:28:21: note: put the semicolon on a separate line to 
silence this warning
+client/connect_sock.c:28:4: error: call to undeclared library function 
'memset' with type
+      'void *(void *, int, unsigned long)'; ISO C99 and later do not support 
implicit function declarations
+      [-Wimplicit-function-declaration]
+   memset(&addr,0,socke);
+   ^
+client/connect_sock.c:28:4: note: include the header <string.h> or explicitly 
provide a declaration for
+      'memset'
+client/connect_sock.c:29:4: error: call to undeclared library function 
'strcpy' with type
+      'char *(char *, const char *)'; ISO C99 and later do not support 
implicit function declarations
+      [-Wimplicit-function-declaration]
+   strcpy(addr.sun_path, CINIT_SOCK);
+
+This patch fixes all three of those errors
+Bug: https://bugs.gentoo.org/898542
+--- a/client/connect_sock.c
++++ b/client/connect_sock.c
+@@ -8,6 +8,7 @@
+ #include <sys/socket.h>
+ #include <sys/un.h>
+ #include <stdio.h>
++#include <string.h>
+ 
+ #include "cinit.h"
+ 
+--- a/client/run_run_svcs.c
++++ b/client/run_run_svcs.c
+@@ -3,6 +3,7 @@
+  * (c) 2005 Nico Schottelius (nico-linux at schottelius.org)
+  * run services parallel
+  */
++#include <linux/limits.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <dirent.h>

Reply via email to