# -*- 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
PortGroup           openssl 1.0

github.setup        libimobiledevice libimobiledevice 1.3.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            3

categories          devel

license             LGPL-2.1
maintainers         {ijackson @JacksonIsaac} {i0ntempest @i0ntempest} openmaintainer

description         A cross-platform software protocol library \
    and tools to communicate with iOS devices natively.

long_description    libimobiledevice is a cross-platform software \
    library that talks the protocols to support iPhone, iPod Touch, \
    iPad and Apple TV devices. Unlike other projects, it does not \
    depend on using any existing proprietary libraries and does not \
    require jailbreaking. It allows other software to easily access \
    the device's filesystem, retrieve information about the device \
    and it's internals, backup/restore the device, manage SpringBoard \
    icons, manage installed applications, retrieve addressbook/calendars \
    /notes and bookmarks and (using libgpod) synchronize music and video \
    to the device.

homepage            https://www.libimobiledevice.org/

checksums           rmd160  4780154bea572854ae35e0d1d8f12972a7409123 \
                    sha256  a2c1145a7177377026f2ee55bd6b4c77b050e89740416e43b4adb5e8325929c8 \
                    size    260987

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

depends_lib-append  port:libplist \
                    port:libusbmuxd

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

configure.cmd       ./autogen.sh

configure.args      --disable-silent-rules \
                    --without-cython

subport libimobiledevice-devel {
    github.setup    libimobiledevice libimobiledevice 333eb1aec92f02b0b61f9ec23880861b93d42c60
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20200618
    revision        3

    checksums       rmd160  27591925392cbc0ee4076ab02491b1d8e832f7bc \
                    sha256  127cb57199e4538eee7e8e01f711cb1cb53d73b70181b0ba6c37c8371ab4faca \
                    size    261030

    depends_lib-replace port:libusbmuxd port:libusbmuxd-devel
    depends_lib-replace port:libplist port:libplist-devel

    conflicts       libimobiledevice

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

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