2 # Copyright (C) 2009-2012 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
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
15 PKG_SOURCE_URL
:=http
://nginx.org
/download
/
16 PKG_MD5SUM
:=5dfaba1cbeae9087f3949860a02caa9f
21 PKG_CONFIG_DEPENDS
:= \
22 CONFIG_NGINX_STUB_STATUS \
28 CONFIG_NGINX_HTTP_CACHE \
29 CONFIG_NGINX_HTTP_CHARSET \
30 CONFIG_NGINX_HTTP_GZIP \
31 CONFIG_NGINX_HTTP_SSI \
32 CONFIG_NGINX_HTTP_USERID \
33 CONFIG_NGINX_HTTP_ACCESS \
34 CONFIG_NGINX_HTTP_AUTH_BASIC \
35 CONFIG_NGINX_HTTP_AUTOINDEX \
36 CONFIG_NGINX_HTTP_GEO \
37 CONFIG_NGINX_HTTP_MAP \
38 CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
39 CONFIG_NGINX_HTTP_REFERER \
40 CONFIG_NGINX_HTTP_REWRITE \
41 CONFIG_NGINX_HTTP_PROXY \
42 CONFIG_NGINX_HTTP_FASTCGI \
43 CONFIG_NGINX_HTTP_UWSGI \
44 CONFIG_NGINX_HTTP_SCGI \
45 CONFIG_NGINX_HTTP_MEMCACHED \
46 CONFIG_NGINX_HTTP_LIMIT_CONN \
47 CONFIG_NGINX_HTTP_LIMIT_REQ \
48 CONFIG_NGINX_HTTP_EMPTY_GIF \
49 CONFIG_NGINX_HTTP_BROWSER \
50 CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
52 include $(INCLUDE_DIR
)/package.mk
57 SUBMENU
:=Web Servers
/Proxies
58 TITLE
:=Nginx web server
59 URL
:=http
://nginx.org
/
60 DEPENDS
:=+NGINX_PCRE
:libpcre
+(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC
):libopenssl
+NGINX_HTTP_GZIP
:zlib
+libpthread
+NGINX_LUA
:liblua
64 define Package
/nginx
/description
65 nginx is an HTTP and reverse proxy server
, as well
as a mail proxy server
,
66 written by Igor Sysoev.
69 define Package
/nginx
/config
70 source
"$(SOURCE)/Config.in"
73 config_files
=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf
75 define Package
/nginx
/conffiles
81 ifeq ($(CONFIG_IPV6
),y
)
82 ADDITIONAL_MODULES
+= --with-ipv6
84 ifeq ($(CONFIG_NGINX_STUB_STATUS
),y
)
85 ADDITIONAL_MODULES
+= --with-http_stub_status_module
87 ifeq ($(CONFIG_NGINX_FLV
),y
)
88 ADDITIONAL_MODULES
+= --with-http_flv_module
90 ifeq ($(CONFIG_NGINX_SSL
),y
)
91 ADDITIONAL_MODULES
+= --with-http_ssl_module
93 ifeq ($(CONFIG_NGINX_DAV
),y
)
94 ADDITIONAL_MODULES
+= --with-http_dav_module
96 ifeq ($(CONFIG_NGINX_LUA
),y
)
97 ADDITIONAL_MODULES
+= --add-module
=$(PKG_BUILD_DIR
)/lua-nginx
99 ifneq ($(CONFIG_NGINX_HTTP_CACHE
),y
)
100 ADDITIONAL_MODULES
+= --without-http-cache
102 ifneq ($(CONFIG_NGINX_PCRE
),y
)
103 ADDITIONAL_MODULES
+= --without-pcre
105 ifneq ($(CONFIG_NGINX_HTTP_CHARSET
),y
)
106 ADDITIONAL_MODULES
+= --without-http_charset_module
108 ifneq ($(CONFIG_NGINX_HTTP_GZIP
),y
)
109 ADDITIONAL_MODULES
+= --without-http_gzip_module
111 ifneq ($(CONFIG_NGINX_HTTP_SSI
),y
)
112 ADDITIONAL_MODULES
+= --without-http_ssi_module
114 ifneq ($(CONFIG_NGINX_HTTP_USERID
),y
)
115 ADDITIONAL_MODULES
+= --without-http_userid_module
117 ifneq ($(CONFIG_NGINX_HTTP_ACCESS
),y
)
118 ADDITIONAL_MODULES
+= --without-http_access_module
120 ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC
),y
)
121 ADDITIONAL_MODULES
+= --without-http_auth_basic_module
123 ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX
),y
)
124 ADDITIONAL_MODULES
+= --without-http_autoindex_module
126 ifneq ($(CONFIG_NGINX_HTTP_GEO
),y
)
127 ADDITIONAL_MODULES
+= --without-http_geo_module
129 ifneq ($(CONFIG_NGINX_HTTP_MAP
),y
)
130 ADDITIONAL_MODULES
+= --without-http_map_module
132 ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS
),y
)
133 ADDITIONAL_MODULES
+= --without-http_split_clients_module
135 ifneq ($(CONFIG_NGINX_HTTP_REFERER
),y
)
136 ADDITIONAL_MODULES
+= --without-http_referer_module
138 ifneq ($(CONFIG_NGINX_HTTP_REWRITE
),y
)
139 ADDITIONAL_MODULES
+= --without-http_rewrite_module
141 ifneq ($(CONFIG_NGINX_HTTP_PROXY
),y
)
142 ADDITIONAL_MODULES
+= --without-http_proxy_module
144 ifneq ($(CONFIG_NGINX_HTTP_FASTCGI
),y
)
145 ADDITIONAL_MODULES
+= --without-http_fastcgi_module
147 ifneq ($(CONFIG_NGINX_HTTP_UWSGI
),y
)
148 ADDITIONAL_MODULES
+= --without-http_uwsgi_module
150 ifneq ($(CONFIG_NGINX_HTTP_SCGI
),y
)
151 ADDITIONAL_MODULES
+= --without-http_scgi_module
153 ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED
),y
)
154 ADDITIONAL_MODULES
+= --without-http_memcached_module
156 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN
),y
)
157 ADDITIONAL_MODULES
+= --without-http_limit_conn_module
159 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ
),y
)
160 ADDITIONAL_MODULES
+= --without-http_limit_req_module
162 ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF
),y
)
163 ADDITIONAL_MODULES
+= --without-http_empty_gif_module
165 ifneq ($(CONFIG_NGINX_HTTP_BROWSER
),y
)
166 ADDITIONAL_MODULES
+= --without-http_browser_module
168 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
),y
)
169 ADDITIONAL_MODULES
+= --without-http_upstream_ip_hash_module
172 define Build
/Configure
173 # TODO: fix --crossbuild
174 (cd
$(PKG_BUILD_DIR
) ;\
175 $(if
$(CONFIG_NGINX_LUA
),LUA_INC
=$(STAGING_DIR
)/usr
/include LUA_LIB
=$(STAGING_DIR
)/usr
/lib
) \
177 --crossbuild
=Linux
::$(ARCH
) \
179 --conf-path
=/etc
/nginx
/nginx.conf \
180 --error-log-path
=/var
/log
/nginx
/error.log \
181 --pid-path
=/var
/run
/nginx.pid \
182 --lock-path
=/var
/lock
/nginx.lock \
183 --http-log-path
=/var
/log
/nginx
/access.log \
184 --http-client-body-temp-path
=/var
/lib
/nginx
/body \
185 --http-proxy-temp-path
=/var
/lib
/nginx
/proxy \
186 --http-fastcgi-temp-path
=/var
/lib
/nginx
/fastcgi \
187 --with-cc
="$(TARGET_CC)" \
188 --with-cc-opt
="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
189 --with-ld-opt
="$(TARGET_LDFLAGS)" \
190 $(ADDITIONAL_MODULES
) )
193 define Package
/nginx
/install
194 $(INSTALL_DIR
) $(1)/usr
/sbin
195 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/nginx
$(1)/usr
/sbin
/
196 $(INSTALL_DIR
) $(1)/etc
/nginx
197 $(INSTALL_DATA
) $(addprefix $(PKG_INSTALL_DIR
)/etc
/nginx
/,$(config_files
)) $(1)/etc
/nginx
/
198 $(INSTALL_DIR
) $(1)/etc
/init.d
199 $(INSTALL_BIN
) .
/files
/nginx.init
$(1)/etc
/init.d
/nginx
203 $(call Build
/Prepare
/Default
)
204 $(if
$(CONFIG_NGINX_LUA
),$(call Prepare
/lua-nginx
))
207 define Download
/lua-nginx
208 VERSION
:=7c0948a08e8449f7a9ffbc35244954e6aaddac5b
210 FILE
:=lua-nginx-module-
$(PKG_VERSION
)-$$(VERSION
).
tar.gz
211 URL
:=https
://github.com
/chaoslawful
/lua-nginx-module.git
215 define Prepare
/lua-nginx
216 $(eval
$(call Download
,lua-nginx
))
217 gzip
-dc
$(DL_DIR
)/$(FILE
) |
tar -C
$(PKG_BUILD_DIR
) $(TAR_OPTIONS
)
218 $(call PatchDir
,$(PKG_BUILD_DIR
),.
/patches-lua-nginx
)
221 $(eval
$(call BuildPackage
,nginx
))