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_HASH
:=b4222e26fdb620a8d3c3a3a8b955e08b713672e1bc5198d1e4f462308a795b30
17 PKG_MD5SUM
:=995eb0a140455cf0cfc497e5bd7f94b3
18 PKG_MAINTAINER
:=Thomas Heil
<heil@terminal-consulting.de
>
19 PKG_LICENSE
:=2-clause BSD-like license
21 PKG_BUILD_DIR
:=$(BUILD_DIR
)/nginx-
$(PKG_VERSION
)
26 PKG_CONFIG_DEPENDS
:= \
30 CONFIG_NGINX_STUB_STATUS \
31 CONFIG_NGINX_HTTP_CHARSET \
32 CONFIG_NGINX_HTTP_GZIP \
33 CONFIG_NGINX_HTTP_SSI \
34 CONFIG_NGINX_HTTP_USERID \
35 CONFIG_NGINX_HTTP_ACCESS \
36 CONFIG_NGINX_HTTP_AUTH_BASIC \
37 CONFIG_NGINX_HTTP_AUTH_REQUEST \
38 CONFIG_NGINX_HTTP_AUTOINDEX \
39 CONFIG_NGINX_HTTP_GEO \
40 CONFIG_NGINX_HTTP_MAP \
41 CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
42 CONFIG_NGINX_HTTP_REFERER \
43 CONFIG_NGINX_HTTP_REWRITE \
44 CONFIG_NGINX_HTTP_PROXY \
45 CONFIG_NGINX_HTTP_FASTCGI \
46 CONFIG_NGINX_HTTP_UWSGI \
47 CONFIG_NGINX_HTTP_SCGI \
48 CONFIG_NGINX_HTTP_MEMCACHED \
49 CONFIG_NGINX_HTTP_LIMIT_CONN \
50 CONFIG_NGINX_HTTP_LIMIT_REQ \
51 CONFIG_NGINX_HTTP_EMPTY_GIF \
52 CONFIG_NGINX_HTTP_BROWSER \
53 CONFIG_NGINX_HTTP_UPSTREAM_HASH \
54 CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
55 CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \
56 CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \
57 CONFIG_NGINX_HTTP_UPSTREAM_ZONE \
58 CONFIG_NGINX_HTTP_CACHE \
59 CONFIG_NGINX_HTTP_V2 \
63 CONFIG_NGINX_HTTP_REAL_IP \
64 CONFIG_NGINX_HTTP_SECURE_LINK
66 include $(INCLUDE_DIR
)/package.mk
71 SUBMENU
:=Web Servers
/Proxies
72 TITLE
:=Nginx web server
73 URL
:=http
://nginx.org
/
74 DEPENDS
:=+NGINX_PCRE
:libpcre
+(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC
):libopenssl
+NGINX_HTTP_GZIP
:zlib
+NGINX_LUA
:liblua
+libpthread
78 define Package
/nginx
/description
79 nginx is an HTTP and reverse proxy server
, as well
as a mail proxy server
,
80 written by Igor Sysoev.
83 define Package
/nginx
/config
84 source
"$(SOURCE)/Config.in"
87 config_files
=nginx.conf mime.types
89 define Package
/nginx
/conffiles
94 ifeq ($(CONFIG_NGINX_NAXSI
),y
)
95 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_src
97 ifeq ($(CONFIG_NGINX_LUA
),y
)
98 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/lua-nginx
100 ifeq ($(CONFIG_IPV6
),y
)
101 ADDITIONAL_MODULES
+= --with-ipv6
103 ifeq ($(CONFIG_NGINX_STUB_STATUS
),y
)
104 ADDITIONAL_MODULES
+= --with-http_stub_status_module
106 ifeq ($(CONFIG_NGINX_FLV
),y
)
107 ADDITIONAL_MODULES
+= --with-http_flv_module
109 ifeq ($(CONFIG_NGINX_SSL
),y
)
110 ADDITIONAL_MODULES
+= --with-http_ssl_module
112 ifeq ($(CONFIG_NGINX_DAV
),y
)
113 ADDITIONAL_MODULES
+= --with-http_dav_module
115 ifneq ($(CONFIG_NGINX_HTTP_CACHE
),y
)
116 ADDITIONAL_MODULES
+= --without-http-cache
118 ifneq ($(CONFIG_NGINX_PCRE
),y
)
119 ADDITIONAL_MODULES
+= --without-pcre
121 ifneq ($(CONFIG_NGINX_HTTP_CHARSET
),y
)
122 ADDITIONAL_MODULES
+= --without-http_charset_module
124 config_files
+= koi-utf koi-win win-utf
126 ifneq ($(CONFIG_NGINX_HTTP_GZIP
),y
)
127 ADDITIONAL_MODULES
+= --without-http_gzip_module
129 ifneq ($(CONFIG_NGINX_HTTP_SSI
),y
)
130 ADDITIONAL_MODULES
+= --without-http_ssi_module
132 ifneq ($(CONFIG_NGINX_HTTP_USERID
),y
)
133 ADDITIONAL_MODULES
+= --without-http_userid_module
135 ifneq ($(CONFIG_NGINX_HTTP_ACCESS
),y
)
136 ADDITIONAL_MODULES
+= --without-http_access_module
138 ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC
),y
)
139 ADDITIONAL_MODULES
+= --without-http_auth_basic_module
141 ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST
),y
)
142 ADDITIONAL_MODULES
+= --with-http_auth_request_module
144 ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX
),y
)
145 ADDITIONAL_MODULES
+= --without-http_autoindex_module
147 ifneq ($(CONFIG_NGINX_HTTP_GEO
),y
)
148 ADDITIONAL_MODULES
+= --without-http_geo_module
150 ifneq ($(CONFIG_NGINX_HTTP_MAP
),y
)
151 ADDITIONAL_MODULES
+= --without-http_map_module
153 ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS
),y
)
154 ADDITIONAL_MODULES
+= --without-http_split_clients_module
156 ifneq ($(CONFIG_NGINX_HTTP_REFERER
),y
)
157 ADDITIONAL_MODULES
+= --without-http_referer_module
159 ifneq ($(CONFIG_NGINX_HTTP_REWRITE
),y
)
160 ADDITIONAL_MODULES
+= --without-http_rewrite_module
162 ifneq ($(CONFIG_NGINX_HTTP_PROXY
),y
)
163 ADDITIONAL_MODULES
+= --without-http_proxy_module
165 ifneq ($(CONFIG_NGINX_HTTP_FASTCGI
),y
)
166 ADDITIONAL_MODULES
+= --without-http_fastcgi_module
168 config_files
+= fastcgi_params
170 ifneq ($(CONFIG_NGINX_HTTP_UWSGI
),y
)
171 ADDITIONAL_MODULES
+= --without-http_uwsgi_module
173 ifneq ($(CONFIG_NGINX_HTTP_SCGI
),y
)
174 ADDITIONAL_MODULES
+= --without-http_scgi_module
176 ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED
),y
)
177 ADDITIONAL_MODULES
+= --without-http_memcached_module
179 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN
),y
)
180 ADDITIONAL_MODULES
+= --without-http_limit_conn_module
182 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ
),y
)
183 ADDITIONAL_MODULES
+= --without-http_limit_req_module
185 ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF
),y
)
186 ADDITIONAL_MODULES
+= --without-http_empty_gif_module
188 ifneq ($(CONFIG_NGINX_HTTP_BROWSER
),y
)
189 ADDITIONAL_MODULES
+= --without-http_browser_module
191 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH
),y
)
192 ADDITIONAL_MODULES
+= --without-http_upstream_hash_module
194 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
),y
)
195 ADDITIONAL_MODULES
+= --without-http_upstream_ip_hash_module
197 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN
),y
)
198 ADDITIONAL_MODULES
+= --without-http_upstream_least_conn_module
200 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE
),y
)
201 ADDITIONAL_MODULES
+= --without-http_upstream_keepalive_module
203 ifeq ($(CONFIG_NGINX_HTTP_V2
),y
)
204 ADDITIONAL_MODULES
+= --with-http_v2_module
206 ifeq ($(CONFIG_NGINX_HTTP_REAL_IP
),y
)
207 ADDITIONAL_MODULES
+= --with-http_realip_module
209 ifeq ($(CONFIG_NGINX_HTTP_SECURE_LINK
),y
)
210 ADDITIONAL_MODULES
+= --with-http_secure_link_module
213 TARGET_CFLAGS
+= -fvisibility
=hidden
-ffunction-sections
-fdata-sections
-DNGX_LUA_NO_BY_LUA_BLOCK
214 TARGET_LDFLAGS
+= -Wl
,--gc-sections
216 define Build
/Configure
217 ( cd
$(PKG_BUILD_DIR
) ; \
218 $(if
$(CONFIG_NGINX_LUA
),LUA_INC
=$(STAGING_DIR
)/usr
/include LUA_LIB
=$(STAGING_DIR
)/usr
/lib
) \
220 --crossbuild
=Linux
::$(ARCH
) \
222 --conf-path
=/etc
/nginx
/nginx.conf \
223 $(ADDITIONAL_MODULES
) \
224 --error-log-path
=/var
/log
/nginx
/error.log \
225 --pid-path
=/var
/run
/nginx.pid \
226 --lock-path
=/var
/lock
/nginx.lock \
227 --http-log-path
=/var
/log
/nginx
/access.log \
228 --http-client-body-temp-path
=/var
/lib
/nginx
/body \
229 --http-proxy-temp-path
=/var
/lib
/nginx
/proxy \
230 --http-fastcgi-temp-path
=/var
/lib
/nginx
/fastcgi \
231 --with-cc
="$(TARGET_CC)" \
232 --with-cc-opt
="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
233 --with-ld-opt
="$(TARGET_LDFLAGS)" \
234 --without-http_upstream_zone_module \
238 define Package
/nginx
/install
239 $(INSTALL_DIR
) $(1)/usr
/sbin
240 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/nginx
$(1)/usr
/sbin
/
241 $(INSTALL_DIR
) $(1)/etc
/nginx
242 $(INSTALL_DATA
) $(addprefix $(PKG_INSTALL_DIR
)/etc
/nginx
/,$(config_files
)) $(1)/etc
/nginx
/
243 $(INSTALL_DIR
) $(1)/etc
/init.d
244 $(INSTALL_BIN
) .
/files
/nginx.init
$(1)/etc
/init.d
/nginx
245 ifeq ($(CONFIG_NGINX_NAXSI
),y
)
246 $(INSTALL_DIR
) $(1)/etc
/nginx
247 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_config
/naxsi_core.rules
$(1)/etc
/nginx
248 chmod
0640 $(1)/etc
/nginx
/naxsi_core.rules
250 $(if
$(CONFIG_NGINX_NAXSI
),$($(INSTALL_BIN
) $(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_config
/naxsi_core.rules
$(1)/etc
/nginx
))
251 $(if
$(CONFIG_NGINX_NAXSI
),$(chmod
0640 $(1)/etc
/nginx
/naxsi_core.rules
))
255 $(call Build
/Prepare
/Default
)
256 $(if
$(CONFIG_NGINX_NAXSI
),$(call Prepare
/nginx-naxsi
))
257 $(if
$(CONFIG_NGINX_LUA
),$(call Prepare
/lua-nginx
))
260 define Download
/nginx-naxsi
261 VERSION
:=cf73f9c8664127252c2a4958d2e169516d3845a1
263 FILE
:=nginx-naxsi-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
264 URL
:=https
://github.com
/nbs-system
/naxsi.git
268 define Prepare
/nginx-naxsi
269 $(eval
$(call Download
,nginx-naxsi
))
270 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
273 define Download
/lua-nginx
274 VERSION
:=1967998b0eedab1ff51bff8fafa5fc3db47976aa
276 FILE
:=lua-nginx-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
277 URL
:=https
://github.com
/openresty
/lua-nginx-module.git
281 define Prepare
/lua-nginx
282 $(eval
$(call Download
,lua-nginx
))
283 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
284 $(call PatchDir
,$(PKG_BUILD_DIR
),.
/patches-lua-nginx
)
287 $(eval
$(call BuildPackage
,nginx
))