summaryrefslogtreecommitdiff
path: root/recipes/mozilla/firefox-l10n.inc
blob: 31555e3d0d4136990328a6ef1a26a9699ed58b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (C) 2009, O.S. Systems Software Ltda. All Rights Reserved
# Released under the MIT license (see packages/COPYING)

def get_language_name(package):
    lang = package.replace('firefox-l10n-', '')

    if lang.find('-'):
        lang = lang.split('-')
        lang[1] = lang[1].upper()
        lang = '-'.join(lang)

    return lang

DEPENDS = "unzip-native"
RDEPENDS = "firefox"
LANGUAGE = "${@get_language_name('${PN}')}"

SRC_URI = "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${PV}/linux-i686/xpi/${LANGUAGE}.xpi"
S = "${WORKDIR}"

do_configure() {
	unzip -o -q -d ${LANGUAGE} ${LANGUAGE}.xpi
}

INC_PR = "r1"

do_install() {
	cd ${S}/${LANGUAGE}

	# Get extension UUID
	EXTENSION=`cat install.rdf | sed --posix '/em:id=/!d;s/[ ]*em:id="//;s/".*//'`

	mkdir -p ${D}/usr/lib/firefox-${PV}/extensions/${EXTENSION}/chrome
	mkdir -p ${D}/usr/lib/firefox-${PV}/extensions/${EXTENSION}/uninstall
	install -m 644 chrome/*.jar ${D}/usr/lib/firefox-${PV}/extensions/${EXTENSION}/chrome
	install -m 644 install.rdf ${D}/usr/lib/firefox-${PV}/extensions/${EXTENSION}
	install -m 644 chrome.manifest ${D}/usr/lib/firefox-${PV}/extensions/${EXTENSION}

	cat install.rdf \
	   | sed --posix '/<em:locale>/!d' \
	   | sed --posix "s/.*/register      global  locale  ${LANGUAGE}/" \
	   > ${D}/usr/lib/firefox-${PV}/extensions/${EXTENSION}/uninstall/Uninstall
}

FILES_${PN} += "/usr/lib/firefox-${PV}"
PACKAGE_ARCH = "all"