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

go.setup            github.com/slackhq/nebula 1.8.0 v
github.tarball_from archive
revision            0

categories          net
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

description         A scalable overlay networking tool with a focus on \
                    performance, simplicity and security.

long_description    Nebula is a scalable overlay networking tool with a focus \
                    on performance, simplicity and security. It lets you \
                    seamlessly connect computers anywhere in the world. \
                    Nebula is portable, and runs on Linux, OSX, and Windows. \
                    It can be used to connect a small number of computers, \
                    but is also able to connect tens of thousands of computers.

checksums           rmd160  e78390a8f0fad65b05f93023e43a1ae918fa0688 \
                    sha256  678ad2bda47258cce8c2d14b3fa56d17c0ba4f894d75b75afab8937d64e12da7 \
                    size    999238

go.offline_build no
build.env-append    BUILD_NUMBER="${version}"
build.cmd           make
build.target        bin

use_parallel_build  no

set neb_share_dir   ${prefix}/share/${name}
set neb_conf_dir    ${prefix}/etc/${name}
set neb_example_dir ${neb_share_dir}/examples

set neb_sample_config   ${neb_example_dir}/config.yml

destroot {
    xinstall -m 0755 ${worksrcpath}/nebula ${destroot}${prefix}/bin/

    xinstall -m 0755 ${worksrcpath}/nebula-cert ${destroot}${prefix}/bin/

    xinstall -d ${destroot}${neb_conf_dir}
    xinstall -d ${destroot}${neb_example_dir}

    copy {*}[glob ${worksrcpath}/examples/*] ${destroot}${neb_example_dir}

    reinplace "s|/etc/nebula|${prefix}/etc/nebula|g" \
        "${destroot}${neb_sample_config}"
}

destroot.keepdirs   ${destroot}${neb_conf_dir}

notes "
  Example configuration for Nebula can be found in:

    ${neb_example_dir}
"
