NAME=mozilla-thunderbird
VERSION=1.5.0.9
SOURCE=(http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/$VERSION/linux-i686/en-US/thunderbird-$VERSION.tar.gz
	mozilla-thunderbird.desktop
	thunderbird.png )
ARCH=i686
BUILD=${BUILD:-1}
STRIP=0

build() {
	mkdir -p $PKG$BINDIR $PKG$LIBDIR $PKG$DATADIR/{applications,pixmaps}
	(
		cd $PKG$LIBDIR
		_explode 0 .
		mv thunderbird thunderbird-$VERSION
		ln -sf thunderbird-$VERSION thunderbird
		cd thunderbird-$VERSION
		cat << "EOF" >> defaults/pref/all-thunderbird.js

// Use Firefox as the default for http:// and https:// links
pref("network.protocol-handler.app.http", "/usr/bin/firefox");
pref("network.protocol-handler.app.https", "/usr/bin/firefox");

EOF

		sed -i "s#/usr/local/lib/\([a-z]\+\)-$VERSION#$LIBDIR/\1-$VERSION#" thunderbird
		find . -name '*~' -exec rm -f {} \;
	)
	ln -sf $LIBDIR/thunderbird-$VERSION/thunderbird $PKG$BINDIR
	cat ${SOURCE[1]} > $PKG$DATADIR/applications/mozilla-thunderbird.desktop
	cat ${SOURCE[2]} > $PKG$DATADIR/pixmaps/thunderbird.png
	_chfix
	_chgrp_bin
}
