# # -*- 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.2 v
github.tarball_from releases
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  ac3bd9dc57d9f68f57ca9d4a24f74d17e3dbd319 \
                    sha256  b65b9c951a9a17b87b8ac0500808c716ef8e5fe6e70f1fd44f23b8385aa30984 \
                    size    129635

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 {
    revision                0
    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
}
