# -*- 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 libplist 2.7.0
revision            0
categories          textproc devel
license             LGPL-2.1
maintainers         {ijackson @JacksonIsaac} {i0ntempest @i0ntempest} openmaintainer

description         Library for working with Apple Binary and XML Property Lists
long_description    ${description}

homepage            https://www.libimobiledevice.org/

checksums           rmd160  034873c101d8bbf38f434ea259f0a05306a9a962 \
                    sha256  7ac42301e896b1ebe3c654634780c82baa7cb70df8554e683ff89f7c2643eb8b \
                    size    484474

depends_build-append \
                    port:pkgconfig

# https://trac.macports.org/ticket/68238
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2 {clang < 421}

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

subport libplist-devel {
    github.setup    libimobiledevice libplist 7355dc8e8344f00fae0e24db72e461d985eb6381
    version         20250926
    revision        0

    github.tarball_from \
                    archive

    checksums       rmd160  548b5a33838b17fdc8da4aca75ae567e28b68dd5 \
                    sha256  d2ccbee5eebfed80dcc307c89e77d6e19a70953a4759b00d29ab15b7a013063b \
                    size    226097

    conflicts       libplist

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

    # Adhere devel port to libimobiledevice's versioning system
    # This is handled in the stable port with a release tarball
    #
    # See https://github.com/libimobiledevice/libimobiledevice-glue/commit/0e7b8b42ce4cbeb32eb3103b0ff97916cb273d78
    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
    conflicts       libplist-devel
}
