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.

602 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.1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://nginx.org/download/
  13. PKG_HASH:=68ba0311342115163a0354cad34f90c05a7e8bf689dc498abf07899eda155560
  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. endif
  181. ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y)
  182. ADDITIONAL_MODULES += --without-http_memcached_module
  183. endif
  184. ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y)
  185. ADDITIONAL_MODULES += --without-http_limit_conn_module
  186. endif
  187. ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y)
  188. ADDITIONAL_MODULES += --without-http_limit_req_module
  189. endif
  190. ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y)
  191. ADDITIONAL_MODULES += --without-http_empty_gif_module
  192. endif
  193. ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y)
  194. ADDITIONAL_MODULES += --without-http_browser_module
  195. endif
  196. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH),y)
  197. ADDITIONAL_MODULES += --without-http_upstream_hash_module
  198. endif
  199. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y)
  200. ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module
  201. endif
  202. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN),y)
  203. ADDITIONAL_MODULES += --without-http_upstream_least_conn_module
  204. endif
  205. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y)
  206. ADDITIONAL_MODULES += --without-http_upstream_keepalive_module
  207. endif
  208. ifeq ($(CONFIG_NGINX_NAXSI),y)
  209. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
  210. endif
  211. ifeq ($(CONFIG_NGINX_LUA),y)
  212. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
  213. endif
  214. ifeq ($(CONFIG_IPV6),y)
  215. ADDITIONAL_MODULES += --with-ipv6
  216. endif
  217. ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
  218. ADDITIONAL_MODULES += --with-http_stub_status_module
  219. endif
  220. ifeq ($(CONFIG_NGINX_FLV),y)
  221. ADDITIONAL_MODULES += --with-http_flv_module
  222. endif
  223. ifeq ($(CONFIG_NGINX_DAV),y)
  224. ADDITIONAL_MODULES += --with-http_dav_module --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module
  225. endif
  226. ifeq ($(CONFIG_NGINX_UBUS),y)
  227. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module
  228. endif
  229. ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y)
  230. ADDITIONAL_MODULES += --with-http_auth_request_module
  231. endif
  232. ifeq ($(CONFIG_NGINX_HTTP_V2),y)
  233. ADDITIONAL_MODULES += --with-http_v2_module
  234. endif
  235. ifeq ($(CONFIG_NGINX_HTTP_REAL_IP),y)
  236. ADDITIONAL_MODULES += --with-http_realip_module
  237. endif
  238. ifeq ($(CONFIG_NGINX_HTTP_SECURE_LINK),y)
  239. ADDITIONAL_MODULES += --with-http_secure_link_module
  240. endif
  241. ifeq ($(CONFIG_NGINX_HTTP_SUB),y)
  242. ADDITIONAL_MODULES += --with-http_sub_module
  243. endif
  244. ifeq ($(CONFIG_NGINX_STREAM_CORE_MODULE),y)
  245. ADDITIONAL_MODULES += --with-stream
  246. endif
  247. ifeq ($(CONFIG_NGINX_STREAM_SSL_MODULE),y)
  248. ADDITIONAL_MODULES += --with-stream_ssl_module
  249. endif
  250. ifeq ($(CONFIG_NGINX_STREAM_SSL_PREREAD_MODULE),y)
  251. ADDITIONAL_MODULES += --with-stream_ssl_preread_module
  252. endif
  253. ifeq ($(CONFIG_NGINX_HEADERS_MORE),y)
  254. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-headers-more
  255. endif
  256. ifeq ($(CONFIG_NGINX_HTTP_BROTLI),y)
  257. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-brotli
  258. endif
  259. ifeq ($(CONFIG_NGINX_RTMP_MODULE),y)
  260. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-rtmp
  261. endif
  262. ifeq ($(CONFIG_NGINX_TS_MODULE),y)
  263. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ts
  264. endif
  265. else
  266. CONFIG_NGINX_HEADERS_MORE:=y
  267. CONFIG_NGINX_HTTP_BROTLI:=y
  268. CONFIG_NGINX_RTMP_MODULE:=y
  269. CONFIG_NGINX_TS_MODULE:=y
  270. CONFIG_NGINX_NAXSI:=y
  271. CONFIG_NGINX_LUA:=y
  272. CONFIG_NGINX_DAV:=y
  273. CONFIG_NGINX_UBUS:=y
  274. ADDITIONAL_MODULES += --with-ipv6 --with-http_stub_status_module --with-http_flv_module \
  275. --with-http_dav_module \
  276. --with-http_auth_request_module --with-http_v2_module --with-http_realip_module \
  277. --with-http_secure_link_module --with-http_sub_module \
  278. --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \
  279. --add-module=$(PKG_BUILD_DIR)/nginx-headers-more \
  280. --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src \
  281. --add-module=$(PKG_BUILD_DIR)/lua-nginx \
  282. --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module \
  283. --add-module=$(PKG_BUILD_DIR)/nginx-brotli --add-module=$(PKG_BUILD_DIR)/nginx-rtmp \
  284. --add-module=$(PKG_BUILD_DIR)/nginx-ts --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module
  285. config_files += koi-utf koi-win win-utf fastcgi_params uwsgi_params
  286. endif
  287. define Package/nginx-mod-luci
  288. TITLE:=Nginx on LuCI
  289. SECTION:=net
  290. CATEGORY:=Network
  291. SUBMENU:=Web Servers/Proxies
  292. TITLE:=Support file for Nginx
  293. URL:=http://nginx.org/
  294. DEPENDS:=+uwsgi +uwsgi-luci-support +nginx
  295. # TODO: add PROVIDES when removing nginx-mod-luci-ssl
  296. # PROVIDES:=nginx-mod-luci-ssl
  297. endef
  298. define Package/nginx-mod-luci/description
  299. Support file for LuCI in nginx. Include custom nginx configuration, autostart script for uwsgi.
  300. endef
  301. TARGET_CFLAGS += -fvisibility=hidden -ffunction-sections -fdata-sections -DNGX_LUA_NO_BY_LUA_BLOCK
  302. TARGET_LDFLAGS += -Wl,--gc-sections
  303. ifeq ($(CONFIG_NGINX_LUA),y)
  304. CONFIGURE_VARS += LUA_INC=$(STAGING_DIR)/usr/include \
  305. LUA_LIB=$(STAGING_DIR)/usr/lib
  306. endif
  307. CONFIGURE_VARS += CONFIG_BIG_ENDIAN=$(CONFIG_BIG_ENDIAN)
  308. CONFIGURE_ARGS += \
  309. --crossbuild=Linux::$(ARCH) \
  310. --prefix=/usr \
  311. --conf-path=/etc/nginx/nginx.conf \
  312. $(ADDITIONAL_MODULES) \
  313. --error-log-path=stderr \
  314. --pid-path=/var/run/nginx.pid \
  315. --lock-path=/var/lock/nginx.lock \
  316. --http-log-path=/var/log/nginx/access.log \
  317. --http-client-body-temp-path=/var/lib/nginx/body \
  318. --http-proxy-temp-path=/var/lib/nginx/proxy \
  319. --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
  320. --with-cc="$(TARGET_CC)" \
  321. --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  322. --with-ld-opt="$(TARGET_LDFLAGS)" \
  323. --without-http_upstream_zone_module
  324. define Package/nginx-mod-luci/install
  325. $(INSTALL_DIR) $(1)/etc/nginx/conf.d
  326. $(INSTALL_CONF) ./files-luci-support/luci.locations $(1)/etc/nginx/conf.d/
  327. $(INSTALL_DIR) $(1)/etc/uci-defaults
  328. $(INSTALL_BIN) ./files-luci-support/60_nginx-luci-support $(1)/etc/uci-defaults/60_nginx-luci-support
  329. endef
  330. define Package/nginx-ssl/install
  331. $(INSTALL_DIR) $(1)/usr/sbin
  332. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
  333. $(INSTALL_DIR) $(1)/etc/nginx/conf.d
  334. $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
  335. $(INSTALL_DIR) $(1)/etc/init.d
  336. $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
  337. ifeq ($(CONFIG_NGINX_NAXSI),y)
  338. $(INSTALL_DIR) $(1)/etc/nginx
  339. $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx
  340. chmod 0640 $(1)/etc/nginx/naxsi_core.rules
  341. endif
  342. $(if $(CONFIG_NGINX_NAXSI),$($(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx))
  343. $(if $(CONFIG_NGINX_NAXSI),$(chmod 0640 $(1)/etc/nginx/naxsi_core.rules))
  344. endef
  345. Package/nginx-all-module/install = $(Package/nginx-ssl/install)
  346. define Package/nginx-ssl/prerm
  347. #!/bin/sh
  348. [ -z "$${IPKG_INSTROOT}" ] || exit 0
  349. [ "$${PKG_UPGRADE}" = "1" ] && exit 0
  350. eval $$(/usr/bin/nginx-util get_env)
  351. [ "$$(uci get "nginx.$${LAN_NAME}.$${MANAGE_SSL}")" = "self-signed" ] || exit 0
  352. rm -f "$$(uci get "nginx.$${LAN_NAME}.ssl_certificate")"
  353. rm -f "$$(uci get "nginx.$${LAN_NAME}.ssl_certificate_key")"
  354. exit 0
  355. endef
  356. Package/nginx-all-module/prerm = $(Package/nginx-ssl/prerm)
  357. define Download/nginx-headers-more
  358. VERSION:=a9f7c7e86cc7441d04e2f11f01c2e3a9c4b0301d
  359. SUBDIR:=nginx-headers-more
  360. FILE:=headers-more-nginx-module-$$(VERSION).tar.xz
  361. URL:=https://github.com/openresty/headers-more-nginx-module.git
  362. MIRROR_HASH:=ce0b9996ecb2cff790831644d6ab1adc087aa2771d77d3931c06246d11bc59fd
  363. PROTO:=git
  364. endef
  365. define Prepare/nginx-headers-more
  366. $(eval $(Download/nginx-headers-more))
  367. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  368. endef
  369. define Download/nginx-brotli
  370. VERSION:=e505dce68acc190cc5a1e780a3b0275e39f160ca
  371. SUBDIR:=nginx-brotli
  372. FILE:=ngx-brotli-module-$$(VERSION).tar.xz
  373. URL:=https://github.com/google/ngx_brotli.git
  374. MIRROR_HASH:=04847f11ef808fed50f44b2af0ef3abf59ff0ffc06dfc7394d9ab51d53fef31f
  375. PROTO:=git
  376. endef
  377. define Prepare/nginx-brotli
  378. $(eval $(Download/nginx-brotli))
  379. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  380. endef
  381. define Download/nginx-rtmp
  382. VERSION:=f0ea62342a4eca504b311cd5df910d026c3ea4cf
  383. SUBDIR:=nginx-rtmp
  384. FILE:=ngx-rtmp-module-$$(VERSION).tar.xz
  385. URL:=https://github.com/ut0mt8/nginx-rtmp-module.git
  386. MIRROR_HASH:=d3f58066f0f858ed79f7f2b0c9b89de2ccc512c94ab3d0625f6dcff3df0b72c1
  387. PROTO:=git
  388. endef
  389. define Prepare/nginx-rtmp
  390. $(eval $(Download/nginx-rtmp))
  391. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  392. endef
  393. define Download/nginx-ts
  394. VERSION:=ef2f874d95cc75747eb625a292524a702aefb0fd
  395. SUBDIR:=nginx-ts
  396. FILE:=ngx-ts-module-$$(VERSION).tar.xz
  397. URL:=https://github.com/arut/nginx-ts-module.git
  398. MIRROR_HASH:=73938950bb286d40d9e54b0994d1a63827340c1156c72eb04d7041b25b20ec18
  399. PROTO:=git
  400. endef
  401. define Prepare/nginx-ts
  402. $(eval $(Download/nginx-ts))
  403. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  404. endef
  405. define Download/nginx-naxsi
  406. VERSION:=951123ad456bdf5ac94e8d8819342fe3d49bc002
  407. SUBDIR:=nginx-naxsi
  408. FILE:=nginx-naxsi-module-$$(VERSION).tar.xz
  409. URL:=https://github.com/nbs-system/naxsi.git
  410. MIRROR_HASH:=c734cae19a596affadd62a2df1b58d3df8d1364093a4e80a7cd1ab4555963535
  411. PROTO:=git
  412. endef
  413. define Prepare/nginx-naxsi
  414. $(eval $(Download/nginx-naxsi))
  415. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  416. endef
  417. define Download/lua-nginx
  418. VERSION:=e94f2e5d64daa45ff396e262d8dab8e56f5f10e0
  419. SUBDIR:=lua-nginx
  420. FILE:=lua-nginx-module-$$(VERSION).tar.xz
  421. URL:=https://github.com/openresty/lua-nginx-module.git
  422. MIRROR_HASH:=27729921964f066d97e99c263da153b34622a2f4b811114e4c3ee61c6fc71395
  423. PROTO:=git
  424. endef
  425. define Prepare/lua-nginx
  426. $(eval $(Download/lua-nginx))
  427. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  428. endef
  429. define Download/nginx-dav-ext-module
  430. VERSION:=f5e30888a256136d9c550bf1ada77d6ea78a48af
  431. SUBDIR:=nginx-dav-ext-module
  432. FILE:=nginx-dav-ext-module-$$(VERSION).tar.xz
  433. URL:=https://github.com/arut/nginx-dav-ext-module.git
  434. MIRROR_HASH:=70bb4c3907f4b783605500ba494e907aede11f8505702e370012abb3c177dc5b
  435. PROTO:=git
  436. endef
  437. define Prepare/nginx-dav-ext-module
  438. $(eval $(Download/nginx-dav-ext-module))
  439. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  440. endef
  441. define Download/nginx-ubus-module
  442. VERSION:=b2d7260dcb428b2fb65540edb28d7538602b4a26
  443. SUBDIR:=nginx-ubus-module
  444. FILE:=nginx-ubus-module-$$(VERSION).tar.xz
  445. URL:=https://github.com/Ansuel/nginx-ubus-module.git
  446. MIRROR_HASH:=472cef416d25effcac66c85417ab6596e634a7a64d45b709bb090892d567553c
  447. PROTO:=git
  448. endef
  449. define Prepare/nginx-ubus-module
  450. $(eval $(Download/nginx-ubus-module))
  451. xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  452. endef
  453. define Build/Patch
  454. $(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)
  455. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nginx,nginx/)
  456. ifneq "$(or $(CONFIG_NGINX_DAV),$(QUILT))" ""
  457. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/dav-nginx,dav-nginx/)
  458. endif
  459. ifneq "$(or $(CONFIG_NGINX_LUA),$(QUILT))" ""
  460. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/lua-nginx,lua-nginx/)
  461. endif
  462. ifneq "$(or $(CONFIG_NGINX_RTMP_MODULE),$(QUILT))" ""
  463. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtmp-nginx,rtmp-nginx/)
  464. endif
  465. $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
  466. endef
  467. define Quilt/Refresh/Package
  468. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nginx,nginx/)
  469. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/dav-nginx,dav-nginx/)
  470. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/lua-nginx,lua-nginx/)
  471. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtmp-nginx,rtmp-nginx/)
  472. endef
  473. define Build/Prepare
  474. rm -rf $(PKG_BUILD_DIR)
  475. mkdir -p $(PKG_BUILD_DIR)
  476. $(PKG_UNPACK)
  477. ifeq ($(CONFIG_NGINX_NAXSI),y)
  478. $(eval $(call Download,nginx-naxsi))
  479. $(Prepare/nginx-naxsi)
  480. endif
  481. ifneq "$(or $(CONFIG_NGINX_LUA),$(QUILT))" ""
  482. $(eval $(call Download,lua-nginx))
  483. $(Prepare/lua-nginx)
  484. endif
  485. ifeq ($(CONFIG_NGINX_HTTP_BROTLI),y)
  486. $(eval $(call Download,nginx-brotli))
  487. $(Prepare/nginx-brotli)
  488. endif
  489. ifeq ($(CONFIG_NGINX_HEADERS_MORE),y)
  490. $(eval $(call Download,nginx-headers-more))
  491. $(Prepare/nginx-headers-more)
  492. endif
  493. ifneq "$(or $(CONFIG_NGINX_RTMP_MODULE),$(QUILT))" ""
  494. $(eval $(call Download,nginx-rtmp))
  495. $(Prepare/nginx-rtmp)
  496. endif
  497. ifeq ($(CONFIG_NGINX_TS_MODULE),y)
  498. $(eval $(call Download,nginx-ts))
  499. $(Prepare/nginx-ts)
  500. endif
  501. ifneq "$(or $(CONFIG_NGINX_DAV),$(QUILT))" ""
  502. $(eval $(call Download,nginx-dav-ext-module))
  503. $(Prepare/nginx-dav-ext-module)
  504. endif
  505. ifeq ($(CONFIG_NGINX_UBUS),y)
  506. $(eval $(call Download,nginx-ubus-module))
  507. $(Prepare/nginx-ubus-module)
  508. endif
  509. $(Build/Patch)
  510. endef
  511. $(eval $(call BuildPackage,nginx-ssl))
  512. $(eval $(call BuildPackage,nginx-all-module))
  513. $(eval $(call BuildPackage,nginx-mod-luci))
  514. # TODO: remove after a transition period (together with pkg nginx-util):
  515. # It is for smoothly substituting nginx and nginx-mod-luci-ssl (by nginx-ssl
  516. # respectively nginx-mod-luci). Add above commented PROVIDES when removing.
  517. define Package/nginx
  518. TITLE:=Dummy package for transition when upgrading.
  519. DEPENDS:=+nginx-ssl
  520. PKGARCH:=all
  521. endef
  522. define Package/nginx/install
  523. $(INSTALL_DIR) $(1)/usr/bin
  524. endef
  525. $(eval $(call BuildPackage,nginx))
  526. define Package/nginx-mod-luci-ssl
  527. TITLE:=Dummy package for transition when upgrading.
  528. DEPENDS:=+nginx-mod-luci
  529. PKGARCH:=all
  530. endef
  531. define Package/nginx-mod-luci-ssl/install
  532. $(INSTALL_DIR) $(1)/usr/bin
  533. endef
  534. $(eval $(call BuildPackage,nginx-mod-luci-ssl))