# -*- 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/air-verse/air 1.61.7 v
go.offline_build    no
github.tarball_from archive
revision            0

description         Live reload for Go apps

long_description    {*}${description}. Just ${name} in your project root \
                    directory, leave it alone, and focus on your code.

categories          devel
installs_libs       no
license             GPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  a54a523422fd15d60e70b5774b1fd01223777608 \
                    sha256  d3c79d84c95bc6ee661bce6f2c6a26acf7ec0335c06d0905616017898372f90c \
                    size    1029170

patch {
    # Set the build version directly in the Makefile. Do not attempt to
    # query for it using git. This is not a git checkout.
    reinplace -W ${worksrcpath} \
        "s|AIRVER :=.*|AIRVER := v${version}|" Makefile

    # Just build. Do not run the check script which would run
    # arbitrary commands.
    reinplace -W ${worksrcpath} {s|build: check|build:|} Makefile

    # Remove -r flag which isn't valid for macOS' sed
    reinplace -W ${worksrcpath} {s|sed -r|sed -E|} Makefile

    # Remove BuildTimestamp field to ensure build is more reproducible.
    reinplace -W ${worksrcpath} {/BuildTimestamp/ d} Makefile
}

build.cmd           make
build.target        build

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