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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations) (download)
Thu Jul 16 16:25:47 2015 UTC (7 weeks ago) by axs
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +17 -3 lines
Update mozilla support eclasses

1 axs 1.10 # Copyright 1999-2015 Gentoo Foundation
2 anarchy 1.1 # Distributed under the terms of the GNU General Public License v2
3 axs 1.10 # $Header: $
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 axs 1.10 #
10     if [[ ! ${_MOZEXTENSION} ]]; then
11 anarchy 1.6
12 axs 1.10 # @ECLASS-VARIABLE: MOZEXTENSION_TARGET
13     # @DESCRIPTION:
14     # This variable allows the installation path for xpi_install
15     # to be overridden from the default app-global extensions path.
16     # Default is empty, which installs to predetermined hard-coded
17     # paths specified in the eclass.
18     : ${MOZEXTENSION_TARGET:=""}
19 anarchy 1.1
20     inherit eutils
21    
22     DEPEND="app-arch/unzip"
23    
24 anarchy 1.9 mozversion_extension_location() {
25     case ${PN} in
26     firefox|firefox-bin)
27     if [[ $(get_version_component_range 1) -ge 21 ]] ; then
28     return 0
29     fi
30     ;;
31     esac
32    
33     return 1
34     }
35    
36 anarchy 1.1 xpi_unpack() {
37     local xpi xpiname srcdir
38    
39     # Not gonna use ${A} as we are looking for a specific option being passed to function
40     # You must specify which xpi to use
41     [[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack"
42    
43     for xpi in "$@"; do
44     einfo "Unpacking ${xpi} to ${PWD}"
45 armin76 1.4 xpiname=$(basename ${xpi%.*})
46 anarchy 1.1
47 armin76 1.4 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
48 anarchy 1.1 srcdir="${DISTDIR}/"
49     fi
50    
51     [[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist"
52    
53     case "${xpi##*.}" in
54     ZIP|zip|jar|xpi)
55     mkdir "${WORKDIR}/${xpiname}" && \
56 fauli 1.7 unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
57 anarchy 1.1 ;;
58     *)
59     einfo "unpack ${xpi}: file format not recognized. Ignoring."
60     ;;
61     esac
62     done
63     }
64    
65    
66     xpi_install() {
67     local emid
68    
69     # You must tell xpi_install which xpi to use
70     [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack"
71    
72     x="${1}"
73 vivo 1.2 cd ${x}
74 anarchy 1.1 # determine id for extension
75 anarchy 1.5 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
76     || die "failed to determine extension id"
77 axs 1.10 if [[ -n ${MOZEXTENSION_TARGET} ]]; then
78     insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/}/${emid}
79     elif $(mozversion_extension_location) ; then
80 anarchy 1.9 insinto "${MOZILLA_FIVE_HOME}"/browser/extensions/${emid}
81     else
82     insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
83     fi
84 anarchy 1.1 doins -r "${x}"/* || die "failed to copy extension"
85     }
86 axs 1.10
87     _MOZEXTENSION=1
88     fi

  ViewVC Help
Powered by ViewVC 1.1.20