/[gentoo-x86]/eclass/office-ext.eclass
Gentoo

Contents of /eclass/office-ext.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Mon May 12 11:53:28 2014 UTC (3 months, 3 weeks ago) by kensington
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +1 -1 lines
FILE REMOVED
Remove last-rited eclasses.

1 scarabeus 1.8 # Copyright 1999-2013 Gentoo Foundation
2 scarabeus 1.1 # Distributed under the terms of the GNU General Public License v2
3 kensington 1.9 # $Header: /var/cvsroot/gentoo-x86/eclass/office-ext.eclass,v 1.8 2013/05/17 11:27:25 scarabeus Exp $
4 scarabeus 1.1
5 scarabeus 1.8 # @DEAD
6 scarabeus 1.1 # @ECLASS: office-ext.eclass
7 vapier 1.6 # @MAINTAINER:
8     # The office team <openoffice@gentoo.org>
9 scarabeus 1.1 # @AUTHOR:
10     # Tomáš Chvátal <scarabeus@gentoo.org>
11     # @BLURB: Eclass for installing libreoffice/openoffice extensions
12     # @DESCRIPTION:
13     # Eclass for easing maitenance of libreoffice/openoffice extensions.
14    
15     case "${EAPI:-0}" in
16 axs 1.7 4|5) OEXT_EXPORTED_FUNCTIONS="src_unpack src_install pkg_postinst pkg_prerm" ;;
17 scarabeus 1.1 *) die "EAPI=${EAPI} is not supported" ;;
18     esac
19    
20     inherit eutils multilib
21    
22     UNOPKG_BINARY="${EPREFIX}/usr/bin/unopkg"
23    
24     # @ECLASS-VARIABLE: OO_EXTENSIONS
25     # @REQUIRED
26     # @DESCRIPTION:
27     # Array containing list of extensions to install.
28     [[ -z ${OO_EXTENSIONS} ]] && die "OO_EXTENSIONS variable is unset."
29     if [[ "$(declare -p OO_EXTENSIONS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
30     die "OO_EXTENSIONS variable is not an array."
31     fi
32    
33     DEPEND="virtual/ooo"
34     RDEPEND="virtual/ooo"
35    
36 scarabeus 1.3 # Most projects actually do not provide any workdir and we do not unpack the
37     # .oxt file at all.
38     S="${WORKDIR}"
39    
40     # @FUNCTION: office-ext_src_unpack
41     # @DESCRIPTION:
42     # Flush the cache after removal of an extension.
43     office-ext_src_unpack() {
44     debug-print-function ${FUNCNAME} "$@"
45     local i
46    
47     default
48    
49     for i in ${OO_EXTENSIONS[@]}; do
50 scarabeus 1.4 # Copy only if the oxt is present, sometimes they are in tarballs
51     # so we want to fail only when we do need to do the cp.
52     if [[ -f "${DISTDIR}/${i}" ]] ; then
53     debug-print "${FUNCNAME}: cp -v \"${DISTDIR}/${i}\" \"${S}\""
54     cp -v "${DISTDIR}/${i}" "${S}" || die
55     fi
56 scarabeus 1.3 done
57     }
58    
59 scarabeus 1.1 # @FUNCTION: office-ext_flush_unopkg_cache
60     # @DESCRIPTION:
61     # Flush the cache after removal of an extension.
62     office-ext_flush_unopkg_cache() {
63     debug-print-function ${FUNCNAME} "$@"
64    
65     debug-print "${FUNCNAME}: ${UNOPKG_BINARY} list --shared > /dev/null"
66     ${UNOPKG_BINARY} list --shared > /dev/null
67     }
68    
69     # @FUNCTION: office-ext_get_implementation
70     # @DESCRIPTION:
71     # Determine the implementation we are building against.
72     office-ext_get_implementation() {
73     debug-print-function ${FUNCNAME} "$@"
74     local implementations=(
75     "libreoffice"
76     "openoffice"
77     )
78     local i
79    
80     for i in "${implementations[@]}"; do
81     if [[ -d "${EPREFIX}/usr/$(get_libdir)/${i}" ]]; then
82     debug-print "${FUNCNAME}: Determined implementation is: \"${EPREFIX}/usr/$(get_libdir)/${i}\""
83     echo "${EPREFIX}/usr/$(get_libdir)/${i}"
84     return
85     fi
86     done
87    
88     die "Unable to determine libreoffice/openoffice implementation!"
89     }
90    
91     # @FUNCTION: office-ext_add_extension
92     # @DESCRIPTION:
93     # Install the extension into the libreoffice/openoffice.
94     office-ext_add_extension() {
95     debug-print-function ${FUNCNAME} "$@"
96     local ext=$1
97     local tmpdir=$(mktemp -d --tmpdir="${T}")
98    
99     debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\""
100 scarabeus 1.2 ebegin "Adding office extension: \"${ext}\""
101 scarabeus 1.5 ${UNOPKG_BINARY} add --suppress-license \
102     --shared "${ext}" \
103 scarabeus 1.1 "-env:UserInstallation=file:///${tmpdir}" \
104     "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
105     eend $?
106     rm -rf "${tmpdir}"
107     }
108    
109     # @FUNCTION: office-ext_remove_extension
110     # @DESCRIPTION:
111     # Remove the extension from the libreoffice/openoffice.
112     office-ext_remove_extension() {
113     debug-print-function ${FUNCNAME} "$@"
114     local ext=$1
115     local tmpdir=$(mktemp -d --tmpdir="${T}")
116    
117     debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\""
118 scarabeus 1.2 ebegin "Removing office extension: \"${ext}\""
119 scarabeus 1.5 ${UNOPKG_BINARY} remove --suppress-license \
120     --shared "${ext}" \
121 scarabeus 1.1 "-env:UserInstallation=file:///${tmpdir}" \
122     "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
123     eend $?
124 scarabeus 1.2 office-ext_flush_unopkg_cache
125 scarabeus 1.1 rm -rf "${tmpdir}"
126     }
127    
128     # @FUNCTION: office-ext_src_install
129     # @DESCRIPTION:
130     # Install the extension source to the proper location.
131     office-ext_src_install() {
132     debug-print-function ${FUNCNAME} "$@"
133 scarabeus 1.2 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
134 scarabeus 1.1 local i
135    
136     # subshell to not pollute rest of the env with the insinto redefinition
137     (
138 scarabeus 1.2 dodir $(office-ext_get_implementation)/share/extension/install/
139     insinto $(office-ext_get_implementation)/share/extension/install/
140     for i in ${OO_EXTENSIONS[@]}; do
141 scarabeus 1.1 doins "${i}"
142     done
143     )
144    
145     einfo "Remember that if you replace your office implementation,"
146     einfo "you need to recompile all the extensions."
147     einfo "Your current implementation location is: "
148 scarabeus 1.2 einfo " $(office-ext_get_implementation)"
149 scarabeus 1.1 }
150    
151     # @FUNCTION: office-ext_pkg_postinst
152     # @DESCRIPTION:
153     # Add the extensions to the libreoffice/openoffice.
154     office-ext_pkg_postinst() {
155     debug-print-function ${FUNCNAME} "$@"
156 scarabeus 1.2 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
157 scarabeus 1.1 local i
158    
159 scarabeus 1.2 for i in ${OO_EXTENSIONS[@]}; do
160     office-ext_add_extension "$(office-ext_get_implementation)/share/extension/install/${i}"
161 scarabeus 1.1 done
162    
163     }
164    
165     # @FUNCTION: office-ext_pkg_prerm
166     # @DESCRIPTION:
167     # Remove the extensions from the libreoffice/openoffice.
168     office-ext_pkg_prerm() {
169     debug-print-function ${FUNCNAME} "$@"
170 scarabeus 1.2 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
171 scarabeus 1.1 local i
172    
173 scarabeus 1.2 for i in ${OO_EXTENSIONS[@]}; do
174     office-ext_remove_extension "${i}"
175 scarabeus 1.1 done
176     }
177 scarabeus 1.2
178     EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
179     unset OEXT_EXPORTED_FUNCTIONS

  ViewVC Help
Powered by ViewVC 1.1.20