# -*- 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 libtatsu 1.0.5
github.tarball_from releases
revision            0
conflicts           libtatsu-devel

categories          devel
license             LGPL-2.1
maintainers         {gmail.com:turbocool3r @turbocool3r} openmaintainer

description         Library handling the communication with Apple's Tatsu Signing Server (TSS).

long_description    This library is part of the libimobiledevice project. The main purpose of this \
                    library is to allow creating TSS request payloads, sending them to Apple's TSS \
                    server, and retrieving and processing the response. \
                    \
                    The code was originally part of idevicerestore and has been split out to its own \
                    library, while obviously idevicerestore will remain the main consumer.

homepage            https://www.libimobiledevice.org/

checksums           rmd160  6869bda02bdbc0feac912e00fffa0b2ef4ede0cd \
                    sha256  536fa228b14f156258e801a7f4d25a3a9dd91bb936bf6344e23171403c57e440 \
                    size    302913

use_bzip2       yes

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

depends_lib-append  port:libplist

configure.args-append \
                    --disable-silent-rules

# this overrides pkg-config's libcurl choice like README requests
configure.env-append \
                    libcurl_CFLAGS=${configure.sdkroot}/usr/include \
                    libcurl_LIBS=-lcurl

subport libtatsu-devel {
    github.setup    libimobiledevice libtatsu 7e1647b9883ff1daa6363de20af2c4129ed45dcd
    version         20241203
    revision        0

    github.tarball_from archive
    use_bzip2       no
    extract.suffix  .tar.gz

    checksums       rmd160  367fa9fba0b0e8a3b263ba77f6d87c6ed26f5cfc \
                    sha256  5007e4c458c8bbb5095fcf74b9e7a590f7dfe79c346867fb642cd9ce57744ced \
                    size    28335

    conflicts       libtatsu

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

    depends_lib-replace \
                    port:libplist \
                    port:libplist-devel

    # 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
}
