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
:=e8f5f4beed041e63eb97f9f4f55f3085
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_AUTOINDEX \
37 CONFIG_NGINX_HTTP_GEO \
38 CONFIG_NGINX_HTTP_MAP \
39 CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
40 CONFIG_NGINX_HTTP_REFERER \
41 CONFIG_NGINX_HTTP_REWRITE \
42 CONFIG_NGINX_HTTP_PROXY \
43 CONFIG_NGINX_HTTP_FASTCGI \
44 CONFIG_NGINX_HTTP_UWSGI \
45 CONFIG_NGINX_HTTP_SCGI \
46 CONFIG_NGINX_HTTP_MEMCACHED \
47 CONFIG_NGINX_HTTP_LIMIT_CONN \
48 CONFIG_NGINX_HTTP_LIMIT_REQ \
49 CONFIG_NGINX_HTTP_EMPTY_GIF \
50 CONFIG_NGINX_HTTP_BROWSER \
51 CONFIG_NGINX_HTTP_UPSTREAM_HASH \
52 CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
53 CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \
54 CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \
55 CONFIG_NGINX_HTTP_UPSTREAM_ZONE \
56 CONFIG_NGINX_HTTP_CACHE \
61 include $(INCLUDE_DIR
)/package.mk
66 SUBMENU
:=Web Servers
/Proxies
67 TITLE
:=Nginx web server
68 URL
:=http
://nginx.org
/
69 DEPENDS
:=+NGINX_PCRE
:libpcre
+(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC
):libopenssl
+NGINX_HTTP_GZIP
:zlib
+NGINX_LUA
:liblua
+libpthread
73 define Package
/nginx
/description
74 nginx is an HTTP and reverse proxy server
, as well
as a mail proxy server
,
75 written by Igor Sysoev.
78 define Package
/nginx
/config
79 source
"$(SOURCE)/Config.in"
82 config_files
=nginx.conf mime.types
84 define Package
/nginx
/conffiles
89 ifeq ($(CONFIG_NGINX_NAXSI
),y
)
90 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_src
92 ifeq ($(CONFIG_NGINX_LUA
),y
)
93 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/lua-nginx
95 ifeq ($(CONFIG_IPV6
),y
)
96 ADDITIONAL_MODULES
+= --with-ipv6
98 ifeq ($(CONFIG_NGINX_STUB_STATUS
),y
)
99 ADDITIONAL_MODULES
+= --with-http_stub_status_module
101 ifeq ($(CONFIG_NGINX_FLV
),y
)
102 ADDITIONAL_MODULES
+= --with-http_flv_module
104 ifeq ($(CONFIG_NGINX_SSL
),y
)
105 ADDITIONAL_MODULES
+= --with-http_ssl_module
107 ifeq ($(CONFIG_NGINX_DAV
),y
)
108 ADDITIONAL_MODULES
+= --with-http_dav_module
110 ifneq ($(CONFIG_NGINX_HTTP_CACHE
),y
)
111 ADDITIONAL_MODULES
+= --without-http-cache
113 ifneq ($(CONFIG_NGINX_PCRE
),y
)
114 ADDITIONAL_MODULES
+= --without-pcre
116 ifneq ($(CONFIG_NGINX_HTTP_CHARSET
),y
)
117 ADDITIONAL_MODULES
+= --without-http_charset_module
119 config_files
+= koi-utf koi-win win-utf
121 ifneq ($(CONFIG_NGINX_HTTP_GZIP
),y
)
122 ADDITIONAL_MODULES
+= --without-http_gzip_module
124 ifneq ($(CONFIG_NGINX_HTTP_SSI
),y
)
125 ADDITIONAL_MODULES
+= --without-http_ssi_module
127 ifneq ($(CONFIG_NGINX_HTTP_USERID
),y
)
128 ADDITIONAL_MODULES
+= --without-http_userid_module
130 ifneq ($(CONFIG_NGINX_HTTP_ACCESS
),y
)
131 ADDITIONAL_MODULES
+= --without-http_access_module
133 ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC
),y
)
134 ADDITIONAL_MODULES
+= --without-http_auth_basic_module
136 ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX
),y
)
137 ADDITIONAL_MODULES
+= --without-http_autoindex_module
139 ifneq ($(CONFIG_NGINX_HTTP_GEO
),y
)
140 ADDITIONAL_MODULES
+= --without-http_geo_module
142 ifneq ($(CONFIG_NGINX_HTTP_MAP
),y
)
143 ADDITIONAL_MODULES
+= --without-http_map_module
145 ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS
),y
)
146 ADDITIONAL_MODULES
+= --without-http_split_clients_module
148 ifneq ($(CONFIG_NGINX_HTTP_REFERER
),y
)
149 ADDITIONAL_MODULES
+= --without-http_referer_module
151 ifneq ($(CONFIG_NGINX_HTTP_REWRITE
),y
)
152 ADDITIONAL_MODULES
+= --without-http_rewrite_module
154 ifneq ($(CONFIG_NGINX_HTTP_PROXY
),y
)
155 ADDITIONAL_MODULES
+= --without-http_proxy_module
157 ifneq ($(CONFIG_NGINX_HTTP_FASTCGI
),y
)
158 ADDITIONAL_MODULES
+= --without-http_fastcgi_module
160 config_files
+= fastcgi_params
162 ifneq ($(CONFIG_NGINX_HTTP_UWSGI
),y
)
163 ADDITIONAL_MODULES
+= --without-http_uwsgi_module
165 ifneq ($(CONFIG_NGINX_HTTP_SCGI
),y
)
166 ADDITIONAL_MODULES
+= --without-http_scgi_module
168 ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED
),y
)
169 ADDITIONAL_MODULES
+= --without-http_memcached_module
171 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN
),y
)
172 ADDITIONAL_MODULES
+= --without-http_limit_conn_module
174 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ
),y
)
175 ADDITIONAL_MODULES
+= --without-http_limit_req_module
177 ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF
),y
)
178 ADDITIONAL_MODULES
+= --without-http_empty_gif_module
180 ifneq ($(CONFIG_NGINX_HTTP_BROWSER
),y
)
181 ADDITIONAL_MODULES
+= --without-http_browser_module
183 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH
),y
)
184 ADDITIONAL_MODULES
+= --without-http_upstream_hash_module
186 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
),y
)
187 ADDITIONAL_MODULES
+= --without-http_upstream_ip_hash_module
189 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN
),y
)
190 ADDITIONAL_MODULES
+= --without-http_upstream_least_conn_module
192 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE
),y
)
193 ADDITIONAL_MODULES
+= --without-http_upstream_keepalive_module
196 TARGET_CFLAGS
+= -fvisibility
=hidden
-ffunction-sections
-fdata-sections
-DNGX_LUA_NO_BY_LUA_BLOCK
197 TARGET_LDFLAGS
+= -Wl
,--gc-sections
199 define Build
/Configure
200 ( cd
$(PKG_BUILD_DIR
) ; \
201 $(if
$(CONFIG_NGINX_LUA
),LUA_INC
=$(STAGING_DIR
)/usr
/include LUA_LIB
=$(STAGING_DIR
)/usr
/lib
) \
203 --crossbuild
=Linux
::$(ARCH
) \
205 --conf-path
=/etc
/nginx
/nginx.conf \
206 $(ADDITIONAL_MODULES
) \
207 --error-log-path
=/var
/log
/nginx
/error.log \
208 --pid-path
=/var
/run
/nginx.pid \
209 --lock-path
=/var
/lock
/nginx.lock \
210 --http-log-path
=/var
/log
/nginx
/access.log \
211 --http-client-body-temp-path
=/var
/lib
/nginx
/body \
212 --http-proxy-temp-path
=/var
/lib
/nginx
/proxy \
213 --http-fastcgi-temp-path
=/var
/lib
/nginx
/fastcgi \
214 --with-cc
="$(TARGET_CC)" \
215 --with-cc-opt
="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
216 --with-ld-opt
="$(TARGET_LDFLAGS)" \
217 --without-http_upstream_zone_module \
221 define Package
/nginx
/install
222 $(INSTALL_DIR
) $(1)/usr
/sbin
223 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/nginx
$(1)/usr
/sbin
/
224 $(INSTALL_DIR
) $(1)/etc
/nginx
225 $(INSTALL_DATA
) $(addprefix $(PKG_INSTALL_DIR
)/etc
/nginx
/,$(config_files
)) $(1)/etc
/nginx
/
226 $(INSTALL_DIR
) $(1)/etc
/init.d
227 $(INSTALL_BIN
) .
/files
/nginx.init
$(1)/etc
/init.d
/nginx
228 ifeq ($(CONFIG_NGINX_NAXSI
),y
)
229 $(INSTALL_DIR
) $(1)/etc
/nginx
230 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_config
/naxsi_core.rules
$(1)/etc
/nginx
231 chmod
0640 $(1)/etc
/nginx
/naxsi_core.rules
233 $(if
$(CONFIG_NGINX_NAXSI
),$($(INSTALL_BIN
) $(PKG_BUILD_DIR
)/nginx-naxsi
/naxsi_config
/naxsi_core.rules
$(1)/etc
/nginx
))
234 $(if
$(CONFIG_NGINX_NAXSI
),$(chmod
0640 $(1)/etc
/nginx
/naxsi_core.rules
))
238 $(call Build
/Prepare
/Default
)
239 $(if
$(CONFIG_NGINX_NAXSI
),$(call Prepare
/nginx-naxsi
))
240 $(if
$(CONFIG_NGINX_LUA
),$(call Prepare
/lua-nginx
))
243 define Download
/nginx-naxsi
244 VERSION
:=cf73f9c8664127252c2a4958d2e169516d3845a1
246 FILE
:=nginx-naxsi-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
247 URL
:=https
://github.com
/nbs-system
/naxsi.git
251 define Prepare
/nginx-naxsi
252 $(eval
$(call Download
,nginx-naxsi
))
253 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
256 define Download
/lua-nginx
257 VERSION
:=1967998b0eedab1ff51bff8fafa5fc3db47976aa
259 FILE
:=lua-nginx-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
260 URL
:=https
://github.com
/openresty
/lua-nginx-module.git
264 define Prepare
/lua-nginx
265 $(eval
$(call Download
,lua-nginx
))
266 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
267 $(call PatchDir
,$(PKG_BUILD_DIR
),.
/patches-lua-nginx
)
270 $(eval
$(call BuildPackage
,nginx
))