gentoo_catmeow_repo/www-client/palemoon-bin/palemoon-bin-33.3.1.ebuild

156 lines
3.5 KiB
Bash
Raw Permalink Normal View History

2024-09-22 18:43:50 -07:00
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MOZ_PV=${PV}
MOZ_PV_SUFFIX=
MOZ_PN="${PN%-bin}"
MOZ_P="${MOZ_PN}-${MOZ_PV}"
MOZ_PV_DISTFILES="${MOZ_PV}${MOZ_PV_SUFFIX}"
MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}"
inherit desktop linux-info optfeature pax-utils xdg
SRC_URI="https://rm-us.palemoon.org/release/${MOZ_PN}-${MOZ_PV}.linux-x86_64-gtk3.tar.xz"
DESCRIPTION="Fork of Firefox"
KEYWORDS="-* amd64"
LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
SLOT=0
IUSE="+alsa +gmp-autoupdate +pulseaudio selinux wayland"
RESTRICT="strip"
BDEPEND="app-arch/unzip"
RDEPEND="${DEPEND}
!www-client/firefox-bin:0
>=app-accessibility/at-spi2-core-2.46.0:2
>=dev-libs/glib-2.26:2
media-libs/alsa-lib
media-libs/fontconfig
>=media-libs/freetype-2.4.10
sys-apps/dbus
virtual/freedesktop-icon-theme
>=x11-libs/cairo-1.10[X]
x11-libs/gdk-pixbuf:2
>=x11-libs/gtk+-3.11:3[X,wayland?]
x11-libs/libX11
x11-libs/libXcomposite
x11-libs/libXcursor
x11-libs/libXdamage
x11-libs/libXext
x11-libs/libXfixes
x11-libs/libXi
x11-libs/libXrandr
x11-libs/libXrender
x11-libs/libxcb
>=x11-libs/pango-1.22.0
alsa? (
!pulseaudio? ( media-sound/apulse )
)
pulseaudio? ( media-libs/libpulse )
selinux? ( sec-policy/selinux-mozilla )
"
QA_PREBUILT="opt/${MOZ_PN}/*"
pkg_setup() {
CONFIG_CHECK="~SECCOMP"
WARNING_SECCOMP="CONFIG_SECCOMP not set! This system will be unable to play DRM-protected content."
linux-info_pkg_setup
}
src_unpack() {
local _lp_dir="${WORKDIR}/language_packs"
local _src_file
mkdir "${S}" || die
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
MY_SRC_FILE=${_src_file}
fi
done
}
src_install() {
# Set MOZILLA_FIVE_HOME
local MOZILLA_FIVE_HOME="/opt/${MOZ_PN}"
dodir /opt
pushd "${ED}"/opt &>/dev/null || die
unpack "${MY_SRC_FILE}"
popd &>/dev/null || die
# Install policy (currently only used to disable application updates)
local icon_srcdir="${ED}/${MOZILLA_FIVE_HOME}/browser/chrome/icons/default"
insinto /usr/share/icons/hicolor/symbolic/apps
local icon size
for icon in "${icon_srcdir}"/default*.png ; do
size=${icon%.png}
size=${size##*/default}
if [[ ${size} -eq 48 ]] ; then
newicon "${icon}" ${PN}.png
fi
newicon -s ${size} "${icon}" ${PN}.png
done
# Install menu
local app_name="Pale Moon (bin)"
local desktop_file="${FILESDIR}/${PN}-r3.desktop"
local desktop_filename="${PN}.desktop"
local icon="${PN}"
local use_wayland="false"
local exec_command="${PN}"
cp "${desktop_file}" "${WORKDIR}/${PN}.desktop-template" || die
# Add apulse support through our wrapper shell launcher, patchelf-method broken since 119.0.
# See bgo#916230
local apulselib=
if use alsa && ! use pulseaudio ; then
apulselib="${EPREFIX}/usr/$(get_libdir)/apulse"
fi
sed -i \
-e "s:@NAME@:${app_name}:" \
-e "s:@EXEC@:${exec_command}:" \
-e "s:@ICON@:${icon}:" \
"${WORKDIR}/${PN}.desktop-template" \
|| die
newmenu "${WORKDIR}/${PN}.desktop-template" "${desktop_filename}"
rm "${WORKDIR}/${PN}.desktop-template" || die
# Install wrapper script
[[ -f "${ED}/usr/bin/${PN}" ]] && rm "${ED}/usr/bin/${PN}"
newbin "${FILESDIR}/${PN}-r1.sh" ${PN}
# Update wrapper
sed -i \
-e "s:@PREFIX@:${EPREFIX}/usr:" \
-e "s:@MOZ_FIVE_HOME@:${EPREFIX}${MOZILLA_FIVE_HOME}:" \
"${ED}/usr/bin/${PN}" \
|| die
}
pkg_postinst() {
xdg_pkg_postinst
}