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

perl5.branches      5.28 5.30 5.32 5.34
perl5.setup         Text-BibTeX 0.91
revision            0
maintainers         nomaintainer
license             {Artistic-1 GPL}
description         Text::BibTeX - interface to read and parse BibTeX files
long_description    {*}${description}

checksums           rmd160  802bf87023c19b4b8a57b4061f9c0e0bd034930c \
                    sha256  3f0113cf8fe71dc7484636dc8e2a581637ecbcc82d0be29bbd46d0bf3f8cdb37 \
                    size    302052

if {${perl5.major} != ""} {
    depends_build-append \
                    port:p${perl5.major}-capture-tiny \
                    port:p${perl5.major}-extutils-libbuilder \
                    port:p${perl5.major}-config-autoconf

    depends_lib-append \
                    port:p${perl5.major}-unicode-normalize

    # in inc/MyBuilder.pm, copy_if_modified is called on binaries and libraries
    # the libraries and binaries are then modified (install names changed)
    # copy_if_modified, however, sets all files as read only
    #    see https://metacpan.org/pod/release/LEONT/Module-Build-0.4220/lib/Module/Build/API.pod#copy_if_modified
    #    see https://github.com/Perl-Toolchain-Gang/Module-Build/blob/master/lib/Module/Build/Base.pm#L5600
    # patch temporarily makes the files writable before changing them
    patchfiles-append \
                    patch-permissions.diff

    perl5.use_module_build

    # libraries and binaries (libbtparse) are installed in
    # $prefix/libexec/perl5.NN/ to avoid conflicts. Put the btparse
    # header file there too.
    post-destroot {
        xinstall -d ${destroot}${prefix}/libexec/perl${perl5.major}/include
        file rename ${destroot}${prefix}/libexec/include/btparse.h ${destroot}${prefix}/libexec/perl${perl5.major}/include
    }
}
