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

github.setup        lastpass lastpass-cli 1.6.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0

categories          security
maintainers         {en.sent.com:macports @Raimondi} oaf.dk:mni {khindenburg @kurthindenburg} openmaintainer
license             GPL-2

description         command line interface to LastPass.com
long_description    {*}${description}

depends_build-append    port:pkgconfig
depends_lib-append  port:curl \
                    port:libxml2 \
                    path:lib/libssl.dylib:openssl

checksums           rmd160  442fc72519e2577c212c135228f6ef78033f5da3 \
                    sha256  284595f13d43a66467f8cd63ee996f6e38a7d6ded7cadaa497dfe927b5929560 \
                    size    119774

post-extract {
    copy ${filespath}/version.h ${worksrcpath}/

}

if {${subport} eq ${name}} {
    default_variants    +pinentry
}

variant pinentry description {Use GnuPG's password entry software pinentry} {
    depends_lib-append  port:pinentry
}

subport ${name}-doc {
    description             Documentation for command line interface to LastPass.com
    long_description        {*}${description}

    depends_build-append    port:asciidoc \
                            port:libxslt
    build.target            doc-man
    destroot.target         install-doc

    post-destroot {
        file delete ${destroot}${prefix}/bin/lpass
    }
}

# not ready to be used for casual use
if {0} {
pre-test {
    reinplace "s|lpass|${cmake.build_dir}/lpass|g" ${worksrcpath}/test/tests
    reinplace "s|lpass |${cmake.build_dir}/lpass |g" ${worksrcpath}/test/include.sh
}
test.run            yes
test.dir            ${worksrcpath}/test
test.cmd            ./tests
test.target
}