summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/office-ext-r1.eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'eclass/office-ext-r1.eclass')
-rw-r--r--eclass/office-ext-r1.eclass230
1 files changed, 230 insertions, 0 deletions
diff --git a/eclass/office-ext-r1.eclass b/eclass/office-ext-r1.eclass
new file mode 100644
index 000000000000..a7afb15e4d84
--- /dev/null
+++ b/eclass/office-ext-r1.eclass
@@ -0,0 +1,230 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: office-ext-r1.eclass
+# @MAINTAINER:
+# The office team <openoffice@gentoo.org>
+# @AUTHOR:
+# Tomáš Chvátal <scarabeus@gentoo.org>
+# @BLURB: Eclass for installing libreoffice/openoffice extensions
+# @DESCRIPTION:
+# Eclass for easing maitenance of libreoffice/openoffice extensions.
+
+case "${EAPI:-0}" in
+ 5) OEXT_EXPORTED_FUNCTIONS="src_unpack src_install pkg_postinst pkg_prerm" ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+inherit eutils multilib
+
+# @ECLASS-VARIABLE: OFFICE_REQ_USE
+# @DESCRIPTION:
+# Useflags required on office implementation for the extension.
+#
+# Example:
+# @CODE
+# OFFICE_REQ_USE="java,jemalloc(-)?"
+# @CODE
+if [[ ${OFFICE_REQ_USE} ]]; then
+ # Append the brackets for the depend bellow
+ OFFICE_REQ_USE="[${OFFICE_REQ_USE}]"
+fi
+
+# @ECLASS-VARIABLE: OFFICE_IMPLEMENTATIONS
+# @DESCRIPTION:
+# List of implementations supported by the extension.
+# Some work only for libreoffice and vice versa.
+# Default value is all implementations.
+#
+# Example:
+# @CODE
+# OFFICE_IMPLEMENTATIONS=( "libreoffice" "openoffice" )
+# @CODE
+[[ -z ${OFFICE_IMPLEMENTATIONS} ]] && OFFICE_IMPLEMENTATIONS=( "libreoffice" "openoffice" )
+
+# @ECLASS-VARIABLE: OFFICE_EXTENSIONS
+# @REQUIRED
+# @DESCRIPTION:
+# Array containing list of extensions to install.
+#
+# Example:
+# @CODE
+# OFFICE_EXTENSIONS=( ${PN}_${PV}.oxt )
+# @CODE
+[[ -z ${OFFICE_EXTENSIONS} ]] && die "OFFICE_EXTENSIONS variable is unset."
+if [[ "$(declare -p OFFICE_EXTENSIONS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
+ die "OFFICE_EXTENSIONS variable is not an array."
+fi
+
+# @ECLASS-VARIABLE: OFFICE_EXTENSIONS_LOCATION
+# @DESCRIPTION:
+# Path to the extensions location. Defaults to ${DISTDIR}.
+#
+# Example:
+# @CODE
+# OFFICE_EXTENSIONS_LOCATION="${S}/unpacked/"
+# @CODE
+: ${OFFICE_EXTENSIONS_LOCATION:=${DISTDIR}}
+
+IUSE=""
+RDEPEND=""
+
+for i in ${OFFICE_IMPLEMENTATIONS[@]}; do
+ IUSE+=" office_implementation_${i}"
+ RDEPEND+="
+ office_implementation_${i}? (
+ || (
+ app-office/${i}${OFFICE_REQ_USE}
+ app-office/${i}-bin${OFFICE_REQ_USE}
+ )
+ )
+ "
+done
+
+REQUIRED_USE="|| ( "
+for i in ${OFFICE_IMPLEMENTATIONS[@]}; do
+ REQUIRED_USE+=" office_implementation_${i} "
+done
+REQUIRED_USE+=" )"
+
+DEPEND="${RDEPEND}
+ app-arch/unzip
+"
+
+# Most projects actually do not provide any relevant sourcedir as they are oxt.
+S="${WORKDIR}"
+
+# @FUNCTION: office-ext-r1_src_unpack
+# @DESCRIPTION:
+# Flush the cache after removal of an extension.
+office-ext-r1_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+ local i
+
+ default
+
+ for i in ${OFFICE_EXTENSIONS[@]}; do
+ # Unpack the extensions where required and add case for oxt
+ # which should be most common case for the extensions.
+ if [[ -f "${OFFICE_EXTENSIONS_LOCATION}/${i}" ]] ; then
+ case ${i} in
+ *.oxt)
+ mkdir -p "${WORKDIR}/${i}/"
+ pushd "${WORKDIR}/${i}/" > /dev/null
+ echo ">>> Unpacking "${OFFICE_EXTENSIONS_LOCATION}/${i}" to ${PWD}"
+ unzip -qo ${OFFICE_EXTENSIONS_LOCATION}/${i}
+ assert "failed unpacking ${OFFICE_EXTENSIONS_LOCATION}/${i}"
+ popd > /dev/null
+ ;;
+ *) unpack ${i} ;;
+ esac
+ fi
+ done
+}
+
+# @FUNCTION: office-ext-r1_src_install
+# @DESCRIPTION:
+# Install the extension source to the proper location.
+office-ext-r1_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+ debug-print "Extensions: ${OFFICE_EXTENSIONS[@]}"
+
+ local i j
+
+ for i in ${OFFICE_IMPLEMENTATIONS[@]}; do
+ if use office_implementation_${i}; then
+ if [[ ${i} == openoffice ]]; then
+ # OOO needs to use uno because direct deployment segfaults.
+ # This is bug by their side, but i don't want to waste time
+ # fixing it myself.
+ insinto /usr/$(get_libdir)/${i}/share/extension/install
+ for j in ${OFFICE_EXTENSIONS[@]}; do
+ doins ${OFFICE_EXTENSIONS_LOCATION}/${j}
+ done
+ else
+ for j in ${OFFICE_EXTENSIONS[@]}; do
+ pushd "${WORKDIR}/${j}/" > /dev/null
+ insinto /usr/$(get_libdir)/${i}/share/extensions/${j/.oxt/}
+ doins -r *
+ popd > /dev/null
+ done
+ fi
+ fi
+ done
+}
+
+#### OPENOFFICE COMPAT CODE
+
+UNOPKG_BINARY="/usr/lib64/openoffice/program/unopkg"
+
+# @FUNCTION: office-ext-r1_add_extension
+# @DESCRIPTION:
+# Install the extension into the libreoffice/openoffice.
+office-ext-r1_add_extension() {
+ debug-print-function ${FUNCNAME} "$@"
+ local ext=$1
+ local tmpdir=$(mktemp -d --tmpdir="${T}")
+
+ debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\""
+ ebegin "Adding office extension: \"${ext}\""
+ ${UNOPKG_BINARY} add --suppress-license \
+ --shared "${ext}" \
+ "-env:UserInstallation=file:///${tmpdir}" \
+ "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
+ eend $?
+ ${UNOPKG_BINARY} list --shared > /dev/null
+ rm -rf "${tmpdir}"
+}
+
+# @FUNCTION: office-ext-r1_remove_extension
+# @DESCRIPTION:
+# Remove the extension from the libreoffice/openoffice.
+office-ext-r1_remove_extension() {
+ debug-print-function ${FUNCNAME} "$@"
+ local ext=$1
+ local tmpdir=$(mktemp -d --tmpdir="${T}")
+
+ debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\""
+ ebegin "Removing office extension: \"${ext}\""
+ ${UNOPKG_BINARY} remove --suppress-license \
+ --shared "${ext}" \
+ "-env:UserInstallation=file:///${tmpdir}" \
+ "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
+ eend $?
+ ${UNOPKG_BINARY} list --shared > /dev/null
+ rm -rf "${tmpdir}"
+}
+
+# @FUNCTION: office-ext-r1_pkg_postinst
+# @DESCRIPTION:
+# Add the extensions to the openoffice.
+office-ext-r1_pkg_postinst() {
+ if in_iuse office_implementation_openoffice && use office_implementation_openoffice; then
+ debug-print-function ${FUNCNAME} "$@"
+ debug-print "Extensions: ${OFFICE_EXTENSIONS[@]}"
+ local i
+
+ for i in ${OFFICE_EXTENSIONS[@]}; do
+ office-ext-r1_add_extension "/usr/lib64/openoffice/share/extension/install/${i}"
+ done
+ fi
+}
+
+# @FUNCTION: office-ext-r1_pkg_prerm
+# @DESCRIPTION:
+# Remove the extensions from the openoffice.
+office-ext-r1_pkg_prerm() {
+ if in_iuse office_implementation_openoffice && use office_implementation_openoffice; then
+ debug-print-function ${FUNCNAME} "$@"
+ debug-print "Extensions: ${OFFICE_EXTENSIONS[@]}"
+ local i
+
+ for i in ${OFFICE_EXTENSIONS[@]}; do
+ office-ext-r1_remove_extension "${i}"
+ done
+ fi
+}
+
+EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
+unset OEXT_EXPORTED_FUNCTIONS