# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        writronic MaCursor 2.4.0 v
github.tarball_from archive
name                [string tolower ${github.project}]
revision            0
platforms           macosx
homepage            https://writronic.com/macursor/
categories          aqua sysutils
maintainers         {i0ntempest @i0ntempest} openmaintainer
license             GPL-3

description         Custom cursor themes for macOS
long_description    ${github.project} lets you replace every macOS system cursor — arrow, I-beam,\
                    crosshair, wait spinner, and more — with custom artwork of your own.

checksums           rmd160  2185f84a4b3f60fee21d4d9425927a943ca05229 \
                    sha256  764070850a8642e5f125a6399ef0d845f6802ea72b1a3aeca13e38c47da56259 \
                    size    81174735

post-patch {
    # Disable Sparkle without messing with xib files
    system -W ${worksrcpath}/${github.project} "/usr/libexec/PlistBuddy -c \"Delete :SUFeedURL\" ${github.project}-Info.plist"
    system -W ${worksrcpath}/${github.project} "/usr/libexec/PlistBuddy -c \"Delete :SUPublicEDKey\" ${github.project}-Info.plist"
    system -W ${worksrcpath}/${github.project} "/usr/libexec/PlistBuddy -c \"Delete :SUScheduledCheckInterval\" ${github.project}-Info.plist"
    system -W ${worksrcpath}/${github.project} "/usr/libexec/PlistBuddy -c \"Set :SUEnableAutomaticChecks bool false\" ${github.project}-Info.plist"
}

xcode.scheme        ${github.project}
xcode.configuration Release
xcode.build.settings-append \
                    ENABLE_USER_SCRIPT_SANDBOXING=NO \
                    OTHER_SWIFT_FLAGS='-disable-sandbox'

build.pre_args-append \
                    -IDEPackageSupportDisableManifestSandbox=1 \
                    -IDEPackageSupportDisablePluginExecutionSandbox=1 \
                    -derivedDataPath ${worksrcpath}/DerivedData

if {${os.major} >= 22} {
    xcode.build.settings-append \
        CODE_SIGN_IDENTITY=-
} else {
    xcode.build.settings-append \
        CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO
}

destroot {
    file copy ${build.dir}/build/${xcode.configuration}/${github.project}.app ${destroot}${applications_dir}
}

notes "
    For a list of ready-to-use cursor themes, see ${github.homepage}/tree/main/themes
"
