b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2012-2016 OpenWrt.org |
| 3 | # |
| 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | # See /LICENSE for more information. |
| 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=nginx |
| 11 | PKG_VERSION:=1.19.6 |
| 12 | PKG_RELEASE:=2 |
| 13 | |
| 14 | PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz |
| 15 | PKG_SOURCE_URL:=https://nginx.org/download/ |
| 16 | PKG_HASH:=b11195a02b1d3285ddf2987e02c6b6d28df41bb1b1dd25f33542848ef4fc33b5 |
| 17 | |
| 18 | PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de> \ |
| 19 | Ansuel Smith <ansuelsmth@gmail.com> |
| 20 | PKG_LICENSE:=2-clause BSD-like license |
| 21 | PKG_CPE_ID:=cpe:/a:nginx:nginx |
| 22 | |
| 23 | PKG_FIXUP:=autoreconf |
| 24 | PKG_BUILD_PARALLEL:=1 |
| 25 | PKG_INSTALL:=1 |
| 26 | |
| 27 | PKG_CONFIG_DEPENDS := \ |
| 28 | CONFIG_NGINX_DAV \ |
| 29 | CONFIG_NGINX_FLV \ |
| 30 | CONFIG_NGINX_UBUS \ |
| 31 | CONFIG_NGINX_STUB_STATUS \ |
| 32 | CONFIG_NGINX_HTTP_CHARSET \ |
| 33 | CONFIG_NGINX_HTTP_GZIP \ |
| 34 | CONFIG_NGINX_HTTP_SSI \ |
| 35 | CONFIG_NGINX_HTTP_USERID \ |
| 36 | CONFIG_NGINX_HTTP_ACCESS \ |
| 37 | CONFIG_NGINX_HTTP_AUTH_BASIC \ |
| 38 | CONFIG_NGINX_HTTP_AUTH_REQUEST \ |
| 39 | CONFIG_NGINX_HTTP_AUTOINDEX \ |
| 40 | CONFIG_NGINX_HTTP_GEO \ |
| 41 | CONFIG_NGINX_HTTP_MAP \ |
| 42 | CONFIG_NGINX_HTTP_SPLIT_CLIENTS \ |
| 43 | CONFIG_NGINX_HTTP_REFERER \ |
| 44 | CONFIG_NGINX_HTTP_REWRITE \ |
| 45 | CONFIG_NGINX_HTTP_PROXY \ |
| 46 | CONFIG_NGINX_HTTP_FASTCGI \ |
| 47 | CONFIG_NGINX_HTTP_UWSGI \ |
| 48 | CONFIG_NGINX_HTTP_SCGI \ |
| 49 | CONFIG_NGINX_HTTP_MEMCACHED \ |
| 50 | CONFIG_NGINX_HTTP_LIMIT_CONN \ |
| 51 | CONFIG_NGINX_HTTP_LIMIT_REQ \ |
| 52 | CONFIG_NGINX_HTTP_EMPTY_GIF \ |
| 53 | CONFIG_NGINX_HTTP_BROWSER \ |
| 54 | CONFIG_NGINX_HTTP_UPSTREAM_HASH \ |
| 55 | CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \ |
| 56 | CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \ |
| 57 | CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \ |
| 58 | CONFIG_NGINX_HTTP_UPSTREAM_ZONE \ |
| 59 | CONFIG_NGINX_HTTP_CACHE \ |
| 60 | CONFIG_NGINX_HTTP_V2 \ |
| 61 | CONFIG_NGINX_PCRE \ |
| 62 | CONFIG_NGINX_NAXSI \ |
| 63 | CONFIG_NGINX_LUA \ |
| 64 | CONFIG_NGINX_HTTP_REAL_IP \ |
| 65 | CONFIG_NGINX_HTTP_SECURE_LINK \ |
| 66 | CONFIG_NGINX_HTTP_BROTLI \ |
| 67 | CONFIG_NGINX_HEADERS_MORE \ |
| 68 | CONFIG_NGINX_STREAM_CORE_MODULE \ |
| 69 | CONFIG_NGINX_STREAM_SSL_MODULE \ |
| 70 | CONFIG_NGINX_STREAM_SSL_PREREAD_MODULE \ |
| 71 | CONFIG_NGINX_RTMP_MODULE \ |
| 72 | CONFIG_NGINX_TS_MODULE \ |
| 73 | CONFIG_OPENSSL_ENGINE \ |
| 74 | CONFIG_OPENSSL_WITH_NPN |
| 75 | |
| 76 | include $(INCLUDE_DIR)/package.mk |
| 77 | include $(INCLUDE_DIR)/nls.mk |
| 78 | |
| 79 | define Package/nginx/default |
| 80 | SECTION:=net |
| 81 | CATEGORY:=Network |
| 82 | SUBMENU:=Web Servers/Proxies |
| 83 | TITLE:=Nginx web server |
| 84 | URL:=http://nginx.org/ |
| 85 | DEPENDS:=+libopenssl +libpthread |
| 86 | # TODO: add PROVIDES when removing nginx |
| 87 | # PROVIDES:=nginx |
| 88 | endef |
| 89 | |
| 90 | define Package/nginx/description |
| 91 | nginx is an HTTP and reverse proxy server, as well as a mail proxy server, \ |
| 92 | written by Igor Sysoev. |
| 93 | endef |
| 94 | |
| 95 | define Package/nginx-ssl |
| 96 | $(Package/nginx/default) |
| 97 | TITLE += with SSL support |
| 98 | VARIANT:=ssl |
| 99 | DEPENDS+= +NGINX_PCRE:libpcre \ |
| 100 | +NGINX_PCRE:nginx-ssl-util +!NGINX_PCRE:nginx-ssl-util-nopcre \ |
| 101 | +NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +NGINX_DAV:libxml2 \ |
| 102 | +NGINX_UBUS:libubus +NGINX_UBUS:libblobmsg-json +NGINX_UBUS:libjson-c |
| 103 | EXTRA_DEPENDS:=nginx-ssl-util$(if $(CONFIG_NGINX_PCRE),,-nopcre) (>=1.5-1) (<2) |
| 104 | CONFLICTS:=nginx-all-module |
| 105 | endef |
| 106 | |
| 107 | Package/nginx-ssl/description = $(Package/nginx/description) \ |
| 108 | This variant is compiled with SSL support enabled. To enable additional module \ |
| 109 | select them in the nginx default configuration menu. |
| 110 | |
| 111 | define Package/nginx-all-module |
| 112 | $(Package/nginx/default) |
| 113 | TITLE += with ALL module selected |
| 114 | DEPENDS+=+libpcre +nginx-ssl-util +zlib +liblua +libxml2 +libubus \ |
| 115 | +libblobmsg-json +libjson-c |
| 116 | EXTRA_DEPENDS:=nginx-ssl-util (>=1.5-1) (<2) |
| 117 | VARIANT:=all-module |
| 118 | PROVIDES += nginx-ssl |
| 119 | endef |
| 120 | |
| 121 | Package/nginx-all-module/description = $(Package/nginx/description) \ |
| 122 | This variant is compiled with ALL module selected. |
| 123 | |
| 124 | define Package/nginx-ssl/config |
| 125 | source "$(SOURCE)/Config_ssl.in" |
| 126 | endef |
| 127 | |
| 128 | config_files=mime.types |
| 129 | |
| 130 | define Package/nginx/conffiles |
| 131 | /etc/nginx/ |
| 132 | endef |
| 133 | |
| 134 | Package/nginx-ssl/conffiles = $(Package/nginx/conffiles) |
| 135 | Package/nginx-all-module/conffiles = $(Package/nginx/conffiles) |
| 136 | |
| 137 | |
| 138 | ADDITIONAL_MODULES:= --with-http_ssl_module |
| 139 | |
| 140 | ifneq ($(BUILD_VARIANT),all-module) |
| 141 | ifneq ($(CONFIG_NGINX_HTTP_CACHE),y) |
| 142 | ADDITIONAL_MODULES += --without-http-cache |
| 143 | endif |
| 144 | ifneq ($(CONFIG_NGINX_PCRE),y) |
| 145 | ADDITIONAL_MODULES += --without-pcre |
| 146 | endif |
| 147 | ifneq ($(CONFIG_NGINX_HTTP_CHARSET),y) |
| 148 | ADDITIONAL_MODULES += --without-http_charset_module |
| 149 | else |
| 150 | config_files += koi-utf koi-win win-utf |
| 151 | endif |
| 152 | ifneq ($(CONFIG_NGINX_HTTP_GZIP),y) |
| 153 | ADDITIONAL_MODULES += --without-http_gzip_module |
| 154 | endif |
| 155 | ifneq ($(CONFIG_NGINX_HTTP_SSI),y) |
| 156 | ADDITIONAL_MODULES += --without-http_ssi_module |
| 157 | endif |
| 158 | ifneq ($(CONFIG_NGINX_HTTP_USERID),y) |
| 159 | ADDITIONAL_MODULES += --without-http_userid_module |
| 160 | endif |
| 161 | ifneq ($(CONFIG_NGINX_HTTP_ACCESS),y) |
| 162 | ADDITIONAL_MODULES += --without-http_access_module |
| 163 | endif |
| 164 | ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC),y) |
| 165 | ADDITIONAL_MODULES += --without-http_auth_basic_module |
| 166 | endif |
| 167 | ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX),y) |
| 168 | ADDITIONAL_MODULES += --without-http_autoindex_module |
| 169 | endif |
| 170 | ifneq ($(CONFIG_NGINX_HTTP_GEO),y) |
| 171 | ADDITIONAL_MODULES += --without-http_geo_module |
| 172 | endif |
| 173 | ifneq ($(CONFIG_NGINX_HTTP_MAP),y) |
| 174 | ADDITIONAL_MODULES += --without-http_map_module |
| 175 | endif |
| 176 | ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS),y) |
| 177 | ADDITIONAL_MODULES += --without-http_split_clients_module |
| 178 | endif |
| 179 | ifneq ($(CONFIG_NGINX_HTTP_REFERER),y) |
| 180 | ADDITIONAL_MODULES += --without-http_referer_module |
| 181 | endif |
| 182 | ifneq ($(CONFIG_NGINX_HTTP_REWRITE),y) |
| 183 | ADDITIONAL_MODULES += --without-http_rewrite_module |
| 184 | endif |
| 185 | ifneq ($(CONFIG_NGINX_HTTP_PROXY),y) |
| 186 | ADDITIONAL_MODULES += --without-http_proxy_module |
| 187 | endif |
| 188 | ifneq ($(CONFIG_NGINX_HTTP_FASTCGI),y) |
| 189 | ADDITIONAL_MODULES += --without-http_fastcgi_module |
| 190 | else |
| 191 | config_files += fastcgi_params |
| 192 | endif |
| 193 | ifneq ($(CONFIG_NGINX_HTTP_UWSGI),y) |
| 194 | ADDITIONAL_MODULES += --without-http_uwsgi_module |
| 195 | else |
| 196 | config_files += uwsgi_params |
| 197 | endif |
| 198 | ifneq ($(CONFIG_NGINX_HTTP_SCGI),y) |
| 199 | ADDITIONAL_MODULES += --without-http_scgi_module |
| 200 | endif |
| 201 | ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y) |
| 202 | ADDITIONAL_MODULES += --without-http_memcached_module |
| 203 | endif |
| 204 | ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y) |
| 205 | ADDITIONAL_MODULES += --without-http_limit_conn_module |
| 206 | endif |
| 207 | ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y) |
| 208 | ADDITIONAL_MODULES += --without-http_limit_req_module |
| 209 | endif |
| 210 | ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y) |
| 211 | ADDITIONAL_MODULES += --without-http_empty_gif_module |
| 212 | endif |
| 213 | ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y) |
| 214 | ADDITIONAL_MODULES += --without-http_browser_module |
| 215 | endif |
| 216 | ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH),y) |
| 217 | ADDITIONAL_MODULES += --without-http_upstream_hash_module |
| 218 | endif |
| 219 | ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y) |
| 220 | ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module |
| 221 | endif |
| 222 | ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN),y) |
| 223 | ADDITIONAL_MODULES += --without-http_upstream_least_conn_module |
| 224 | endif |
| 225 | ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y) |
| 226 | ADDITIONAL_MODULES += --without-http_upstream_keepalive_module |
| 227 | endif |
| 228 | ifeq ($(CONFIG_NGINX_NAXSI),y) |
| 229 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src |
| 230 | endif |
| 231 | ifeq ($(CONFIG_NGINX_LUA),y) |
| 232 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx |
| 233 | endif |
| 234 | ifeq ($(CONFIG_IPV6),y) |
| 235 | ADDITIONAL_MODULES += --with-ipv6 |
| 236 | endif |
| 237 | ifeq ($(CONFIG_NGINX_STUB_STATUS),y) |
| 238 | ADDITIONAL_MODULES += --with-http_stub_status_module |
| 239 | endif |
| 240 | ifeq ($(CONFIG_NGINX_FLV),y) |
| 241 | ADDITIONAL_MODULES += --with-http_flv_module |
| 242 | endif |
| 243 | ifeq ($(CONFIG_NGINX_DAV),y) |
| 244 | ADDITIONAL_MODULES += --with-http_dav_module --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module |
| 245 | endif |
| 246 | ifeq ($(CONFIG_NGINX_UBUS),y) |
| 247 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module |
| 248 | endif |
| 249 | ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y) |
| 250 | ADDITIONAL_MODULES += --with-http_auth_request_module |
| 251 | endif |
| 252 | ifeq ($(CONFIG_NGINX_HTTP_V2),y) |
| 253 | ADDITIONAL_MODULES += --with-http_v2_module |
| 254 | endif |
| 255 | ifeq ($(CONFIG_NGINX_HTTP_REAL_IP),y) |
| 256 | ADDITIONAL_MODULES += --with-http_realip_module |
| 257 | endif |
| 258 | ifeq ($(CONFIG_NGINX_HTTP_SECURE_LINK),y) |
| 259 | ADDITIONAL_MODULES += --with-http_secure_link_module |
| 260 | endif |
| 261 | ifeq ($(CONFIG_NGINX_HTTP_SUB),y) |
| 262 | ADDITIONAL_MODULES += --with-http_sub_module |
| 263 | endif |
| 264 | ifeq ($(CONFIG_NGINX_STREAM_CORE_MODULE),y) |
| 265 | ADDITIONAL_MODULES += --with-stream |
| 266 | endif |
| 267 | ifeq ($(CONFIG_NGINX_STREAM_SSL_MODULE),y) |
| 268 | ADDITIONAL_MODULES += --with-stream_ssl_module |
| 269 | endif |
| 270 | ifeq ($(CONFIG_NGINX_STREAM_SSL_PREREAD_MODULE),y) |
| 271 | ADDITIONAL_MODULES += --with-stream_ssl_preread_module |
| 272 | endif |
| 273 | ifeq ($(CONFIG_NGINX_HEADERS_MORE),y) |
| 274 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-headers-more |
| 275 | endif |
| 276 | ifeq ($(CONFIG_NGINX_HTTP_BROTLI),y) |
| 277 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-brotli |
| 278 | endif |
| 279 | ifeq ($(CONFIG_NGINX_RTMP_MODULE),y) |
| 280 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-rtmp |
| 281 | endif |
| 282 | ifeq ($(CONFIG_NGINX_TS_MODULE),y) |
| 283 | ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ts |
| 284 | endif |
| 285 | else |
| 286 | CONFIG_NGINX_HEADERS_MORE:=y |
| 287 | CONFIG_NGINX_HTTP_BROTLI:=y |
| 288 | CONFIG_NGINX_RTMP_MODULE:=y |
| 289 | CONFIG_NGINX_TS_MODULE:=y |
| 290 | CONFIG_NGINX_NAXSI:=y |
| 291 | CONFIG_NGINX_LUA:=y |
| 292 | CONFIG_NGINX_DAV:=y |
| 293 | CONFIG_NGINX_UBUS:=y |
| 294 | ADDITIONAL_MODULES += --with-ipv6 --with-http_stub_status_module --with-http_flv_module \ |
| 295 | --with-http_dav_module \ |
| 296 | --with-http_auth_request_module --with-http_v2_module --with-http_realip_module \ |
| 297 | --with-http_secure_link_module --with-http_sub_module \ |
| 298 | --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \ |
| 299 | --add-module=$(PKG_BUILD_DIR)/nginx-headers-more \ |
| 300 | --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src \ |
| 301 | --add-module=$(PKG_BUILD_DIR)/lua-nginx \ |
| 302 | --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module \ |
| 303 | --add-module=$(PKG_BUILD_DIR)/nginx-brotli --add-module=$(PKG_BUILD_DIR)/nginx-rtmp \ |
| 304 | --add-module=$(PKG_BUILD_DIR)/nginx-ts --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module |
| 305 | config_files += koi-utf koi-win win-utf fastcgi_params uwsgi_params |
| 306 | endif |
| 307 | |
| 308 | define Package/nginx-mod-luci |
| 309 | TITLE:=Nginx on LuCI |
| 310 | SECTION:=net |
| 311 | CATEGORY:=Network |
| 312 | SUBMENU:=Web Servers/Proxies |
| 313 | TITLE:=Support file for Nginx |
| 314 | URL:=http://nginx.org/ |
| 315 | DEPENDS:=+uwsgi +uwsgi-luci-support +nginx |
| 316 | # TODO: add PROVIDES when removing nginx-mod-luci-ssl |
| 317 | # PROVIDES:=nginx-mod-luci-ssl |
| 318 | endef |
| 319 | |
| 320 | define Package/nginx-mod-luci/description |
| 321 | Support file for LuCI in nginx. Include custom nginx configuration, autostart script for uwsgi. |
| 322 | endef |
| 323 | |
| 324 | |
| 325 | TARGET_CFLAGS += -fvisibility=hidden -ffunction-sections -fdata-sections -DNGX_LUA_NO_BY_LUA_BLOCK |
| 326 | TARGET_LDFLAGS += -Wl,--gc-sections |
| 327 | |
| 328 | ifeq ($(CONFIG_NGINX_LUA),y) |
| 329 | CONFIGURE_VARS += LUA_INC=$(STAGING_DIR)/usr/include \ |
| 330 | LUA_LIB=$(STAGING_DIR)/usr/lib |
| 331 | endif |
| 332 | |
| 333 | CONFIGURE_VARS += CONFIG_BIG_ENDIAN=$(CONFIG_BIG_ENDIAN) |
| 334 | |
| 335 | CONFIGURE_ARGS += \ |
| 336 | --crossbuild=Linux::$(ARCH) \ |
| 337 | --prefix=/usr \ |
| 338 | --conf-path=/etc/nginx/nginx.conf \ |
| 339 | $(ADDITIONAL_MODULES) \ |
| 340 | --error-log-path=stderr \ |
| 341 | --pid-path=/var/run/nginx.pid \ |
| 342 | --lock-path=/var/lock/nginx.lock \ |
| 343 | --http-log-path=/var/log/nginx/access.log \ |
| 344 | --http-client-body-temp-path=/var/lib/nginx/body \ |
| 345 | --http-proxy-temp-path=/var/lib/nginx/proxy \ |
| 346 | --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ |
| 347 | --with-cc="$(TARGET_CC)" \ |
| 348 | --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ |
| 349 | --with-ld-opt="$(TARGET_LDFLAGS)" \ |
| 350 | --without-http_upstream_zone_module |
| 351 | |
| 352 | define Package/nginx-mod-luci/install |
| 353 | $(INSTALL_DIR) $(1)/etc/nginx/conf.d |
| 354 | $(INSTALL_CONF) ./files-luci-support/luci.locations $(1)/etc/nginx/conf.d/ |
| 355 | $(INSTALL_DIR) $(1)/etc/uci-defaults |
| 356 | $(INSTALL_BIN) ./files-luci-support/60_nginx-luci-support $(1)/etc/uci-defaults/60_nginx-luci-support |
| 357 | endef |
| 358 | |
| 359 | define Package/nginx-ssl/install |
| 360 | $(INSTALL_DIR) $(1)/usr/sbin |
| 361 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/ |
| 362 | $(INSTALL_DIR) $(1)/etc/nginx/conf.d |
| 363 | $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/ |
| 364 | $(INSTALL_DIR) $(1)/etc/init.d |
| 365 | $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx |
| 366 | ifeq ($(CONFIG_NGINX_NAXSI),y) |
| 367 | $(INSTALL_DIR) $(1)/etc/nginx |
| 368 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx |
| 369 | chmod 0640 $(1)/etc/nginx/naxsi_core.rules |
| 370 | endif |
| 371 | $(if $(CONFIG_NGINX_NAXSI),$($(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx)) |
| 372 | $(if $(CONFIG_NGINX_NAXSI),$(chmod 0640 $(1)/etc/nginx/naxsi_core.rules)) |
| 373 | endef |
| 374 | |
| 375 | Package/nginx-all-module/install = $(Package/nginx-ssl/install) |
| 376 | |
| 377 | define Package/nginx-ssl/prerm |
| 378 | #!/bin/sh |
| 379 | [ -z "$${IPKG_INSTROOT}" ] || exit 0 |
| 380 | [ "$${PKG_UPGRADE}" = "1" ] && exit 0 |
| 381 | eval $$(/usr/bin/nginx-util get_env) |
| 382 | [ "$$(uci get "nginx.$${LAN_NAME}.$${MANAGE_SSL}")" = "self-signed" ] || exit 0 |
| 383 | rm -f "$$(uci get "nginx.$${LAN_NAME}.ssl_certificate")" |
| 384 | rm -f "$$(uci get "nginx.$${LAN_NAME}.ssl_certificate_key")" |
| 385 | exit 0 |
| 386 | endef |
| 387 | |
| 388 | Package/nginx-all-module/prerm = $(Package/nginx-ssl/prerm) |
| 389 | |
| 390 | define Build/Prepare |
| 391 | $(Build/Prepare/Default) |
| 392 | $(Prepare/nginx-naxsi) |
| 393 | $(Prepare/lua-nginx) |
| 394 | $(Prepare/nginx-brotli) |
| 395 | $(Prepare/nginx-headers-more) |
| 396 | $(Prepare/nginx-rtmp) |
| 397 | $(Prepare/nginx-ts) |
| 398 | $(Prepare/nginx-dav-ext-module) |
| 399 | $(Prepare/nginx-ubus-module) |
| 400 | endef |
| 401 | |
| 402 | |
| 403 | ifeq ($(CONFIG_NGINX_HEADERS_MORE),y) |
| 404 | define Download/nginx-headers-more |
| 405 | VERSION:=a9f7c7e86cc7441d04e2f11f01c2e3a9c4b0301d |
| 406 | SUBDIR:=nginx-headers-more |
| 407 | FILE:=headers-more-nginx-module-$$(VERSION).tar.xz |
| 408 | URL:=https://github.com/openresty/headers-more-nginx-module.git |
| 409 | MIRROR_HASH:=ce0b9996ecb2cff790831644d6ab1adc087aa2771d77d3931c06246d11bc59fd |
| 410 | PROTO:=git |
| 411 | endef |
| 412 | $(eval $(call Download,nginx-headers-more)) |
| 413 | |
| 414 | define Prepare/nginx-headers-more |
| 415 | $(eval $(Download/nginx-headers-more)) |
| 416 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 417 | endef |
| 418 | endif |
| 419 | |
| 420 | |
| 421 | ifeq ($(CONFIG_NGINX_HTTP_BROTLI),y) |
| 422 | define Download/nginx-brotli |
| 423 | VERSION:=e505dce68acc190cc5a1e780a3b0275e39f160ca |
| 424 | SUBDIR:=nginx-brotli |
| 425 | FILE:=ngx-brotli-module-$$(VERSION).tar.xz |
| 426 | URL:=https://github.com/google/ngx_brotli.git |
| 427 | MIRROR_HASH:=04847f11ef808fed50f44b2af0ef3abf59ff0ffc06dfc7394d9ab51d53fef31f |
| 428 | PROTO:=git |
| 429 | endef |
| 430 | $(eval $(call Download,nginx-brotli)) |
| 431 | |
| 432 | define Prepare/nginx-brotli |
| 433 | $(eval $(Download/nginx-brotli)) |
| 434 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 435 | endef |
| 436 | endif |
| 437 | |
| 438 | |
| 439 | ifeq ($(CONFIG_NGINX_RTMP_MODULE),y) |
| 440 | define Download/nginx-rtmp |
| 441 | VERSION:=f0ea62342a4eca504b311cd5df910d026c3ea4cf |
| 442 | SUBDIR:=nginx-rtmp |
| 443 | FILE:=ngx-rtmp-module-$$(VERSION).tar.xz |
| 444 | URL:=https://github.com/ut0mt8/nginx-rtmp-module.git |
| 445 | MIRROR_HASH:=d3f58066f0f858ed79f7f2b0c9b89de2ccc512c94ab3d0625f6dcff3df0b72c1 |
| 446 | PROTO:=git |
| 447 | endef |
| 448 | $(eval $(call Download,nginx-rtmp)) |
| 449 | |
| 450 | define Prepare/nginx-rtmp |
| 451 | $(eval $(Download/nginx-rtmp)) |
| 452 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 453 | endef |
| 454 | endif |
| 455 | |
| 456 | |
| 457 | ifeq ($(CONFIG_NGINX_TS_MODULE),y) |
| 458 | define Download/nginx-ts |
| 459 | VERSION:=ef2f874d95cc75747eb625a292524a702aefb0fd |
| 460 | SUBDIR:=nginx-ts |
| 461 | FILE:=ngx-ts-module-$$(VERSION).tar.xz |
| 462 | URL:=https://github.com/arut/nginx-ts-module.git |
| 463 | MIRROR_HASH:=73938950bb286d40d9e54b0994d1a63827340c1156c72eb04d7041b25b20ec18 |
| 464 | PROTO:=git |
| 465 | endef |
| 466 | $(eval $(call Download,nginx-ts)) |
| 467 | |
| 468 | define Prepare/nginx-ts |
| 469 | $(eval $(Download/nginx-ts)) |
| 470 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 471 | endef |
| 472 | endif |
| 473 | |
| 474 | |
| 475 | ifeq ($(CONFIG_NGINX_NAXSI),y) |
| 476 | define Download/nginx-naxsi |
| 477 | VERSION:=951123ad456bdf5ac94e8d8819342fe3d49bc002 |
| 478 | SUBDIR:=nginx-naxsi |
| 479 | FILE:=nginx-naxsi-module-$$(VERSION).tar.xz |
| 480 | URL:=https://github.com/nbs-system/naxsi.git |
| 481 | MIRROR_HASH:=c734cae19a596affadd62a2df1b58d3df8d1364093a4e80a7cd1ab4555963535 |
| 482 | PROTO:=git |
| 483 | endef |
| 484 | $(eval $(call Download,nginx-naxsi)) |
| 485 | |
| 486 | define Prepare/nginx-naxsi |
| 487 | $(eval $(Download/nginx-naxsi)) |
| 488 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 489 | endef |
| 490 | endif |
| 491 | |
| 492 | |
| 493 | ifeq ($(CONFIG_NGINX_LUA),y) |
| 494 | define Download/lua-nginx |
| 495 | VERSION:=e94f2e5d64daa45ff396e262d8dab8e56f5f10e0 |
| 496 | SUBDIR:=lua-nginx |
| 497 | FILE:=lua-nginx-module-$$(VERSION).tar.xz |
| 498 | URL:=https://github.com/openresty/lua-nginx-module.git |
| 499 | MIRROR_HASH:=27729921964f066d97e99c263da153b34622a2f4b811114e4c3ee61c6fc71395 |
| 500 | PROTO:=git |
| 501 | endef |
| 502 | $(eval $(call Download,lua-nginx)) |
| 503 | |
| 504 | define Prepare/lua-nginx |
| 505 | $(eval $(Download/lua-nginx)) |
| 506 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 507 | $(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx) |
| 508 | endef |
| 509 | endif |
| 510 | |
| 511 | |
| 512 | ifeq ($(CONFIG_NGINX_DAV),y) |
| 513 | define Download/nginx-dav-ext-module |
| 514 | VERSION:=f5e30888a256136d9c550bf1ada77d6ea78a48af |
| 515 | SUBDIR:=nginx-dav-ext-module |
| 516 | FILE:=nginx-dav-ext-module-$$(VERSION).tar.xz |
| 517 | URL:=https://github.com/arut/nginx-dav-ext-module.git |
| 518 | MIRROR_HASH:=70bb4c3907f4b783605500ba494e907aede11f8505702e370012abb3c177dc5b |
| 519 | PROTO:=git |
| 520 | endef |
| 521 | $(eval $(call Download,nginx-dav-ext-module)) |
| 522 | |
| 523 | define Prepare/nginx-dav-ext-module |
| 524 | $(eval $(Download/nginx-dav-ext-module)) |
| 525 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 526 | $(call PatchDir,$(PKG_BUILD_DIR),./patches-dav-nginx) |
| 527 | endef |
| 528 | endif |
| 529 | |
| 530 | ifeq ($(CONFIG_NGINX_UBUS),y) |
| 531 | define Download/nginx-ubus-module |
| 532 | VERSION:=b2d7260dcb428b2fb65540edb28d7538602b4a26 |
| 533 | SUBDIR:=nginx-ubus-module |
| 534 | FILE:=nginx-ubus-module-$$(VERSION).tar.xz |
| 535 | URL:=https://github.com/Ansuel/nginx-ubus-module.git |
| 536 | MIRROR_HASH:=472cef416d25effcac66c85417ab6596e634a7a64d45b709bb090892d567553c |
| 537 | PROTO:=git |
| 538 | endef |
| 539 | $(eval $(call Download,nginx-ubus-module)) |
| 540 | |
| 541 | define Prepare/nginx-ubus-module |
| 542 | $(eval $(Download/nginx-ubus-module)) |
| 543 | xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) |
| 544 | endef |
| 545 | endif |
| 546 | |
| 547 | $(eval $(call BuildPackage,nginx-ssl)) |
| 548 | $(eval $(call BuildPackage,nginx-all-module)) |
| 549 | $(eval $(call BuildPackage,nginx-mod-luci)) |
| 550 | |
| 551 | # TODO: remove after a transition period (together with pkg nginx-util): |
| 552 | # It is for smoothly substituting nginx and nginx-mod-luci-ssl (by nginx-ssl |
| 553 | # respectively nginx-mod-luci). Add above commented PROVIDES when removing. |
| 554 | |
| 555 | define Package/nginx |
| 556 | TITLE:=Dummy package for transition when upgrading. |
| 557 | DEPENDS:=+nginx-ssl |
| 558 | PKGARCH:=all |
| 559 | endef |
| 560 | |
| 561 | define Package/nginx/install |
| 562 | $(INSTALL_DIR) $(1)/usr/bin |
| 563 | endef |
| 564 | |
| 565 | $(eval $(call BuildPackage,nginx)) |
| 566 | |
| 567 | define Package/nginx-mod-luci-ssl |
| 568 | TITLE:=Dummy package for transition when upgrading. |
| 569 | DEPENDS:=+nginx-mod-luci |
| 570 | PKGARCH:=all |
| 571 | endef |
| 572 | |
| 573 | define Package/nginx-mod-luci-ssl/install |
| 574 | $(INSTALL_DIR) $(1)/usr/bin |
| 575 | endef |
| 576 | |
| 577 | $(eval $(call BuildPackage,nginx-mod-luci-ssl)) |