# $Id: Portfile 55022 2009-08-06 03:06:13Z ryandesign@macports.org $

PortSystem      1.0

name            sunbird-x11
categories      x11
version         0.7
platforms       darwin
maintainers     nomaintainer
description     Mozilla.org's stand-alone calendar

long_description \
    Sunbird lets you manage your schedule easily, and store it where you want to.

homepage        http://www.mozilla.org/projects/calendar/sunbird/
master_sites    http://releases.mozilla.org/pub/mozilla.org/calendar/sunbird/releases/${version}/source/
distname        lightning-sunbird-${version}-source
use_bzip2       yes

checksums       md5 14412fad1c72a5281164ca96f6c23cf4 \
                sha1 aa98305783a6ea765a2ea83667ead8fd664cb379 \
                rmd160  f4ead53117fbbbe208dbdada01800446b800116d

worksrcdir      mozilla

patchfiles      patch-xpcom-build-Makefile \
                patch-libprldap-Makefile.in

depends_build   port:pkgconfig

depends_lib     port:libidl \
                path:lib/pkgconfig/glib-2.0.pc:glib2 \
                port:zip \
                port:gtk2 \
                port:gnome-vfs \
                port:gnome-icon-theme \
                path:lib/pkgconfig/cairo.pc:cairo \
                port:nspr


configure.args  --enable-application=calendar \
                --disable-official-branding \
                --with-distribution-id=org.macports \
                --disable-static \
                --enable-shared \
                --enable-default-toolkit=gtk2 \
                --enable-xft \
                --disable-freetype2 \
                --enable-xinerama \
                --with-pthreads \
                --enable-gnomevfs \
                --enable-postscript \
                --disable-prebinding \
                --disable-debug \
                --enable-strip \
                --enable-optimize='-O2' \
                --disable-tests \
                --with-default-mozilla-five-home=${prefix}/lib/sunbird \
                --with-system-jpeg=${prefix} \
                --with-system-zlib=${prefix} \
                --with-system-png=${prefix} \
                --enable-system-cairo \
                --with-system-cairo=${prefix} \
                --with-system-nspr \
                --with-nspr-prefix=${prefix}


variant debug description "build with debugging symbols" {
    configure.args-delete   --disable-debug \
                            --enable-optimize='-O2' \
                            --enable-strip
    
    configure.args-append   --enable-debug \
                            --disable-optimize \
                            --disable-strip
}

post-destroot   {
    file mkdir ${destroot}${prefix}/share/applications
    
    copy \
        ${filespath}/share-applications-sunbird.desktop \
        ${destroot}${prefix}/share/applications/sunbird.desktop

system "( echo '#!/bin/sh'; echo 'exec ${prefix}/lib/sunbird-${version}/sunbird-bin \"\$@\"' ) > ${destroot}${prefix}/bin/sunbird"
system "chmod 755 ${destroot}${prefix}/bin/sunbird"
}
