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

name            libusb
categories      devel

description     library for USB device access
long_description \
    library for use by user level applications to \
    access USB devices regardless of OS
homepage        https://libusb.info/

platforms       darwin
license         LGPL-2.1+
maintainers     {michaelld @michaelld} openmaintainer

use_parallel_build no

subport libusb-devel {}

if {${subport} eq ${name}} {

    github.setup   libusb libusb 1.0.23 v
    checksums      rmd160 0630bc588dd839986c8ca21374473ec4c3b5b76d \
                   sha256 68de7c676ac17a87c508d01370cc7a656afd7a2b26f90b484fb0e911160cd4d5 \
                   size   394009
    revision       0

    conflicts      libusb-devel

    # overload the github livecheck regex to look for versions that
    # are just numbers and '.', no letters (e.g., "1.0.19rc1").

    github.livecheck.regex  {([0-9.]+)}

} else {

    long_description {*}${long_description} \
        This port provides devel version of ${name}, updated weekly to monthly.

    github.setup   libusb libusb 4b64ecc6409ff3533b00153c65e02099c6ca55a9
    version        20200825-[string range ${github.version} 0 7]
    checksums      rmd160 9d9e0e2d972367b9dfb11acd6b593b0d3adb4f0e \
                   sha256 ba6a3e7f804cac3e6260680f96ac0fe28f9603b93a02c8f8fe7bbaf502346e52 \
                   size   356584
    revision       0

    conflicts      libusb

}

# see https://trac.macports.org/ticket/56156
patchfiles-append patch-10.7-nospeedsuper.diff

depends_build    port:libtool \
                 port:automake \
                 port:autoconf

configure.cmd    ./autogen.sh

# build verbosely

build.args-append AM_DEFAULT_VERBOSITY=1
