# -*- 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
# $Id: Portfile 115802 2014-01-11 19:22:12Z jeremyhu@macports.org $

PortSystem          1.0

name                libpwquality
version             1.2.3
license             LGPL-2.1+
categories          devel
maintainers         nomaintainer
description         A library for password quality checking and \
                    the generation of random passwords that \
                    pass the checks.

long_description    ${description}

platforms           darwin

homepage            https://fedorahosted.org/${name}/
master_sites        https://fedorahosted.org/releases/l/i/${name}/

use_bzip2           yes

checksums           rmd160  e98ace88997f9cd0806acb7492b418835b9cb56f \
                    sha256  b11c79ce7b03cdf878fccb653e67bd430155cc6fd224efbbb3e78842f752516a

depends_build       port:pkgconfig

depends_lib         port:gettext \
                    port:libiconv \
                    port:cracklib

patchfiles          patch-src-pam_pwquality.c.diff

configure.ldflags-append \
                    -lintl

configure.args      --with-securedir=/usr/lib/pam \
                    --with-sconfigdir=/etc/security

# installs PAM modules in /usr/lib/pam

destroot.violate_mtree yes

variant python26 conflicts python27 description {Use python 2.6} {
    set python_ver          2.6
    depends_lib-append      port:python26
    configure.python        ${prefix}/bin/python${python_ver}
    set python_prefix       ${frameworks_dir}/Python.framework/Versions/${python_ver}
    set python_site_path    ${python_prefix}/lib/python${python_ver}/site-packages
    configure.args-append   --with-python-rev=${python_ver} \
                            --with-pythonsitedir=${python_site_path}
}

variant python27 conflicts python26 description {Use python 2.7} {
    set python_ver          2.7
    depends_lib-append      port:python27
    configure.python        ${prefix}/bin/python${python_ver}
    set python_prefix       ${frameworks_dir}/Python.framework/Versions/${python_ver}
    set python_site_path    ${python_prefix}/lib/python${python_ver}/site-packages
    configure.args-append   --with-python-rev=${python_ver} \
                            --with-pythonsitedir=${python_site_path}
}

if {![variant_isset python26]} {
    default_variants +python27
}

post-patch {
    reinplace "s|python setup.py|${configure.python} setup.py|g" \
        ${worksrcpath}/python/Makefile.am \
        ${worksrcpath}/python/Makefile.in
}

platform darwin {
    if {${os.major} < 10} {
        configure.args-append --disable-pam
    }
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"

