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.

604 lines
19 KiB

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