summaryrefslogtreecommitdiff
blob: 1cd1001b0015d4697f5280387f8f0ddaf4d2c20f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author: Martin Schlemmer <azarah@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/app-office/openoffice-bin/openoffice-bin-641d-r1.ebuild,v 1.1 2002/05/03 22:55:25 azarah Exp $

# NOTE:  There are two big issues that should be addressed.
#
#        1)  The registry should be generated as done via "./setup -net",
#            and not via the tarball.
#
#        2)  Language support and fonts should be addressed.
#
#        It will also be good to generate regcomp via some other method.

MY_PV="`echo ${PV} | gawk '{ print toupper($1) }'`"
LOC="/opt"
MAIN_VER="`echo ${PV} |sed -e "s:[a-z]::g"`"
S="${WORKDIR}/normal"
DESCRIPTION="OpenOffice productivity suite"
SRC_URI="http://ny1.mirror.openoffice.org/${PV}/install${MY_PV}_linux_intel.tar.gz
	http://sf1.mirror.openoffice.org/${PV}/install${MY_PV}_linux_intel.tar.gz
	http://www.ibiblio.org/gentoo/distfiles/openoffice-${PV}-registry.tbz2"
HOMEPAGE="http://www.openoffice.org"

DEPEND="virtual/glibc
	>=sys-devel/perl-5.0
	virtual/x11
	app-arch/zip
	app-arch/unzip
	>=virtual/jdk-1.3.1"

SLOT="0"

src_unpack() {

	unpack install${MY_PV}_linux_intel.tar.gz
}

src_install() {

	# Generate a install script
	PREFIX=${D}
	REGCOMP=${S}/regcomp
	INSTDIR=${S}
	DESTDIR=${D}${LOC}/OpenOffice-${PV}
	export PREFIX REGCOMP INSTDIR DESTDIR
	export RUNARGS="install"
	${FILESDIR}/${PV}/read_ins.pl >${S}/gentoo-install.sh || die
	chmod 0755 ${S}/gentoo-install.sh

	# Generate a register and createdb scripts
	PREFIX=""
	REGCOMP=${LOC}/OpenOffice-${PV}/program/regcomp
	INSTDIR=${S}
	DESTDIR=${LOC}/OpenOffice-${PV}
	export PREFIX REGCOMP INSTDIR DESTDIR
	export RUNARGS="register"
	${FILESDIR}/${PV}/read_ins.pl >${S}/gentoo-register.sh || die
	chmod 0755 ${S}/gentoo-register.sh
	export RUNARGS="createdb"
	${FILESDIR}/${PV}/read_ins.pl >${S}/gentoo-createdb.sh || die
	chmod 0755 ${S}/gentoo-createdb.sh

	# Install to ${D}
	${S}/gentoo-install.sh || die "Failed to install data to ${D}!"

	# Install regcomp.  For this we need to compile OO without
	# CFLAGS/CXXFLAGS.  I dont know when the config server API may
	# change, so this included regcomp may not work for future
	# versions of OO.
	cd ${D}${LOC}/OpenOffice-${PV}/program
	tar -jxf ${FILESDIR}/${PV}/regcomp-${PV}.tbz2 || \
		die "Could not unpack regcomp!"

	# Unpack the registry needed for NETWORK installation.
	# This my need to be updated for future versions of OO.
	# Install binary with "./setup -net" to generate.
	cd ${D}${LOC}/OpenOffice-${PV}/share/config/registry
	rm -rf *
	tar -jxpf ${DISTDIR}/openoffice-${PV}-registry.tbz2 || \
		die "Could not unpack registry!"
	# Fix paths
	cd ${D}${LOC}/OpenOffice-${PV}/share/config/registry/instance/org/openoffice/Office
	cp Common.xml Common.xml.orig
	sed -e "s:/opt/OpenOffice.org641:${LOC}/OpenOffice-${PV}:g" \
		Common.xml.orig >Common.xml
	rm -f Common.xml.orig

	# Generate ISO resource files.
	cd ${D}${LOC}/OpenOffice-${PV}/program/resource
	for x in ooo*.res
	do
		cp ${x} ${x/ooo/iso}
	done

	# Create the global fonts.dir file
	cd ${D}${LOC}/OpenOffice-${PV}/share/fonts/truetype
	cp -f fonts.dir  fonts_dir.global

	# Create misc directories
	cd ${D}${LOC}/OpenOffice-${PV}
	mkdir -p user/config/registry/instance/org/openoffice/{Office,ucb}
	mkdir -p user/psprint/{driver,fontmetric}
	mkdir -p user/{autocorr,backup,plugin,store,temp,template}

	# Move the register and createdb scripts to ${D}
	cp -f ${S}/gentoo-register.sh ${D}${LOC}/OpenOffice-${PV}/program
	cp -f ${S}/gentoo-createdb.sh ${D}${LOC}/OpenOffice-${PV}/program
}

pkg_postinst() {
	if [ "${ROOT}" = "/" ]
	then
		for x in bootstraprc configmgrrc instdb.ins sofficerc unorc
		do
			if [ -e ${LOC}/OpenOffice-${PV}/program/${x} ]
			then
				rm -f ${LOC}/OpenOffice-${PV}/program/${x} >/dev/null
			fi
		done
		${LOC}/OpenOffice-${PV}/program/gentoo-createdb.sh || die
		echo ">>> Registering components (this may take a few minutes)..."
		${LOC}/OpenOffice-${PV}/program/gentoo-register.sh &>/dev/null || die
	fi

	# Make sure these do not get nuked.
	cd ${ROOT}${LOC}/OpenOffice-${PV}
	mkdir -p user/config/registry/instance/org/openoffice/{Office,ucb}
	mkdir -p user/psprint/{driver,fontmetric}
	mkdir -p user/{autocorr,backup,plugin,store,temp,template}
}