# 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" SLOT="0" KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86" # 149.0 is when the firefox-l10n was introduced. RDEPEND="!]\([^\"<>]*\)[\"<].*/\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 }