# -*- 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
PortGroup           xcode 1.0

github.setup        cocoadialog cocoadialog f0bf3a7704437bc0b6df52709735589a06bfd8a0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             2.3.7
revision            0
checksums           rmd160  450d3ee338de605b0ea073882992438d2e304c06 \
                    sha256  348839daa6cd789ef525a7ce64bd9ced336c0a8ec694eab31b3a50c2af88dbeb \
                    size    2851302

# The name will go all-lowercase in version 3.
# https://github.com/cocoadialog/cocoadialog/issues/93
name                CocoaDialog
categories          aqua sysutils
# 2.3.x files say GPL 2 or later, but it seems to have been changed to 2 only.
# https://github.com/cocoadialog/cocoadialog/commit/8617c8d1024017b8e703df3833378935f143905c
license             GPL-2
maintainers         {ryandesign @ryandesign} openmaintainer
# The bundled Growl framework is compiled for these architectures.
# TODO: Try to patch out the use of Growl on other archs.
supported_archs     i386 x86_64

description         common GUI controls for command-line application
long_description    CocoaDialog is a macOS application that allows the use \
                    of common GUI controls such as file selectors, text \
                    input, progress bars, yes/no confirmations and more \
                    with a command-line application. It requires no \
                    knowledge of Cocoa, and is ideal for use in shell and \
                    Perl scripts (or Ruby, or Python, or... etc).

homepage            https://cocoadialog.com/v2/#2.3.x

patchfiles          fix-Changelog-case.patch \
                    fix-CocoaDialog_Prefix.pch-case.patch \
                    no-sparkle.patch \
                    no-Werror.patch \
                    update-Changelog.patch \
                    update-URLs.patch

post-patch {
    # 3.0.0-betaX was retroactively rebranded as 2.3.X.
    # https://github.com/cocoadialog/cocoadialog/blob/master/HISTORY.md#version-23--300-betax
    reinplace -E -W ${worksrcpath} "s|3\\.0(\\.0)?-beta7|${version}|g" \
                    Resources/en-US.lproj/InfoPlist.strings \
                    Resources/Info.plist
}

xcode.configuration Release
xcode.target        cocoaDialog

post-destroot {
    delete ${destroot}${applications_dir}/relaunch
    xinstall ${filespath}/cocoadialog.in ${destroot}${prefix}/bin/cocoadialog
    reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" ${destroot}${prefix}/bin/cocoadialog
}
