# -*- 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.90
revision            0
maintainers         nomaintainer
license             {Artistic-1 GPL}
description         Text::BibTeX - interface to read and parse BibTeX files
long_description    {*}${description}

checksums           rmd160  98c6a43728dd6b3da111c38428995eff242a87ee \
                    sha256  5d5d3b69b91c7d00ca6d969269bfefa148211f4effc62bee72bd1375d57b0fc7 \
                    size    302032

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