package haproxy: fix gcc 4.7 warning
[openwrt/svn-archive/archive.git] / net / nginx / Makefile
1 #
2 # Copyright (C) 2009-2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=nginx
11 PKG_VERSION:=1.4.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://nginx.org/download/
16 PKG_MD5SUM:=5dfaba1cbeae9087f3949860a02caa9f
17
18 PKG_BUILD_PARALLEL:=1
19 PKG_INSTALL:=1
20
21 PKG_CONFIG_DEPENDS := \
22 CONFIG_NGINX_STUB_STATUS \
23 CONFIG_NGINX_FLV \
24 CONFIG_NGINX_SSL \
25 CONFIG_NGINX_DAV \
26 CONFIG_NGINX_LUA \
27 CONFIG_NGINX_PCRE \
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
51
52 include $(INCLUDE_DIR)/package.mk
53
54 define Package/nginx
55 SECTION:=net
56 CATEGORY:=Network
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
61 MENU:=1
62 endef
63
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.
67 endef
68
69 define Package/nginx/config
70 source "$(SOURCE)/Config.in"
71 endef
72
73 config_files=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf
74
75 define Package/nginx/conffiles
76 /etc/nginx/
77 endef
78
79 ADDITIONAL_MODULES:=
80
81 ifeq ($(CONFIG_IPV6),y)
82 ADDITIONAL_MODULES += --with-ipv6
83 endif
84 ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
85 ADDITIONAL_MODULES += --with-http_stub_status_module
86 endif
87 ifeq ($(CONFIG_NGINX_FLV),y)
88 ADDITIONAL_MODULES += --with-http_flv_module
89 endif
90 ifeq ($(CONFIG_NGINX_SSL),y)
91 ADDITIONAL_MODULES += --with-http_ssl_module
92 endif
93 ifeq ($(CONFIG_NGINX_DAV),y)
94 ADDITIONAL_MODULES += --with-http_dav_module
95 endif
96 ifeq ($(CONFIG_NGINX_LUA),y)
97 ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
98 endif
99 ifneq ($(CONFIG_NGINX_HTTP_CACHE),y)
100 ADDITIONAL_MODULES += --without-http-cache
101 endif
102 ifneq ($(CONFIG_NGINX_PCRE),y)
103 ADDITIONAL_MODULES += --without-pcre
104 endif
105 ifneq ($(CONFIG_NGINX_HTTP_CHARSET),y)
106 ADDITIONAL_MODULES += --without-http_charset_module
107 endif
108 ifneq ($(CONFIG_NGINX_HTTP_GZIP),y)
109 ADDITIONAL_MODULES += --without-http_gzip_module
110 endif
111 ifneq ($(CONFIG_NGINX_HTTP_SSI),y)
112 ADDITIONAL_MODULES += --without-http_ssi_module
113 endif
114 ifneq ($(CONFIG_NGINX_HTTP_USERID),y)
115 ADDITIONAL_MODULES += --without-http_userid_module
116 endif
117 ifneq ($(CONFIG_NGINX_HTTP_ACCESS),y)
118 ADDITIONAL_MODULES += --without-http_access_module
119 endif
120 ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC),y)
121 ADDITIONAL_MODULES += --without-http_auth_basic_module
122 endif
123 ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX),y)
124 ADDITIONAL_MODULES += --without-http_autoindex_module
125 endif
126 ifneq ($(CONFIG_NGINX_HTTP_GEO),y)
127 ADDITIONAL_MODULES += --without-http_geo_module
128 endif
129 ifneq ($(CONFIG_NGINX_HTTP_MAP),y)
130 ADDITIONAL_MODULES += --without-http_map_module
131 endif
132 ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS),y)
133 ADDITIONAL_MODULES += --without-http_split_clients_module
134 endif
135 ifneq ($(CONFIG_NGINX_HTTP_REFERER),y)
136 ADDITIONAL_MODULES += --without-http_referer_module
137 endif
138 ifneq ($(CONFIG_NGINX_HTTP_REWRITE),y)
139 ADDITIONAL_MODULES += --without-http_rewrite_module
140 endif
141 ifneq ($(CONFIG_NGINX_HTTP_PROXY),y)
142 ADDITIONAL_MODULES += --without-http_proxy_module
143 endif
144 ifneq ($(CONFIG_NGINX_HTTP_FASTCGI),y)
145 ADDITIONAL_MODULES += --without-http_fastcgi_module
146 endif
147 ifneq ($(CONFIG_NGINX_HTTP_UWSGI),y)
148 ADDITIONAL_MODULES += --without-http_uwsgi_module
149 endif
150 ifneq ($(CONFIG_NGINX_HTTP_SCGI),y)
151 ADDITIONAL_MODULES += --without-http_scgi_module
152 endif
153 ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y)
154 ADDITIONAL_MODULES += --without-http_memcached_module
155 endif
156 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y)
157 ADDITIONAL_MODULES += --without-http_limit_conn_module
158 endif
159 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y)
160 ADDITIONAL_MODULES += --without-http_limit_req_module
161 endif
162 ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y)
163 ADDITIONAL_MODULES += --without-http_empty_gif_module
164 endif
165 ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y)
166 ADDITIONAL_MODULES += --without-http_browser_module
167 endif
168 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y)
169 ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module
170 endif
171
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) \
176 ./configure \
177 --crossbuild=Linux::$(ARCH) \
178 --prefix=/usr \
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) )
191 endef
192
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
200 endef
201
202 define Build/Prepare
203 $(call Build/Prepare/Default)
204 $(if $(CONFIG_NGINX_LUA),$(call Prepare/lua-nginx))
205 endef
206
207 define Download/lua-nginx
208 VERSION:=7c0948a08e8449f7a9ffbc35244954e6aaddac5b
209 SUBDIR:=lua-nginx
210 FILE:=lua-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz
211 URL:=https://github.com/chaoslawful/lua-nginx-module.git
212 PROTO:=git
213 endef
214
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)
219 endef
220
221 $(eval $(call BuildPackage,nginx))