summaryrefslogtreecommitdiff
blob: 5a72ac24f9369089d106d8ff7f4494a7cd4f7943 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit verify-sig

DESCRIPTION="Free Finnish spell checking and hyphenation for LibreOffice"
HOMEPAGE="https://voikko.puimula.org/"
SRC_URI="https://www.puimula.org/voikko-sources/${PN}/${P}.tar.gz
	verify-sig? ( https://www.puimula.org/voikko-sources/libreoffice-voikko/${P}.tar.gz.asc )"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 x86"

DEPEND="|| (
		app-office/libreoffice[odk]
		>=app-office/libreoffice-bin-6.4.7.2_p1
	)
	dev-libs/voikko-fi"
RDEPEND="${DEPEND}
	dev-libs/libvoikko"
BDEPEND="verify-sig? ( app-crypt/openpgp-keys-voikko )"

VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/voikko.asc

src_compile() {
	emake oxt
}

src_install() {
	einstalldocs

	emake DESTDIR="${D}/usr/$(get_libdir)/${P}" install-unpacked

	insinto /usr/$(get_libdir)/libreoffice/share/extension/install/
	doins build/voikko.oxt
}

pkg_postinst() {
	# Register voikko with libreoffice
	COMPONENT="${ROOT}/usr/$(get_libdir)/libreoffice/share/extension/install/voikko.oxt"

	einfo "Trying to register ${COMPONENT} ..."
	unopkg add --shared "${COMPONENT}"
	if [[ ${?} == 0 ]] ; then
		einfo "${PN} registered succesfully with LibreOffice."
	else
		eerror "Couldn't register ${PN} with LibreOffice."
	fi
}

pkg_prerm() {
	# Remove voikko registration from libreoffice
	unopkg remove --shared org.puimula.ooovoikko
	if [[ ${?} == 0 ]] ; then
		einfo "${PN} removed succesfully from LibreOffice."
	else
		eerror "Couldn't remove ${PN} from LibreOffice, "
		eerror "manual removal might be needed with "
		eerror "  unopkg list --shared"
		eerror "  unopkg remove --shared VOIKKO-IDENTIFIER"
	fi
}