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

github.setup        yggdrasil-network yggdrasil-go 0.5.12 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          net
maintainers         {l2dy @l2dy} openmaintainer
license             LGPL-3

description         An experiment in scalable routing as an encrypted IPv6 overlay network

long_description    Yggdrasil is an early-stage implementation of a fully \
                    end-to-end encrypted IPv6 network. It is lightweight, self-arranging, \
                    supported on multiple platforms and allows pretty much any \
                    IPv6-capable application to communicate securely with other Yggdrasil \
                    nodes.

checksums           rmd160  522f3a8e3f02f23b9bbfe8bcde987b34d484348a \
                    sha256  a10a89a2655a1e30fb9e40f9fe4d3fe538319a3448aa69f8209f2eea3410ae79 \
                    size    111870

depends_build       port:go

use_configure       no

build.cmd           "./build"
build.target
build.env-append    PKGNAME=yggdrasil PKGVER=${version}

destroot {
        xinstall -m 755 -d ${destroot}${prefix}/bin
        # https://github.com/yggdrasil-network/yggdrasil-go/commit/4b9bce855eeb6af6b53e6927dc394c65af8bd157
        xinstall -m 755 -W ${worksrcpath} yggdrasil yggdrasilctl ${destroot}${prefix}/bin
}

startupitem.create      yes
startupitem.name        yggdrasil
startupitem.executable  ${prefix}/bin/yggdrasil -useconffile ${prefix}/etc/yggdrasil.conf

notes "
To launch yggdrasil at startup, first generate default config with the following command:
umask 0077 && yggdrasil -genconf | sudo tee ${prefix}/etc/yggdrasil.conf >/dev/null
"
