# Template file for 'libreoffice-bin'
pkgname=libreoffice-bin
version=4.2.3
revision=1
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.libreoffice.org/"
license="LGPL-3"
short_desc="Productivity suite compatible with other major office suites (binary build)"

_disturi="http://download.documentfoundation.org/libreoffice/stable/${version}/deb"
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
	_arch=x86-64
	distfiles="${_disturi}/x86_64/LibreOffice_${version}_Linux_${_arch}_deb.tar.gz"
	checksum=78bb3d60cd244d7dd1faf5b3753d4bad98dce6c5bd46d605752e1e3fd7488742
elif [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
	_arch=x86
	distfiles="${_disturi}/x86/LibreOffice_${version}_Linux_${_arch}_deb.tar.gz"
	checksum=e2a4e12a1f10fda8c8c59dbb86a8cf6a85ee95bc7a52656a37bc3402bd19061c
fi
only_for_archs="i686 x86_64"
wrksrc="LibreOffice_${version}.3_Linux_${_arch}_deb"
makedepends="shared-mime-info desktop-file-utils hicolor-icon-theme"
depends="${makedepends}"
allow_unknown_shlibs=yes

do_install() {
	cd DEBS
	mkdir -p ${DESTDIR}
	for a in *.deb ; do
		ar x $a
		tar xzpvf data.tar.gz -C ${DESTDIR}
	done
	# install symlinked programs to /usr
	programs="soffice scalc swriter simpress sdraw sbase"
	vmkdir usr/bin
	for a in ${programs} ; do
		ln -fs /opt/libreoffice${version%.*}/program/$a ${DESTDIR}/usr/bin/$a
	done
}
