[NEW] www/unit

Sergey A. Osokin osa at freebsd.org
Wed Sep 29 09:50:13 UTC 2021


Hi,

updated version of the www/unit/Portfile is attached, here's the list
of changes:

1. multi-versions support for perl, python and ruby languages
2. added php module, commented out at the moment, PHP embed SAPI is
   required to build Unit's PHP module, here's the
   `./configure php .. ' output:

    configuring PHP module
    checking for PHP ... found
     + PHP SAPI: [cli phpdbg]
    checking for PHP version ... not found
    checking for PHP embed SAPI ... not found

3. added `--ld-opt' flag to the configure script

Please provide your comments, questions, suggestions.

Thank you.
 
-- 
Sergey Osokin
-------------- next part --------------
# -*- 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

PortSystem      1.0

name            unit
version         1.25.0
categories      www
platforms       darwin
license         Apache-2
maintainers     osokin

description     Dynamic web application server

long_description \
    NGINX Unit is a dynamic web application server, designed \
    to run applications in multiple languages.  Unit is lightweight, \
    polyglot, and dynamically configured via API.  The design of the \
    server allows reconfiguration of specific application parameters \
    as needed by the engineering or operations.

homepage        https://unit.nginx.org/

master_sites    https://unit.nginx.org/download/

checksums       sha256  4ab4f05a934dd00628c0e067f7d0c5ba62bb55e9e2e7a333fa3764a180b9765d \
                size    853280 \
                rmd160  d08da7f6404e3fad4a69f31ba203cc9a3b69024c

depends_lib     port:pcre2 \
                port:zlib

set unit_vardir         ${prefix}/var
set unit_dbdir          ${unit_vardir}/db/${name}
set unit_logdir         ${unit_vardir}/log/${name}
set unit_logfile        ${unit_logdir}/${name}.log
set unit_rundir         ${unit_vardir}/run/${name}
set unit_pidfile        ${unit_rundir}/${name}.pid
set unit_sockfile       ${unit_rundir}/control.unit.sock
set unit_tmpdir         ${unit_vardir}/tmp/${name}
set unit_moddir         ${prefix}/libexec/${name}/modules

configure.args  --prefix=${prefix} \
                --ld-opt=\"${configure.ldflags}\" \
                --log=${unit_logfile} \
                --modules=libexec/${name}/modules \
                --pid=${unit_pidfile} \
                --state=${unit_dbdir} \
                --tmp=${unit_tmpdir} \
                --user=_www \
                --group=_www

default_variants        +debug +ssl

destroot.keepdirs       ${destroot}${unit_moddir}

subport ${name} {
    post-destroot {
        xinstall -d -m 755 ${destroot}${unit_dbdir}
        xinstall -d -m 755 ${destroot}${unit_logdir}
        xinstall -d -m 755 ${destroot}${unit_rundir}
        xinstall -d -m 755 ${destroot}${unit_tmpdir}
    }
}

set perl_versions {528 530 532 534}
foreach perl_v ${perl_versions} {
    subport ${name}-perl${perl_v} {
        description         Perl module for NGINX Unit

        long_description    {*}${description}

        set perl_ver_dot    [string index ${perl_v} 0].[string range ${perl_v} 1 end]
        set perl_ver        [string index ${perl_v} 0][string range ${perl_v} 1 end]

        depends_build       port:perl${perl_ver_dot}
        depends_run         port:unit

        post-configure {
            system -W ${worksrcpath} "${configure.cmd} perl --perl=${prefix}/bin/perl${perl_ver_dot} --module=perl${perl_ver}"
        }

        build {
            system -W ${worksrcpath} "${build.cmd} perl${perl_ver}"
        }

        destroot {
            xinstall -d -m 755 ${destroot}${unit_moddir}
            xinstall    -m 644 ${worksrcpath}/build/perl${perl_ver}.unit.so ${destroot}${unit_moddir}/
        }
    }
}

#set php_versions {73 74 80}
#foreach php_v ${php_versions} {
#    subport ${name}-php${php_v} {
#        description         PHP module for NGINX Unit
#
#        long_description    {*}${description}
#
#        set php_ver_dot     [string index ${php_v} 0].[string range ${php_v} 1 end]
#        set php_ver         [string index ${php_v} 0][string range ${php_v} 1 end]
#
#        depends_build       port:php${php_ver}
#        depends_run         port:unit
#
#        post-configure {
#            system -W ${worksrcpath} \
#                "${configure.cmd} php --config=${prefix}/bin/php-config${php_ver} --module=php${php_ver}"
#        }
#
#        build {
#            system -W ${worksrcpath} "${build.cmd} php${php_ver}"
#        }
#
#        destroot {
#            xinstall -d -m 755 ${destroot}${unit_moddir}
#            xinstall    -m 644 ${worksrcpath}/build/php${php_ver}.unit.so ${destroot}${unit_moddir}/
#        }
#    }
#}

set python_versions {27 37 38 39}
foreach python_v ${python_versions} {
    subport ${name}-python${python_v} {
        description         Python module for NGINX Unit

        long_description    {*}${description}

        set python_ver_dot  [string index ${python_v} 0].[string range ${python_v} 1 end]
        set python_ver      [string index ${python_v} 0][string range ${python_v} 1 end]

        depends_build       port:python${python_ver}
        depends_run         port:unit

        post-configure {
            system -W ${worksrcpath} \
                "${configure.cmd} python --config=${prefix}/bin/python${python_ver_dot}-config --module=python${python_ver}"
        }

        build {
            system -W ${worksrcpath} "${build.cmd} python${python_ver}"
        }

        destroot {
            xinstall -d -m 755 ${destroot}${unit_moddir}
            xinstall -m 644 ${worksrcpath}/build/python${python_ver}.unit.so ${destroot}${unit_moddir}/
        }
    }
}

set ruby_versions {26 27 30}
foreach ruby_v ${ruby_versions} {
    subport ${name}-ruby${ruby_v} {
        description         Ruby module for NGINX Unit
    
        long_description    {*}${description}
    
        set ruby_ver_dot    [string index ${ruby_v} 0].[string range ${ruby_v} 1 end]
        set ruby_ver        [string index ${ruby_v} 0][string range ${ruby_v} 1 end]

        depends_run         port:unit
    
        post-configure {
            system -W ${worksrcpath} \
                "${configure.cmd} ruby --ruby=${prefix}/bin/ruby${ruby_ver_dot} --module=ruby${ruby_ver}"
        }
    
        build {
            system -W ${worksrcpath} "${build.cmd} ruby${ruby_ver}"
        }
    
        destroot {
            xinstall -d -m 755 ${destroot}${unit_moddir}
            xinstall -m 644 ${worksrcpath}/build/ruby${ruby_ver}.unit.so ${destroot}${unit_moddir}/
        }
    }
}

startupitem.create      yes
startupitem.pidfile     auto ${unit_pidfile}
startupitem.executable  ${prefix}/sbin/unitd

variant debug description "Enable debug logging" {
    configure.args-append   --debug
}

variant ssl description "Support secure connections using OpenSSL" {
    depends_lib-append      path:lib/libssl.dylib:openssl
    configure.args-append   --openssl
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 789 bytes
Desc: not available
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20210929/0ec4559d/attachment.sig>


More information about the macports-dev mailing list