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

name                buku
version             5.1
revision            0
checksums           rmd160  989c4f8a246734a7d0f179a9d0998b857540c758 \
                    sha256  c7028bdd211bf5b88377938fa19d1819e057c198197383a4298ef4aeea8689bf \
                    size    292496

description         A command-line bookmark manager
long_description    buku is a powerful bookmark manager written in \
                    Python3 and SQLite3. buku can auto-import \
                    bookmarks from your browser(s) or fetch the title \
                    and description of a bookmarked url from the web. \
                    You can use your favourite editor to compose and \
                    update bookmarks. With multiple search options, \
                    including regex and a deep scan mode (particularly \
                    for URLs), it can find any bookmark instantly. \
                    buku can look up the latest snapshot of a broken \
                    link on the Wayback Machine.  There's an Easter \
                    egg to revisit random forgotten bookmarks too! \
                    buku is too busy to track you: no hidden history, \
                    obsolete records, usage analytics or homing.

homepage            https://github.com/jarun/buku

categories-append   www
platforms           {darwin any}
supported_archs     noarch
maintainers         {acm.org:cardi @cardi} openmaintainer
license             GPL-3

python.default_version  314

depends_build-append \
                    port:py${python.version}-setuptools

depends_lib-append  port:py${python.version}-beautifulsoup4 \
                    port:py${python.version}-certifi \
                    port:py${python.version}-cryptography \
                    port:py${python.version}-html5lib \
                    port:py${python.version}-urllib3

post-extract {
    # build only buku by default
    reinplace "/^bukuserver/d" ${worksrcpath}/pyproject.toml
    reinplace "s|\"bukuserver\", \"bukuserver\.\*\"||" ${worksrcpath}/pyproject.toml
}

pre-destroot {}

post-destroot {
    # install documentation
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} CHANGELOG LICENSE README.md ${destroot}${prefix}/share/doc/${name}

    # install man pages
    xinstall -d -m 0755 ${destroot}${prefix}/share/man/man1
    xinstall -m 0644 -W ${worksrcpath} buku.1 ${destroot}${prefix}/share/man/man1/

    # install shell completions (bash, fish, zsh)
    xinstall -d ${destroot}${prefix}/share/bash-completion/completions/
    xinstall -m 644 ${worksrcpath}/auto-completion/bash/buku-completion.bash ${destroot}${prefix}/share/bash-completion/completions/${name}
    xinstall -d ${destroot}${prefix}/share/fish/vendor_completions.d/
    xinstall -m 644 ${worksrcpath}/auto-completion/fish/buku.fish ${destroot}${prefix}/share/fish/vendor_completions.d/
    xinstall -d ${destroot}${prefix}/share/zsh/site-functions/
    xinstall -m 644 ${worksrcpath}/auto-completion/zsh/_buku ${destroot}${prefix}/share/zsh/site-functions/
}
