sys-libs/libnbd: add 1.24.0

Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45370
Signed-off-by: Arsen Arsenović <arsen@gentoo.org>
This commit is contained in:
Christopher Byrne
2026-01-13 21:15:08 -06:00
committed by Arsen Arsenović
parent 217f3b1ce6
commit a3beee1fbd
5 changed files with 344 additions and 0 deletions

View File

@@ -2,3 +2,4 @@ DIST libnbd-1.18.1.tar.gz 1482736 BLAKE2B d3f0b2993fa1392df93b0bbc5d63805489ad1a
DIST libnbd-1.22.5.tar.gz 1574844 BLAKE2B ab3bdea1774c9aadd2613ac56ada0d8797c75186ec0f84980231f0ad4bf3f71cf4a0f909f160b33b8719c3eee993cf6e7151dddb6a427eeedfa0e605f5e93804 SHA512 5440f1755a4724265336d59af37aaba9e8426821689d045ce307316772ceb3e8d7840838b2a2f378db014e6927f4627fc3f33a58b24519e515af6474d0669bf2
DIST libnbd-1.23.4.tar.gz 1578765 BLAKE2B 5760ef9270c37a3ec8391183951612ea30becd79df6e4fd33719eadf95c823080770f291abe23c02482bfacee7f4f7097baf343c2bbc6ae797a5eb29cb30f51b SHA512 870615431885f6755808a33d287be57ec4b019199daf40a0643d5c6fe4d00d04424a82c55324106f07c96b4004896121654ab545a7c9e05c64728c2fa853f5d4
DIST libnbd-1.23.9.tar.gz 1594098 BLAKE2B af1448d4e071600d3c2e74b77131c00f79a30ac279be2782dc94da91bab16cdd47657cf53522d1ffb022075a0da0b54fd19a4ec86a44e87bfc73fffd0d2a5b1b SHA512 0ff4fa3aea2e841fe22990055e073afa7262781d764c05830a14cec64142d5c859411d6cf593f95c12a0a47eb38b1cd6f4bf969af0e229ccc6dc7b44641ede49
DIST libnbd-1.24.0.tar.gz 1621956 BLAKE2B c44ff4147a1166a3b165afdd6af85ab415e3d8d27dc27514f5a4cb814b8f6bd60d27a38e445bb4b2050338476daf2a1e691c02c93067c45383b45cfef4a8381f SHA512 db05b606a19b3efb6a53c05b5b7ea96571892b7540fff1f4df0c53d0f82e3817f724fd0aa665597b58a4613545b03d7df6e1ac8f3fa64c7f85e824ca2221f3ae

View File

@@ -0,0 +1,66 @@
diff --git a/Makefile.am b/Makefile.am
index d587a092..18df2ad1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,31 +42,50 @@ SUBDIRS = \
common/utils \
lib \
docs \
- examples \
valgrind \
. \
tests \
- python \
- sh \
info \
copy \
dump \
- fuse \
misc \
- ublk \
- ocaml \
- ocaml/examples \
- ocaml/tests \
- golang \
- golang/examples \
- rust \
interop \
fuzzing \
bash-completion \
$(NULL)
+if HAVE_FUSE
+SUBDIRS += fuse
+endif
+
+if HAVE_UBLK
+SUBDIRS += ublk
+endif
+
+if HAVE_GOLANG
+SUBDIRS += golang
+endif
+
+if HAVE_OCAML
+SUBDIRS += ocaml ocaml/tests
+endif
+
+if HAVE_PYTHON
+SUBDIRS += python sh
+endif
+
+if HAVE_RUST
+SUBDIRS += rust
+endif
+
if BUILD_EXAMPLES
SUBDIRS += examples
+if HAVE_OCAML
+SUBDIRS += ocaml/examples
+endif
+if HAVE_GOLANG
+SUBDIRS += golang/examples
+endif
endif
noinst_SCRIPTS = run

View File

