# -*- 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           xcodeversion 1.0

use_xcode           yes
github.setup        jpsim SourceKitten 0.32.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
categories          devel
platforms           macosx

universal_variant   no
license             MIT
maintainers         nomaintainer

description         An adorable little framework and command line tool for \
                    interacting with SourceKit.
long_description    {*}${description}

# Fetch from git instead of distfile because it needs submodules
fetch.type          git

use_configure       no
# everything is built during the prefix_install target
build               {}

minimum_xcodeversions {19 12}

platform macosx {
    if {[vercmp ${macos_version} 10.15.4] < 0} {
        known_fail  yes
        pre-fetch {
            ui_error "SourceKitten requires at least macOS 10.15.4 and Xcode 12 to build."
            return -code error "incompatible macOS version"
        }
    }
}

destroot {
    system -W ${worksrcpath} "${build.cmd} prefix_install PREFIX=${destroot}${prefix} TEMPORARY_FOLDER=${destroot}"
}
