# -*- 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 libusbmuxd 2.1.1
revision            0

categories          devel

maintainers         {ijackson @JacksonIsaac} {i0ntempest @i0ntempest} openmaintainer

description         A client library to multiplex connections from and to iOS devices
long_description    {*}${description} by connecting to a socket provided by a usbmuxd daemon.

license             LGPL-2.1
conflicts           libusbmuxd-devel

checksums           rmd160  5fa6163d9e3cea93554ae8024f8d41ce3e2c5226 \
                    sha256  5546f1aba1c3d1812c2b47d976312d00547d1044b84b6a461323c621f396efce \
                    size    325055

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:libimobiledevice-glue \
                    port:libplist

configure.args      --disable-silent-rules

subport libusbmuxd-devel {
    github.setup    libimobiledevice libusbmuxd 2387d8e5820ee4621494e20434c0017aba6bea71
    version         20240327
    # Epoch 1: Downgrade due to https://github.com/libimobiledevice/libusbmuxd/issues/71
    epoch           1
    revision        0

    checksums       rmd160  cfb6ea05671686e8dd5e8785827242b2cb9ba62c \
                    sha256  3377a23ce86fd59bb6b2313fff60ff9410ec9ac3eebb5963ef5c45583f4a6433 \
                    size    46674

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

    depends_lib-replace \
                    port:libimobiledevice-glue \
                    port:libimobiledevice-glue-devel

    depends_lib-replace port:libplist port:libplist-devel

    conflicts       libusbmuxd

    pre-configure {
        system -W ${worksrcpath} "echo ${version} > .tarball-version"
    }

    configure.cmd   ./autogen.sh

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

if {${subport} eq ${name}} {
    github.tarball_from     releases
    use_bzip2               yes
} else {
    github.tarball_from     archive
}
