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

github.setup        sbingner ldid 5b8581c
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             2.1.5
revision            1
categories          devel
conflicts           ${name}-procursus
maintainers         {i0ntempest @i0ntempest} openmaintainer
license             AGPL-3

description         Link Identity Editor
long_description    {*}${description}. ${name} lets you manipulate the signature block \
                    in a Mach-O binary. This is Sam Bingner's fork of ldid, originally \
                    by Jay Freeman (saurik).

homepage            https://cydia.saurik.com/info/ldid/

checksums           rmd160  c98fee4cab68cee697f91836b4faf1d214749b1b \
                    sha256  555167499675cbe5a6b1ea305c9ef3097fa1536c2e7388898937c426b64412c2 \
                    size    45716

compiler.cxx_standard   2011
configure.args-append   -DLDID_VERSION=${version}

depends_build-append    port:pkgconfig
depends_lib-append      path:lib/libplist-2.0.dylib:libplist

universal_variant   no
use_xcode           yes
patch.pre_args-replace  -p0 -p1
patchfiles          patch-nullbuf.diff \
                    dont-use-git-for-ldid-version.diff

post-patch {
    # Force CMake to use libplist-2.0 when building
    reinplace "s|libplist|libplist-2.0|" ${worksrcpath}/CMakeLists.txt
}

post-destroot {
    ln -s ldid ${destroot}${prefix}/bin/ldid2
    xinstall -d ${destroot}${prefix}/share/doc/ldid
    xinstall -m 0644 ${worksrcpath}/COPYING ${destroot}${prefix}/share/doc/ldid
}
