# $Id: Portfile 55013 2009-08-06 02:50:26Z ryandesign@macports.org $

PortSystem      1.0

name            thunderbird-x11
categories      mail x11
version         2.0.0.22
platforms       darwin
maintainers     nomaintainer
description     Mozilla.org's popular stand-alone mail/news client

long_description \
    Thunderbird makes emailing safer, faster and easier than ever before \
    with the industry's best implementations of features such as intelligent \
    spam filters, a built-in spell checker, extension support, and much more.

homepage        http://www.mozilla.com/thunderbird/
master_sites    http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/${version}/source/
distname        thunderbird-${version}-source
use_bzip2       yes

checksums       md5     080c26dcb0ed563519a6061139a0bf92 \
                sha1    a9da470ff090dfd049cae6b0c3b1a4e95c3f2022 \
                rmd160  6f9693c0b7f5af0c60d245c96492f11a4c286efd

worksrcdir      mozilla

patchfiles      patch-xpcom-build-Makefile \
                patch-libprldap-Makefile.in \
                patch-directory_c-sdk_ldap_libraries_libprldap_Makefile.in.diff

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=mail \
                --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/thunderbird \
                --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-thunderbird.desktop \
        ${destroot}${prefix}/share/applications/thunderbird.desktop

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