source: trunk/dports/www/nginx/Portfile @ 149005

Last change on this file since 149005 was 149005, checked in by mps@…, 3 years ago

nginx: update to 1.11.0.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.1 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 149005 2016-05-24 21:44:58Z mps@macports.org $
3
4PortSystem          1.0
5
6name                nginx
7version             1.11.0
8categories          www mail
9platforms           darwin
10license             BSD
11maintainers         cal mps openmaintainer
12
13description         High-performance HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
14long_description    \
15    Nginx ("engine x") is a high-performance HTTP(S) server and reverse proxy, \
16    as well as an IMAP/POP3 proxy server. Nginx was written by Igor Sysoev for \
17    Rambler.ru, Russia's second-most visited website, where it has been running \
18    in production for over two and a half years. Igor has released the source \
19    code under a BSD-like license. Although still in beta, Nginx is known for \
20    its stability, rich feature set, simple configuration, and low resource \
21    consumption.
22
23homepage            http://nginx.org/
24master_sites        http://nginx.org/download:nginx \
25                    http://www.grid.net.ru/nginx/download/:upload_module \
26                    googlecode:mod-zip:zip_module \
27                    http://people.freebsd.org/~osa/:redis_module \
28                    https://github.com/masterzen/nginx-upload-progress-module/archive/:uploadprogress_module \
29                    https://github.com/arut/nginx-dav-ext-module/archive/:davext_module \
30                    https://github.com/arut/nginx-rtmp-module/archive/:rtmp_module \
31                    https://github.com/slact/nchan/archive/:http_push_module \
32                    https://github.com/simpl/ngx_devel_kit/archive/:devel_kit_module \
33                    https://github.com/openresty/lua-nginx-module/archive/:lua_module
34
35distfiles           ${name}-${version}${extract.suffix}:nginx
36checksums           ${name}-${version}${extract.suffix} \
37                    rmd160  7e42064c0deddeadf546a3e8325c3a0cbe6d6d96 \
38                    sha256  6ca0e7bf540cdae387ce9470568c2c3a826bc7e7f12def1ae7d20b66f4065a99
39
40depends_lib         port:pcre \
41                    port:zlib
42
43patchfiles          patch-auto__install.diff \
44                    patch-conf__nginx.conf.diff
45
46set nginx_share     ${prefix}/share/${name}
47set nginx_examples  ${nginx_share}/examples
48set nginx_confdir   ${prefix}/etc/${name}
49set nginx_logdir    ${prefix}/var/log/${name}
50set nginx_rundir    ${prefix}/var/run/${name}
51set nginx_pidfile   ${nginx_rundir}/${name}.pid
52set nginx_all_confs {fastcgi.conf fastcgi_params mime.types nginx.conf scgi_params uwsgi_params}
53set auto_activate_confs {nginx.conf mime.types fastcgi.conf}
54
55# portfile-scoped vars for variant routines to re-def and use in port-stages (post-extract, pre-patch, etc)
56set nginx_upload_mod_dirname   ""
57
58# for aforementioned re-defs of portfile-scoped vars in variant routines
59proc nginx_set_portfile_var {var_name new_value} {
60    upvar   $var_name   portfile_var
61    set portfile_var   $new_value
62}
63
64
65configure.args-append \
66                    --with-cc-opt=\"${configure.cppflags} ${configure.cflags}\" \
67                    --with-ld-opt=\"${configure.ldflags}\" \
68                    --conf-path=${nginx_confdir}/${name}.conf \
69                    --error-log-path=${nginx_logdir}/error.log \
70                    --http-log-path=${nginx_logdir}/access.log \
71                    --pid-path=${nginx_pidfile} \
72                    --lock-path=${nginx_rundir}/${name}.lock \
73                    --http-client-body-temp-path=${nginx_rundir}/client_body_temp \
74                    --http-proxy-temp-path=${nginx_rundir}/proxy_temp \
75                    --http-fastcgi-temp-path=${nginx_rundir}/fastcgi_temp \
76                    --http-uwsgi-temp-path=${nginx_rundir}/uwsgi_temp \
77                    --with-ipv6
78
79# remove --disable-dependency-tracking
80configure.universal_args-delete   --disable-dependency-tracking
81
82build.target        build
83destroot.keepdirs   ${destroot}${nginx_logdir} \
84                    ${destroot}${nginx_rundir}
85
86post-destroot {
87    xinstall -d -m 755 ${destroot}${nginx_share}
88    xinstall -d -m 755 ${destroot}${nginx_examples}
89
90    foreach conf ${nginx_all_confs} {
91        set conf_path "${destroot}${nginx_confdir}/${conf}"
92        if {[file exists ${conf_path}]} {
93            file delete ${conf_path}
94        }
95        if {[file exists ${conf_path}.default]} {
96            move ${conf_path}.default ${destroot}${nginx_examples}
97        }
98    }
99
100    file rename ${destroot}${prefix}/html ${destroot}${nginx_share}
101}
102
103post-activate {
104    foreach conf ${auto_activate_confs} {
105        if {![file exists ${nginx_confdir}/${conf}]} {
106            xinstall -m 644 ${nginx_examples}/${conf}.default ${nginx_confdir}/${conf}
107        }
108    }
109}
110
111startupitem.create      yes
112startupitem.pidfile     auto ${nginx_pidfile}
113startupitem.executable  ${prefix}/sbin/nginx
114
115notes "\
116    A set of sample configuration files has been installed in ${nginx_examples}.\n\n\
117    Additionally, the files [join ${auto_activate_confs} ", "] have been copied to ${nginx_confdir} if they didn't exist yet.\n\
118    Adjust these files to your needs before starting nginx."
119
120default_variants +mp4 +flv +secure_link +ssl
121
122variant auth_request description {Add client authorization based on the result of a subrequest} {
123    configure.args-append   --with-http_auth_request_module
124}
125
126variant addition description {Append text to pages} {
127    configure.args-append   --with-http_addition_module
128}
129
130variant dav description {Add WebDAV support to server} {
131    configure.args-append   --with-http_dav_module
132}
133
134variant davext description {Add WebDAV (extended) support to server} {
135    set davext_filename     nginx-dav-ext-module
136    set davext_version      0.0.3
137    set davext_distname     ${davext_filename}-${davext_version}
138    distfiles-append        v${davext_version}.tar.gz:davext_module
139    checksums-append        v${davext_version}.tar.gz \
140                            rmd160  0d407e687bd59e81c2c9805ee8b39b8b85d43d08 \
141                            sha256  d428a0236c933779cb40ac8c91afb19d5c25a376dc3caab825bfd543e1ee530d
142    configure.args-append   --with-http_dav_module --add-module=${workpath}/${davext_distname}
143}
144
145variant debug description {Enable debug mode} {
146    configure.args-append   --with-debug
147}
148
149variant degradation description {Allow to return 204 or 444 code for some locations on low memory condition} {
150    configure.args-append   --with-http_degradation_module
151}
152
153variant flv description {Add FLV (Flash Video) streaming support to server} {
154    configure.args-append   --with-http_flv_module
155}
156
157variant geoip description {Enable Ngx http GeoIP module (http://wiki.nginx.org/HttpGeoIPModule)} {
158    configure.args-append   --with-http_geoip_module
159    depends_lib-append      port:libgeoip
160}
161
162variant google_perftools description {Enable Google Performance Tools profiling for workers} {
163    configure.args-append   --with-google_perftools_module
164    depends_lib-append      port:google-perftools
165
166    # If 'google_perftools' port doesn't find headers needed for the profiler lib, it just quietly skips it.
167    # Check if "-lprofiler" will fail -- if so, pre-empt configure-stage error with a more useful error msg.
168    pre-configure {
169        if {![file exists "${prefix}/lib/libprofiler.dylib"] && ![file exists "${prefix}/lib/libprofiler.a"]} {
170            ui_error "\
171                The 'google-perftools' port did not install a libprofiler library (libprofiler.dylib or\
172                libprofiler.a) on your version of OS X, but the +google_perftools variant will not work\
173                without this library. Disable the +google_perftools variant to continue installing ${name}"
174            error "Required libprofiler library missing from google-perftools port."
175        }
176    }
177}
178
179variant gzip_static description {Avoids compressing the same file each time it is requested} {
180    configure.args-append   --with-http_gzip_static_module
181}
182
183variant spdy requires http2 description {Legacy compatibility variant: SPDY has been replaced by HTTP/2} {
184    # added 2015-11-05
185}
186variant http2 requires ssl description {Add HTTP/2 support to the server} {
187    configure.args-append   --with-http_v2_module
188}
189
190variant image_filter description {Transform images with libgd} {
191    configure.args-append   --with-http_image_filter_module
192    depends_lib-append      port:gd2
193}
194
195variant mail description {Add IMAP4/POP3 mail proxy support} {
196    configure.args-append   --with-mail
197    if {[variant_isset ssl]} {
198        configure.args-append   --with-mail_ssl_module
199    }
200}
201
202variant mp4 description {Enables mp4 streaming with seeking ability} {
203    configure.args-append   --with-http_mp4_module
204}
205
206variant perl5 description {Add perl support to the server directly within nginx and call perl via SSI} {
207    depends_lib-append      port:perl5.22
208    configure.args-append   --with-http_perl_module \
209                            --with-perl=${prefix}/bin/perl5.22
210}
211
212variant random_index description {Randomize directory indexes} {
213    configure.args-append   --with-http_random_index_module
214}
215
216variant realip description {For using nginx as backend} {
217    configure.args-append   --with-http_realip_module
218}
219
220variant secure_link description {Protect pages with a secret key} {
221    configure.args-append   --with-http_secure_link_module
222}
223
224variant ssl description {Add SSL (HTTPS) support to the server, and also to the mail proxy if that is enabled} {
225    configure.args-append   --with-http_ssl_module
226    depends_lib-append      path:lib/libssl.dylib:openssl
227}
228
229variant status description {Add /nginx_status support to the server} {
230    configure.args-append   --with-http_stub_status_module
231}
232
233variant substitution description {Replace text in pages} {
234    configure.args-append   --with-http_sub_module
235}
236
237variant stream description {Enable ngx_stream_core_module for generic TCP proxying and load balancing (install with +ssl to enable ngx_stream_ssl_module)} {
238    configure.args-append   --with-stream
239    if {[variant_isset ssl]} {
240        configure.args-append   --with-stream_ssl_module
241    }
242}
243
244variant upload description {Enable Valery Kholodkov's upload module (http://grid.net.ru/nginx/upload.en.html)} {
245    set upload_filename     nginx_upload_module
246    set upload_version      2.2.0
247    set upload_distname     ${upload_filename}-${upload_version}
248    distfiles-append        ${upload_distname}.tar.gz:upload_module
249    checksums-append        ${upload_distname}.tar.gz \
250                            rmd160  5734af837be3fe8ec444a7e5e7f6707118594098 \
251                            sha256  b1c26abe0427180602e257627b4ed21848c93cc20cefc33af084983767d65805
252    configure.args-append   --add-module=${workpath}/${upload_distname}
253
254    # v2.2.0 release references members of ngx_http_request_body_t that were renamed in later nginx versions.
255    # Patch nginx_upload_module.c with fixed version from https://github.com/TimothyKlim/nginx-upload-module.
256    patchfiles-append       patch-nginx_upload_module.tmp-ngx_http_upload_module.c.diff
257
258
259    nginx_set_portfile_var   nginx_upload_mod_dirname    "${upload_distname}"
260
261    pre-fetch {
262        ui_error "The +upload variant is currently broken, because the upload module is not compatible with nginx 1.9.0."
263        error "incompatible variant selection"
264    }
265    # patch routine balks on file names with "../", but rel-paths in patchfiles start from $worksrcpath
266    pre-patch {
267        ln -s   "${workpath}/${nginx_upload_mod_dirname}" "${worksrcpath}/nginx_upload_module.tmp"
268    }
269    post-patch {
270        file delete   "${worksrcpath}/nginx_upload_module.tmp"
271    }
272}
273
274variant upload_progress description {Enable Brice Figureau's upload progress module (https://github.com/masterzen/nginx-upload-progress-module)} {
275    set uploadprg_filename  nginx_uploadprogress_module
276    set uploadprg_version   0.9.1
277    set uploadprg_distname  v${uploadprg_version}
278    distfiles-append        ${uploadprg_distname}.tar.gz:uploadprogress_module
279    checksums-append        ${uploadprg_distname}.tar.gz \
280                            rmd160  4810c8588d7fba9dc0130ec67ffe7e3ef27a2dd5 \
281                            sha256  99ec072cca35cd7791e77c40a8ded41a7a8c1111e057be26e55fba2fdf105f43
282    configure.args-append   --add-module=${workpath}/nginx-upload-progress-module-${uploadprg_version}
283}
284
285variant xslt description {Post-process pages with XSLT} {
286    configure.args-append   --with-http_xslt_module
287
288    depends_lib-append      port:libxslt
289}
290
291variant zip description {Enable Ngx zip download module \
292        (http://code.google.com/p/mod-zip/)} {
293
294    set zip_distname        mod_zip-1.1.6
295    distfiles-append        ${zip_distname}.tar.gz:zip_module
296    checksums-append        ${zip_distname}.tar.gz \
297                            rmd160  17a465d87b8e1ba71bdd6ad40e20d21cc7dcd434 \
298                            sha256  d30546b4be8308c721df0240ebc38c474c6b577381a110321eded6dbed5104b1
299    configure.args-append   --add-module=${workpath}/${zip_distname}
300}
301
302variant redis description {Enable Ngx HTTP Redis module} {
303    set redis_filename      ngx_http_redis
304    set redis_version       0.3.7
305    set redis_distname      ${redis_filename}-${redis_version}
306    distfiles-append        ${redis_distname}.tar.gz:redis_module
307    checksums-append        ${redis_distname}.tar.gz \
308                            rmd160  c63731371c547f67f4dd8a222ce0fad6ea67632f \
309                            sha256  9dfc14db81f431fdf3d69f3661a37daf110aef5f9479aa7c88cf362bb5d62604
310    configure.args-append   --add-module=${workpath}/${redis_distname}
311}
312
313variant rtmp description {Enable Ngx RTMP module (https://github.com/arut/nginx-rtmp-module)} {
314    set rtmp_filename       nginx-rtmp-module
315    set rtmp_version        1.1.7
316    set rtmp_distname       ${rtmp_filename}-${rtmp_version}
317    distfiles-append        v${rtmp_version}.tar.gz:rtmp_module
318    checksums-append        v${rtmp_version}.tar.gz \
319                            rmd160  3b7510fba6f6e572f0fb0b3676fe1eb4d4caecb1 \
320                            sha256  7922b0e3d5f3d9c4b275e4908cfb8f5fb1bfb3ac2df77f4c262cda56df21aab3
321    configure.args-append   --add-module=${workpath}/${rtmp_distname}
322}
323
324variant http_push description {Enable Ngx HTTP Push module (https://github.com/slact/nchan)} {
325    set http_push_filename  nchan
326    set http_push_version   0.731
327    set http_push_distname  ${http_push_filename}-${http_push_version}
328    distfiles-append        v${http_push_version}.tar.gz:http_push_module
329    checksums-append        v${http_push_version}.tar.gz \
330                            rmd160  d35d7138d3b4dd20076b1026c420f03c68177f99 \
331                            sha256  dd0c893fcf5af90a4f3c76a5750df9c39cba486ecb93cf76624af29f809ec345
332    configure.args-append   --add-module=${workpath}/${http_push_distname}
333}
334
335variant devel_kit description {Enable ngx_devel_kit module (https://github.com/simpl/ngx_devel_kit)} {
336    set devel_kit_filename    ngx_devel_kit
337    set devel_kit_version     0.2.19
338    set devel_kit_distname    ${devel_kit_filename}-${devel_kit_version}
339    distfiles-append          v${devel_kit_version}.tar.gz:devel_kit_module
340    checksums-append          v${devel_kit_version}.tar.gz \
341                              rmd160  64d3737bc4cc948c1363cce80d70e5260878811e \
342                              sha256  501f299abdb81b992a980bda182e5de5a4b2b3e275fbf72ee34dd7ae84c4b679
343
344    configure.args-append     --add-module=${workpath}/${devel_kit_distname}
345}
346
347variant lua requires devel_kit description {Enable Lua module (https://github.com/openresty/lua-nginx-module)} {
348    depends_lib-append      port:luajit
349    set ngx_lua_filename    lua-nginx-module
350    set ngx_lua_version     0.10.1rc0
351    set ngx_lua_distname    ${ngx_lua_filename}-${ngx_lua_version}
352    distfiles-append        v${ngx_lua_version}.tar.gz:lua_module
353    checksums-append        v${ngx_lua_version}.tar.gz \
354                            rmd160  c9add9c5755741b12a428ba60943900ff7d23d62 \
355                            sha256  1bae94d2a0fd4fad39f2544a2f8eaf71335ea512a6f0027af190b46562224c68
356
357    configure.cflags        -I${prefix}/include/luajit-2.0/ ${configure.cflags}
358    configure.env           LUAJIT_INC=${prefix}/include/luajit-2.0/
359    configure.env           LUAJIT_LIB=${prefix}/lib
360    configure.args-append   --add-module=${workpath}/${ngx_lua_distname}
361}
362
363livecheck.type      regexm
364livecheck.url       ${homepage}
365livecheck.regex     {nginx-(\d+\.\d+\.\d+)</a>\s+mainline}
Note: See TracBrowser for help on using the repository browser.