commit:     db4e9704449722571dc5e185cfe8b2846f2aba0c
Author:     Brahmajit Das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Sun Aug  4 19:55:10 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Aug  4 20:58:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db4e9704

sys-block/nbd: Fix passing incompatible pointer type

Closes: https://bugs.gentoo.org/937330
Signed-off-by: Brahmajit Das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37959
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../files/nbd-3.25-fix-build-on-musl-gcc14.patch   | 34 +++++++++
 sys-block/nbd/nbd-3.25-r1.ebuild                   | 86 ++++++++++++++++++++++
 2 files changed, 120 insertions(+)

diff --git a/sys-block/nbd/files/nbd-3.25-fix-build-on-musl-gcc14.patch 
b/sys-block/nbd/files/nbd-3.25-fix-build-on-musl-gcc14.patch
new file mode 100644
index 000000000000..91828c159d76
--- /dev/null
+++ b/sys-block/nbd/files/nbd-3.25-fix-build-on-musl-gcc14.patch
@@ -0,0 +1,34 @@
+https://github.com/NetworkBlockDevice/nbd/commit/4664b8dd3bc124c27b160720113339c1da97c2c4.patch
+From: Khem Raj <[email protected]>
+Date: Mon, 20 May 2024 17:50:51 -0700
+Subject: [PATCH] nbd-client: Fix build on musl + gcc14
+
+GCC-14 has promoted incompatible-pointer-types warning into error which is
+now flagged especially with when building on musl
+
+Fixes following error
+
+| ../nbd-3.26.1/nbd-client.c: In function 'openunix':
+| ../nbd-3.26.1/nbd-client.c:345:27: error: passing argument 2 of 'connect' 
from incompatible pointer type [-Wincompatible-pointer-types]
+|   345 |         if (connect(sock, &un_addr, sizeof(un_addr)) == -1) {
+|       |                           ^~~~~~~~
+|       |                           |
+|       |                           struct sockaddr_un *
+| In file included from ../nbd-3.26.1/nbd-client.c:25:
+| 
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/nbd/3.26.1/recipe-sysroot/usr/include/sys/socket.h:386:19:
 note: expected 'const struct sockaddr *' but argument is of type 'struct 
sockaddr_un *'
+|   386 | int connect (int, const struct sockaddr *, socklen_t);
+|       |                   ^~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <[email protected]>
+--- a/nbd-client.c
++++ b/nbd-client.c
+@@ -342,7 +342,7 @@ int openunix(const char *path) {
+               return -1;
+       };
+ 
+-      if (connect(sock, &un_addr, sizeof(un_addr)) == -1) {
++      if (connect(sock, (struct sockaddr*)&un_addr, sizeof(un_addr)) == -1) {
+               err_nonfatal("CONNECT failed");
+               close(sock);
+               return -1;
+

diff --git a/sys-block/nbd/nbd-3.25-r1.ebuild b/sys-block/nbd/nbd-3.25-r1.ebuild
new file mode 100644
index 000000000000..731fdfff88c4
--- /dev/null
+++ b/sys-block/nbd/nbd-3.25-r1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit systemd
+
+DESCRIPTION="Userland client/server for kernel network block device"
+HOMEPAGE="https://nbd.sourceforge.io/";
+
+if [[ ${PV} == 9999 ]] ; then
+       inherit autotools git-r3
+       EGIT_REPO_URI="https://github.com/NetworkBlockDevice/nbd.git";
+else
+       
SRC_URI="https://github.com/NetworkBlockDevice/nbd/releases/download/${P}/${P}.tar.xz";
+       SRC_URI+=" https://downloads.sourceforge.net/nbd/${P}.tar.xz";
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 
~sparc ~x86"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="debug gnutls netlink zlib"
+
+RDEPEND="
+       >=dev-libs/glib-2.32.0
+       gnutls? ( >=net-libs/gnutls-2.12.0 )
+       netlink? ( >=dev-libs/libnl-3.1 )
+       zlib? ( sys-libs/zlib )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       sys-devel/bison
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-3.25-fix-build-on-musl-gcc14.patch"
+)
+
+if [[ ${PV} == 9999 ]] ; then
+       BDEPEND+="
+               app-text/docbook-sgml-dtd:4.5
+               app-text/docbook-sgml-utils
+               dev-build/autoconf-archive
+       "
+fi
+
+src_prepare() {
+       default
+
+       if [[ ${PV} == 9999 ]] ; then
+               emake -C man -f mans.mk \
+                       nbd-server.1.sh.in \
+                       nbd-server.5.sh.in \
+                       nbd-client.8.sh.in \
+                       nbd-trdump.1.sh.in \
+                       nbd-trplay.1.sh.in \
+                       nbdtab.5.sh.in
+
+               emake -C systemd -f Makefile.am [email protected]
+
+               eautoreconf
+       fi
+}
+
+src_configure() {
+       # Needs Bison
+       unset YACC
+
+       local myeconfargs=(
+               --enable-lfs
+               # https://github.com/NetworkBlockDevice/nbd/issues/149
+               --disable-gznbd
+               $(use_enable !debug syslog)
+               $(use_enable debug)
+               $(use_with gnutls)
+               $(use_with netlink libnl)
+       )
+
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+       systemd_dounit systemd/[email protected]
+}

Reply via email to