miniupnpd: igdv1 & igdv2 compatibility as separate packages

Build miniupnpd as two package variants, default is IGDv1
compatibility, igdv2 variant enables IGDv2 compatibility.

IGDv2 has backwards compatibility issues, notably with Microsoft
products and whilst miniupnpd can be built with IGDv2 disabled, until
recently the default had it enabled.  Two package variants allow the end
user to choose without getting into building own packages.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
This commit is contained in:
Kevin Darbyshire-Bryant 2017-07-04 14:45:12 +01:00
parent c2a2489a53
commit b9de06d696

View file

@ -18,9 +18,12 @@ PKG_HASH:=9677aeccadf73b4bf8bb9d832c32b5da8266b4d58eed888f3fd43d7656405643
PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi> PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Package/miniupnpd define Package/miniupnpd/Default
SECTION:=net SECTION:=net
CATEGORY:=Network CATEGORY:=Network
DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libuuid DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libuuid
@ -29,17 +32,28 @@ define Package/miniupnpd
URL:=http://miniupnp.free.fr/ URL:=http://miniupnp.free.fr/
endef endef
define Package/miniupnpd/config define Package/miniupnpd-igdv1
config MINIUPNPD_IGDv2 $(call Package/miniupnpd/Default)
bool TITLE += IGDv1
default n VARIANT:=noigdv2
prompt "Enable IGDv2" PROVIDES:=miniupnpd
DEFAULT_VARIANT:=1
endef
define Package/miniupnpd-igdv2
$(call Package/miniupnpd/Default)
TITLE += IGDv2
VARIANT:=igdv2
PROVIDES:=miniupnpd
endef endef
define Package/miniupnpd/conffiles define Package/miniupnpd/conffiles
/etc/config/upnpd /etc/config/upnpd
endef endef
Package/miniupnpd-igdv1/conffiles = $(Package/miniupnpd/conffiles)
Package/miniupnpd-igdv2/conffiles = $(Package/miniupnpd/conffiles)
define Package/miniupnpd/postinst define Package/miniupnpd/postinst
#!/bin/sh #!/bin/sh
@ -56,6 +70,12 @@ define Build/Prepare
echo "OpenWrt" | tr \(\)\ _ >$(PKG_BUILD_DIR)/os.openwrt echo "OpenWrt" | tr \(\)\ _ >$(PKG_BUILD_DIR)/os.openwrt
endef endef
VARIANT_CONFIG_OPTS=
ifeq ($(BUILD_VARIANT),igdv2)
VARIANT_CONFIG_OPTS+= --igd2
endif
MAKE_FLAGS += \ MAKE_FLAGS += \
TARGET_OPENWRT=1 TEST=0 \ TARGET_OPENWRT=1 TEST=0 \
LIBS="" \ LIBS="" \
@ -63,7 +83,7 @@ MAKE_FLAGS += \
-lip4tc $(if $(CONFIG_IPV6),-lip6tc) -luuid" \ -lip4tc $(if $(CONFIG_IPV6),-lip6tc) -luuid" \
CONFIG_OPTIONS="--portinuse --leasefile \ CONFIG_OPTIONS="--portinuse --leasefile \
$(if $(CONFIG_IPV6),--ipv6) \ $(if $(CONFIG_IPV6),--ipv6) \
$(if $(CONFIG_MINIUPNPD_IGDv2),--igd2)" \ $(VARIANT_CONFIG_OPTS)" \
-f Makefile.linux \ -f Makefile.linux \
miniupnpd miniupnpd
@ -78,4 +98,8 @@ define Package/miniupnpd/install
$(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/miniupnpd/firewall.include $(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/miniupnpd/firewall.include
endef endef
$(eval $(call BuildPackage,miniupnpd)) Package/miniupnpd-igdv1/install = $(Package/miniupnpd/install)
Package/miniupnpd-igdv2/install = $(Package/miniupnpd/install)
$(eval $(call BuildPackage,miniupnpd-igdv1))
$(eval $(call BuildPackage,miniupnpd-igdv2))