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

github.setup            keepassx keepassx 2.0.3
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
name                    KeePassX
categories              security aqua
maintainers             nomaintainer

description             KeePassX is a password manager compatiable with KeePass
long_description        KeePassX is an application for people with extremely \
                        high demands on secure personal data management. It \
                        has a light interface and is cross platform. KeePassX \
                        saves many different types of information including \
                        user names, passwords, URLs, attachments and comments \
                        in one single database.

license                 GPL-2 LGPL-2 LGPL-3 BSD permissive
license_noconflict      openssl

homepage                https://www.keepassx.org
master_sites            ${homepage}/releases/${version}

checksums               rmd160  340c2de991bd9e3bb33940d49c97fada00aa61a3 \
                        sha256  23ffb4ae360c58aa139943442d175bc6b8f08e6a876ae76c4543ab983a6647c5

depends_lib-append      port:libgcrypt \
                        port:zlib

cmake.out_of_source     yes
configure.pre_args-append \
    -DCMAKE_INSTALL_PREFIX=${applications_dir}

if {${configure.cxx_stdlib} eq "libstdc++"} {
    configure.pre_args-append   -DWITH_CXX11=OFF
}

# Don't make copies of all the QT4 libraries etc... (MUCH smaller install)
post-configure {
    reinplace "s/FIXUP_QT4_EXECUTABLE.*//" \
        ${cmake.build_dir}/src/cmake_install.cmake
}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -W ${worksrcpath} COPYING LICENSE.BSD LICENSE.CC0 \
             LICENSE.GPL-2 LICENSE.LGPL-2.1 LICENSE.LGPL-3 \
             LICENSE.NOKIA-LGPL-EXCEPTION \
             ${destroot}${prefix}/share/doc/${name}
}

livecheck.type          regex
livecheck.url           ${homepage}/releases/
livecheck.regex         {href="([^/]+)\/"}