Skip to content

Commit

Permalink
unbound: add compile options to library and daemon
Browse files Browse the repository at this point in the history
Two seperate package names were chosen instead of menu selected options
because dependents need a ready (large) package in release directory.

Signed-off-by: Eric Luehrsen <ericluehrsen@gmail.com>
  • Loading branch information
EricLuehrsen authored and yousong committed May 28, 2019
1 parent f1d1530 commit e681232
Showing 1 changed file with 117 additions and 55 deletions.
172 changes: 117 additions & 55 deletions net/unbound/Makefile
Expand Up @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=unbound
PKG_VERSION:=1.9.1
PKG_RELEASE:=3
PKG_RELEASE:=4

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.unbound.net/downloads
PKG_SOURCE_URL:=https://nlnetlabs.nl/downloads/unbound
PKG_HASH:=c3c0bf9b86ccba4ca64f93dd4fe7351308ab54293f297a67de5a8914c1dc59c5

PKG_MAINTAINER:=Eric Luehrsen <ericluehrsen@gmail.com>
Expand All @@ -23,49 +23,102 @@ PKG_CPE_ID:=cpe:/a:nlnetlabs:unbound
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/unbound/Default
TITLE:=Validating Recursive DNS Server
URL:=https://www.unbound.net/
DEPENDS:=+libopenssl +@OPENSSL_WITH_EC
endef

