# -*- 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.3
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  e345f1fd946faca147b9642a0f9ecfdcf9c814fd \
                    sha256  7b58096241e584465b93aab3af22f5ef251f50732bbb1aaa353efc0773802afd \
                    size    1594939

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

}
