# -*- 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

name            Growl
github.setup    growl growl 1.2.2
revision		0
platforms		macosx
license			BSD zlib
maintainers		nomaintainer
description		Global notification system for Mac OS X
long_description \
                Growl is a global notification system for Mac OS X. \
				Any application can send a notification to Growl, which will \
				display an attractive message on your screen.

homepage		http://growl.info

checksums           rmd160  82cae1e728a7b9875caa32868fcb9a7295d4e882 \
                    sha256  ed19f65253c8ce9151c3ccd0b88b3957f19168cfd022d5cc329fa02a11d534bd \
                    size    10343926
github.tarball_from archive

xcode.target            Growl Growl.framework
destroot.destdir        DSTROOT=${worksrcpath}/build
xcode.destroot.path     /destroot
destroot.violate_mtree  yes

# Common/Source/LoginItemAE.c uses Carbon so can't build x86_64
supported_archs     i386 ppc

# Revert https://github.com/growl/growl/commit/250eefc7f296f23a73cea826a097bd6291c0aa56
# It does not work outside of mercurial.
patchfiles          patch-GrowlVersion.h.diff

post-patch {
    reinplace "s|GCC_VERSION = 4.0|GCC_VERSION = 4.2|g" ${worksrcpath}/Growl.xcodeproj/project.pbxproj
}

post-destroot {
	xinstall -d "${destroot}/Library/PreferencePanes"
	move ${worksrcpath}/build/destroot/Growl.prefPane "${destroot}/Library/PreferencePanes"
	move ${worksrcpath}/build/Debug/Growl.framework "${destroot}${frameworks_dir}"
}

# The old behaviour of automatically installing the contributed extras in
# the source distribution has been disabled for now, as it is not apparent that
# every Growl user will want these. They should probably go into other ports,
# in any case.

# this proc is overriden to remove the SYMROOT=build/ configuration
# overwise, Extras/GrowlAction builds in Extras/GrowlAction/build instead of build
proc xcode::get_build_args {args} {
    global tcl_platform
    global configure.universal_archs configure.build_arch macosx_deployment_target
    global os.major os.arch
    global developer_dir configure.sdkroot

    set xcode_build_args "OBJROOT=build/"

    # MACOSX_DEPLOYMENT_TARGET
    append xcode_build_args " MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}"

    # ARCHS
    if {[variant_exists universal] && [variant_isset universal]} {
        append xcode_build_args " ARCHS=\"${configure.universal_archs}\""
    } else {
        append xcode_build_args " ARCHS=${configure.build_arch}"
    }

    # SDKROOT
    append xcode_build_args " SDKROOT=\"${configure.sdkroot}\""

    return $xcode_build_args
}
