[NEW] www/unit

Sergey A. Osokin osa at freebsd.org
Fri Sep 24 17:49:09 UTC 2021


Hi,

hope you're doing well these days.

I'm working on the NGINX Unit port and created my first version
of the Portfile, and it's attached.

NGINX Unit supports mostly all versions of:
- perl
- php
- python
- ruby
and other languages, so I'm interested how to support all of
those with macports.

Could you please provide your comments and guidance.
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} \
			--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}-perl {
    description		Perl module for NGINX Unit

    long_description	${description}

    depends_run		port:unit

    post-configure {
        system -W ${worksrcpath} "${configure.cmd} perl"
    }

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

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

    post-destroot {}

    startupitem.create	no
}

# PHP module for NGINX Unit requires a build of PHP with `--enable-embed' option
#subport ${name}-php {
#    description		PHP module for NGINX Unit
#
#    long_description	${description}
#
#    depends_run		port:unit
#
#    post-configure {
#        system -W ${worksrcpath} "${configure.cmd} php"
#    }
#
#    build {
#        system -W ${worksrcpath} "${build.cmd} php"
#    }
#
#    destroot {
#        xinstall -d -m 755 ${destroot}${unit_moddir}
#        xinstall -m 644 ${worksrcpath}/build/php.unit.so ${destroot}${unit_moddir}/
#    }
#
#    post-destroot {}
#
#    startupitem.create	no
#}

subport ${name}-python {
    description		Python module for NGINX Unit

    long_description	${description}

    depends_run		port:unit

    post-configure {
        system -W ${worksrcpath} "${configure.cmd} python"
    }

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

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

    post-destroot {}

    startupitem.create	no
}

subport ${name}-ruby {
    description		Ruby module for NGINX Unit

    long_description	${description}

    depends_run		port:unit

    post-configure {
        system -W ${worksrcpath} "${configure.cmd} ruby"
    }

    build {
        system -W ${worksrcpath} "${build.cmd} ruby"
    }

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

    post-destroot {}

    startupitem.create	no
}

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}
}

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/20210924/6b90bbc4/attachment.sig>


More information about the macports-dev mailing list