# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem      1.0
PortGroup       makefile 1.0

name            wpa_passphrase
version         2.12
revision        0

categories      net
license         BSD
maintainers     @jrjsmrtn openmaintainer

description     Generate a WPA PSK from an ASCII passphrase for a SSID
long_description    wpa_passphrase pre-computes PSK entries for network \
                    configuration blocks of a wpa_supplicant.conf file. \
                    An ASCII passphrase and SSID are used to generate a \
                    256-bit PSK.
homepage        https://w1.fi/wpa_supplicant/

depends_lib     path:lib/libssl.dylib:openssl

master_sites    https://w1.fi/releases/
distname        wpa_supplicant-${version}

checksums       rmd160  daf045061846ebeeacc30a77be9f1faee7546aae \
                sha256  08e23937e16d0155e55cab2b51f51fbe10d80a1aa91c4e15442645059b737ef6 \
                size    4247413


build.dir       ${worksrcpath}/wpa_supplicant
build.target    wpa_passphrase
pre-build {
    delete "${build.dir}/.config"
    copy "${build.dir}/defconfig" "${build.dir}/.config"
    reinplace "s|^CONFIG_|#CONFIG_|g" "${build.dir}/.config"
    reinplace -E "s|^#CONFIG_OSX.+$|CONFIG_OSX=y|" "${build.dir}/.config"
}

destroot {
    xinstall -m 755 ${build.dir}/wpa_passphrase \
        ${destroot}${prefix}/bin

    file copy ${build.dir}/doc/docbook/wpa_passphrase.8 \
        ${destroot}${prefix}/share/man/man8
}

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex    wpa_supplicant-(\\d+(?:\\.\\d+)*)${extract.suffix}
