# -*- 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.2.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  5f2c773edb3bec79f8794b59e56a5fe9764e0e9d \
                    sha256  6d1cf5d610ce60f6cffe5125853019fc844f9e178e338c056d0c51e51da149d6 \
                    size    78246090

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
"
