# -*- 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            syncthing syncthing-macos 1.26.1-1 v
github.tarball_from     archive
revision                0

checksums               rmd160  fe932aed93a5ead0a67f2f78e6a9019f5fbe4b96 \
                        sha256  f7f59eb537be5bbc05b76c2274a26c9991e448f17369f8d94aca04a4ed19f514 \
                        size    13222566

categories              net aqua
installs_libs           no
license                 MIT
maintainers             {gmail.com:herby.gillot @herbygillot} \
                        openmaintainer

description             Frugal and native macOS Syncthing application bundle
long_description        {*}${description}

depends_lib-append      port:syncthing

patchfiles-append       patch-no-bundled-syncthing.diff \
                        patch-disable-autoupdatechecks.diff

if {[vercmp $xcodeversion 14.3] >= 0} {
    patchfiles-append   patch-fix-ventura-build.diff
}

post-patch {
    reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/syncthing/STApplication.m
}

use_configure           no
use_xcode               yes

build {
    system -W ${build.dir} "make release"
}

destroot {
    copy \
        ${build.dir}/Build/Products/Release/Syncthing.app \
        ${destroot}${applications_dir}
}
