# -*- 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        libimobiledevice usbmuxd 1.1.1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            1

categories          devel
maintainers         {i0ntempest @i0ntempest} openmaintainer
description         USB Multiplex Daemon
long_description    {*}${description} is in charge of talking to your iPhone \
                    or iPod Touch over USB and coordinating access to its services by other \
                    applications.
license             GPL-2+ GPL-3+ LGPL-2.1+

checksums           rmd160  a62819bcd32f1e9941f9df431b80111b4dd920d0 \
                    sha256  b992014d28b6633245ea326cd1237e5009e180e6cef22746f82252085721a291 \
                    size    61693

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:pkgconfig

depends_lib         port:libplist \
                    path:lib/pkgconfig/libusb-1.0.pc:libusb

# Avoid redefinition errors with libplist v2.3
post-patch {
    reinplace "s|PLIST_FORMAT_XML|PLIST_FORMAT_XML_|g" ${worksrcpath}/src/utils.h
    reinplace "s|PLIST_FORMAT_BINARY|PLIST_FORMAT_BINARY_|g" ${worksrcpath}/src/utils.h
}

configure.cmd       ./autogen.sh
configure.args      --disable-silent-rules \
                    --without-preflight \
                    --without-systemd

subport usbmuxd-devel {
    github.setup    libimobiledevice usbmuxd 3daa1e9c3e3a18933b7d885fab99f374b9850144
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20200615
    revision        0

    checksums       rmd160  08baef0927a589dd90a6a6ac6cfa9f0de44ea1df \
                    sha256  2c5c1601a427671cb6b19448c897fea40b79d69b706d2969a5655e3886db0003 \
                    size    61688

    conflicts       usbmuxd

    depends_lib-replace port:libplist port:libplist-devel

    livecheck.url   ${github.homepage}/commits/${github.livecheck.branch}.atom
}

if {${subport} eq ${name}} {
    conflicts       usbmuxd-devel
}
