sys-block/nbd: Added live ebuild.
authorLars Wendler <polynomial-c@gentoo.org>
Tue, 17 Apr 2018 13:28:40 +0000 (15:28 +0200)
committerLars Wendler <polynomial-c@gentoo.org>
Tue, 17 Apr 2018 13:29:46 +0000 (15:29 +0200)
Package-Manager: Portage-2.3.29, Repoman-2.3.9

sys-block/nbd/files/nbd-3.17-automagic.patch [new file with mode: 0644]
sys-block/nbd/metadata.xml
sys-block/nbd/nbd-9999.ebuild [new file with mode: 0644]

diff --git a/sys-block/nbd/files/nbd-3.17-automagic.patch b/sys-block/nbd/files/nbd-3.17-automagic.patch
new file mode 100644 (file)
index 0000000..4ece535
--- /dev/null
@@ -0,0 +1,84 @@
+From 55c225b53c24b0ae93f49d5f004291da8c265870 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Mon, 9 Apr 2018 11:26:06 +0200
+Subject: [PATCH] Don't make gnutls and libnl automagic
+
+Introduce --without-gnutls and --without-libnl configure options so that
+users can disable gnutls/libnl even if the packages are available on the
+system. The default is unchanged from before this patch. If no
+--with(out)-* option has been given on the command line, the macro looks
+for presence and uses the packages if found.
+---
+ configure.ac | 47 ++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 38 insertions(+), 9 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index cdb4af3..4b76007 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -212,10 +212,25 @@ dnl              ;;
+ dnl   esac
+ dnl fi
+-PKG_CHECK_MODULES(GnuTLS, [gnutls >= 2.12.0],[HAVE_GNUTLS=1],[HAVE_GNUTLS=0])
+-if test x$HAVE_GNUTLS = x1; then
+-      AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if you have a GnuTLS version of 2.12 or above])
++AC_ARG_WITH([gnutls],
++      [AS_HELP_STRING([--without-gnutls],
++              [do not use gnutls])],
++      [],
++      [with_gnutls=check]
++)
++if test "x$with_gnutls" != "xno"; then
++      PKG_CHECK_MODULES(GnuTLS, [gnutls >= 2.12.0],
++              [HAVE_GNUTLS=1
++              AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if you have a GnuTLS version of 2.12 or above])],
++              [if test "x$with_gnutls" = "xyes"; then
++                      AC_MSG_ERROR([--with-gnutls given but cannot find gnutls])
++              else
++                      HAVE_GNUTLS=0
++                      AC_DEFINE(HAVE_GNUTLS, 0)
++              fi]
++      )
+ else
++      HAVE_GNUTLS=0
+       AC_DEFINE(HAVE_GNUTLS, 0)
+ fi
+ AM_CONDITIONAL([GNUTLS], [test "x$HAVE_GNUTLS" = "x1"])
+@@ -294,13 +309,27 @@ AC_PREPROC_IFELSE(
+       [AC_MSG_RESULT([yes]); NEED_BSD_SOURCE=1])
+ AC_DEFINE([NEED_BSD_SOURCE], $NEED_BSD_SOURCE, [Define to 1 if _BSD_SOURCE needs to be defined before certain inclusions])
+-PKG_CHECK_MODULES(LIBNL3, libnl-genl-3.0 >= 3.1, [have_libnl3=yes], [have_libnl3=no])
+-if test "${have_libnl3}" = "yes"
+-then
+-      AC_DEFINE(HAVE_NETLINK, 1, [Define to 1 if we have netlink support])
+-      CFLAGS+=" $LIBNL3_CFLAGS"
+-      LIBS+=" $LIBNL3_LIBS"
++AC_ARG_WITH([libnl],
++      [AS_HELP_STRING([--without-libnl],
++              [do not use libnl])],
++      [],
++      [with_libnl=check]
++)
++if test "x$with_libnl" != "xno"; then
++      PKG_CHECK_MODULES(LIBNL3, libnl-genl-3.0 >= 3.1,
++              [HAVE_NETLINK=1
++              AC_DEFINE(HAVE_NETLINK, 1, [Define to 1 if we have netlink support])
++              CFLAGS+=" $LIBNL3_CFLAGS"
++              LIBS+=" $LIBNL3_LIBS"],
++              [if test "x$with_libnl" = "xyes"; then
++                      AC_MSG_ERROR([--with-libnl given but cannot find libnl])
++              else
++                      HAVE_NETLINK=0
++                      AC_DEFINE(HAVE_NETLINK, 0)
++              fi]
++      )
+ else
++      HAVE_NETLINK=0
+       AC_DEFINE(HAVE_NETLINK, 0, [Define to 1 if we have netlink support])
+ fi
+-- 
+2.17.0
+
index f583809ec4770597ddac7b68677380b9d224c0f0..e233f07bc3f4ce04102e4e13e897f6c1b6451be2 100644 (file)
@@ -5,6 +5,9 @@
        <email>base-system@gentoo.org</email>
        <name>Gentoo Base System</name>
 </maintainer>
+<use>
+       <flag name="netlink">Add support for netlink protocol via <pkg>dev-libs/libnl</pkg></flag>
+</use>
 <upstream>
        <remote-id type="sourceforge">nbd</remote-id>
 </upstream>
diff --git a/sys-block/nbd/nbd-9999.ebuild b/sys-block/nbd/nbd-9999.ebuild
new file mode 100644 (file)
index 0000000..1117aff
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Userland client/server for kernel network block device"
+HOMEPAGE="http://nbd.sourceforge.net/"
+if [[ "${PV}" = 9999 ]] ; then
+       inherit autotools git-r3
+       EGIT_REPO_URI="https://github.com/NetworkBlockDevice/nbd.git"
+else
+       SRC_URI="mirror://sourceforge/nbd/${P}.tar.xz"
+       KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+fi
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="debug gnutls netlink zlib"
+
+# gnutls is an automagic dep.
+RDEPEND="
+       >=dev-libs/glib-2.26.0
+       gnutls? ( >=net-libs/gnutls-2.12.0 )
+       netlink? ( >=dev-libs/libnl-3.1 )
+       zlib? ( sys-libs/zlib )
+"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+"
+
+if [[ "${PV}" = 9999 ]] ; then
+       DEPEND+="
+               app-text/docbook-sgml-dtd:4.5
+               app-text/docbook-sgml-utils
+       "
+fi
+
+PATCHES=(
+       "${FILESDIR}/${PN}-3.17-automagic.patch"
+)
+
+src_prepare() {
+       default
+       if [[ "${PV}" = 9999 ]] ; then
+               emake -C man -f Makefile.am \
+                       nbd-server.1.sh.in \
+                       nbd-server.5.sh.in \
+                       nbd-client.8.sh.in \
+                       nbd-trdump.1.sh.in \
+                       nbdtab.5.sh.in
+               emake -C systemd -f Makefile.am nbd@.service.sh.in
+               eautoreconf
+       fi
+}
+
+src_configure() {
+       local myeconfargs=(
+               --enable-lfs
+               $(use_enable !debug syslog)
+               $(use_enable debug)
+               $(use_enable zlib gznbd)
+               $(use_with gnutls)
+               $(use_with netlink libnl)
+       )
+       econf "${myeconfargs[@]}"
+}