blob: d0506fb86ca3d5065d1708da09eccec9470f4cb9 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MOZ_ESR=
MOZ_PV=${PV}
MOZ_PV_SUFFIX=
if [[ ${PV} =~ (_(alpha|beta|rc).*)$ ]] ; then
MOZ_PV_SUFFIX=${BASH_REMATCH[1]}
# Convert the ebuild version to the upstream Mozilla version
MOZ_PV="${MOZ_PV/_alpha/a}" # Handle alpha for SRC_URI
MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
MOZ_PV="${MOZ_PV%%_rc*}" # Handle rc for SRC_URI
fi
if [[ -n ${MOZ_ESR} ]] ; then
# ESR releases have slightly different version numbers
MOZ_PV="${MOZ_PV}esr"
HOMEPAGE="https://www.firefox.com https://www.firefox.com/enterprise/"
else
HOMEPAGE="https://www.firefox.com"
fi
MOZ_PN="${PN%-l10n}"
MOZ_P="${MOZ_PN}-${MOZ_PV}"
MOZ_PV_DISTFILES="${MOZ_PV}${MOZ_PV_SUFFIX}"
MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}"
MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/releases/${MOZ_PV}"
DESCRIPTION="Firefox Web Browser's translation files"
LICENSE="MPL-2.0"
KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86"
if [[ -n ${MOZ_ESR} ]] ; then
SLOT="0/esr"
else
SLOT="0/rapid"
fi
# 149.0 is when the firefox-l10n was introduced.
RDEPEND="!<www-client/firefox-149.0"
BDEPEND="app-arch/unzip"
S="${WORKDIR}"
MOZ_LANGS=(
af ar ast be bg br ca cak cs cy da de dsb el en-CA en-GB
en-US es-AR es-ES et eu fi fr fy-NL ga-IE gd gl he hr hsb hu id
is it ja ka kab kk ko lt lv ms nb-NO nl nn-NO pa-IN pl pt-BR
pt-PT rm ro ru sk sl sq sr sv-SE th tr uk uz vi zh-CN zh-TW
)
# Firefox-only LANGS
MOZ_LANGS+=( ach )
MOZ_LANGS+=( an )
MOZ_LANGS+=( az )
MOZ_LANGS+=( bn )
MOZ_LANGS+=( bs )
MOZ_LANGS+=( ca-valencia )
MOZ_LANGS+=( eo )
MOZ_LANGS+=( es-CL )
MOZ_LANGS+=( es-MX )
MOZ_LANGS+=( fa )
MOZ_LANGS+=( ff )
MOZ_LANGS+=( fur )
MOZ_LANGS+=( gn )
MOZ_LANGS+=( gu-IN )
MOZ_LANGS+=( hi-IN )
MOZ_LANGS+=( hy-AM )
MOZ_LANGS+=( ia )
MOZ_LANGS+=( km )
MOZ_LANGS+=( kn )
MOZ_LANGS+=( lij )
MOZ_LANGS+=( mk )
MOZ_LANGS+=( mr )
MOZ_LANGS+=( my )
MOZ_LANGS+=( ne-NP )
MOZ_LANGS+=( oc )
MOZ_LANGS+=( sc )
MOZ_LANGS+=( sco )
MOZ_LANGS+=( si )
MOZ_LANGS+=( skr )
MOZ_LANGS+=( son )
MOZ_LANGS+=( szl )
MOZ_LANGS+=( ta )
MOZ_LANGS+=( te )
MOZ_LANGS+=( tl )
MOZ_LANGS+=( trs )
MOZ_LANGS+=( ur )
MOZ_LANGS+=( xh )
mozilla_set_globals() {
# https://bugs.gentoo.org/587334
local MOZ_TOO_REGIONALIZED_FOR_L10N=(
fy-NL ga-IE gu-IN hi-IN hy-AM nb-NO ne-NP nn-NO pa-IN sv-SE
)
local lang xflag
for lang in "${MOZ_LANGS[@]}" ; do
# en and en_US are handled internally
if [[ ${lang} == en ]] || [[ ${lang} == en-US ]] ; then
continue
fi
# strip region subtag if $lang is in the list
if has ${lang} "${MOZ_TOO_REGIONALIZED_FOR_L10N[@]}" ; then
xflag=${lang%%-*}
else
xflag=${lang}
fi
SRC_URI+=" l10n_${xflag/[_@]/-}? ("
SRC_URI+=" ${MOZ_SRC_BASE_URI}/linux-x86_64/xpi/${lang}.xpi -> ${MOZ_P_DISTFILES}-${lang}.xpi"
SRC_URI+=" )"
IUSE+=" l10n_${xflag/[_@]/-}"
done
}
mozilla_set_globals
moz_install_xpi() {
debug-print-function ${FUNCNAME} "$@"
if [[ ${#} -lt 2 ]] ; then
die "${FUNCNAME} requires at least two arguments"
fi
local DESTDIR=${1}
shift
insinto "${DESTDIR}"
local emid xpi_file xpi_tmp_dir
for xpi_file in "${@}" ; do
emid=
xpi_tmp_dir=$(mktemp -d --tmpdir="${T}")
# Unpack XPI
unzip -qq "${xpi_file}" -d "${xpi_tmp_dir}" || die
# Determine extension ID
if [[ -f "${xpi_tmp_dir}/install.rdf" ]] ; then
emid=$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${xpi_tmp_dir}/install.rdf")
[[ -z "${emid}" ]] && die "failed to determine extension id from install.rdf"
elif [[ -f "${xpi_tmp_dir}/manifest.json" ]] ; then
emid=$(sed -n -e 's/.*"id": "\([^"]*\)".*/\1/p' "${xpi_tmp_dir}/manifest.json")
[[ -z "${emid}" ]] && die "failed to determine extension id from manifest.json"
else
die "failed to determine extension id"
fi
einfo "Installing ${emid}.xpi into ${ED}${DESTDIR} ..."
newins "${xpi_file}" "${emid}.xpi"
done
}
src_unpack() {
local _lp_dir="${WORKDIR}/language_packs"
local _src_file
if [[ ! -d "${_lp_dir}" ]] ; then
mkdir "${_lp_dir}" || die
fi
for _src_file in ${A} ; do
if [[ ${_src_file} == *.xpi ]]; then
cp "${DISTDIR}/${_src_file}" "${_lp_dir}" || die "Failed to copy '${_src_file}' to '${_lp_dir}'!"
else
unpack ${_src_file}
fi
done
}
src_install() {
export MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${MOZ_PN}"
# Install language packs
local langpacks=( $(find "${WORKDIR}/language_packs" -type f -name '*.xpi') )
if [[ -n "${langpacks}" ]] ; then
moz_install_xpi "${MOZILLA_FIVE_HOME}/distribution/extensions" "${langpacks[@]}"
fi
}
|