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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        lhaeger AutoRaise 2.1.0 launcher-v
revision            0

categories          sysutils
platforms           macosx

license             GPL-3+
maintainers         nomaintainer

description         AutoRaise raises application windows to the front and gives them focus on mouse hover
long_description    ${description} after a configurable delay. There is also an option to warp the mouse \
                    to the center of the activated window, using the cmd-tab key combination for example.

github.tarball_from archive

checksums           rmd160  3894d02525b67ed99e000b01048c3eb88cfa5b02 \
                    sha256  37a89324e94fc5e121ef37887a26d8a6bc0c8ac5dfe3d681abd0fb1a83a933f2 \
                    size    374397

# fail if Swift 5 is not supported
if {[vercmp ${xcodeversion} 10.2] < 0} {
    known_fail yes
    pre-fetch {
        ui_error "${name} @${version} requires at least Xcode 10.2 with support for Swift 5."
        ui_error "See https://guide.macports.org/chunked/installing.html#installing.xcode for download links."
        return -code error "incompatible Xcode version"
    }
}

# use the SDK version that came with the Xcode version in use, even if that does not match the macOS version
# see https://trac.macports.org/ticket/62816 for more details
if {[vercmp ${xcodeversion} 11.0] < 0} {
    configure.sdk_version 10.14
} elseif {[vercmp ${xcodeversion} 12.2] < 0} {
    configure.sdk_version 10.15
} elseif {[vercmp ${xcodeversion} 12.3] < 0} {
    configure.sdk_version 11
} elseif {[vercmp ${xcodeversion} 12.5] < 0} {
    configure.sdk_version 11.1
}

xcode.configuration Release

post-destroot {
    ln -s ${applications_dir}/${name}.app/Contents/Resources/${name}  ${destroot}${prefix}/bin/${name}
}
