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

PortSystem          1.0

name                usbutils
version             007
categories          net
platforms           darwin
maintainers         bwalle.de:bernhard
license             GPL-2+
description         USB Device Utilities from Linux
long_description    Provides the famous 'lsusb' from Linux
homepage            http://linux-usb.sourceforge.net
master_sites        https://www.kernel.org/pub/linux/utils/usb/usbutils/
use_xz              yes

checksums           rmd160  b3b509ec7f9153402da4519aaedc141ecf064adf \
                    sha256  7593a01724bbc0fd9fe48e62bc721ceb61c76654f1d7b231b3c65f6dfbbaefa4

depends_build       port:pkgconfig

depends_lib         port:libusb \
                    port:zlib

# Darwin linker has no "--as-needed"
build.args          AM_LDFLAGS=""

# since many usbutils programs only work on Linux, install the one we need
# ("lsusb" and the hardware database) manually
destroot {
    xinstall -m 0755 ${worksrcpath}/lsusb ${destroot}${prefix}/bin/lsusb
    xinstall -m 0644 ${worksrcpath}/usb.ids.gz ${destroot}${prefix}/share
    xinstall -d ${destroot}${prefix}/share/man/man8
    xinstall -m 0644 ${worksrcpath}/lsusb.8 ${destroot}${prefix}/share/man/man8

    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        NEWS \
        ${destroot}${docdir}
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}