# -*- 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.2 v
go.offline_build    no
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  448de6225edf2d07b3dbe9e9dc8068b83b266af1 \
                    sha256  203713c58d0ec8a10df2f605af791a77a33f825454911ac3a5313ced591547fd \
                    size    999794

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