# Template build file for 'thunderbird'.
pkgname=thunderbird
version=17.0.2
revision=2
wrksrc=comm-release
short_desc="Standalone Mail/News reader"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.mozilla.org/thunderbird/"
license="MPL-1.1, GPL-2, LGPL-2.1"
distfiles="${MOZILLA_SITE}/${pkgname}/releases/${version}/source/${pkgname}-${version}.source.tar.bz2"
checksum=081b53161750a31f9b43d4ba4ccb496c69fdfaa3430f0ce0798cd5fa3036764c

disable_debug=yes

hostmakedepends="unzip zip perl python yasm pkg-config"
makedepends="libjpeg-turbo-devel libpng-devel>=1.6 hunspell-devel
 pixman-devel libIDL-devel nss-devel>=3.13.3 sqlite-devel libXrender-devel
 gtk+-devel libevent-devel libnotify-devel libvpx-devel GConf-devel
 startup-notification-devel dbus-glib-devel alsa-lib-devel hunspell-devel
 wireless_tools-devel libXScrnSaver-devel libSM-devel libXt-devel"

do_build() {
	cp -f ${FILESDIR}/mozconfig .mozconfig
	export LDFLAGS="-Wl,-R/usr/lib/thunderbird"

	make ${makejobs} -f client.mk MOZ_MAKE_FLAGS="${makejobs}"
}

do_install() {
	make -f client.mk DESTDIR=${DESTDIR} install

	vinstall ${FILESDIR}/vendor.js 644 usr/lib/thunderbird/defaults/pref

	vinstall ${FILESDIR}/thunderbird.desktop 644 usr/share/applications
	for i in 16x16 22x22 24x24 32x32 48x48 256x256; do
		vinstall other-licenses/branding/thunderbird/mailicon${i%x*}.png 644 \
			usr/share/icons/hicolor/${i}/apps thunderbird.png
	done

	rm -rf ${DESTDIR}/usr/lib/thunderbird/{dictionaries,hyphenation}
	ln -sf /usr/share/hunspell ${DESTDIR}/usr/lib/thunderbird/dictionaries
	ln -sf /usr/share/hyphen ${DESTDIR}/usr/lib/thunderbird/hyphenation

	# We don't want the development stuff
	rm -r ${DESTDIR}/usr/{include,lib/thunderbird-devel,share/idl}
}

thunderbird_package() {
	depends="desktop-file-utils hicolor-icon-theme"
	pkg_install() {
		vmove all
	}
}