define Package/unbound
$(call Package/unbound/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
USERID:=unbound:unbound
TITLE+= (daemon)
TITLE:=Recursive DNS Server
URL:=https://nlnetlabs.nl/projects/unbound/about
DEPENDS:=+libopenssl +@OPENSSL_WITH_EC
endef

define Package/unbound-daemon
$(call Package/unbound/Default)
TITLE+= (daemon, light traffic)
DEPENDS+= +libunbound
VARIANT:=light
endef

define Package/unbound-daemon/description
This package contains the Unbound daemon with basic includes
necessary to meet the needs of UCI/LuCI configuration optoins.
endef

define Package/unbound/description
This package contains the Unbound daemon.
define Package/unbound-daemon-heavy
$(call Package/unbound/Default)
TITLE+= (daemon, heavy traffic)
URL:=https://nlnetlabs.nl/documentation/unbound/howto-optimise
DEPENDS+= +libunbound-heavy +libpthread +libevent2 +libevent2-pthreads
VARIANT:=heavy
PROVIDES:=unbound-daemon

This comment has been minimized.

Copy link
@jow-

jow- Jun 23, 2019

Contributor

This will not work with opkg unless you rename the existing unbound-daemon to something else, e.g. unbound-daemon-light and have it set PROVIDES:=unbound-daemon as well.

The way it is now, users are left with no way to tell opkg which provider of unbound-daemon to choose (the physical one or the virtual provided one) and as it looks, opkg appears to favor the unbound-daemon-heavy one on opkg install unbound-daemon.

endef

define Package/unbound-daemon-heavy/description
This package contains the Unbound daemon including 'libevent' and
'libpthread' to better handle large networks with heavy query loads.
endef

define Package/libunbound
$(call Package/unbound/Default)
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=Networking
TITLE+= (library, light traffic)
VARIANT:=light
DEFAULT_VARIANT:=1
endef

define Package/libunbound/description
This package contains the Unbound shared library with basic includes
necessary to meet the needs of UCI/LuCI configuration optoins.
endef

define Package/libunbound-heavy
$(call Package/unbound/Default)
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=Networking
TITLE+= (library, heavy traffic)
URL:=https://nlnetlabs.nl/documentation/unbound/howto-optimise
DEPENDS+= +libpthread +libevent2 +libevent2-pthreads
VARIANT:=heavy
PROVIDES:=libunbound
endef

define Package/libunbound-heavy/description
This package contains the Unbound shared library including 'libevent' and
'libpthread' to better handle large networks with heavy query loads.
endef

define Package/unbound-anchor
$(call Package/unbound/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE+= (DSKEY utility)
DEPENDS+= +unbound +libexpat
TITLE+= (root DSKEY)
DEPENDS+= +unbound-daemon +libexpat
endef

define Package/unbound-anchor/description
This package contains the Unbound anchor utility.
endef

define Package/unbound-checkconf
$(call Package/unbound/Default)
TITLE+= (config checker)
DEPENDS+= +unbound-daemon
endef

define Package/unbound-checkconf/description
This package contains the Unbound DNS configuration checker utility.
endef

define Package/unbound-control
$(call Package/unbound/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE+= (control utility)
DEPENDS+= +unbound
TITLE+= (remote control)
DEPENDS+= +unbound-daemon
endef

define Package/unbound-control/description
Expand All @@ -74,9 +127,6 @@ endef

define Package/unbound-control-setup
$(call Package/unbound/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE+= (control setup)
DEPENDS+= +unbound-control +openssl-util
endef
Expand All @@ -87,29 +137,14 @@ endef

define Package/unbound-host
$(call Package/unbound/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE+= (lookup utility)
TITLE+= (DNS lookup)
DEPENDS+= +libunbound
endef

define Package/unbound-host/description
This package contains the Unbound DNS lookup utility.
endef

define Package/libunbound
$(call Package/unbound/Default)
SECTION:=libs
CATEGORY:=Libraries
TITLE+= (library)
DEPENDS+= +libpthread
endef

define Package/libunbound/description
This package contains the Unbound shared library.
endef

CONFIGURE_ARGS += \
--disable-dsa \
--disable-gost \
Expand All @@ -124,26 +159,41 @@ CONFIGURE_ARGS += \
--with-conf-file=/var/lib/unbound/unbound.conf \
--with-pidfile=/var/run/unbound.pid

define Package/unbound/conffiles
ifeq ($(BUILD_VARIANT),heavy)
CONFIGURE_ARGS += \
--with-pthreads \
--with-libevent="$(STAGING_DIR)/usr" \
--enable-event-api
else
CONFIGURE_ARGS += \
--without-pthreads \
--without-solaris-threads \
--without-libevent
endif

define Package/unbound-daemon/conffiles
/etc/config/unbound
/etc/unbound/unbound.conf
/etc/unbound/unbound_ext.conf
/etc/unbound/unbound_srv.conf
endef

Package/unbound-daemon-heavy/conffiles = $(Package/unbound-daemon/conffiles)

define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/unbound.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libunbound.{so*,a,la} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/unbound.h $(1)/usr/include/
ifeq ($(BUILD_VARIANT),heavy)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/unbound-event.h $(1)/usr/include/
endif
endef

define Package/unbound/install
define Package/unbound-daemon/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) \
$(PKG_INSTALL_DIR)/usr/sbin/unbound \
$(PKG_INSTALL_DIR)/usr/sbin/unbound-checkconf \
$(1)/usr/sbin/
$(PKG_INSTALL_DIR)/usr/sbin/unbound $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/unbound
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/var/lib/unbound/unbound.conf \
Expand All @@ -167,11 +217,25 @@ define Package/unbound/install
$(INSTALL_DATA) ./files/unbound.sh $(1)/usr/lib/unbound/unbound.sh
endef

Package/unbound-daemon-heavy/install = $(Package/unbound-daemon/install)

define Package/libunbound/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libunbound.so.* $(1)/usr/lib/
endef

Package/libunbound-heavy/install = $(Package/libunbound/install)

define Package/unbound-anchor/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-anchor $(1)/usr/sbin/
endef

define Package/unbound-checkconf/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-checkconf $(1)/usr/sbin/
endef

define Package/unbound-control/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-control $(1)/usr/sbin/
Expand All @@ -187,15 +251,13 @@ define Package/unbound-host/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-host $(1)/usr/sbin/
endef

define Package/libunbound/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libunbound.so.* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,unbound))
$(eval $(call BuildPackage,unbound-daemon))
$(eval $(call BuildPackage,unbound-daemon-heavy))
$(eval $(call BuildPackage,libunbound))
$(eval $(call BuildPackage,libunbound-heavy))
$(eval $(call BuildPackage,unbound-anchor))
$(eval $(call BuildPackage,unbound-checkconf))
$(eval $(call BuildPackage,unbound-control))
$(eval $(call BuildPackage,unbound-control-setup))
$(eval $(call BuildPackage,unbound-host))
$(eval $(call BuildPackage,libunbound))

0 comments on commit e681232

Please sign in to comment.