# -*- 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 # $Id: Portfile 149005 2016-05-24 21:44:58Z mps@macports.org $ PortSystem 1.0 name nginx version 1.11.0 categories www mail platforms darwin license BSD maintainers cal mps openmaintainer description High-performance HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server long_description \ Nginx ("engine x") is a high-performance HTTP(S) server and reverse proxy, \ as well as an IMAP/POP3 proxy server. Nginx was written by Igor Sysoev for \ Rambler.ru, Russia's second-most visited website, where it has been running \ in production for over two and a half years. Igor has released the source \ code under a BSD-like license. Although still in beta, Nginx is known for \ its stability, rich feature set, simple configuration, and low resource \ consumption. homepage http://nginx.org/ master_sites http://nginx.org/download:nginx \ http://www.grid.net.ru/nginx/download/:upload_module \ googlecode:mod-zip:zip_module \ http://people.freebsd.org/~osa/:redis_module \ https://github.com/masterzen/nginx-upload-progress-module/archive/:uploadprogress_module \ https://github.com/arut/nginx-dav-ext-module/archive/:davext_module \ https://github.com/arut/nginx-rtmp-module/archive/:rtmp_module \ https://github.com/slact/nchan/archive/:http_push_module \ https://github.com/simpl/ngx_devel_kit/archive/:devel_kit_module \ https://github.com/openresty/lua-nginx-module/archive/:lua_module distfiles ${name}-${version}${extract.suffix}:nginx checksums ${name}-${version}${extract.suffix} \ rmd160 7e42064c0deddeadf546a3e8325c3a0cbe6d6d96 \ sha256 6ca0e7bf540cdae387ce9470568c2c3a826bc7e7f12def1ae7d20b66f4065a99 depends_lib port:pcre \ port:zlib patchfiles patch-auto__install.diff \ patch-conf__nginx.conf.diff set nginx_share ${prefix}/share/${name} set nginx_examples ${nginx_share}/examples set nginx_confdir ${prefix}/etc/${name} set nginx_logdir ${prefix}/var/log/${name} set nginx_rundir ${prefix}/var/run/${name} set nginx_pidfile ${nginx_rundir}/${name}.pid set nginx_all_confs {fastcgi.conf fastcgi_params mime.types nginx.conf scgi_params uwsgi_params} set auto_activate_confs {nginx.conf mime.types fastcgi.conf} # portfile-scoped vars for variant routines to re-def and use in port-stages (post-extract, pre-patch, etc) set nginx_upload_mod_dirname "" # for aforementioned re-defs of portfile-scoped vars in variant routines proc nginx_set_portfile_var {var_name new_value} { upvar $var_name portfile_var set portfile_var $new_value } configure.args-append \ --with-cc-opt=\"${configure.cppflags} ${configure.cflags}\" \ --with-ld-opt=\"${configure.ldflags}\" \ --conf-path=${nginx_confdir}/${name}.conf \ --error-log-path=${nginx_logdir}/error.log \ --http-log-path=${nginx_logdir}/access.log \ --pid-path=${nginx_pidfile} \ --lock-path=${nginx_rundir}/${name}.lock \ --http-client-body-temp-path=${nginx_rundir}/client_body_temp \ --http-proxy-temp-path=${nginx_rundir}/proxy_temp \ --http-fastcgi-temp-path=${nginx_rundir}/fastcgi_temp \ --http-uwsgi-temp-path=${nginx_rundir}/uwsgi_temp \ --with-ipv6 # remove --disable-dependency-tracking configure.universal_args-delete --disable-dependency-tracking build.target build destroot.keepdirs ${destroot}${nginx_logdir} \ ${destroot}${nginx_rundir} post-destroot { xinstall -d -m 755 ${destroot}${nginx_share} xinstall -d -m 755 ${destroot}${nginx_examples} foreach conf ${nginx_all_confs} { set conf_path "${destroot}${nginx_confdir}/${conf}" if {[file exists ${conf_path}]} { file delete ${conf_path} } if {[file exists ${conf_path}.default]} { move ${conf_path}.default ${destroot}${nginx_examples} } } file rename ${destroot}${prefix}/html ${destroot}${nginx_share} } post-activate { foreach conf ${auto_activate_confs} { if {![file exists ${nginx_confdir}/${conf}]} { xinstall -m 644 ${nginx_examples}/${conf}.default ${nginx_confdir}/${conf} } } } startupitem.create yes startupitem.pidfile auto ${nginx_pidfile} startupitem.executable ${prefix}/sbin/nginx notes "\ A set of sample configuration files has been installed in ${nginx_examples}.\n\n\ Additionally, the files [join ${auto_activate_confs} ", "] have been copied to ${nginx_confdir} if they didn't exist yet.\n\ Adjust these files to your needs before starting nginx." default_variants +mp4 +flv +secure_link +ssl variant auth_request description {Add client authorization based on the result of a subrequest} { configure.args-append --with-http_auth_request_module } variant addition description {Append text to pages} { configure.args-append --with-http_addition_module } variant dav description {Add WebDAV support to server} { configure.args-append --with-http_dav_module } variant davext description {Add WebDAV (extended) support to server} { set davext_filename nginx-dav-ext-module set davext_version 0.0.3 set davext_distname ${davext_filename}-${davext_version} distfiles-append v${davext_version}.tar.gz:davext_module checksums-append v${davext_version}.tar.gz \ rmd160 0d407e687bd59e81c2c9805ee8b39b8b85d43d08 \ sha256 d428a0236c933779cb40ac8c91afb19d5c25a376dc3caab825bfd543e1ee530d configure.args-append --with-http_dav_module --add-module=${workpath}/${davext_distname} } variant debug description {Enable debug mode} { configure.args-append --with-debug } variant degradation description {Allow to return 204 or 444 code for some locations on low memory condition} { configure.args-append --with-http_degradation_module } variant flv description {Add FLV (Flash Video) streaming support to server} { configure.args-append --with-http_flv_module } variant geoip description {Enable Ngx http GeoIP module (http://wiki.nginx.org/HttpGeoIPModule)} { configure.args-append --with-http_geoip_module depends_lib-append port:libgeoip } variant google_perftools description {Enable Google Performance Tools profiling for workers} { configure.args-append --with-google_perftools_module depends_lib-append port:google-perftools # If 'google_perftools' port doesn't find headers needed for the profiler lib, it just quietly skips it. # Check if "-lprofiler" will fail -- if so, pre-empt configure-stage error with a more useful error msg. pre-configure { if {![file exists "${prefix}/lib/libprofiler.dylib"] && ![file exists "${prefix}/lib/libprofiler.a"]} { ui_error "\ The 'google-perftools' port did not install a libprofiler library (libprofiler.dylib or\ libprofiler.a) on your version of OS X, but the +google_perftools variant will not work\ without this library. Disable the +google_perftools variant to continue installing ${name}" error "Required libprofiler library missing from google-perftools port." } } } variant gzip_static description {Avoids compressing the same file each time it is requested} { configure.args-append --with-http_gzip_static_module } variant spdy requires http2 description {Legacy compatibility variant: SPDY has been replaced by HTTP/2} { # added 2015-11-05 } variant http2 requires ssl description {Add HTTP/2 support to the server} { configure.args-append --with-http_v2_module } variant image_filter description {Transform images with libgd} { configure.args-append --with-http_image_filter_module depends_lib-append port:gd2 } variant mail description {Add IMAP4/POP3 mail proxy support} { configure.args-append --with-mail if {[variant_isset ssl]} { configure.args-append --with-mail_ssl_module } } variant mp4 description {Enables mp4 streaming with seeking ability} { configure.args-append --with-http_mp4_module } variant perl5 description {Add perl support to the server directly within nginx and call perl via SSI} { depends_lib-append port:perl5.22 configure.args-append --with-http_perl_module \ --with-perl=${prefix}/bin/perl5.22 } variant random_index description {Randomize directory indexes} { configure.args-append --with-http_random_index_module } variant realip description {For using nginx as backend} { configure.args-append --with-http_realip_module } variant secure_link description {Protect pages with a secret key} { configure.args-append --with-http_secure_link_module } variant ssl description {Add SSL (HTTPS) support to the server, and also to the mail proxy if that is enabled} { configure.args-append --with-http_ssl_module depends_lib-append path:lib/libssl.dylib:openssl } variant status description {Add /nginx_status support to the server} { configure.args-append --with-http_stub_status_module } variant substitution description {Replace text in pages} { configure.args-append --with-http_sub_module } variant stream description {Enable ngx_stream_core_module for generic TCP proxying and load balancing (install with +ssl to enable ngx_stream_ssl_module)} { configure.args-append --with-stream if {[variant_isset ssl]} { configure.args-append --with-stream_ssl_module } } variant upload description {Enable Valery Kholodkov's upload module (http://grid.net.ru/nginx/upload.en.html)} { set upload_filename nginx_upload_module set upload_version 2.2.0 set upload_distname ${upload_filename}-${upload_version} distfiles-append ${upload_distname}.tar.gz:upload_module checksums-append ${upload_distname}.tar.gz \ rmd160 5734af837be3fe8ec444a7e5e7f6707118594098 \ sha256 b1c26abe0427180602e257627b4ed21848c93cc20cefc33af084983767d65805 configure.args-append --add-module=${workpath}/${upload_distname} # v2.2.0 release references members of ngx_http_request_body_t that were renamed in later nginx versions. # Patch nginx_upload_module.c with fixed version from https://github.com/TimothyKlim/nginx-upload-module. patchfiles-append patch-nginx_upload_module.tmp-ngx_http_upload_module.c.diff nginx_set_portfile_var nginx_upload_mod_dirname "${upload_distname}" pre-fetch { ui_error "The +upload variant is currently broken, because the upload module is not compatible with nginx 1.9.0." error "incompatible variant selection" } # patch routine balks on file names with "../", but rel-paths in patchfiles start from $worksrcpath pre-patch { ln -s "${workpath}/${nginx_upload_mod_dirname}" "${worksrcpath}/nginx_upload_module.tmp" } post-patch { file delete "${worksrcpath}/nginx_upload_module.tmp" } } variant upload_progress description {Enable Brice Figureau's upload progress module (https://github.com/masterzen/nginx-upload-progress-module)} { set uploadprg_filename nginx_uploadprogress_module set uploadprg_version 0.9.1 set uploadprg_distname v${uploadprg_version} distfiles-append ${uploadprg_distname}.tar.gz:uploadprogress_module checksums-append ${uploadprg_distname}.tar.gz \ rmd160 4810c8588d7fba9dc0130ec67ffe7e3ef27a2dd5 \ sha256 99ec072cca35cd7791e77c40a8ded41a7a8c1111e057be26e55fba2fdf105f43 configure.args-append --add-module=${workpath}/nginx-upload-progress-module-${uploadprg_version} } variant xslt description {Post-process pages with XSLT} { configure.args-append --with-http_xslt_module depends_lib-append port:libxslt } variant zip description {Enable Ngx zip download module \ (http://code.google.com/p/mod-zip/)} { set zip_distname mod_zip-1.1.6 distfiles-append ${zip_distname}.tar.gz:zip_module checksums-append ${zip_distname}.tar.gz \ rmd160 17a465d87b8e1ba71bdd6ad40e20d21cc7dcd434 \ sha256 d30546b4be8308c721df0240ebc38c474c6b577381a110321eded6dbed5104b1 configure.args-append --add-module=${workpath}/${zip_distname} } variant redis description {Enable Ngx HTTP Redis module} { set redis_filename ngx_http_redis set redis_version 0.3.7 set redis_distname ${redis_filename}-${redis_version} distfiles-append ${redis_distname}.tar.gz:redis_module checksums-append ${redis_distname}.tar.gz \ rmd160 c63731371c547f67f4dd8a222ce0fad6ea67632f \ sha256 9dfc14db81f431fdf3d69f3661a37daf110aef5f9479aa7c88cf362bb5d62604 configure.args-append --add-module=${workpath}/${redis_distname} } variant rtmp description {Enable Ngx RTMP module (https://github.com/arut/nginx-rtmp-module)} { set rtmp_filename nginx-rtmp-module set rtmp_version 1.1.7 set rtmp_distname ${rtmp_filename}-${rtmp_version} distfiles-append v${rtmp_version}.tar.gz:rtmp_module checksums-append v${rtmp_version}.tar.gz \ rmd160 3b7510fba6f6e572f0fb0b3676fe1eb4d4caecb1 \ sha256 7922b0e3d5f3d9c4b275e4908cfb8f5fb1bfb3ac2df77f4c262cda56df21aab3 configure.args-append --add-module=${workpath}/${rtmp_distname} } variant http_push description {Enable Ngx HTTP Push module (https://github.com/slact/nchan)} { set http_push_filename nchan set http_push_version 0.731 set http_push_distname ${http_push_filename}-${http_push_version} distfiles-append v${http_push_version}.tar.gz:http_push_module checksums-append v${http_push_version}.tar.gz \ rmd160 d35d7138d3b4dd20076b1026c420f03c68177f99 \ sha256 dd0c893fcf5af90a4f3c76a5750df9c39cba486ecb93cf76624af29f809ec345 configure.args-append --add-module=${workpath}/${http_push_distname} } variant devel_kit description {Enable ngx_devel_kit module (https://github.com/simpl/ngx_devel_kit)} { set devel_kit_filename ngx_devel_kit set devel_kit_version 0.2.19 set devel_kit_distname ${devel_kit_filename}-${devel_kit_version} distfiles-append v${devel_kit_version}.tar.gz:devel_kit_module checksums-append v${devel_kit_version}.tar.gz \ rmd160 64d3737bc4cc948c1363cce80d70e5260878811e \ sha256 501f299abdb81b992a980bda182e5de5a4b2b3e275fbf72ee34dd7ae84c4b679 configure.args-append --add-module=${workpath}/${devel_kit_distname} } variant lua requires devel_kit description {Enable Lua module (https://github.com/openresty/lua-nginx-module)} { depends_lib-append port:luajit set ngx_lua_filename lua-nginx-module set ngx_lua_version 0.10.1rc0 set ngx_lua_distname ${ngx_lua_filename}-${ngx_lua_version} distfiles-append v${ngx_lua_version}.tar.gz:lua_module checksums-append v${ngx_lua_version}.tar.gz \ rmd160 c9add9c5755741b12a428ba60943900ff7d23d62 \ sha256 1bae94d2a0fd4fad39f2544a2f8eaf71335ea512a6f0027af190b46562224c68 configure.cflags -I${prefix}/include/luajit-2.0/ ${configure.cflags} configure.env LUAJIT_INC=${prefix}/include/luajit-2.0/ configure.env LUAJIT_LIB=${prefix}/lib configure.args-append --add-module=${workpath}/${ngx_lua_distname} } livecheck.type regexm livecheck.url ${homepage} livecheck.regex {nginx-(\d+\.\d+\.\d+)\s+mainline}