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

name            wpa_passphrase
version         2.9
revision            1

platforms       darwin
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  0158e57d210df190dc1f7cce432762e7a91aea39 \
                sha256  fcbdee7b4a64bea8177973299c8c824419c413ec2e3a95db63dd6a5dc3541f17 \
                size    3231785

patchfiles      patch-Makefile.diff

use_configure   no

build.dir       ${worksrcpath}/wpa_supplicant
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}
