# -*- 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 93eb168bf6b07472d17781328c21df0c60300524
    version         20250907
    # Epoch 1: Downgrade due to https://github.com/libimobiledevice/libusbmuxd/issues/71
    epoch           1
    revision        0

    checksums       rmd160  c398129f239d8e158c207e215bec977e2605bfd4 \
                    sha256  cde522a4f9370b4f7cc4bdb5bc60c6c4c34d9a1b0707d0b542612a8daa6b39af \
                    size    47041

    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
}
