# $Id: Portfile 97186 2012-08-29 13:25:54Z raimue@macports.org $

PortSystem 1.0
PortGroup       github 1.0
PortGroup       xcode 1.0

github.setup    alloy terminal-notifier 1.4.2
categories      aqua
platforms       darwin
license         MIT
maintainers     raimue openmaintainer

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.

pre-fetch {
    if {${os.platform} == "darwin" && ${os.major} < 12} {
        ui_error "${name} only works with Mac OS X 10.8 Mountain Lion or later."
        return -code error "incompatible Mac OS X version"
    }
}

checksums       rmd160  6b19283737767afc75f01c3863fce539f2d69bf7 \
                sha256  32827a6a685bd2b5f7923522fdf364b5743940a4bbf8814ae638e7247f45cde3

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

post-destroot {
    # The terminal-notifier.app is not meant to be called directly, however, it
    # has to be an application bundle in order to be able to work with the
    # notification center. We hide the bundle in libexec and install a symlink
    # in bin.

    move ${destroot}${applications_dir}/${name}.app ${destroot}${prefix}/libexec/
    xinstall -m 755 ${filespath}/${name} ${destroot}${prefix}/bin/
    reinplace "s:@PREFIX@:${prefix}:g" ${destroot}${prefix}/bin/${name}
}
