blob: b1d9c5e6fa626b367a33d19adebf1fe30a86fdc1 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001include $(TOPDIR)/rules.mk
2
3PKG_NAME:=nginx-util
4PKG_VERSION:=1.6
5PKG_RELEASE:=1
6PKG_MAINTAINER:=Peter Stadler <peter.stadler@student.uibk.ac.at>
7
8include $(INCLUDE_DIR)/package.mk
9include $(INCLUDE_DIR)/cmake.mk
10
11CMAKE_OPTIONS+= -DUBUS=y
12CMAKE_OPTIONS+= -DVERSION=$(PKG_VERSION)
13
14
15define Package/nginx-ssl-util/default
16 SECTION:=net
17 CATEGORY:=Network
18 SUBMENU:=Web Servers/Proxies
19 TITLE:=Nginx configurator including SSL
20 DEPENDS:=+libstdcpp +libuci +libubus +libubox +libpthread +libopenssl
21 # TODO: remove after a transition period (together with below and pkg nginx):
22 # It actually removes nginx-util (replacing it by a dummy pkg) to avoid
23 # conflicts with nginx-ssl-util*
24 DEPENDS+= +nginx-util
25 EXTRA_DEPENDS:=nginx-util (>=1.4-2)
26endef
27
28
29define Package/nginx-ssl-util
30 $(Package/nginx-ssl-util/default)
31 TITLE+= (using PCRE)
32 DEPENDS+= +libpcre
33 CONFLICTS:=nginx-ssl-util-nopcre,
34endef
35
36
37define Package/nginx-ssl-util-nopcre
38 $(Package/nginx-ssl-util/default)
39 TITLE+= (using <regex>)
40 CONFLICTS:=nginx-ssl-util
41endef
42
43
44define Package/nginx-ssl-util/default/description
45 Utility that builds dynamically LAN listen directives for Nginx.
46 Furthermore, it manages SSL directives for its server parts and can create
47 corresponding (self-signed) certificates.
48endef
49
50
51Package/nginx-ssl-util/description = \
52 $(Package/nginx-ssl-util/default/description) \
53 It uses the PCRE library for performance.
54
55
56Package/nginx-ssl-util-nopcre/description = \
57 $(Package/nginx-ssl-util/default/description) \
58 It uses the standard regex library of C++.
59
60
61define Package/nginx-ssl-util/install/default
62 $(INSTALL_DIR) $(1)/etc/nginx/conf.d/
63
64 $(INSTALL_CONF) ./files/uci.conf.template $(1)/etc/nginx/
65 $(LN) /var/lib/nginx/uci.conf $(1)/etc/nginx/uci.conf
66
67 $(INSTALL_CONF) ./files/restrict_locally $(1)/etc/nginx/
68
69 $(INSTALL_DIR) $(1)/etc/config/
70 $(INSTALL_CONF) ./files/nginx.config $(1)/etc/config/nginx
71
72ifneq ($(CONFIG_IPV6),y) # the used IPv6 directives have `::` in them:
73 $(SED) "/::/d" $(1)/etc/nginx/restrict_locally
74 $(SED) "/::/d" $(1)/etc/config/nginx
75endif
76endef
77
78
79define Package/nginx-ssl-util/install
80 $(call Package/nginx-ssl-util/install/default, $(1))
81 $(INSTALL_DIR) $(1)/usr/bin
82 $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-ssl-util $(1)/usr/bin/nginx-util
83endef
84
85
86define Package/nginx-ssl-util-nopcre/install
87 $(call Package/nginx-ssl-util/install/default, $(1))
88 $(INSTALL_DIR) $(1)/usr/bin
89 $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-ssl-util-nopcre \
90 $(1)/usr/bin/nginx-util
91endef
92
93
94define Package/nginx-ssl-util/prerm
95#!/bin/sh
96
97[ -n "$${IPKG_INSTROOT}" ] && exit 0
98[ "$${PKG_UPGRADE}" = "1" ] && exit 0
99case "$$(/sbin/uci get "nginx.global.uci_enable" 2>/dev/null)" in
100 1|on|true|yes|enabled) ;;
101 *) exit 0;;
102esac
103
104eval "$$(/usr/bin/nginx-util get_env)" &&
105[ "$$(/sbin/uci get "nginx.$${LAN_NAME}.$${MANAGE_SSL}" 2>/dev/null)" = \
106 "self-signed" ] &&
107cd "/etc/nginx" &&
108rm -f "$$(/sbin/uci get "nginx.$${LAN_NAME}.ssl_certificate")" \
109 "$$(/sbin/uci get "nginx.$${LAN_NAME}.ssl_certificate_key")"
110
111exit 0
112endef
113
114
115Package/nginx-ssl-util-nopcre/prerm = $(Package/nginx-ssl-util/prerm)
116
117
118$(eval $(call BuildPackage,nginx-ssl-util))
119$(eval $(call BuildPackage,nginx-ssl-util-nopcre))
120
121
122# TODO: remove after a transition period (together with above and pkg nginx):
123# It replaces nginx-util by a dummy pkg for a smooth upgrade of nginx*
124
125define Package/nginx-util
126 TITLE:=Dummy package for removing nginx-util when upgrading.
127 DEPENDS:=+libstdcpp +libubus +libubox +libpthread
128 PKGARCH:=all
129endef
130
131define Package/nginx-util/install
132 $(INSTALL_DIR) $(1)/usr/bin
133endef
134
135$(eval $(call BuildPackage,nginx-util))