# -*- 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            gitlab.com/esr/reposurgeon 5.8
go.offline_build    no
revision            0

homepage            https://www.catb.org/esr/reposurgeon

description         \
    A tool for editing version-control repositories and translating among \
    different systems. Supports git, bzr, Subversion, darcs, and fossil \
    directly.


long_description    \
    {*}${description} ${name} enables risky operations that version-control \
    systems don’t want to let you do, such as \(a\) editing past comments and \
    metadata, \(b\) excising commits, \(c\) coalescing commits, and \(d\) \
    removing files and subtrees from repo history. The original motivation \
    for ${name} was to clean up artifacts created by repository conversions.

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

checksums           rmd160  9d0ce7f04f00ee8f0f67469fb658aa5b265bc3f3 \
                    sha256  0d5275d6784876e917e170d4458652c97fc8d54bd5749ad491fc76f82a2c3a6b \
                    size    1598114

depends_build-append \
                    port:gawk \
                    port:asciidoctor

build.cmd           make
build.target        all

use_parallel_build  no

patch {
    # Don't build HTML pages (remove HTML pages build target from "all" target)
    reinplace -E {s|(all:.*)\$\(HTMLFILES\)$|\1|} ${worksrcpath}/Makefile

    # Use gawk
    reinplace -E "s|AWK = awk|AWK = ${prefix}/bin/gawk|g" \
        ${worksrcpath}/Makefile
}

destroot {

    foreach _repobin {
        repobench
        repocutter
        repomapper
        reposurgeon
        repotool
    } {
        xinstall -m 0755 ${worksrcpath}/${_repobin} \
            ${destroot}${prefix}/bin/

        xinstall -m 0644 ${worksrcpath}/${_repobin}.1 \
            ${destroot}${prefix}/share/man/man1/
    }

}
