/[gentoo-x86]/eclass/mozextension.eclass
Gentoo

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Tue May 28 03:29:50 2013 UTC (14 months ago) by anarchy
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +18 -2 lines
Ensure plugins/extensions are in correct place for >=firefox{-bin}-21.0

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/mozextension.eclass,v 1.8 2013/04/05 15:27:40 floppym Exp $
4 #
5 # @ECLASS: mozextension.eclass
6 # @MAINTAINER:
7 # Mozilla team <mozilla@gentoo.org>
8 # @BLURB: Install extensions for use in mozilla products.
9
10
11 inherit eutils
12
13 DEPEND="app-arch/unzip"
14
15 mozversion_extension_location() {
16 case ${PN} in
17 firefox|firefox-bin)
18 if [[ $(get_version_component_range 1) -ge 21 ]] ; then
19 return 0
20 fi
21 ;;
22 esac
23
24 return 1
25 }
26
27 xpi_unpack() {
28 local xpi xpiname srcdir
29
30 # Not gonna use ${A} as we are looking for a specific option being passed to function
31 # You must specify which xpi to use
32 [[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack"
33
34 for xpi in "$@"; do
35 einfo "Unpacking ${xpi} to ${PWD}"
36 xpiname=$(basename ${xpi%.*})
37
38 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
39 srcdir="${DISTDIR}/"
40 fi
41
42 [[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist"
43
44 case "${xpi##*.}" in
45 ZIP|zip|jar|xpi)
46 mkdir "${WORKDIR}/${xpiname}" && \
47 unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
48 ;;
49 *)
50 einfo "unpack ${xpi}: file format not recognized. Ignoring."
51 ;;
52 esac
53 done
54 }
55
56
57 xpi_install() {
58 local emid
59
60 # You must tell xpi_install which xpi to use
61 [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack"
62
63 x="${1}"
64 cd ${x}
65 # determine id for extension
66 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
67 || die "failed to determine extension id"
68 if $(mozversion_extension_location) ; then
69 insinto "${MOZILLA_FIVE_HOME}"/browser/extensions/${emid}
70 else
71 insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
72 fi
73 doins -r "${x}"/* || die "failed to copy extension"
74 }

  ViewVC Help
Powered by ViewVC 1.1.20