gentoo/sys-libs/libnbd/files/libnbd-1.22.2-build-Remove-automagic-compiling-of-examples.patch
Christopher Byrne 7354829ce0
sys-libs/libnbd: add 1.22.2
Dropped test dependency on sys-block/nbd. The only dependency required
for test is sys-block/ndbkit. However, it will test sys-block/nbd and
app-emulation/qemu, if present.
The examples were automagically added, so made that a seperate use flag
Add Python 3.13 support
Add support for compiling rust binding
If support for a particular for a partical feature wasn't enabled, 0 tests
would be run for that, which while not fatal, produces a QA warning. Worked
around it by removing what isn't select in the top-level Makefile.am with
sed
Test calls certtool, go net-libs/gnutls[tools] required to test.

Closes: https://bugs.gentoo.org/884245
Closes: https://bugs.gentoo.org/884247
Closes: https://bugs.gentoo.org/926647
Closes: https://bugs.gentoo.org/938348
Closes: https://bugs.gentoo.org/938349
Closes: https://bugs.gentoo.org/946553
Closes: https://bugs.gentoo.org/952745
Closes: https://bugs.gentoo.org/955251

Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/40808
Signed-off-by: Sam James <sam@gentoo.org>
2025-06-26 21:01:57 +01:00

150 lines
4.9 KiB
Diff

From 53e0ade7f46525e048cea7bd321cdf370800e18a Mon Sep 17 00:00:00 2001
From: Christopher Byrne <salah.coronya@gmail.com>
Date: Sat, 14 Jun 2025 21:01:17 -0500
Subject: [PATCH 1/2] build: Remove automagic compiling of examples
---
Makefile.am | 4 +++
configure.ac | 93 +++++++++++++++++++++++++++++-----------------------
2 files changed, 56 insertions(+), 41 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 129e393..f31e067 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,6 +64,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 84ec09d..d27a605 100644
--- a/configure.ac
+++ b/configure.ac
@@ -308,57 +308,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], [
- printf "glib2 version is "; $PKG_CONFIG --modversion 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], [
+ printf "glib2 version is "; $PKG_CONFIG --modversion 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], [
- printf "libev version is "; $PKG_CONFIG --modversion 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], [
+ printf "libev version is "; $PKG_CONFIG --modversion 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],
@@ -378,6 +388,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]),
--
2.49.0