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

name                libusb-legacy
version             0.1.12
revision            4
categories          devel
license             LGPL-2.1
maintainers         {snc @nerdling} {michaelld @michaelld} openmaintainer
description         Library providing access to USB devices
long_description    A library originally developed under Linux to give \
                    userland programs an API to access to USB hardware.
homepage            https://libusb.info/

platforms           darwin

distname            libusb-${version}
master_sites        sourceforge:libusb
checksums           rmd160  63848df717e00fff67ab30ba86a85466370d4e8e \
                    sha256  37f6f7d9de74196eb5fc0bbe0aea9b5c939de7f500acba3af6fd643f3b538b44

patchfiles          patch-configure.in.diff patch-darwin.c.diff rename.patch

post-patch {
    reinplace "s|-Werror||" ${worksrcpath}/Makefile.am
}

use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --disable-build-docs \
                    --libdir=${prefix}/lib/libusb-legacy \
                    --includedir=${prefix}/include/libusb-legacy

destroot.args       pkgconfigdir=${prefix}/lib/pkgconfig

post-destroot {
    # Symbolic links for old ids dylib for compatibility with ports that might be expecting them
    ln -s libusbpp-legacy-0.1.4.dylib ${destroot}${prefix}/lib/libusb-legacy/libusbpp-legacy-0.1.4.4.4.dylib
    ln -s libusb-legacy-0.1.4.dylib ${destroot}${prefix}/lib/libusb-legacy/libusb-legacy-0.1.4.4.4.dylib
}

livecheck.type      regex
livecheck.url       http://sourceforge.net/projects/libusb/files/libusb-0.1%20(LEGACY)/
livecheck.regex     Click to enter (\\d+(\\.\\d+)+)