@@ -0,0 +1,136 @@
diff --git a/Makefile.am b/Makefile.am
index 32213efa..d587a092 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,10 @@ SUBDIRS = \
bash-completion \
$(NULL)
+if BUILD_EXAMPLES
+SUBDIRS += examples
+endif
+
noinst_SCRIPTS = run
# Check no files are missing from EXTRA_DIST rules, and that all
diff --git a/configure.ac b/configure.ac
index 6c7cae8a..920625d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,57 +327,67 @@ AS_IF([test "$with_libxml2" != "no"],[
])
AM_CONDITIONAL([HAVE_LIBXML2], [test "x$LIBXML2_LIBS" != "x"])
+dnl Examples
+AC_ARG_ENABLE([examples],
+ [AS_HELP_STRING([--disable-examples],
+ [disable building of glib and libev examples @<:@default=check@:>@])],
+ [],
+ [with_examples=check])
+
+AS_IF([test "$enable_examples" != "no"],[
dnl glib2 main loop for examples that interoperate with the glib main loop.
-PKG_CHECK_MODULES([GLIB], [glib-2.0], [
- PRINT_PKG_VERSION([glib-2.0])
- AC_SUBST([GLIB_CFLAGS])
- AC_SUBST([GLIB_LIBS])
-],[
- AC_MSG_WARN([glib2 not found, some examples will not be compiled])
-])
-AM_CONDITIONAL([HAVE_GLIB], [test "x$GLIB_LIBS" != "x"])
+ PKG_CHECK_MODULES([GLIB], [glib-2.0], [
+ PRINT_PKG_VERSION([glib-2.0])
+ AC_SUBST([GLIB_CFLAGS])
+ AC_SUBST([GLIB_LIBS])
+ ], [
+ AC_MSG_WARN([glib2 not found, some examples will not be compiled])
+ ])
dnl libev support for examples that interoperate with libev event loop.
-PKG_CHECK_MODULES([LIBEV], [libev], [
- PRINT_PKG_VERSION(libev)
- AC_SUBST([LIBEV_CFLAGS])
- AC_SUBST([LIBEV_LIBS])
-],[
- dnl no pkg-config for libev, searching manually:
- AC_CHECK_HEADERS([ev.h], [
- AC_CHECK_LIB([ev], [ev_time], [
- AC_SUBST([LIBEV_LIBS], ["-lev"])
- ],
- [
- AC_MSG_WARN([libev not found, some examples will not be compiled])
- ])
- ],[
- AC_MSG_WARN([ev.h not found, some examples will not be compiled])
+ PKG_CHECK_MODULES([LIBEV], [libev], [
+ PRINT_PKG_VERSION(libev)
+ AC_SUBST([LIBEV_CFLAGS])
+ AC_SUBST([LIBEV_LIBS])
+ ],[
+dnl no pkg-config for libev, searching manually:
+ AC_CHECK_HEADERS([ev.h], [
+ AC_CHECK_LIB([ev], [ev_time], [
+ AC_SUBST([LIBEV_LIBS], ["-lev"])
+ ],
+ [
+ AC_MSG_WARN([libev not found, some examples will not be compiled])
+ ])
+ ],[
+ AC_MSG_WARN([ev.h not found, some examples will not be compiled])
+ ])
])
-])
-AS_IF([test "x$LIBEV_LIBS" != "x"], [
- old_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $LIBEV_CFLAGS -Werror=strict-aliasing -O2"
- AC_MSG_CHECKING([if the compiler is new enough for good aliasing rules])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([
- #include <ev.h>
-
- static void cb (struct ev_loop *l, ev_timer *t, int e) { }
- static ev_timer timer;
+ AS_IF([test "x$LIBEV_LIBS" != "x"], [
+ old_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $LIBEV_CFLAGS -Werror=strict-aliasing -O2"
+ AC_MSG_CHECKING([if the compiler is new enough for good aliasing rules])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+ #include <ev.h>
+
+ static void cb (struct ev_loop *l, ev_timer *t, int e) { }
+ static ev_timer timer;
+ ], [
+ ev_timer_init (&timer, cb, 0, .1);
+ ])
], [
- ev_timer_init (&timer, cb, 0, .1);
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ LIBEV_CFLAGS="$LIBEV_CFLAGS -Wno-strict-aliasing"
])
- ], [
- AC_MSG_RESULT([yes])
- ], [
- AC_MSG_RESULT([no])
- LIBEV_CFLAGS="$LIBEV_CFLAGS -Wno-strict-aliasing"
+ CFLAGS="$old_CFLAGS"
])
- CFLAGS="$old_CFLAGS"
])
+AM_CONDITIONAL([HAVE_GLIB], [test "x$GLIB_LIBS" != "x"])
AM_CONDITIONAL([HAVE_LIBEV], [test "x$LIBEV_LIBS" != "x"])
+AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$enable_examples" != "xno" ])
dnl FUSE 3 is optional to build the nbdfuse program.
AC_ARG_ENABLE([fuse],
@@ -397,6 +407,7 @@ AS_IF([test "x$enable_fuse" != "xno"],[
])
AM_CONDITIONAL([HAVE_FUSE],[test "x$enable_fuse" != "xno"])
+
dnl libublksrv is optional to build the nbdublk program.
AC_ARG_ENABLE([ublk],
AS_HELP_STRING([--disable-ublk], [disable ublk (nbdublk) support]),

View File

@@ -0,0 +1,25 @@
diff --git a/configure.ac b/configure.ac
index 6c7cae8a..dafcf606 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,8 +275,6 @@ AS_IF([test "$GNUTLS_LIBS" != ""],[
[tls_priority=$withval],
[tls_priority=NORMAL])
AC_MSG_RESULT([$tls_priority])
- AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
- [Default TLS session priority string])
# Check for working <gnutls/socket.h>. This is only needed for
# gnutls 3.7.9 and no other version (unfortunately used by Debian
@@ -299,6 +297,11 @@ AS_IF([test "$GNUTLS_LIBS" != ""],[
LIBS="$old_LIBS"
])
+dnl Define unconditionally because TLS_PRIORITY must be defined to
+dnl compile, even if GNUTLS support isn't enabled
+AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
+ [Default TLS session priority string])
+
dnl certtool (part of GnuTLS) for testing TLS with certificates.
dnl macOS has its own program called certtool and packages the
dnl GnuTLS tool as "gnutls-certtool".

View File

@@ -0,0 +1,116 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..14} )
inherit autotools bash-completion-r1 dot-a python-single-r1
MY_PV_1="$(ver_cut 1-2)"
MY_PV_2="$(ver_cut 2)"
[[ $(( ${MY_PV_2} % 2 )) -eq 0 ]] && SD="stable" || SD="development"
DESCRIPTION="NBD client library in userspace"
HOMEPAGE="https://gitlab.com/nbdkit/libnbd"
SRC_URI="https://download.libguestfs.org/libnbd/${MY_PV_1}-${SD}/${P}.tar.gz"
LICENSE="LGPL-2.1+"
SLOT="0"
KEYWORDS="~amd64 ~loong ~ppc64 ~sparc ~x86"
IUSE="examples fuse gnutls go ocaml python test"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
RESTRICT="!test? ( test )"
# libxml2 - URI support
RDEPEND="
dev-libs/libxml2:=
examples? ( dev-libs/glib
dev-libs/libev )
fuse? ( sys-fs/fuse:3 )
gnutls? ( net-libs/gnutls:= )
go? ( dev-lang/go )
ocaml? ( >=dev-lang/ocaml-4.03:=[ocamlopt] )
python? ( ${PYTHON_DEPS} )
"
DEPEND="
${RDEPEND}
ocaml? ( dev-ml/findlib )
test? ( sys-block/nbdkit[gnutls?]
net-libs/gnutls:=[tools]
ocaml? ( dev-ml/findlib[ocamlopt] )
)
"
BDEPEND="dev-lang/perl"
PATCHES=(
"${FILESDIR}/${PN}-1.24.0-build-Remove-automagic-compiling-of-examples.patch"
"${FILESDIR}/${PN}-1.24.0-Makefile.am-Conditionally-compile-some-SUBDIRS.patch"
"${FILESDIR}/${PN}-1.24.0-build-define-TLS_PRIORITY-unconditionally.patch"
"${FILESDIR}/${PN}-1.22.5-which-hunt.patch"
)
pkg_setup() {
if use python; then
python_setup
fi
}
src_prepare() {
default
# Some tests require impossible to provide features, such as fuse.
# These are marked by requires_... in the functions.sh shell
# library. Rather than listing these tests, let's list out the
# impossible to support features and make them skip.
cat <<-EOF >> tests/functions.sh.in || die
requires_fuse ()
{
requires false
}
EOF
# Broken under sandbox.
cat <<-EOF > lib/test-fork-safe-execvpe.sh || die
#!/bin/sh
:
EOF
eautoreconf
}
src_configure() {
# /usr/lib64/ocaml/nbd/libmlnbd.a
# /usr/lib64/ocaml/stublibs/dllmlnbd.so
use ocaml && lto-guarantee-fat
local myeconfargs=(
$(use_enable examples)
$(use_enable fuse)
$(use_enable go golang)
$(use_enable ocaml)
$(use_enable python)
$(use_with gnutls)
$(use_with !gnutls with-tls-priority NORMAL)
--disable-rust
--disable-ublk # Not in portage
--with-libxml2
)
export bashcompdir="$(get_bashcompdir)"
econf "${myeconfargs[@]}"
}
src_install() {
default
use fuse || bashcomp_alias nbdsh nbdfuse
bashcomp_alias nbdsh nbdublk
use ocaml && strip-lto-bytecode
find "${ED}" -name '*.la' -delete || die
use python && python_optimize
}