# -*- 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 60a39f36d719344360ec2e87563ed43f61f0530f
    version         20250922
    revision        0

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

    checksums       rmd160  0e502ae29ecb3736bd37ff8ec9c185e7979eaf99 \
                    sha256  77e4ce4214b4b0d967bbea4ece204181e017cda7cbc3d2aac314c1fbb1ef9f14 \
                    size    28476

    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
}
