# -*- 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

name                atool
version             0.39.0
revision            1
categories          archivers
platforms           any
supported_archs     noarch
license             GPL-3
maintainers         devils.com:expiation
homepage            https://www.nongnu.org/atool/
description         An archival front-end
long_description    ${name} is a script for managing file archives of various \
                    types (tar, tar+gzip, zip etc).

master_sites        https://download.savannah.gnu.org/releases/atool/

checksums           rmd160  ca067ba295ff2ad11dc1c9147a13f8a1becaf078 \
                    sha256  aaf60095884abb872e25f8e919a8a63d0dabaeca46faeba87d12812d6efc703b

post-patch {
    # /usr/bin/sed does not work, use ${prefix}/bin/gsed instead
    reinplace -E \
        "s|(\[\t \])sed |\\1${prefix}/bin/gsed |g" \
        ${worksrcpath}/configure \
        ${worksrcpath}/Makefile.in
}

depends_build       port:gsed
depends_lib         path:bin/perl:perl5

configure.perl      ${prefix}/bin/perl

post-build {
    # use symlink but not resolved real path of perl5 in shebang
    reinplace -E "1s|^#!.*$|#!${prefix}/bin/perl5 -w|" ${worksrcpath}/atool
}

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README TODO \
        ${destroot}${docdir}
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "latest version of atool is (\[0-9.\]+),"
