# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Maintainer: Michael Kelly <michaelkkelly@yahoo.com>
# $Header:$

# This ebuild was generated by Ebuilder v0.4.

#inherit rpm


LOC="/opt"
INSTDIR="${LOC}/OpenOffice.org"
DESCRIPTION="OpenOffice 2.0 Snapshot Build"
S="${WORKDIR}/RPMS"
RESTRICT="fetch"
HOMEPAGE="http://download.openoffice.org/680/index.html"
SRC_URI="OOo_1.9.m58_native_LinuxIntel_install.tar.gz"
LICENSE="|| ( LGPL-2  SISSL-1.1 )"
KEYWORDS="x86 amd64"
IUSE="kde gnome"
DEPEND="sys-apps/findutils
	virtual/libc
	>=dev-lang/perl-5.0
	virtual/x11
	app-arch/zip
	app-arch/unzip
	app-arch/rpm2targz
	|| ( >=virtual/jdk-1.3.1 >=virtual/jre-1.3.1 )
	!app-office/openoffice
	amd64? ( >=app-emulation/emul-linux-x86-xlibs-1.0 )"
RDEPEND="virtual/libc
	>=dev-lang/perl-5.0
	virtual/x11
	app-arch/zip
	app-arch/unzip
	|| ( >=virtual/jdk-1.3.1 >=virtual/jre-1.3.1 )
	!app-office/openoffice
	amd64? ( >=app-emulation/emul-linux-x86-xlibs-1.0 )"
src_unpack() {
	unpack "OOo_1.9.m58_native_LinuxIntel_install.tar.gz"
	cd "${S}"
	
	# Convert RPMS to .tar.gz
	echo "Converting RPM files to .tar.gz files"
	rpm2targz openoffice-calc-1.9.58-1.i586.rpm
	rpm2targz openoffice-core-1.9.58-1.i586.rpm
	rpm2targz openoffice-draw-1.9.58-1.i586.rpm
	rpm2targz openoffice-graphicfilter-1.9.58-1.i586.rpm
	rpm2targz openoffice-impress-1.9.58-1.i586.rpm
	rpm2targz openoffice-javafilter-1.9.58-1.i586.rpm
	rpm2targz openoffice-mailcap-1.9.58-1.i586.rpm
	rpm2targz openoffice-math-1.9.58-1.i586.rpm
	rpm2targz openoffice-redhat-menus-1.9.58-1.noarch.rpm
	rpm2targz openoffice-spellcheck-1.9.58-1.i586.rpm
	rpm2targz openoffice-suse-menus-1.9.58-1.noarch.rpm
	rpm2targz openoffice-testtool-1.9.58-1.i586.rpm
	rpm2targz openoffice-writer-1.9.58-1.i586.rpm
	
	#Unpack files
	echo "Unpacking .tar.gz files"
	tar -xzf openoffice-calc-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-core-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-draw-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-graphicfilter-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-impress-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-javafilter-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-mailcap-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-redhat-menus-1.9.58-1.noarch.tar.gz
	tar -xzf openoffice-spellcheck-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-suse-menus-1.9.58-1.noarch.tar.gz
	tar -xzf openoffice-testtool-1.9.58-1.i586.tar.gz
	tar -xzf openoffice-writer-1.9.58-1.i586.tar.gz
}

src_compile() {
	echo ""
}

src_install () {
	# Sandbox issues; bug #8587
	addpredict "/user"
	addpredict "/share"
	addpredict "/pspfontcache"
	addpredict "/usr/bin/soffice"
	addpredict "/root/.gconfd"
	addpredict "/opt/OpenOffice.org/foo.tmp"
	addpredict "/opt/OpenOffice.org/delme"

	# Sandbox issues; bug 8063
	addpredict "/dev/dri"
	
	einfo "Installing OpenOffice.org into build root..."
	dodir ${INSTDIR}
	#dodir ${WORKDIR}/image/opt/
	cp -a ${WORKDIR}/RPMS/opt/openoffice1.9.58/* ${D}/opt/OpenOffice.org
		
	# Install shortcuts
	
	# Install documentation.
	#dodoc
}

pkg_postinst() {
	echo "Running post installation scripts"
	cd ${INSTDIR}
	/opt/OpenOffice.org/program/pkgchk --shared --quiet
	/opt/OpenOffice.org/program/configimport --spool
}