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.

244 lines
7.2 KiB

  1. #
  2. # Copyright (C) 2012-2015 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.9.13
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://nginx.org/download/
  13. PKG_MD5SUM:=e7502dc170277597ca73eb53c359c771
  14. PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
  15. PKG_LICENSE:=2-clause BSD-like license
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/nginx-$(PKG_VERSION)
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_INSTALL:=1
  19. PKG_CONFIG_DEPENDS := \
  20. CONFIG_NGINX_SSL \
  21. CONFIG_NGINX_DAV \
  22. CONFIG_NGINX_FLV \
  23. CONFIG_NGINX_STUB_STATUS \
  24. CONFIG_NGINX_HTTP_CHARSET \
  25. CONFIG_NGINX_HTTP_GZIP \
  26. CONFIG_NGINX_HTTP_SSI \
  27. CONFIG_NGINX_HTTP_USERID \
  28. CONFIG_NGINX_HTTP_ACCESS \
  29. CONFIG_NGINX_HTTP_AUTH_BASIC \
  30. CONFIG_NGINX_HTTP_AUTOINDEX \
  31. CONFIG_NGINX_HTTP_GEO \
  32. CONFIG_NGINX_HTTP_MAP \
  33. CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
  34. CONFIG_NGINX_HTTP_REFERER \
  35. CONFIG_NGINX_HTTP_REWRITE \
  36. CONFIG_NGINX_HTTP_PROXY \
  37. CONFIG_NGINX_HTTP_FASTCGI \
  38. CONFIG_NGINX_HTTP_UWSGI \
  39. CONFIG_NGINX_HTTP_SCGI \
  40. CONFIG_NGINX_HTTP_MEMCACHED \
  41. CONFIG_NGINX_HTTP_LIMIT_CONN \
  42. CONFIG_NGINX_HTTP_LIMIT_REQ \
  43. CONFIG_NGINX_HTTP_EMPTY_GIF \
  44. CONFIG_NGINX_HTTP_BROWSER \
  45. CONFIG_NGINX_HTTP_UPSTREAM_HASH \
  46. CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
  47. CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \
  48. CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \
  49. CONFIG_NGINX_HTTP_UPSTREAM_ZONE \
  50. CONFIG_NGINX_HTTP_CACHE \
  51. CONFIG_NGINX_PCRE
  52. include $(INCLUDE_DIR)/package.mk
  53. define Package/nginx
  54. SECTION:=net
  55. CATEGORY:=Network
  56. SUBMENU:=Web Servers/Proxies
  57. TITLE:=Nginx web server
  58. URL:=http://nginx.org/
  59. DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl +NGINX_HTTP_GZIP:zlib +libpthread
  60. MENU:=1
  61. endef
  62. define Package/nginx/description
  63. nginx is an HTTP and reverse proxy server, as well as a mail proxy server,
  64. written by Igor Sysoev.
  65. endef
  66. define Package/nginx/config
  67. source "$(SOURCE)/Config.in"
  68. endef
  69. config_files=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf
  70. define Package/nginx/conffiles
  71. /etc/nginx/
  72. endef
  73. ADDITIONAL_MODULES:=
  74. ifeq ($(CONFIG_NGINX_NAXSI),y)
  75. ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
  76. endif
  77. ADDITIONAL_MODULES:=
  78. ifeq ($(CONFIG_IPV6),y)
  79. ADDITIONAL_MODULES += --with-ipv6
  80. endif
  81. ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
  82. ADDITIONAL_MODULES += --with-http_stub_status_module
  83. endif
  84. ifeq ($(CONFIG_NGINX_FLV),y)
  85. ADDITIONAL_MODULES += --with-http_flv_module
  86. endif
  87. ifeq ($(CONFIG_NGINX_SSL),y)
  88. ADDITIONAL_MODULES += --with-http_ssl_module
  89. endif
  90. ifeq ($(CONFIG_NGINX_DAV),y)
  91. ADDITIONAL_MODULES += --with-http_dav_module
  92. endif
  93. ifneq ($(CONFIG_NGINX_HTTP_CACHE),y)
  94. ADDITIONAL_MODULES += --without-http-cache
  95. endif
  96. ifneq ($(CONFIG_NGINX_PCRE),y)
  97. ADDITIONAL_MODULES += --without-pcre
  98. endif
  99. ifneq ($(CONFIG_NGINX_HTTP_CHARSET),y)
  100. ADDITIONAL_MODULES += --without-http_charset_module
  101. endif
  102. ifneq ($(CONFIG_NGINX_HTTP_GZIP),y)
  103. ADDITIONAL_MODULES += --without-http_gzip_module
  104. endif
  105. ifneq ($(CONFIG_NGINX_HTTP_SSI),y)
  106. ADDITIONAL_MODULES += --without-http_ssi_module
  107. endif
  108. ifneq ($(CONFIG_NGINX_HTTP_USERID),y)
  109. ADDITIONAL_MODULES += --without-http_userid_module
  110. endif
  111. ifneq ($(CONFIG_NGINX_HTTP_ACCESS),y)
  112. ADDITIONAL_MODULES += --without-http_access_module
  113. endif
  114. ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC),y)
  115. ADDITIONAL_MODULES += --without-http_auth_basic_module
  116. endif
  117. ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX),y)
  118. ADDITIONAL_MODULES += --without-http_autoindex_module
  119. endif
  120. ifneq ($(CONFIG_NGINX_HTTP_GEO),y)
  121. ADDITIONAL_MODULES += --without-http_geo_module
  122. endif
  123. ifneq ($(CONFIG_NGINX_HTTP_MAP),y)
  124. ADDITIONAL_MODULES += --without-http_map_module
  125. endif
  126. ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS),y)
  127. ADDITIONAL_MODULES += --without-http_split_clients_module
  128. endif
  129. ifneq ($(CONFIG_NGINX_HTTP_REFERER),y)
  130. ADDITIONAL_MODULES += --without-http_referer_module
  131. endif
  132. ifneq ($(CONFIG_NGINX_HTTP_REWRITE),y)
  133. ADDITIONAL_MODULES += --without-http_rewrite_module
  134. endif
  135. ifneq ($(CONFIG_NGINX_HTTP_PROXY),y)
  136. ADDITIONAL_MODULES += --without-http_proxy_module
  137. endif
  138. ifneq ($(CONFIG_NGINX_HTTP_FASTCGI),y)
  139. ADDITIONAL_MODULES += --without-http_fastcgi_module
  140. endif
  141. ifneq ($(CONFIG_NGINX_HTTP_UWSGI),y)
  142. ADDITIONAL_MODULES += --without-http_uwsgi_module
  143. endif
  144. ifneq ($(CONFIG_NGINX_HTTP_SCGI),y)
  145. ADDITIONAL_MODULES += --without-http_scgi_module
  146. endif
  147. ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y)
  148. ADDITIONAL_MODULES += --without-http_memcached_module
  149. endif
  150. ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y)
  151. ADDITIONAL_MODULES += --without-http_limit_conn_module
  152. endif
  153. ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y)
  154. ADDITIONAL_MODULES += --without-http_limit_req_module
  155. endif
  156. ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y)
  157. ADDITIONAL_MODULES += --without-http_empty_gif_module
  158. endif
  159. ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y)
  160. ADDITIONAL_MODULES += --without-http_browser_module
  161. endif
  162. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH),y)
  163. ADDITIONAL_MODULES += --without-http_upstream_hash_module
  164. endif
  165. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y)
  166. ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module
  167. endif
  168. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN),y)
  169. ADDITIONAL_MODULES += --without-http_upstream_least_conn_module
  170. endif
  171. ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y)
  172. ADDITIONAL_MODULES += --without-http_upstream_keepalive_module
  173. endif
  174. define Build/Configure
  175. ( cd $(PKG_BUILD_DIR) ; \
  176. ./configure \
  177. --crossbuild=Linux::$(ARCH) \
  178. --prefix=/usr \
  179. --conf-path=/etc/nginx/nginx.conf \
  180. $(ADDITIONAL_MODULES) \
  181. --error-log-path=/var/log/nginx/error.log \
  182. --pid-path=/var/run/nginx.pid \
  183. --lock-path=/var/lock/nginx.lock \
  184. --http-log-path=/var/log/nginx/access.log \
  185. --http-client-body-temp-path=/var/lib/nginx/body \
  186. --http-proxy-temp-path=/var/lib/nginx/proxy \
  187. --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
  188. --with-cc="$(TARGET_CC)" \
  189. --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  190. --with-ld-opt="$(TARGET_LDFLAGS)" \
  191. --without-http_upstream_zone_module \
  192. )
  193. endef
  194. define Package/nginx/install
  195. $(INSTALL_DIR) $(1)/usr/sbin
  196. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
  197. $(INSTALL_DIR) $(1)/etc/nginx
  198. $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
  199. $(INSTALL_DIR) $(1)/etc/init.d
  200. $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
  201. ifeq ($(CONFIG_NGINX_NAXSI),y)
  202. $(INSTALL_DIR) $(1)/etc/nginx
  203. $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx
  204. chmod 0640 $(1)/etc/nginx/naxsi_core.rules
  205. endif
  206. $(if $(CONFIG_NGINX_NAXSI),$($(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx))
  207. $(if $(CONFIG_NGINX_NAXSI),$(chmod 0640 $(1)/etc/nginx/naxsi_core.rules))
  208. endef
  209. define Build/Prepare
  210. $(call Build/Prepare/Default)
  211. $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi))
  212. endef
  213. define Download/nginx-naxsi
  214. VERSION:=6358c3d2e68a0c9e3ad11661c2a1f63fadc9b4f2
  215. SUBDIR:=nginx-naxsi
  216. FILE:=nginx-naxsi-module-$(PKG_VERSION)-$$(VERSION).tar.gz
  217. URL:=https://github.com/nbs-system/naxsi.git
  218. PROTO:=git
  219. endef
  220. define Prepare/nginx-naxsi
  221. $(eval $(call Download,nginx-naxsi))
  222. gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  223. endef
  224. $(eval $(call BuildPackage,nginx))