diff mbox

[OpenWrt-Devel] dnsmasq: Makefile fixes and cleanups

Message ID 1418926141-28959-1-git-send-email-fschaefer.oss@googlemail.com
State Rejected
Headers show

Commit Message

Frank Schäfer Dec. 18, 2014, 6:09 p.m. UTC
- DHCPv6 config option depends on IPV6
- DNSSEC config option needs to select libnettle
- do not install trust-anchors.conf if package compiled without DNSSEC support
- show build configuration options in a submenu and only if the package is enabled
- only provide a single (but configurable) package

Fixes commit a2558749e8 "dnsmasq: allow de-selecting features from -full variant".

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 package/network/services/dnsmasq/Makefile | 93 ++++++++-----------------------
 1 file changed, 23 insertions(+), 70 deletions(-)

Comments

Steven Barth Dec. 21, 2014, 1:21 p.m. UTC | #1
NAK, unless you deal with all the "dnsmasq-dhcpv6 and dnsmasq-full 
missing in opkg" tickets afterwards ;)

On a more serious note, some people depend on the precompiled stuff and 
they would probably not welcome that change all too much.
Frank Schäfer Dec. 21, 2014, 2:17 p.m. UTC | #2
Am 21.12.2014 um 14:21 schrieb Steven Barth:
> NAK, unless you deal with all the "dnsmasq-dhcpv6 and dnsmasq-full
> missing in opkg" tickets afterwards ;)
Following this argumentation, you can never change anything.

I'm confused.
Can we please come to a clear decision which way to go !?
Package variants or configurable package ?
My initial suggestion aimed at the first direction.
But then commit a2558749e8 has been accepted which goes the other direction.
Again, I'm fine with both approaches (I just don't think we should mix
them).

In any case, trunk needs to be fixed.

Regards,
Frank
diff mbox

Patch

diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index 2da593d..6ff6c37 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -9,7 +9,7 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.72
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
@@ -18,101 +18,62 @@  PKG_MD5SUM:=cf82f81cf09ad3d47612985012240483
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/dnsmasq/Default
+define Package/dnsmasq
   SECTION:=net
   CATEGORY:=Base system
   TITLE:=DNS and DHCP server
   URL:=http://www.thekelleys.org.uk/dnsmasq/
-endef
-
-define Package/dnsmasq
-$(call Package/dnsmasq/Default)
-  VARIANT:=nodhcpv6
-endef
-
-define Package/dnsmasq-dhcpv6
-$(call Package/dnsmasq/Default)
-  TITLE += (with DHCPv6 support)
-  DEPENDS:=@IPV6 +kmod-ipv6
-  VARIANT:=dhcpv6
-endef
-
-define Package/dnsmasq-full
-$(call Package/dnsmasq/Default)
-  TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPSET)
-  DEPENDS:=@IPV6 +kmod-ipv6 +libnettle
-  VARIANT:=full
+  DEPENDS:=+PACKAGE_dnsmasq_dnssec:libnettle
+  MENU:=1
 endef
 
 define Package/dnsmasq/description
   It is intended to provide coupled DNS and DHCP service to a LAN.
 endef
 
-define Package/dnsmasq-dhcpv6/description
-$(call Package/dnsmasq/description)
-
-This is a variant with DHCPv6 support
-endef
-
-define Package/dnsmasq-full/description
-$(call Package/dnsmasq/description)
-
-This is a variant with DHCPv6, DNSSEC, Authroitative DNS and IPSET support
-endef
-
 define Package/dnsmasq/conffiles
 /etc/config/dhcp
 /etc/dnsmasq.conf
+$(if $(CONFIG_PACKAGE_dnsmasq_dnssec),/usr/share/dnsmasq/trust-anchors.conf)
 endef
 
-define Package/dnsmasq/config/Default
-  if PACKAGE_$(1)-$(2)
-  config PACKAGE_dnsmasq_$(2)_dhcpv6
+define Package/dnsmasq/config
+  config PACKAGE_dnsmasq_dhcpv6
     bool "Build with DHCPv6 support."
+    depends on PACKAGE_dnsmasq
+    depends on IPV6
     default y
-  config PACKAGE_dnsmasq_$(2)_dnssec
+  config PACKAGE_dnsmasq_dnssec
     bool "Build with DNSSEC support."
+    depends on PACKAGE_dnsmasq
     default y
-  config PACKAGE_dnsmasq_$(2)_auth
+  config PACKAGE_dnsmasq_auth
     bool "Build with the facility to act as an authoritative DNS server."
+    depends on PACKAGE_dnsmasq
     default y
-  config PACKAGE_dnsmasq_$(2)_ipset
+  config PACKAGE_dnsmasq_ipset
     bool "Build with ipset support."
+    depends on PACKAGE_dnsmasq
     select PACKAGE_kmod-ipt-ipset
     default y
-  endif
 endef
 
-Package/dnsmasq-full/config=$(call Package/dnsmasq/config/Default,dnsmasq,full)
-
-Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
-Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
-
 TARGET_CFLAGS += -ffunction-sections -fdata-sections
 TARGET_LDFLAGS += -Wl,--gc-sections
 
 COPTS = $(if $(CONFIG_IPV6),,-DNO_IPV6)
-
-ifeq ($(BUILD_VARIANT),nodhcpv6)
-	COPTS += -DNO_DHCP6
-endif
-
-ifeq ($(BUILD_VARIANT),full)
-	COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \
-		$(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \
-		$(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \
-		$(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET)
-	COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,)
-else
-	COPTS += -DNO_AUTH -DNO_IPSET
-endif
+COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_dhcpv6),,-DNO_DHCP6) \
+	$(if $(CONFIG_PACKAGE_dnsmasq_dnssec),-DHAVE_DNSSEC,) \
+	$(if $(CONFIG_PACKAGE_dnsmasq_auth),,-DNO_AUTH) \
+	$(if $(CONFIG_PACKAGE_dnsmasq_ipset),,-DNO_IPSET)
+COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,)
 
 MAKE_FLAGS := \
 	$(TARGET_CONFIGURE_OPTS) \
@@ -131,16 +92,8 @@  define Package/dnsmasq/install
 	$(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
 	$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
 	$(INSTALL_DATA) ./files/dnsmasq.hotplug $(1)/etc/hotplug.d/iface/25-dnsmasq
-endef
-
-Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
-
-define Package/dnsmasq-full/install
-$(call Package/dnsmasq/install,$(1))
-	$(INSTALL_DIR) $(1)/usr/share/dnsmasq
-	$(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
+	$(if $(CONFIG_PACKAGE_dnsmasq_dnssec),$(INSTALL_DIR) $(1)/usr/share/dnsmasq)
+	$(if $(CONFIG_PACKAGE_dnsmasq_dnssec),$(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq)
 endef
 
 $(eval $(call BuildPackage,dnsmasq))
-$(eval $(call BuildPackage,dnsmasq-dhcpv6))
-$(eval $(call BuildPackage,dnsmasq-full))