From 5b8d176d7acdbc92c2031573c3c97b232d628140 Mon Sep 17 00:00:00 2001 From: freetolga Date: Tue, 15 Apr 2025 10:40:00 +0300 Subject: [PATCH 1/4] duplicate palemoon-33.7.0-r1.ebuild --- www-client/palemoon/palemoon-33.7.0-r1.ebuild | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 www-client/palemoon/palemoon-33.7.0-r1.ebuild diff --git a/www-client/palemoon/palemoon-33.7.0-r1.ebuild b/www-client/palemoon/palemoon-33.7.0-r1.ebuild new file mode 100644 index 0000000..2c00dae --- /dev/null +++ b/www-client/palemoon/palemoon-33.7.0-r1.ebuild @@ -0,0 +1,224 @@ +EAPI=8 + +REQUIRED_BUILDSPACE='16G' +# Check https://developer.palemoon.org/build/linux/ for supported versions +GCC_SUPPORTED_VERSIONS="7.5 8.5 9.3 9.4 10.3 11.3 12.2 12.3 13.2 13.3 14.1 14.2" + +inherit palemoon-5 git-r3 flag-o-matic pax-utils xdg + +DESCRIPTION="Pale Moon Web Browser" +HOMEPAGE="https://www.palemoon.org/" +LICENSE="MPL-2.0 GPL-2 LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE=" + +official-branding + +optimize + cpu_flags_x86_avx + cpu_flags_x86_sse + cpu_flags_x86_sse2 + threads + debug + +jemalloc + valgrind + dbus + necko-wifi + gtk2 + gtk3 + pulseaudio + +devtools + +av1 + +jpegxl +" + +EGIT_REPO_URI="https://repo.palemoon.org/MoonchildProductions/Pale-Moon.git" +EGIT_COMMIT="${PV}_Release" + +DEPEND=" + dev-lang/python:2.7 + >=dev-lang/perl-5.6 + dev-lang/yasm +" + +RDEPEND=" + x11-libs/libXt + app-arch/zip + media-libs/freetype + media-libs/fontconfig + + valgrind? ( dev-debug/valgrind ) + + dbus? ( + >=sys-apps/dbus-0.60 + >=dev-libs/dbus-glib-0.60 + ) + + gtk2? ( >=x11-libs/gtk+-2.18.0:2 ) + gtk3? ( >=x11-libs/gtk+-3.4.0:3 ) + + media-libs/alsa-lib + pulseaudio? ( media-libs/libpulse ) + + media-video/ffmpeg[x264] + + necko-wifi? ( net-wireless/wireless-tools ) +" + +REQUIRED_USE=" + optimize? ( !debug ) + jemalloc? ( !valgrind ) + ^^ ( gtk2 gtk3 ) + necko-wifi? ( dbus ) +" + +src_prepare() { + # Ensure that our plugins dir is enabled by default: + sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \ + "${S}/platform/xpcom/io/nsAppFileLocationProvider.cpp" \ + || die "sed failed to replace plugin path for 32bit!" + sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \ + "${S}/platform/xpcom/io/nsAppFileLocationProvider.cpp" \ + || die "sed failed to replace plugin path for 64bit!" + + default +} + +src_configure() { + # Basic configuration: + mozconfig_init + + mozconfig_disable updater install-strip accessibility gconf gold + + if use official-branding; then + official-branding_warning + mozconfig_enable official-branding + fi + + if use optimize; then + O='-O2' + if use cpu_flags_x86_avx; then + O="${O} -mavx" + fi + if use cpu_flags_x86_sse && use cpu_flags_x86_sse2; then + O="${O} -msse2 -mfpmath=sse" + fi + mozconfig_enable "optimize=\"${O}\"" + filter-flags '-O*' '-mavx' '-msse2' '-mfpmath=sse' + else + mozconfig_disable optimize + fi + + if use threads; then + mozconfig_with pthreads + fi + + if use debug; then + mozconfig_var MOZ_DEBUG_SYMBOLS 1 + mozconfig_enable "debug-symbols=\"-gdwarf-2\"" + fi + + if use jemalloc; then + mozconfig_enable jemalloc + fi + + if use valgrind; then + mozconfig_enable valgrind + fi + + if ! use dbus; then + mozconfig_disable dbus + fi + + if use gtk2; then + mozconfig_enable default-toolkit=\"cairo-gtk2\" + fi + + if use gtk3; then + mozconfig_enable default-toolkit=\"cairo-gtk3\" + fi + + if ! use necko-wifi; then + mozconfig_disable necko-wifi + fi + + if ! use pulseaudio; then + mozconfig_disable pulseaudio + fi + + if use devtools; then + mozconfig_enable devtools + fi + + if use av1; then + mozconfig_enable av1 + fi + + if use jpegxl; then + mozconfig_enable jxl + fi + + # Enabling this causes xpcshell to hang during the packaging process, + # so disabling it until the cause can be tracked down. It most likely + # has something to do with the sandbox since the issue goes away when + # building with FEATURES="-sandbox -usersandbox". + mozconfig_disable precompiled-startupcache + + # Mainly to prevent system's NSS/NSPR from taking precedence over + # the built-in ones: + append-ldflags -Wl,-rpath="${EPREFIX}/usr/$(get_libdir)/palemoon" + + export MOZBUILD_STATE_PATH="${WORKDIR}/mach_state" + mozconfig_var PYTHON $(which python2) + mozconfig_var MOZ_MAKE_FLAGS "\"${MAKEOPTS}\"" + + # Shorten obj dir to limit some errors linked to the path size hitting + # a kernel limit (127 chars): + mozconfig_var MOZ_OBJDIR "@TOPSRCDIR@/o" + + # Disable mach notifications, which also cause sandbox access violations: + export MOZ_NOSPAM=1 +} + +src_compile() { + # Prevents portage from setting its own XARGS which messes with the + # Pale Moon build system checks: + # See: https://gitweb.gentoo.org/proj/portage.git/tree/bin/isolated-functions.sh + export XARGS="$(which xargs)" + + python2 "${S}/platform/mach" build || die +} + +src_install() { + # obj_dir changes depending on arch, compiler, etc: + local obj_dir="$(echo */config.log)" + obj_dir="${obj_dir%/*}" + + # Disable MPROTECT for startup cache creation: + pax-mark m "${obj_dir}"/dist/bin/xpcshell + + # Set the backspace behaviour to be consistent with the other platforms: + set_pref "browser.backspace_action" 0 + + # Gotta create the package, unpack it and manually install the files + # from there not to miss anything (e.g. the statusbar extension): + einfo "Creating the package..." + python2 "${S}/platform/mach" mozpackage || die + local extracted_dir="${T}/package" + mkdir -p "${extracted_dir}" + cd "${extracted_dir}" || die + einfo "Extracting the package..." + tar xjpf "${S}/${obj_dir}/dist/${P}.linux-${CTARGET_default%%-*}.tar.bz2" || die + einfo "Installing the package..." + local dest_libdir="/usr/$(get_libdir)" + mkdir -p "${D}/${dest_libdir}" + cp -rL "${PN}" "${D}/${dest_libdir}" || die + dosym "${dest_libdir}/${PN}/${PN}" "/usr/bin/${PN}" + einfo "Done installing the package." + + # Until JIT-less builds are supported, + # also disable MPROTECT on the main executable: + pax-mark m "${D}/${dest_libdir}/${PN}/"{palemoon,palemoon-bin,plugin-container} + + # Install icons and .desktop for menu entry: + install_branding_files +} From 504ee01cfbdf438796e78604c09d4e2737bb35c0 Mon Sep 17 00:00:00 2001 From: freetolga Date: Tue, 15 Apr 2025 10:47:49 +0300 Subject: [PATCH 2/4] enable pthreads by default * from https://developer.palemoon.org/build/linux/ --- www-client/palemoon/palemoon-33.7.0-r1.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www-client/palemoon/palemoon-33.7.0-r1.ebuild b/www-client/palemoon/palemoon-33.7.0-r1.ebuild index 2c00dae..5429dc2 100644 --- a/www-client/palemoon/palemoon-33.7.0-r1.ebuild +++ b/www-client/palemoon/palemoon-33.7.0-r1.ebuild @@ -17,7 +17,7 @@ IUSE=" cpu_flags_x86_avx cpu_flags_x86_sse cpu_flags_x86_sse2 - threads + +threads debug +jemalloc valgrind From 86623c76eec75b573a5e2f35b5a5355fb2a53ca8 Mon Sep 17 00:00:00 2001 From: freetolga Date: Tue, 15 Apr 2025 10:41:22 +0300 Subject: [PATCH 3/4] filter lto flags from make.conf * from https://wiki.gentoo.org/wiki/LTO --- www-client/palemoon/palemoon-33.7.0-r1.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www-client/palemoon/palemoon-33.7.0-r1.ebuild b/www-client/palemoon/palemoon-33.7.0-r1.ebuild index 5429dc2..6f20698 100644 --- a/www-client/palemoon/palemoon-33.7.0-r1.ebuild +++ b/www-client/palemoon/palemoon-33.7.0-r1.ebuild @@ -103,7 +103,7 @@ src_configure() { O="${O} -msse2 -mfpmath=sse" fi mozconfig_enable "optimize=\"${O}\"" - filter-flags '-O*' '-mavx' '-msse2' '-mfpmath=sse' + filter-flags '-O*' '-mavx' '-msse2' '-mfpmath=sse' '-flto*' '-Werror*' else mozconfig_disable optimize fi From 26e27095d2b4f3fea87fc94b90155e24414c8011 Mon Sep 17 00:00:00 2001 From: freetolga Date: Tue, 15 Apr 2025 10:43:05 +0300 Subject: [PATCH 4/4] make mach build verbose --- www-client/palemoon/palemoon-33.7.0-r1.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www-client/palemoon/palemoon-33.7.0-r1.ebuild b/www-client/palemoon/palemoon-33.7.0-r1.ebuild index 6f20698..dd23c7f 100644 --- a/www-client/palemoon/palemoon-33.7.0-r1.ebuild +++ b/www-client/palemoon/palemoon-33.7.0-r1.ebuild @@ -185,7 +185,7 @@ src_compile() { # See: https://gitweb.gentoo.org/proj/portage.git/tree/bin/isolated-functions.sh export XARGS="$(which xargs)" - python2 "${S}/platform/mach" build || die + python2 "${S}/platform/mach" build --verbose || die } src_install() {