You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.4 KiB

  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=miniupnpd
  9. PKG_SOURCE_PROTO:=git
  10. PKG_SOURCE_URL:=https://github.com/miniupnp/miniupnp.git
  11. PKG_SOURCE_DATE:=2022-08-31
  12. PKG_SOURCE_VERSION:=68c8ec508a421f4f4af67a63e3eb6f497d2531e1
  13. PKG_MIRROR_HASH:=68a3170ec73149c4cf4855b1ce6e031557cc12bff85a58421bb94785daaf225d
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)/miniupnpd
  15. PKG_RELEASE:=1
  16. PKG_MAINTAINER:=
  17. PKG_LICENSE:=BSD-3-Clause
  18. PKG_LICENSE_FILES:=LICENSE
  19. PKG_CPE_ID:=cpe:/a:miniupnp_project:miniupnpd
  20. PKG_INSTALL:=1
  21. PKG_BUILD_PARALLEL:=1
  22. include $(INCLUDE_DIR)/package.mk
  23. include $(INCLUDE_DIR)/version.mk
  24. TAR_OPTIONS+= --strip-components 1
  25. TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS)
  26. define Package/miniupnpd/Default
  27. SECTION:=net
  28. CATEGORY:=Network
  29. DEPENDS:= \
  30. +libcap-ng \
  31. +libmnl \
  32. +libuuid
  33. PROVIDES:=miniupnpd
  34. TITLE:=Lightweight UPnP IGD, NAT-PMP & PCP daemon
  35. SUBMENU:=Firewall
  36. URL:=https://miniupnp.tuxfamily.org/
  37. endef
  38. define Package/miniupnpd-iptables
  39. $(call Package/miniupnpd/Default)
  40. DEPENDS+= \
  41. +IPV6:ip6tables \
  42. +IPV6:libip6tc \
  43. +iptables \
  44. +libip4tc \
  45. +libnetfilter-conntrack
  46. TITLE+= (iptables)
  47. VARIANT:=iptables
  48. endef
  49. define Package/miniupnpd-nftables
  50. $(call Package/miniupnpd/Default)
  51. DEPENDS+= \
  52. +libnftnl
  53. TITLE+= (nftables)
  54. VARIANT:=nftables
  55. DEFAULT_VARIANT:=1
  56. CONFLICTS:=miniupnpd-iptables
  57. endef
  58. define Package/miniupnpd/conffiles/Default
  59. /etc/config/upnpd
  60. endef
  61. Package/miniupnpd-iptables/conffiles = $(Package/miniupnpd/conffiles/Default)
  62. Package/miniupnpd-nftables/conffiles = $(Package/miniupnpd/conffiles/Default)
  63. define Build/Prepare
  64. $(call Build/Prepare/Default)
  65. echo "$(VERSION_NUMBER)" | tr '() ' '_' >$(PKG_BUILD_DIR)/os.openwrt
  66. endef
  67. CONFIGURE_ARGS = \
  68. $(if $(CONFIG_IPV6),--ipv6) \
  69. --igd2 \
  70. --leasefile \
  71. --portinuse \
  72. --firewall=$(BUILD_VARIANT) \
  73. --disable-fork
  74. TARGET_CFLAGS += $(FPIC)
  75. TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
  76. ifeq ($(BUILD_VARIANT),iptables)
  77. TARGET_CFLAGS += -flto
  78. endif
  79. define Package/miniupnpd/install/Default
  80. $(INSTALL_DIR) $(1)/usr/sbin
  81. $(INSTALL_DIR) $(1)/etc/init.d
  82. $(INSTALL_DIR) $(1)/etc/config
  83. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  84. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/miniupnpd $(1)/usr/sbin/miniupnpd
  85. $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
  86. $(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
  87. $(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/iface/50-miniupnpd
  88. endef
  89. define Package/miniupnpd-iptables/install
  90. $(call Package/miniupnpd/install/Default,$1)
  91. $(INSTALL_DIR) $(1)/etc/uci-defaults
  92. $(INSTALL_DIR) $(1)/usr/share/miniupnpd
  93. $(INSTALL_BIN) ./files/miniupnpd.defaults.iptables $(1)/etc/uci-defaults/99-miniupnpd
  94. $(INSTALL_DATA) ./files/firewall3.include $(1)/usr/share/miniupnpd/firewall.include
  95. endef
  96. define Package/miniupnpd-nftables/install
  97. $(call Package/miniupnpd/install/Default,$1)
  98. $(INSTALL_DIR) $(1)/etc/uci-defaults
  99. $(INSTALL_DIR) $(1)/usr/share/miniupnpd
  100. $(INSTALL_BIN) ./files/miniupnpd.defaults.nftables $(1)/etc/uci-defaults/99-miniupnpd
  101. $(INSTALL_DATA) ./files/firewall4.include $(1)/usr/share/miniupnpd/firewall.include
  102. $(INSTALL_DIR) $(1)/usr/share/nftables.d
  103. $(CP) ./files/nftables.d/* $(1)/usr/share/nftables.d/
  104. endef
  105. $(eval $(call BuildPackage,miniupnpd-iptables))
  106. $(eval $(call BuildPackage,miniupnpd-nftables))