2 # Copyright (C) 2012-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=nginx-
$(PKG_VERSION
).
tar.gz
15 PKG_SOURCE_URL
:=http
://nginx.org
/download
/
16 PKG_MD5SUM
:=204a20cb4f0b0c9db746c630d89ff4ea
17 PKG_MAINTAINER
:=Thomas Heil
<heil@terminal-consulting.de
>
18 PKG_LICENSE
:=2-clause BSD-like license
20 PKG_BUILD_DIR
:=$(BUILD_DIR
)/nginx-
$(PKG_VERSION
)
25 PKG_CONFIG_DEPENDS
:= \
29 CONFIG_NGINX_STUB_STATUS \
30 CONFIG_NGINX_HTTP_CHARSET \
31 CONFIG_NGINX_HTTP_GZIP \
32 CONFIG_NGINX_HTTP_SSI \
33 CONFIG_NGINX_HTTP_USERID \
34 CONFIG_NGINX_HTTP_ACCESS \
35 CONFIG_NGINX_HTTP_AUTH_BASIC \
36 CONFIG_NGINX_HTTP_AUTH_REQUEST \
37 CONFIG_NGINX_HTTP_AUTOINDEX \
38 CONFIG_NGINX_HTTP_GEO \
39 CONFIG_NGINX_HTTP_MAP \
40 CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
41 CONFIG_NGINX_HTTP_REFERER \
42 CONFIG_NGINX_HTTP_REWRITE \
43 CONFIG_NGINX_HTTP_PROXY \
44 CONFIG_NGINX_HTTP_FASTCGI \
45 CONFIG_NGINX_HTTP_UWSGI \
46 CONFIG_NGINX_HTTP_SCGI \
47 CONFIG_NGINX_HTTP_MEMCACHED \
48 CONFIG_NGINX_HTTP_LIMIT_CONN \
49 CONFIG_NGINX_HTTP_LIMIT_REQ \
50 CONFIG_NGINX_HTTP_EMPTY_GIF \
51 CONFIG_NGINX_HTTP_BROWSER \
52 CONFIG_NGINX_HTTP_UPSTREAM_HASH \
53 CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
54 CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \
55 CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \
56 CONFIG_NGINX_HTTP_UPSTREAM_ZONE \
57 CONFIG_NGINX_HTTP_CACHE \
58 CONFIG_NGINX_HTTP_V2 \
62 CONFIG_NGINX_HTTP_REAL_IP \
63 CONFIG_NGINX_HTTP_SECURE_LINK
65 include $(INCLUDE_DIR
)/package.mk
70 SUBMENU
:=Web Servers
/Proxies
71 TITLE
:=Nginx web server
72 URL
:=http
://nginx.org
/
73 DEPENDS
:=+NGINX_PCRE
:libpcre
+(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC
):libopenssl
+NGINX_HTTP_GZIP
:zlib
+NGINX_LUA
:liblua
+libpthread
77 define Package
/nginx
/description
78 nginx is an HTTP and reverse proxy server
, as well
as a mail proxy server
,
79 written by Igor Sysoev.
82 define Package
/nginx
/config
83 source
"$(SOURCE)/Config.in"
86 config_files
=nginx.conf mime.types
88 define Package
/nginx
/conffiles
93 ifeq ($(CONFIG_NGINX_NAXSI
),y
)
94 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_src
96 ifeq ($(CONFIG_NGINX_LUA
),y
)
97 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/lua-nginx
99 ifeq ($(CONFIG_IPV6
),y
)
100 ADDITIONAL_MODULES
+= --with-ipv6
102 ifeq ($(CONFIG_NGINX_STUB_STATUS
),y
)
103 ADDITIONAL_MODULES
+= --with-http_stub_status_module
105 ifeq ($(CONFIG_NGINX_FLV
),y
)
106 ADDITIONAL_MODULES
+= --with-http_flv_module
108 ifeq ($(CONFIG_NGINX_SSL
),y
)
109 ADDITIONAL_MODULES
+= --with-http_ssl_module
111 ifeq ($(CONFIG_NGINX_DAV
),y
)
112 ADDITIONAL_MODULES
+= --with-http_dav_module
114 ifneq ($(CONFIG_NGINX_HTTP_CACHE
),y
)
115 ADDITIONAL_MODULES
+= --without-http-cache
117 ifneq ($(CONFIG_NGINX_PCRE
),y
)
118 ADDITIONAL_MODULES
+= --without-pcre
120 ifneq ($(CONFIG_NGINX_HTTP_CHARSET
),y
)
121 ADDITIONAL_MODULES
+= --without-http_charset_module
123 config_files
+= koi-utf koi-win win-utf
125 ifneq ($(CONFIG_NGINX_HTTP_GZIP
),y
)
126 ADDITIONAL_MODULES
+= --without-http_gzip_module
128 ifneq ($(CONFIG_NGINX_HTTP_SSI
),y
)
129 ADDITIONAL_MODULES
+= --without-http_ssi_module
131 ifneq ($(CONFIG_NGINX_HTTP_USERID
),y
)
132 ADDITIONAL_MODULES
+= --without-http_userid_module
134 ifneq ($(CONFIG_NGINX_HTTP_ACCESS
),y
)
135 ADDITIONAL_MODULES
+= --without-http_access_module
137 ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC
),y
)
138 ADDITIONAL_MODULES
+= --without-http_auth_basic_module
140 ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST
),y
)
141 ADDITIONAL_MODULES
+= --with-http_auth_request_module
143 ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX
),y
)
144 ADDITIONAL_MODULES
+= --without-http_autoindex_module
146 ifneq ($(CONFIG_NGINX_HTTP_GEO
),y
)
147 ADDITIONAL_MODULES
+= --without-http_geo_module
149 ifneq ($(CONFIG_NGINX_HTTP_MAP
),y
)
150 ADDITIONAL_MODULES
+= --without-http_map_module
152 ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS
),y
)
153 ADDITIONAL_MODULES
+= --without-http_split_clients_module
155 ifneq ($(CONFIG_NGINX_HTTP_REFERER
),y
)
156 ADDITIONAL_MODULES
+= --without-http_referer_module
158 ifneq ($(CONFIG_NGINX_HTTP_REWRITE
),y
)
159 ADDITIONAL_MODULES
+= --without-http_rewrite_module
161 ifneq ($(CONFIG_NGINX_HTTP_PROXY
),y
)
162 ADDITIONAL_MODULES
+= --without-http_proxy_module
164 ifneq ($(CONFIG_NGINX_HTTP_FASTCGI
),y
)
165 ADDITIONAL_MODULES
+= --without-http_fastcgi_module
167 config_files
+= fastcgi_params
169 ifneq ($(CONFIG_NGINX_HTTP_UWSGI
),y
)
170 ADDITIONAL_MODULES
+= --without-http_uwsgi_module
172 ifneq ($(CONFIG_NGINX_HTTP_SCGI
),y
)
173 ADDITIONAL_MODULES
+= --without-http_scgi_module
175 ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED
),y
)
176 ADDITIONAL_MODULES
+= --without-http_memcached_module
178 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN
),y
)
179 ADDITIONAL_MODULES
+= --without-http_limit_conn_module
181 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ
),y
)
182 ADDITIONAL_MODULES
+= --without-http_limit_req_module
184 ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF
),y
)
185 ADDITIONAL_MODULES
+= --without-http_empty_gif_module
187 ifneq ($(CONFIG_NGINX_HTTP_BROWSER
),y
)
188 ADDITIONAL_MODULES
+= --without-http_browser_module
190 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH
),y
)
191 ADDITIONAL_MODULES
+= --without-http_upstream_hash_module
193 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
),y
)
194 ADDITIONAL_MODULES
+= --without-http_upstream_ip_hash_module
196 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN
),y
)
197 ADDITIONAL_MODULES
+= --without-http_upstream_least_conn_module
199 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE
),y
)
200 ADDITIONAL_MODULES
+= --without-http_upstream_keepalive_module
202 ifeq ($(CONFIG_NGINX_HTTP_V2
),y
)
203 ADDITIONAL_MODULES
+= --with-http_v2_module
205 ifeq ($(CONFIG_NGINX_HTTP_REAL_IP
),y
)
206 ADDITIONAL_MODULES
+= --with-http_realip_module
208 ifeq ($(CONFIG_NGINX_HTTP_SECURE_LINK
),y
)
209 ADDITIONAL_MODULES
+= --with-http_secure_link_module
212 TARGET_CFLAGS
+= -fvisibility
=hidden
-ffunction-sections
-fdata-sections
-DNGX_LUA_NO_BY_LUA_BLOCK
213 TARGET_LDFLAGS
+= -Wl
,--gc-sections
215 define Build
/Configure
216 ( cd
$(PKG_BUILD_DIR
) ; \
217 $(if
$(CONFIG_NGINX_LUA
),LUA_INC
=$(STAGING_DIR
)/usr
/include LUA_LIB
=$(STAGING_DIR
)/usr
/lib
) \
219 --crossbuild
=Linux
::$(ARCH
) \
221 --conf-path
=/etc
/nginx
/nginx.conf \
222 $(ADDITIONAL_MODULES
) \
223 --error-log-path
=/var
/log
/nginx
/error.log \
224 --pid-path
=/var
/run
/nginx.pid \
225 --lock-path
=/var
/lock
/nginx.lock \
226 --http-log-path
=/var
/log
/nginx
/access.log \
227 --http-client-body-temp-path
=/var
/lib
/nginx
/body \
228 --http-proxy-temp-path
=/var
/lib
/nginx
/proxy \
229 --http-fastcgi-temp-path
=/var
/lib
/nginx
/fastcgi \
230 --with-cc
="$(TARGET_CC)" \
231 --with-cc-opt
="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
232 --with-ld-opt
="$(TARGET_LDFLAGS)" \
233 --without-http_upstream_zone_module \
237 define Package
/nginx
/install
238 $(INSTALL_DIR
) $(1)/usr
/sbin
239 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/nginx
$(1)/usr
/sbin
/
240 $(INSTALL_DIR
) $(1)/etc
/nginx
241 $(INSTALL_DATA
) $(addprefix $(PKG_INSTALL_DIR
)/etc
/nginx
/,$(config_files
)) $(1)/etc
/nginx
/
242 $(INSTALL_DIR
) $(1)/etc
/init.d
243 $(INSTALL_BIN
) .
/files
/nginx.init
$(1)/etc
/init.d
/nginx
244 ifeq ($(CONFIG_NGINX_NAXSI
),y
)
245 $(INSTALL_DIR
) $(1)/etc
/nginx
246 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_config
/naxsi_core.rules
$(1)/etc
/nginx
247 chmod
0640 $(1)/etc
/nginx
/naxsi_core.rules
249 $(if
$(CONFIG_NGINX_NAXSI
),$($(INSTALL_BIN
) $(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_config
/naxsi_core.rules
$(1)/etc
/nginx
))
250 $(if
$(CONFIG_NGINX_NAXSI
),$(chmod
0640 $(1)/etc
/nginx
/naxsi_core.rules
))
254 $(call Build
/Prepare
/Default
)
255 $(if
$(CONFIG_NGINX_NAXSI
),$(call Prepare
/nginx-naxsi
))
256 $(if
$(CONFIG_NGINX_LUA
),$(call Prepare
/lua-nginx
))
259 define Download
/nginx-naxsi
260 VERSION
:=cf73f9c8664127252c2a4958d2e169516d3845a1
262 FILE
:=nginx-naxsi-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
263 URL
:=https
://github.com
/nbs-system
/naxsi.git
267 define Prepare
/nginx-naxsi
268 $(eval
$(call Download
,nginx-naxsi
))
269 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
272 define Download
/lua-nginx
273 VERSION
:=1967998b0eedab1ff51bff8fafa5fc3db47976aa
275 FILE
:=lua-nginx-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
276 URL
:=https
://github.com
/openresty
/lua-nginx-module.git
280 define Prepare
/lua-nginx
281 $(eval
$(call Download
,lua-nginx
))
282 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
283 $(call PatchDir
,$(PKG_BUILD_DIR
),.
/patches-lua-nginx
)
286 $(eval
$(call BuildPackage
,nginx
))