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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4 #
5 # @ECLASS: mozextension.eclass
6 # @MAINTAINER:
7 # Mozilla team <mozilla@gentoo.org>
8 # @BLURB: Install extensions for use in mozilla products.
9 #
10 if [[ ! ${_MOZEXTENSION} ]]; then
11
12 # @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
20 inherit eutils
21
22 DEPEND="app-arch/unzip"
23
24 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 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 xpiname=$(basename ${xpi%.*})
46
47 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
48 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 unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
57 ;;
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 cd ${x}
74 # determine id for extension
75 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
76 || die "failed to determine extension id"
77 if [[ -n ${MOZEXTENSION_TARGET} ]]; then
78 insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/}/${emid}
79 elif $(mozversion_extension_location) ; then
80 insinto "${MOZILLA_FIVE_HOME}"/browser/extensions/${emid}
81 else
82 insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
83 fi
84 doins -r "${x}"/* || die "failed to copy extension"
85 }
86
87 _MOZEXTENSION=1
88 fi

  ViewVC Help
Powered by ViewVC 1.1.20