# $Id: Portfile 119791 2014-05-07 00:21:15Z sean@macports.org $

PortSystem 1.0
PortGroup       github 1.0
PortGroup       xcode 1.0

github.setup    alloy terminal-notifier 1.6.0
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} eq "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  2a9e8dc2c19d90e20b31f5800fb0bcb62c16fc57 \
                sha256  84d67bbcb1677c3485acdf4f5539846454ff40478d7f62e6694ff67a815d95b5

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}
}
