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