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

github.setup                toy blueutil 2.4.0 v
categories                  sysutils
platforms                   darwin
maintainers                 {dons.net.au:darius @DanielO}
license                     BSD

description                 CLI for bluetooth on OSX

long_description            Command line interface for Bluetooth on OSX, \
                            control power, discoverable state, list paired \
                            devices, pair new devices, connect and disconnect \
                            devices, and check if a device is connected.

checksums                   sha1    de57e6a1783a89523b0aec96b1bbbac2b1dd3a0e \
                            rmd160  e342c7a6b8112b93abccfc86fe177cd2b1db1a5d \
                            sha256  3ddbd876885f9b79d7da8dc2f6a19b263b4c7708c6f7f1172a5320a89464066b \
                            size    9727

if { ${os.platform} eq "darwin" && ${os.major} <= 12} {
    pre-fetch {
        ui_error "${name} ${version} does not presently install on MacOSX 10.8 or earlier."
        return -code error "Unsupported platform"
    }
}

patchfiles                  blueutil-Makefile.diff

post-patch {
    reinplace  "s|@PREFIX@|${prefix}|g" ${worksrcpath}/Makefile
}

use_configure               no

post-destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/share/${name}
    xinstall -m 0644 -W ${worksrcpath} README.md LICENSE.txt \
        ${destroot}${prefix}/share/${name}/
}

test.run                    yes
test.args                   ""
test.cmd                    echo y | ./test