# -*- 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
PortGroup               cmake 1.1
PortGroup               github 1.0
PortGroup               openssl 1.0

name                    softether5
github.setup            SoftEtherVPN SoftEtherVPN 5.2.5188
github.tarball_from     releases
revision                0
categories              net security
maintainers             {@barracuda156 gmail.com:vital.had} \
                        {i0ntempest @i0ntempest} \
                        openmaintainer
license                 Apache-2
description             Cross-platform multi-protocol VPN software
long_description        {*}${description}
use_xz                  yes
homepage                https://www.softether.org

checksums               rmd160  6046936e5d330ebcab8e376e97c50b84eee6d384 \
                        sha256  e89278e7edd7e137bd521851b42c2bf9ce4e5cae2489db406588d3388646b147 \
                        size    12305536

depends_lib-append      port:libiconv \
                        port:libsodium \
                        port:ncurses \
                        port:readline

depends_build-append    port:pkgconfig

compiler.c_standard     2011

# https://github.com/metalefty/SoftEtherVPN/commit/a461121b.patch
patchfiles-append       0001-enable-enterprise.patch

set dbdir               ${prefix}/var/db/${name}
set logdir              ${prefix}/var/log/${name}
set piddir              ${prefix}/var/run/${name}
set docdir              ${prefix}/share/doc/${name}

configure.args-append   -DSE_DBDIR=${dbdir} \
                        -DSE_LOGDIR=${logdir} \
                        -DSE_PIDDIR=${piddir}

destroot.keepdirs       ${destroot}${dbdir} \
                        ${destroot}${logdir} \
                        ${destroot}${piddir}

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS.TXT DISCLAIMER.md LICENSE README.md ${destroot}${docdir}
    foreach dir [list ${dbdir} ${logdir} ${piddir}] {
        xinstall -d ${destroot}${dir}
    }
}
