blob: e7ebaa8fcd48fedf14d03c0523b5c2700b40854c (
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
133
134
135
136
137
138
139
140
|
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils versionator multilib
MY_P="${P/office-voikko/office.org-voikko}"
MY_PN="${PN/office-voikko/office.org-voikko}"
DESCRIPTION="Voikko—Free Finnish spell checking and hyphenation for OpenOffice"
HOMEPAGE="http://voikko.sf.net/"
SRC_URI="mirror://sourceforge/voikko/${MY_P}.tar.gz"
LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~x86"
#DEPEND="|| ( >=app-office/openoffice-2 (
# >=app-office/openoffice-bin-2 app-office/openoffice-sdk
# )
# )
DEPEND="|| ( >=app-office/openoffice-2 >=app-office/openoffice-bin-2 )
app-office/openoffice-sdk
app-text/voikko
sys-apps/grep
sys-apps/sed
sys-apps/sysvinit
!app-office/oo2-voikko"
RDEPEND="|| ( >=app-office/openoffice-2 >=app-office/openoffice-bin-2 )
app-text/voikko"
S="${WORKDIR}/${MY_P}"
pkg_setup() {
# This check originates from soikko times I think...
# Also, pidof belongs to sysvinit, dep?
if pidof soffice.bin >/dev/null; then
die "${PN} can’t be installed while OpenOffice.org is running."
fi
# We need OpenOffice SDK initialisation sh script executable
if [[ ! -x "${ROOT}/usr/lib/openoffice/program/setsdkenv_unix.sh" ]] ; then
die "Couldn’t find open office SDK settings from \
${ROOT}/usr/lib/openoffice/program/setsdkenv_unix.sh"
else
export SDKENV="${ROOT}/usr/lib/openoffice/program/setsdkenv_unix.sh"
fi
if [[ ! -x "${ROOT}/usr/$(get_libdir)/openoffice/program/unopkg" ]] ; then
die "Couldn’t find unopkg binary"
else
export UNOPKG="${ROOT}/$(get_libdir)/openoffice/program/unopkg"
fi
# Open Office must be installed with SDK
if has_version app-office/openoffice ; then
if ! built_with_use app-office/openoffice odk ; then
ewarn "OpenOffice should be built with USE flag “odk”"
ewarn "for building uno package from source to work"
fi
fi
}
src_compile() {
einfo "Searching OpenOffice.org SDK environment..."
source "${SDKENV}"
einfo "SDK set to: OO_SDK_HOME=${OO_SDK_HOME}"
emake || die "make uno package failed"
}
src_install() {
dodoc impl/doc/Linux_*/ASENNUS.txt
insinto /usr/lib/openoffice/share/
newins linux-installer ${PN}-installer
dodir /usr/lib/${P}
insinto /usr/lib/${P}
doins build/${MY_PN}-Linux*-${PV}.uno.pkg
}
# FIXME: installation of an unopkg is troublesome, move to src_install when
# OO.o supports it somehow sanely
pkg_postinst() {
# N.B.: uno packages meddle with $HOME, let's fool it
HOME="${S}"
cd "${S}"
# Yay, OO.o package installation requires .ooo-2.0 directory from once
# started instance of the program. How fun!
tar jxf "${FILESDIR}/ooo-2.0-home.tar.bz2"
# select component
if use amd64; then
COMPONENT="${ROOT}/usr/lib/${P}/${MY_PN}-Linux_x86_64-${PV}.uno.pkg"
else
COMPONENT="${ROOT}/usr/lib/${P}/${MY_PN}-Linux_x86-${PV}.uno.pkg"
fi
PKG=$(basename "${COMPONENT}")
# Global scope in install-oo2-voikko
if [[ -e "${HOME}/.openoffice.org2/.lock" ]] ;
then
die "lockfile from previous failed installation attempt found in \
${HOME}/.openoffice.org2/.lock, please clean and retry"
fi
# register()
if [[ "${COMPONENT}" == "" ]] ;
then
die "UNO component not found"
fi
einfo "Trying to register uno package ${COMPONENT}..."
HOME=${HOME} "${UNOPKG}" add --shared "${COMPONENT}"
if [[ $? == 0 ]] ;
then
einfo "Voikko package (${PKG}) registered succesfully"
else
die "Couldn’t register ${PN} package (${PKG})"
fi
elog "Please note that ${PN} is very dependent on ABI compatible "
elog "version of OpenOffice.org to exist on system when removing voikko!"
elog "Before incompatible update or removal of OpenOffice you must"
elog "unmerge ${PN}!"
}
pkg_prerm() {
#unregister()
UNOPKG_LIST="$(${UNOPKG} list --shared 2> /dev/null)"
if [[ $? != 0 ]] ; then
ewarn "Couldn’t list existing packages..."
fi
PKG=$(echo "${UNOPKG_LIST}" | egrep -m1 "^Name: ${UNONAME}-Linux_x86(_64)?-${PV}" | sed -e "s/Name: //")
if [ "${PKG}" != "" ]; then
einfo "Removing uno package ${PKG}..."
if "${UNOPKG}" remove --shared ${PKG} &>/dev/null
then
einfo "${PN} package (${PKG}) unregistered succesfully"
else
die "Couldn’t uninstall existing ${PN} packages"
fi
else
ewarn "Couldn’t find existing ${PN} packages."
ewarn "You may need to \`unopkg remove\` them manually."
fi
}
|