PortSystem 1.0
PortGroup       github 1.0
PortGroup       xcode 1.0
PortGroup       xcodeversion 1.0

github.setup    julienXX terminal-notifier 2.0.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
categories      aqua
license         MIT
maintainers     nomaintainer

description     A command line tool to send Mac OS X user notifications
long_description \
                ${name} is able to send notifications to the Mac OS X \
                Notification Center, which is available in Mac OS X \
                10.8 Mountain Lion or later.

minimum_xcodeversions {12 5.0}

pre-fetch {
    if {${os.subplatform} eq "macosx" && [vercmp ${macosx_version} 10.10] < 0} {
        ui_error "${name} only works with OS X 10.10 Yosemite or later."
        return -code error "incompatible macOS version"
    }
}

checksums       rmd160  72ddf0b935edefb734a6073bbf1a16fd4fe9452e \
                sha256  7831e92a48c041c2b1c58671a6de62d4162d7144b63cbc489fc43ac4a74e179d \
                size    662059

post-extract {
    # This icon is a copy from Apple and is protected by copyright. Delete this
    # here to avoid distributing copyright protected files in archives.
    delete ${worksrcpath}/Terminal.icns
}

patchfiles      patch-pbxproj.diff

xcode.destroot.path ${prefix}/libexec/terminal-notifier

post-destroot {
    xinstall -m 0755 ${filespath}/terminal-notifier ${destroot}${prefix}/bin/terminal-notifier
    reinplace "s:@@PREFIX@@:${prefix}:" ${destroot}${prefix}/bin/terminal-notifier
}

# this port does not build with the new xcode build system at present
if {[vercmp ${xcodeversion} 10.0] >= 0} {
    build.pre_args      -UseNewBuildSystem=NO
    destroot.pre_args   -UseNewBuildSystem=NO
}
