source: trunk/dports/www/nginx/Portfile

Last change on this file was 154390, checked in by mojca@…, 11 months ago

nginx: switch to perl5.24 (#52081)

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