python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / nginx / nginx.mk
blobf9b2cd1d3c874fa206680325b04f7be21f14e972
1 ################################################################################
3 # nginx
5 ################################################################################
7 NGINX_VERSION = 1.10.3
8 NGINX_SITE = http://nginx.org/download
9 NGINX_LICENSE = BSD-2c
10 NGINX_LICENSE_FILES = LICENSE
11 NGINX_DEPENDENCIES = host-pkgconf
13 NGINX_CONF_OPTS = \
14 --crossbuild=Linux::$(BR2_ARCH) \
15 --with-cc="$(TARGET_CC)" \
16 --with-cpp="$(TARGET_CC)" \
17 --with-ld-opt="$(TARGET_LDFLAGS)" \
18 --with-ipv6
20 # www-data user and group are used for nginx. Because these user and group
21 # are already set by buildroot, it is not necessary to redefine them.
22 # See system/skeleton/etc/passwd
23 # username: www-data uid: 33
24 # groupname: www-data gid: 33
26 # So, we just need to create the directories used by nginx with the right
27 # ownership.
28 define NGINX_PERMISSIONS
29 /var/lib/nginx d 755 33 33 - - - - -
30 endef
32 # disable external libatomic_ops because its detection fails.
33 NGINX_CONF_ENV += \
34 ngx_force_c_compiler=yes \
35 ngx_force_c99_have_variadic_macros=yes \
36 ngx_force_gcc_have_variadic_macros=yes \
37 ngx_force_gcc_have_atomic=yes \
38 ngx_force_have_epoll=yes \
39 ngx_force_have_sendfile=yes \
40 ngx_force_have_sendfile64=yes \
41 ngx_force_have_pr_set_dumpable=yes \
42 ngx_force_have_timer_event=yes \
43 ngx_force_have_map_anon=yes \
44 ngx_force_have_map_devzero=yes \
45 ngx_force_have_sysvshm=yes \
46 ngx_force_have_posix_sem=yes
48 # prefix: nginx root configuration location
49 NGINX_CONF_OPTS += \
50 --prefix=/usr \
51 --conf-path=/etc/nginx/nginx.conf \
52 --sbin-path=/usr/sbin/nginx \
53 --pid-path=/var/run/nginx.pid \
54 --lock-path=/var/run/lock/nginx.lock \
55 --user=www-data \
56 --group=www-data \
57 --error-log-path=/var/log/nginx/error.log \
58 --http-log-path=/var/log/nginx/access.log \
59 --http-client-body-temp-path=/var/tmp/nginx/client-body \
60 --http-proxy-temp-path=/var/tmp/nginx/proxy \
61 --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
62 --http-scgi-temp-path=/var/tmp/nginx/scgi \
63 --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
65 NGINX_CONF_OPTS += \
66 $(if $(BR2_PACKAGE_NGINX_FILE_AIO),--with-file-aio) \
67 $(if $(BR2_PACKAGE_NGINX_THREADS),--with-threads)
69 ifeq ($(BR2_PACKAGE_LIBATOMIC_OPS),y)
70 NGINX_DEPENDENCIES += libatomic_ops
71 NGINX_CONF_OPTS += --with-libatomic
72 NGINX_CONF_ENV += ngx_force_have_libatomic=yes
73 ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
74 NGINX_CFLAGS += "-DAO_NO_SPARC_V9"
75 endif
76 else
77 NGINX_CONF_ENV += ngx_force_have_libatomic=no
78 endif
80 ifeq ($(BR2_PACKAGE_PCRE),y)
81 NGINX_DEPENDENCIES += pcre
82 NGINX_CONF_OPTS += --with-pcre
83 else
84 NGINX_CONF_OPTS += --without-pcre
85 endif
87 # modules disabled or not activated because of missing dependencies:
88 # - google_perftools (googleperftools)
89 # - http_geoip_module (geoip)
90 # - http_perl_module (host-perl)
91 # - pcre-jit (want to rebuild pcre)
93 # Notes:
94 # * Feature/module option are *not* symetric.
95 # If a feature is on by default, only its --without-xxx option exists;
96 # if a feature is off by default, only its --with-xxx option exists.
97 # * The configure script fails if unknown options are passed on the command
98 # line.
100 # misc. modules
101 NGINX_CONF_OPTS += \
102 $(if $(BR2_PACKAGE_NGINX_SELECT_MODULE),--with-select_module,--without-select_module) \
103 $(if $(BR2_PACKAGE_NGINX_POLL_MODULE),--with-poll_module,--without-poll_module)
105 ifneq ($(BR2_PACKAGE_NGINX_ADD_MODULES),)
106 NGINX_CONF_OPTS += \
107 $(addprefix --add-module=,$(call qstrip,$(BR2_PACKAGE_NGINX_ADD_MODULES)))
108 endif
110 # http server modules
111 ifeq ($(BR2_PACKAGE_NGINX_HTTP),y)
112 ifeq ($(BR2_PACKAGE_NGINX_HTTP_CACHE),y)
113 NGINX_DEPENDENCIES += openssl
114 else
115 NGINX_CONF_OPTS += --without-http-cache
116 endif
118 ifeq ($(BR2_PACKAGE_NGINX_HTTP_V2_MODULE),y)
119 NGINX_DEPENDENCIES += zlib
120 NGINX_CONF_OPTS += --with-http_v2_module
121 endif
123 ifeq ($(BR2_PACKAGE_NGINX_HTTP_SSL_MODULE),y)
124 NGINX_DEPENDENCIES += openssl
125 NGINX_CONF_OPTS += --with-http_ssl_module
126 endif
128 ifeq ($(BR2_PACKAGE_NGINX_HTTP_XSLT_MODULE),y)
129 NGINX_DEPENDENCIES += libxml2 libxslt
130 NGINX_CONF_OPTS += --with-http_xslt_module
131 endif
133 ifeq ($(BR2_PACKAGE_NGINX_HTTP_IMAGE_FILTER_MODULE),y)
134 NGINX_DEPENDENCIES += gd jpeg libpng
135 NGINX_CONF_OPTS += --with-http_image_filter_module
136 endif
138 ifeq ($(BR2_PACKAGE_NGINX_HTTP_GUNZIP_MODULE),y)
139 NGINX_DEPENDENCIES += zlib
140 NGINX_CONF_OPTS += --with-http_gunzip_module
141 endif
143 ifeq ($(BR2_PACKAGE_NGINX_HTTP_GZIP_STATIC_MODULE),y)
144 NGINX_DEPENDENCIES += zlib
145 NGINX_CONF_OPTS += --with-http_gzip_static_module
146 endif
148 ifeq ($(BR2_PACKAGE_NGINX_HTTP_SECURE_LINK_MODULE),y)
149 NGINX_DEPENDENCIES += openssl
150 NGINX_CONF_OPTS += --with-http_secure_link_module
151 endif
153 ifeq ($(BR2_PACKAGE_NGINX_HTTP_GZIP_MODULE),y)
154 NGINX_DEPENDENCIES += zlib
155 else
156 NGINX_CONF_OPTS += --without-http_gzip_module
157 endif
159 ifeq ($(BR2_PACKAGE_NGINX_HTTP_REWRITE_MODULE),y)
160 NGINX_DEPENDENCIES += pcre
161 else
162 NGINX_CONF_OPTS += --without-http_rewrite_module
163 endif
165 NGINX_CONF_OPTS += \
166 $(if $(BR2_PACKAGE_NGINX_HTTP_REALIP_MODULE),--with-http_realip_module) \
167 $(if $(BR2_PACKAGE_NGINX_HTTP_ADDITION_MODULE),--with-http_addition_module) \
168 $(if $(BR2_PACKAGE_NGINX_HTTP_SUB_MODULE),--with-http_sub_module) \
169 $(if $(BR2_PACKAGE_NGINX_HTTP_DAV_MODULE),--with-http_dav_module) \
170 $(if $(BR2_PACKAGE_NGINX_HTTP_FLV_MODULE),--with-http_flv_module) \
171 $(if $(BR2_PACKAGE_NGINX_HTTP_MP4_MODULE),--with-http_mp4_module) \
172 $(if $(BR2_PACKAGE_NGINX_HTTP_AUTH_REQUEST_MODULE),--with-http_auth_request_module) \
173 $(if $(BR2_PACKAGE_NGINX_HTTP_RANDOM_INDEX_MODULE),--with-http_random_index_module) \
174 $(if $(BR2_PACKAGE_NGINX_HTTP_DEGRADATION_MODULE),--with-http_degradation_module) \
175 $(if $(BR2_PACKAGE_NGINX_HTTP_STUB_STATUS_MODULE),--with-http_stub_status_module) \
176 $(if $(BR2_PACKAGE_NGINX_HTTP_CHARSET_MODULE),,--without-http_charset_module) \
177 $(if $(BR2_PACKAGE_NGINX_HTTP_SSI_MODULE),,--without-http_ssi_module) \
178 $(if $(BR2_PACKAGE_NGINX_HTTP_USERID_MODULE),,--without-http_userid_module) \
179 $(if $(BR2_PACKAGE_NGINX_HTTP_ACCESS_MODULE),,--without-http_access_module) \
180 $(if $(BR2_PACKAGE_NGINX_HTTP_AUTH_BASIC_MODULE),,--without-http_auth_basic_module) \
181 $(if $(BR2_PACKAGE_NGINX_HTTP_AUTOINDEX_MODULE),,--without-http_autoindex_module) \
182 $(if $(BR2_PACKAGE_NGINX_HTTP_GEO_MODULE),,--without-http_geo_module) \
183 $(if $(BR2_PACKAGE_NGINX_HTTP_MAP_MODULE),,--without-http_map_module) \
184 $(if $(BR2_PACKAGE_NGINX_HTTP_SPLIT_CLIENTS_MODULE),,--without-http_split_clients_module) \
185 $(if $(BR2_PACKAGE_NGINX_HTTP_REFERER_MODULE),,--without-http_referer_module) \
186 $(if $(BR2_PACKAGE_NGINX_HTTP_PROXY_MODULE),,--without-http_proxy_module) \
187 $(if $(BR2_PACKAGE_NGINX_HTTP_FASTCGI_MODULE),,--without-http_fastcgi_module) \
188 $(if $(BR2_PACKAGE_NGINX_HTTP_UWSGI_MODULE),,--without-http_uwsgi_module) \
189 $(if $(BR2_PACKAGE_NGINX_HTTP_SCGI_MODULE),,--without-http_scgi_module) \
190 $(if $(BR2_PACKAGE_NGINX_HTTP_MEMCACHED_MODULE),,--without-http_memcached_module) \
191 $(if $(BR2_PACKAGE_NGINX_HTTP_LIMIT_CONN_MODULE),,--without-http_limit_conn_module) \
192 $(if $(BR2_PACKAGE_NGINX_HTTP_LIMIT_REQ_MODULE),,--without-http_limit_req_module) \
193 $(if $(BR2_PACKAGE_NGINX_HTTP_EMPTY_GIF_MODULE),,--without-http_empty_gif_module) \
194 $(if $(BR2_PACKAGE_NGINX_HTTP_BROWSER_MODULE),,--without-http_browser_module) \
195 $(if $(BR2_PACKAGE_NGINX_HTTP_UPSTREAM_IP_HASH_MODULE),,--without-http_upstream_ip_hash_module) \
196 $(if $(BR2_PACKAGE_NGINX_HTTP_UPSTREAM_LEAST_CONN_MODULE),,--without-http_upstream_least_conn_module) \
197 $(if $(BR2_PACKAGE_NGINX_HTTP_UPSTREAM_KEEPALIVE_MODULE),,--without-http_upstream_keepalive_module)
199 else # !BR2_PACKAGE_NGINX_HTTP
200 NGINX_CONF_OPTS += --without-http
201 endif # BR2_PACKAGE_NGINX_HTTP
203 # mail modules
204 ifeq ($(BR2_PACKAGE_NGINX_MAIL),y)
205 NGINX_CONF_OPTS += --with-mail
207 ifeq ($(BR2_PACKAGE_NGINX_MAIL_SSL_MODULE),y)
208 NGINX_DEPENDENCIES += openssl
209 NGINX_CONF_OPTS += --with-mail_ssl_module
210 endif
212 NGINX_CONF_OPTS += \
213 $(if $(BR2_PACKAGE_NGINX_MAIL_POP3_MODULE),,--without-mail_pop3_module) \
214 $(if $(BR2_PACKAGE_NGINX_MAIL_IMAP_MODULE),,--without-mail_imap_module) \
215 $(if $(BR2_PACKAGE_NGINX_MAIL_SMTP_MODULE),,--without-mail_smtp_module)
217 endif # BR2_PACKAGE_NGINX_MAIL
219 # stream modules
220 ifeq ($(BR2_PACKAGE_NGINX_STREAM),y)
221 NGINX_CONF_OPTS += --with-stream
223 ifeq ($(BR2_PACKAGE_NGINX_STREAM_SSL_MODULE),y)
224 NGINX_DEPENDENCIES += openssl
225 NGINX_CONF_OPTS += --with-stream_ssl_module
226 endif
228 NGINX_CONF_OPTS += \
229 $(if $(BR2_PACKAGE_NGINX_STREAM_LIMIT_CONN_MODULE),,--without-stream_limit_conn_module) \
230 $(if $(BR2_PACKAGE_NGINX_STREAM_ACCESS_MODULE),,--without-stream_access_module) \
231 $(if $(BR2_PACKAGE_NGINX_STREAM_UPSTREAM_HASH_MODULE),,--without-stream_upstream_hash_module) \
232 $(if $(BR2_PACKAGE_NGINX_STREAM_UPSTREAM_LEAST_CONN_MODULE),,--without-stream_upstream_least_conn_module) \
233 $(if $(BR2_PACKAGE_NGINX_STREAM_UPSTREAM_ZONE_MODULE),,--without-stream_upstream_zone_module)
235 endif # BR2_PACKAGE_NGINX_STREAM
237 # external modules
238 ifeq ($(BR2_PACKAGE_NGINX_UPLOAD),y)
239 NGINX_CONF_OPTS += $(addprefix --add-module=,$(NGINX_UPLOAD_DIR))
240 NGINX_DEPENDENCIES += nginx-upload
241 endif
243 ifeq ($(BR2_PACKAGE_NGINX_DAV_EXT),y)
244 NGINX_CONF_OPTS += --add-module=$(NGINX_DAV_EXT_DIR)
245 NGINX_DEPENDENCIES += nginx-dav-ext
246 endif
248 ifeq ($(BR2_PACKAGE_NGINX_NAXSI),y)
249 NGINX_DEPENDENCIES += nginx-naxsi
250 NGINX_CONF_OPTS += --add-module=$(NGINX_NAXSI_DIR)/naxsi_src
251 endif
253 # Debug logging
254 NGINX_CONF_OPTS += $(if $(BR2_PACKAGE_NGINX_DEBUG),--with-debug)
256 define NGINX_DISABLE_WERROR
257 $(SED) 's/-Werror//g' -i $(@D)/auto/cc/*
258 endef
260 NGINX_PRE_CONFIGURE_HOOKS += NGINX_DISABLE_WERROR
262 define NGINX_CONFIGURE_CMDS
263 cd $(@D) ; $(NGINX_CONF_ENV) \
264 PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
265 GDLIB_CONFIG=$(STAGING_DIR)/usr/bin/gdlib-config \
266 ./configure $(NGINX_CONF_OPTS) \
267 --with-cc-opt="$(TARGET_CFLAGS) $(NGINX_CFLAGS)"
268 endef
270 define NGINX_BUILD_CMDS
271 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
272 endef
274 define NGINX_INSTALL_TARGET_CMDS
275 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
276 $(RM) $(TARGET_DIR)/usr/sbin/nginx.old
277 $(INSTALL) -D -m 0664 package/nginx/nginx.logrotate \
278 $(TARGET_DIR)/etc/logrotate.d/nginx
279 endef
281 define NGINX_INSTALL_INIT_SYSTEMD
282 $(INSTALL) -D -m 0644 package/nginx/nginx.service \
283 $(TARGET_DIR)/usr/lib/systemd/system/nginx.service
285 mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
287 ln -fs ../../../../usr/lib/systemd/system/nginx.service \
288 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/nginx.service
289 endef
291 define NGINX_INSTALL_INIT_SYSV
292 $(INSTALL) -D -m 0755 package/nginx/S50nginx \
293 $(TARGET_DIR)/etc/init.d/S50nginx
294 endef
296 $(eval $(generic-package))