1 ################################################################################
5 ################################################################################
8 NGINX_SITE = http://nginx.org/download
10 NGINX_LICENSE_FILES = LICENSE
13 --crossbuild=Linux::$(BR2_ARCH) \
14 --with-cc="$(TARGET_CC)" \
15 --with-cpp="$(TARGET_CC)" \
16 --with-cc-opt="$(TARGET_CFLAGS)" \
17 --with-ld-opt="$(TARGET_LDFLAGS)" \
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/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
28 define NGINX_PERMISSIONS
29 /var/lib/nginx d 755 33 33 - - - - -
32 # disable external libatomic_ops because its detection fails.
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_libatomic=no \
39 ngx_force_have_epoll=yes \
40 ngx_force_have_sendfile=yes \
41 ngx_force_have_sendfile64=yes \
42 ngx_force_have_pr_set_dumpable=yes \
43 ngx_force_have_timer_event=yes \
44 ngx_force_have_map_anon=yes \
45 ngx_force_have_map_devzero=yes \
46 ngx_force_have_sysvshm=yes \
47 ngx_force_have_posix_sem=yes
49 # prefix: nginx root configuration location
52 --conf-path=/etc/nginx/nginx.conf \
53 --sbin-path=/usr/sbin/nginx \
54 --pid-path=/var/run/nginx.pid \
55 --lock-path=/var/run/lock/nginx.lock \
58 --error-log-path=/var/log/nginx/error.log \
59 --http-log-path=/var/log/nginx/access.log \
60 --http-client-body-temp-path=/var/tmp/nginx/client-body \
61 --http-proxy-temp-path=/var/tmp/nginx/proxy \
62 --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
63 --http-scgi-temp-path=/var/tmp/nginx/scgi \
64 --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
67 $(if $(BR2_PACKAGE_NGINX_FILE_AIO),--with-file-aio)
69 ifeq ($(BR2_PACKAGE_PCRE),y)
70 NGINX_DEPENDENCIES += pcre
71 NGINX_CONF_OPTS += --with-pcre
73 NGINX_CONF_OPTS += --without-pcre
76 # modules disabled or not activated because of missing dependencies:
77 # - google_perftools (googleperftools)
78 # - http_geoip_module (geoip)
79 # - http_perl_module (host-perl)
80 # - pcre-jit (want to rebuild pcre)
83 # * Feature/module option are *not* symetric.
84 # If a feature is on by default, only its --without-xxx option exists;
85 # if a feature is off by default, only its --with-xxx option exists.
86 # * The configure script fails if unknown options are passed on the command
91 $(if $(BR2_PACKAGE_NGINX_SELECT_MODULE),--with-select_module,--without-select_module) \
92 $(if $(BR2_PACKAGE_NGINX_POLL_MODULE),--with-poll_module,--without-poll_module)
94 ifneq ($(BR2_PACKAGE_NGINX_ADD_MODULES),)
96 $(addprefix --add-module=,$(call qstrip,$(BR2_PACKAGE_NGINX_ADD_MODULES)))
100 ifeq ($(BR2_PACKAGE_NGINX_HTTP),y)
101 ifeq ($(BR2_PACKAGE_NGINX_HTTP_CACHE),y)
102 NGINX_DEPENDENCIES += openssl
104 NGINX_CONF_OPTS += --without-http-cache
107 ifeq ($(BR2_PACKAGE_NGINX_HTTP_SPDY_MODULE),y)
108 NGINX_DEPENDENCIES += zlib
109 NGINX_CONF_OPTS += --with-http_spdy_module
112 ifeq ($(BR2_PACKAGE_NGINX_HTTP_SSL_MODULE),y)
113 NGINX_DEPENDENCIES += openssl
114 NGINX_CONF_OPTS += --with-http_ssl_module
117 ifeq ($(BR2_PACKAGE_NGINX_HTTP_XSLT_MODULE),y)
118 NGINX_DEPENDENCIES += libxml2 libxslt
119 NGINX_CONF_OPTS += --with-http_xslt_module
121 ngx_feature_path_libxslt=$(STAGING_DIR)/usr/include/libxml2
124 ifeq ($(BR2_PACKAGE_NGINX_HTTP_IMAGE_FILTER_MODULE),y)
125 NGINX_DEPENDENCIES += gd jpeg libpng
126 NGINX_CONF_OPTS += --with-http_image_filter_module
129 ifeq ($(BR2_PACKAGE_NGINX_HTTP_GUNZIP_MODULE),y)
130 NGINX_DEPENDENCIES += zlib
131 NGINX_CONF_OPTS += --with-http_gunzip_module
134 ifeq ($(BR2_PACKAGE_NGINX_HTTP_GZIP_STATIC_MODULE),y)
135 NGINX_DEPENDENCIES += zlib
136 NGINX_CONF_OPTS += --with-http_gzip_static_module
139 ifeq ($(BR2_PACKAGE_NGINX_HTTP_SECURE_LINK_MODULE),y)
140 NGINX_DEPENDENCIES += openssl
141 NGINX_CONF_OPTS += --with-http_secure_link_module
144 ifeq ($(BR2_PACKAGE_NGINX_HTTP_GZIP_MODULE),y)
145 NGINX_DEPENDENCIES += zlib
147 NGINX_CONF_OPTS += --without-http_gzip_module
150 ifeq ($(BR2_PACKAGE_NGINX_HTTP_REWRITE_MODULE),y)
151 NGINX_DEPENDENCIES += pcre
153 NGINX_CONF_OPTS += --without-http_rewrite_module
157 $(if $(BR2_PACKAGE_NGINX_HTTP_REALIP_MODULE),--with-http_realip_module) \
158 $(if $(BR2_PACKAGE_NGINX_HTTP_ADDITION_MODULE),--with-http_addition_module) \
159 $(if $(BR2_PACKAGE_NGINX_HTTP_SUB_MODULE),--with-http_sub_module) \
160 $(if $(BR2_PACKAGE_NGINX_HTTP_DAV_MODULE),--with-http_dav_module) \
161 $(if $(BR2_PACKAGE_NGINX_HTTP_FLV_MODULE),--with-http_flv_module) \
162 $(if $(BR2_PACKAGE_NGINX_HTTP_MP4_MODULE),--with-http_mp4_module) \
163 $(if $(BR2_PACKAGE_NGINX_HTTP_AUTH_REQUEST_MODULE),--with-http_auth_request_module) \
164 $(if $(BR2_PACKAGE_NGINX_HTTP_RANDOM_INDEX_MODULE),--with-http_random_index_module) \
165 $(if $(BR2_PACKAGE_NGINX_HTTP_DEGRADATION_MODULE),--with-http_degradation_module) \
166 $(if $(BR2_PACKAGE_NGINX_HTTP_STUB_STATUS_MODULE),--with-http_stub_status_module) \
167 $(if $(BR2_PACKAGE_NGINX_HTTP_CHARSET_MODULE),,--without-http_charset_module) \
168 $(if $(BR2_PACKAGE_NGINX_HTTP_SSI_MODULE),,--without-http_ssi_module) \
169 $(if $(BR2_PACKAGE_NGINX_HTTP_USERID_MODULE),,--without-http_userid_module) \
170 $(if $(BR2_PACKAGE_NGINX_HTTP_ACCESS_MODULE),,--without-http_access_module) \
171 $(if $(BR2_PACKAGE_NGINX_HTTP_AUTH_BASIC_MODULE),,--without-http_auth_basic_module) \
172 $(if $(BR2_PACKAGE_NGINX_HTTP_AUTOINDEX_MODULE),,--without-http_autoindex_module) \
173 $(if $(BR2_PACKAGE_NGINX_HTTP_GEO_MODULE),,--without-http_geo_module) \
174 $(if $(BR2_PACKAGE_NGINX_HTTP_MAP_MODULE),,--without-http_map_module) \
175 $(if $(BR2_PACKAGE_NGINX_HTTP_SPLIT_CLIENTS_MODULE),,--without-http_split_clients_module) \
176 $(if $(BR2_PACKAGE_NGINX_HTTP_REFERER_MODULE),,--without-http_referer_module) \
177 $(if $(BR2_PACKAGE_NGINX_HTTP_PROXY_MODULE),,--without-http_proxy_module) \
178 $(if $(BR2_PACKAGE_NGINX_HTTP_FASTCGI_MODULE),,--without-http_fastcgi_module) \
179 $(if $(BR2_PACKAGE_NGINX_HTTP_UWSGI_MODULE),,--without-http_uwsgi_module) \
180 $(if $(BR2_PACKAGE_NGINX_HTTP_SCGI_MODULE),,--without-http_scgi_module) \
181 $(if $(BR2_PACKAGE_NGINX_HTTP_MEMCACHED_MODULE),,--without-http_memcached_module) \
182 $(if $(BR2_PACKAGE_NGINX_HTTP_LIMIT_CONN_MODULE),,--without-http_limit_conn_module) \
183 $(if $(BR2_PACKAGE_NGINX_HTTP_LIMIT_REQ_MODULE),,--without-http_limit_req_module) \
184 $(if $(BR2_PACKAGE_NGINX_HTTP_EMPTY_GIF_MODULE),,--without-http_empty_gif_module) \
185 $(if $(BR2_PACKAGE_NGINX_HTTP_BROWSER_MODULE),,--without-http_browser_module) \
186 $(if $(BR2_PACKAGE_NGINX_HTTP_UPSTREAM_IP_HASH_MODULE),,--without-http_upstream_ip_hash_module) \
187 $(if $(BR2_PACKAGE_NGINX_HTTP_UPSTREAM_LEAST_CONN_MODULE),,--without-http_upstream_least_conn_module) \
188 $(if $(BR2_PACKAGE_NGINX_HTTP_UPSTREAM_KEEPALIVE_MODULE),,--without-http_upstream_keepalive_module)
190 else # !BR2_PACKAGE_NGINX_HTTP
191 NGINX_CONF_OPTS += --without-http
192 endif # BR2_PACKAGE_NGINX_HTTP
195 ifeq ($(BR2_PACKAGE_NGINX_MAIL),y)
197 ifeq ($(BR2_PACKAGE_NGINX_MAIL_SSL_MODULE),y)
198 NGINX_DEPENDENCIES += openssl
199 NGINX_CONF_OPTS += --with-mail_ssl_module
203 $(if $(BR2_PACKAGE_NGINX_MAIL_POP3_MODULE),,--without-mail_pop3_module) \
204 $(if $(BR2_PACKAGE_NGINX_MAIL_IMAP_MODULE),,--without-mail_imap_module) \
205 $(if $(BR2_PACKAGE_NGINX_MAIL_SMTP_MODULE),,--without-mail_smtp_module)
207 endif # BR2_PACKAGE_NGINX_MAIL
209 define NGINX_DISABLE_WERROR
210 $(SED) 's/-Werror//g' -i $(@D)/auto/cc/*
213 NGINX_PRE_CONFIGURE_HOOKS += NGINX_DISABLE_WERROR
215 define NGINX_CONFIGURE_CMDS
216 cd $(@D) ; $(NGINX_CONF_ENV) ./configure $(NGINX_CONF_OPTS)
219 define NGINX_BUILD_CMDS
220 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
223 define NGINX_INSTALL_TARGET_CMDS
224 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
225 -$(RM) $(TARGET_DIR)/usr/bin/nginx.old
226 $(INSTALL) -D -m 0664 package/nginx/nginx.logrotate \
227 $(TARGET_DIR)/etc/logrotate.d/nginx
230 define NGINX_INSTALL_INIT_SYSTEMD
231 $(INSTALL) -D -m 0644 package/nginx/nginx.service \
232 $(TARGET_DIR)/usr/lib/systemd/system/nginx.service
235 define NGINX_INSTALL_INIT_SYSV
236 $(INSTALL) -D -m 0755 package/nginx/S50nginx \
237 $(TARGET_DIR)/etc/init.d/S50nginx
240 $(eval $(generic-package))