# -*- 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        hashicorp nomad 0.10.2 v
homepage            https://www.nomadproject.io/

platforms           darwin
categories          net
license             MPL-2
installs_libs       no

# Nomad's build process requires the git repository.
fetch.type          git

maintainers         {gmail.com:herby.gillot @herbygillot} openmaintainer

description         Nomad is an open source scheduler for scheduling \
                    virtualized, containerized, and standalone applications. 

long_description    Nomad is a flexible container orchestration tool that \
                    enables an organization to easily deploy and manage any \
                    containerized or legacy application using a single, \
                    unified workflow. Nomad can run a diverse workload of \
                    Docker, non-containerized, microservice, and batch \
                    applications.

depends_build       port:go

set proj_dir "${workpath}/src/github.com/${github.author}/${github.project}"

# The "dev" build target must be used to build just the binary for this
# platform, instead of for ALL platforms
# - https://www.nomadproject.io/docs/install/index.html#compiling-from-source
build.target        bootstrap
build.post_args     dev
build.dir           ${proj_dir}
build.env           GOPATH=${workpath} PATH=$env(PATH):${workpath}/bin
use_configure       no
# Bootstrap target must run before dev, so we disable parallel building.
use_parallel_build  no

post-extract {
    file mkdir [file dirname ${proj_dir}]
    move ${worksrcpath} ${proj_dir}
}

destroot {
    xinstall -m 755 ${workpath}/bin/${name} ${destroot}${prefix}/bin/${name}
}