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

name                makepasswd
version             1.10-13
revision            0
categories          security
license             GPL-2
platforms           darwin
maintainers         nomaintainer
description         generate and encrypt passwords
long_description    A port of Rob Levin's makepasswd tool.
homepage            http://packages.debian.org/stable/source/makepasswd
master_sites        http://ftp.debian.org/debian/pool/main/m/makepasswd/

distfiles           ${name}_${version}_all.deb

checksums           rmd160  9374d4a72d7d14f436a56f34a54f8acf49883992 \
                    sha256  f5afe0b8f8f4191af10a6f8bcf6978728d6287a3ae3e8d0b3527ef432e9122a1 \
                    size    12140

perl5.require_variant   yes
perl5.conflict_variants yes
perl5.branches          5.28 5.30 5.32 5.34
perl5.default_branch    5.34
perl5.create_variants   ${perl5.branches}

depends_extract     port:xz

depends_run         port:p${perl5.major}-bytes-random-secure \
                    port:p${perl5.major}-crypt-passwdmd5 \
                    port:p${perl5.major}-getopt-long

extract.cmd         ar
extract.pre_args    -x
extract.post_args   data.tar.xz && mkdir ${worksrcpath} && \
                    xzcat data.tar.xz | tar -C ${worksrcpath} -xf -

patchfiles          patch-usr-bin-makepasswd.diff

use_configure       no

post-configure {
    reinplace "s|/usr/bin/perl|${perl5.bin}|g" \
              "${worksrcpath}/usr/bin/makepasswd"
}

build {}

destroot {
    xinstall -m 0755 ${worksrcpath}/usr/bin/makepasswd \
        ${destroot}${prefix}/bin/makepasswd
    xinstall -m 0644 \
        ${worksrcpath}/usr/share/man/man1/makepasswd.1.gz \
        ${destroot}${prefix}/share/man/man1/makepasswd.1.gz
}

livecheck.regex     "${name}_(\\d+(?:\\.\\d+)*-\\d+)_all.deb"