# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ OO_PATCHLEVEL="OOC680" OO_SRC="OOO_2_0_3" DESCRIPTION="Voikko—Free Finnish spell checking and hyphenation for OpenOffice" HOMEPAGE="http://www.lemi.fi/voikko/" #IUSE="unobuild" SRC_URI="http://dev.gentoo.org/~flammie/${P}.tar.bz2" # unobuild? ( http://www.hunspell-fi.org/files/${P}.tar.gz # http://mirrors.dotsrc.org/openoffice/stable/2.0.3_sdk/OOo_2.0.3_LinuxIntel_sdk.sh ) # !unobuild? ( http://dev.gentoo.org/~flammie/${P}.tar.bz2 )" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~x86" DEPEND="|| ( >=app-office/openoffice-2 >=app-office/openoffice-bin-2 ) app-text/voikko sys-apps/grep sys-apps/sed" # "unobuild? ( >=app-office/openoffice-2 # app-arch/zip ) # ! app-office/oo2-soikko RDEPEND="|| ( >=app-office/openoffice-2 >=app-office/openoffice-bin-2 ) app-text/voikko" pkg_setup() { if pidof soffice.bin >/dev/null; then die "Voikko can’t be installed while OpenOffice.org is running." # Or use the force #killall soffice.bin || killall -9 soffice.bin fi } src_install() { dodoc ASENNUS.txt insinto /usr/lib/openoffice/share/ doins linux-installer dodir /usr/lib/${P} insinto /usr/lib/${P} if use amd64 ; then doins oo2-voikko-Linux_x86_64-${PV}.uno.pkg else doins oo2-voikko-Linux_x86-${PV}.uno.pkg fi } find_unopkg() { if has_version '>=app-office/openoffice-bin'; then if use amd64 ; then UNOPKG="/usr/lib32/openoffice/program/unopkg" else UNOPKG="/usr/lib/openoffice/program/unopkg" fi else UNOPKG="/usr/lib/openoffice/program/unopkg" #verify! fi } pkg_postinst() { # N.B.: uno packages meddle with $HOME, let's fool it HOME="${S}" find_unopkg # select component if use amd64; then COMPONENT="${ROOT}/usr/lib/${P}/oo2-voikko-Linux_x86_64-${PV}.uno.pkg" else COMPONENT="${ROOT}/usr/lib/${P}/oo2-voikko-Linux_x86-${PV}.uno.pkg" fi PKG=$(basename "${COMPONENT}") # verify binary interface if grep -U -q CXXABI_1.3 "$UNOPKG".bin && echo "$COMPONENT" | grep -q gcc3.3 then die "g++ ABI mismatch or such" fi # 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 # use normal binary # register() if [[ "${COMPONENT}" == "" ]] ; then die "UNO component not found" fi einfo "Trying to register uno package ${COMPONENT}..." "${UNOPKG}" add --shared "${COMPONENT}" if [[ $? == 0 ]] ; then einfo "Voikko package (${PKG}) registered succesfully" else die "Couldn't register Voikko package (${PKG})" fi elog "Please note that oo2-voikko 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 oo2-voikko!" } pkg_prerm() { find_unopkg #unregister() UNOPKG_LIST="$(${UNOPKG} list --shared 2> /dev/null)" if [[ $? != 0 ]] ; then die "Couldn't list existing packages" fi PKG=$(echo "${UNOPKG_LIST}" | egrep -m1 "^Name: oo2-voikko-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 "Voikko package (${PKG}) unregistered succesfully" else die "Couldn't uninstall existing Voikko packages" fi else ewarn "Couldn't find existing Voikko packages." ewarn "You may need to unopkg remove them manually." fi }