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

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

nginx +perl5: Switch to perl 5.22, #48365

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.0 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 143442 2015-12-12 16:28:36Z cal@macports.org $
3
4PortSystem          1.0
5
6name                nginx
7version             1.9.9
8categories          www mail
9platforms           darwin
10license             BSD
11maintainers         cal gmail.com:mschamschula 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  221623f7faa4984d285fc6b6442840c1f81b74b7 \
38                    sha256  de66bb2b11c82533aa5cb5ccc27cbce736ab87c9f2c761e5237cda0b00068d73
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_params}
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} {
238    configure.args-append   --with-stream
239}
240
241variant upload description {Enable Valery Kholodkov's upload module (http://grid.net.ru/nginx/upload.en.html)} {
242    set upload_filename     nginx_upload_module
243    set upload_version      2.2.0
244    set upload_distname     ${upload_filename}-${upload_version}
245    distfiles-append        ${upload_distname}.tar.gz:upload_module
246    checksums-append        ${upload_distname}.tar.gz \
247                            rmd160  5734af837be3fe8ec444a7e5e7f6707118594098 \
248                            sha256  b1c26abe0427180602e257627b4ed21848c93cc20cefc33af084983767d65805
249    configure.args-append   --add-module=${workpath}/${upload_distname}
250
251    # v2.2.0 release references members of ngx_http_request_body_t that were renamed in later nginx versions.
252    # Patch nginx_upload_module.c with fixed version from https://github.com/TimothyKlim/nginx-upload-module.
253    patchfiles-append       patch-nginx_upload_module.tmp-ngx_http_upload_module.c.diff
254
255
256    nginx_set_portfile_var   nginx_upload_mod_dirname    "${upload_distname}"
257
258    pre-fetch {
259        ui_error "The +upload variant is currently broken, because the upload module is not compatible with nginx 1.9.0."
260        error "incompatible variant selection"
261    }
262    # patch routine balks on file names with "../", but rel-paths in patchfiles start from $worksrcpath
263    pre-patch {
264        ln -s   "${workpath}/${nginx_upload_mod_dirname}" "${worksrcpath}/nginx_upload_module.tmp"
265    }
266    post-patch {
267        file delete   "${worksrcpath}/nginx_upload_module.tmp"
268    }
269}
270
271variant upload_progress description {Enable Brice Figureau's upload progress module (https://github.com/masterzen/nginx-upload-progress-module)} {
272    set uploadprg_filename  nginx_uploadprogress_module
273    set uploadprg_version   0.9.1
274    set uploadprg_distname  v${uploadprg_version}
275    distfiles-append        ${uploadprg_distname}.tar.gz:uploadprogress_module
276    checksums-append        ${uploadprg_distname}.tar.gz \
277                            rmd160  4810c8588d7fba9dc0130ec67ffe7e3ef27a2dd5 \
278                            sha256  99ec072cca35cd7791e77c40a8ded41a7a8c1111e057be26e55fba2fdf105f43
279    configure.args-append   --add-module=${workpath}/nginx-upload-progress-module-${uploadprg_version}
280}
281
282variant xslt description {Post-process pages with XSLT} {
283    configure.args-append   --with-http_xslt_module
284
285    depends_lib-append      port:libxslt
286}
287
288variant zip description {Enable Ngx zip download module \
289        (http://code.google.com/p/mod-zip/)} {
290
291    set zip_distname        mod_zip-1.1.6
292    distfiles-append        ${zip_distname}.tar.gz:zip_module
293    checksums-append        ${zip_distname}.tar.gz \
294                            rmd160  17a465d87b8e1ba71bdd6ad40e20d21cc7dcd434 \
295                            sha256  d30546b4be8308c721df0240ebc38c474c6b577381a110321eded6dbed5104b1
296    configure.args-append   --add-module=${workpath}/${zip_distname}
297}
298
299variant redis description {Enable Ngx HTTP Redis module} {
300    set redis_filename      ngx_http_redis
301    set redis_version       0.3.7
302    set redis_distname      ${redis_filename}-${redis_version}
303    distfiles-append        ${redis_distname}.tar.gz:redis_module
304    checksums-append        ${redis_distname}.tar.gz \
305                            rmd160  c63731371c547f67f4dd8a222ce0fad6ea67632f \
306                            sha256  9dfc14db81f431fdf3d69f3661a37daf110aef5f9479aa7c88cf362bb5d62604
307    configure.args-append   --add-module=${workpath}/${redis_distname}
308}
309
310variant rtmp description {Enable Ngx RTMP module (https://github.com/arut/nginx-rtmp-module)} {
311    set rtmp_filename       nginx-rtmp-module
312    set rtmp_version        1.1.7
313    set rtmp_distname       ${rtmp_filename}-${rtmp_version}
314    distfiles-append        v${rtmp_version}.tar.gz:rtmp_module
315    checksums-append        v${rtmp_version}.tar.gz \
316                            rmd160  3b7510fba6f6e572f0fb0b3676fe1eb4d4caecb1 \
317                            sha256  7922b0e3d5f3d9c4b275e4908cfb8f5fb1bfb3ac2df77f4c262cda56df21aab3
318    configure.args-append   --add-module=${workpath}/${rtmp_distname}
319}
320
321variant http_push description {Enable Ngx HTTP Push module (https://github.com/slact/nchan)} {
322    set http_push_filename  nchan
323    set http_push_version   0.731
324    set http_push_distname  ${http_push_filename}-${http_push_version}
325    distfiles-append        v${http_push_version}.tar.gz:http_push_module
326    checksums-append        v${http_push_version}.tar.gz \
327                            rmd160  d35d7138d3b4dd20076b1026c420f03c68177f99 \
328                            sha256  dd0c893fcf5af90a4f3c76a5750df9c39cba486ecb93cf76624af29f809ec345
329    configure.args-append   --add-module=${workpath}/${http_push_distname}
330}
331
332variant devel_kit description {Enable ngx_devel_kit module (https://github.com/simpl/ngx_devel_kit)} {
333    set devel_kit_filename    ngx_devel_kit
334    set devel_kit_version     0.2.19
335    set devel_kit_distname    ${devel_kit_filename}-${devel_kit_version}
336    distfiles-append          v${devel_kit_version}.tar.gz:devel_kit_module
337    checksums-append          v${devel_kit_version}.tar.gz \
338                              rmd160  64d3737bc4cc948c1363cce80d70e5260878811e \
339                              sha256  501f299abdb81b992a980bda182e5de5a4b2b3e275fbf72ee34dd7ae84c4b679
340
341    configure.args-append     --add-module=${workpath}/${devel_kit_distname}
342}
343
344variant lua requires devel_kit description {Enable Lua module (https://github.com/openresty/lua-nginx-module)} {
345    depends_lib-append      port:luajit
346    set ngx_lua_filename    lua-nginx-module
347    set ngx_lua_version     0.9.19
348    set ngx_lua_distname    ${ngx_lua_filename}-${ngx_lua_version}
349    distfiles-append        v${ngx_lua_version}.tar.gz:lua_module
350    checksums-append        v${ngx_lua_version}.tar.gz \
351                            rmd160  e125372c1f3a1985ef70c55c2d7907ed4dc6b5fb \
352                            sha256  2b41d4d2627fda76946f194aae6c2b4d89bb59afd792d397c6b481ee82c10eb4
353
354    configure.cflags        -I${prefix}/include/luajit-2.0/ ${configure.cflags}
355    configure.env           LUAJIT_INC=${prefix}/include/luajit-2.0/
356    configure.env           LUAJIT_LIB=${prefix}/lib
357    configure.args-append   --add-module=${workpath}/${ngx_lua_distname}
358}
359
360livecheck.type      regexm
361livecheck.url       ${homepage}
362livecheck.regex     {nginx-(\d+\.\d+\.\d+)</a>\s+mainline}
Note: See TracBrowser for help on using the repository browser.