# -*- 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            git-up GitUp 1.3.2 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                0
categories              devel
license                 GPL-3
maintainers             {chello.at:knapoc @Knapoc} openmaintainer
description             GitUp is a native macOS git client
long_description        GitUp provides features such as a live and interactive repo graph \
                        unlimited redo/undo, snapshots for 1-click rollbacks, visual commit \
                        splitter and many more
homepage                https://gitup.co

checksums               rmd160  fd7fb6d650908bad247c8f6a1442cba3ff8f15ec \
                        sha256  34856e9a3b2029e82e33318043a89439ea22c00181e26574448c0738b95001d8 \
                        size    21312701

fetch.type              git

if {${os.platform} eq "darwin" && ${os.major} < 20} {
    known_fail yes
    pre-fetch {
        ui_error "${name} @${version} requires macOS 11 or greater to build."
        return -code error "incompatible macOS version"
    }
}

post-fetch {
    system -W ${worksrcpath} "git submodule update --init"
}

patchfiles              patch-disable-sparkle.diff \
                        patch-disable-clt-install.diff \
                        patch-libgit2.diff

use_configure           no
use_xcode               yes

variant clt description {Installs GitUp command line tool} {
}

default_variants        +clt

build {
    system -W ${build.dir}/GitUp "xcodebuild -derivedDataPath ${build.dir} -configuration Release -scheme Application 'CODE_SIGN_IDENTITY=' CODE_SIGNING_REQUIRED=NO 'CODE_SIGN_ENTITLEMENTS='"
}

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

if {[variant_isset clt]} {
    post-destroot {
        ln -s ${applications_dir}/GitUp.app/Contents/SharedSupport/gitup ${destroot}${prefix}/bin/gitup
    }
}
