# $Id: Portfile 38077 2008-07-05 21:37:56Z ryandesign@macports.org $

PortSystem      1.0

name            thunderbird-x11
categories      mail x11
version         2.0.0.12
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 c23f576a8fd0ceee5135829c8ae5168b \
                sha1 36ea64353d32a9f138ef658250cfdcf8f9e862f2 \
                rmd160  80d6fdb4b8e085a82234825cfbfc6cd05d015f6f

worksrcdir      mozilla

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

depends_build   port:pkgconfig

depends_lib     port:libidl \
                path:${prefix}/lib/pkgconfig/glib-2.0.pc:glib2 \
                port:zip \
                port:gtk2 \
                port:gnome-vfs \
                port:gnome-icon-theme \
                port: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"
}
