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

github.setup        tldr-pages tldr-cpp-client 1.3.0 v
revision            1

categories          sysutils
platforms           darwin
license             MIT
maintainers         {khindenburg @kurthindenburg} openmaintainer

description         tldr c client - simplified and community-driven man pages
long_description    The TLDR pages are a community effort to simplify \
                    the beloved man pages with practical examples.

homepage            http://tldr-pages.github.io

checksums           rmd160  29020d3f0fe5a34a7b976af67ad9c1ee868a2d0a \
                    sha256  fa65b9d49ec94034195b1cb985e4238cbc2ce34352d4be8772c0f058b89b41a4

patchfiles          patch-Makefile.diff

use_configure       no

variant universal {}

depends_build-append \
                    port:pkgconfig
depends_lib-append \
                    port:curl \
                    port:libzip
build.env-append    CC=${configure.cc} \
                    LD=${configure.cc} \
                    "CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                    "LDFLAGS=${configure.ldflags} [get_canonical_archflags ld]"

destroot.args       PREFIX=${destroot}${prefix}

post-destroot {
    set docdir ${prefix}/share/${subport}
    set compldir ${prefix}/share/${subport}/autocomplete
    xinstall -d ${destroot}${docdir}
    xinstall -d ${destroot}${compldir}
    xinstall -m 644 -W ${worksrcpath} \
        LICENSE \
        README.md \
        ${destroot}${docdir}
    xinstall -m 644 {*}[glob ${worksrcpath}/autocomplete/*] \
        ${destroot}${compldir}
}

notes "
To install the autocompletion, source the complete script from the shell's rc:
echo \"source ${prefix}/share/${name}/autocomplete/complete.bash\" >> ~/.bashrc
echo \"source ${prefix}/share/${name}/autocomplete/complete.zsh\" >> ~/.zshrc
"