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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Tue May 28 03:29:50 2013 UTC (13 months, 4 weeks 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 floppym 1.8 # Copyright 1999-2013 Gentoo Foundation
2 anarchy 1.1 # Distributed under the terms of the GNU General Public License v2
3 anarchy 1.9 # $Header: /var/cvsroot/gentoo-x86/eclass/mozextension.eclass,v 1.8 2013/04/05 15:27:40 floppym Exp $
4 anarchy 1.1 #
5 anarchy 1.6 # @ECLASS: mozextension.eclass
6     # @MAINTAINER:
7     # Mozilla team <mozilla@gentoo.org>
8 floppym 1.8 # @BLURB: Install extensions for use in mozilla products.
9 anarchy 1.6
10 anarchy 1.1
11     inherit eutils
12    
13     DEPEND="app-arch/unzip"
14    
15 anarchy 1.9 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 anarchy 1.1 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 armin76 1.4 xpiname=$(basename ${xpi%.*})
37 anarchy 1.1
38 armin76 1.4 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
39 anarchy 1.1 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 fauli 1.7 unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
48 anarchy 1.1 ;;
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 vivo 1.2 cd ${x}
65 anarchy 1.1 # determine id for extension
66 anarchy 1.5 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
67     || die "failed to determine extension id"
68 anarchy 1.9 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 anarchy 1.1 doins -r "${x}"/* || die "failed to copy extension"
74     }

  ViewVC Help
Powered by ViewVC 1.1.20