# -*- 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

github.setup        shadowsocks shadowsocks-libev 3.3.6 v
github.tarball_from archive

revision            0
categories          net
license             GPL-3
maintainers         nomaintainer
description         Lightweight secured SOCKS5 proxy

long_description \
    Shadowsocks-libev is written in pure C and depends on libev. \
    It's designed to be a lightweight implementation of shadowsocks \
    protocol, in order to keep the resource usage as low as possible.

fetch.type              git

depends_build-append    port:asciidoc \
                        port:xmlto
depends_lib-append      port:mbedtls3 \
                        port:libsodium \
                        port:libev \
                        port:c-ares \
                        port:pcre2

configure.args-append   -DWITH_STATIC=OFF

if {${os.platform} eq "darwin" && ${os.major} < 16} {
    # "SSL certificate problem: Invalid certificate chain" on macOS <10.12
    # Only use non-system Git on legacy systems
    depends_build-append \
                        path:bin/git:git
    git.cmd             ${prefix}/bin/git
}

post-fetch {
    system -W ${worksrcpath} "git submodule update --init --recursive"
}

compiler.c_standard     1999

set ssuser          _shadowsocks
add_users ${ssuser} group=${ssuser} realname=Shadowsocks\ Daemon
