# Depends on autoconf213
# Depends on gcc750
# Requires GCC 7.5.0's libgcc in /lib
# Requires 4GB+ RAM

# Exit on error:
set -e

# Be verbose:
set -v

# 8.2MB:
wget https://repo.palemoon.org/MoonchildProductions/Pale-Moon/archive/32.5.1_Release.tar.gz

# 265MB:
wget https://repo.palemoon.org/MoonchildProductions/UXP/archive/RB_20231128.tar.gz

tar xf 32.5.1_Release.tar.gz

tar xf RB_20231128.tar.gz
mv uxp/* pale-moon/platform
mv uxp/.[a-z]* pale-moon/platform
rmdir uxp

cd pale-moon

cat > .mozconfig << EOF
# AUTOCONF 2.13:
export AUTOCONF=/local/bin/autoconf

# GCC 7.5.0:
#export CC=/opt/bin/gcc
#export CXX=/opt/bin/g++

# Clear this if not a 64bit build
#_BUILD_64=1

# Standard build options for Pale Moon
ac_add_options --enable-application=palemoon
ac_add_options --enable-optimize="-O2 -w"
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-devtools
ac_add_options --enable-av1
ac_add_options --enable-jxl
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --with-pthreads

# Is GCONF really useful?
ac_add_options --disable-gconf

# Is Pulseaudio really useful?
ac_add_options --disable-pulseaudio

# Please see https://www.palemoon.org/redist.shtml for restrictions when using the official branding.
ac_add_options --enable-official-branding
export MOZILLA_OFFICIAL=1

ac_add_options --x-libraries=/usr/lib

export MOZ_PKG_SPECIAL=gtk2

# Use python2:
mk_add_options PYTHON=/usr/bin/python2

#mk_add_options AUTOCONF=/usr/bin/autoconf-2.13

EOF

# Building time here: 4h30
./mach build 2>&1 | tee ../mach-build.log

ln -sv /src/palemoon3251/pale-moon/obj-i686-pc-linux-gnu/dist/bin/palemoon /bin/palemoon3251

#./mach run
#./mach package

cd ..

#rm RB_20231128.tar.gz
#rm 32.5.1_Release.tar.gz

exit 0

http://developer.palemoon.org/build/Linux/ as of 20240102

Building Pale Moon: GNU Linux

    At least 6 GB RAM free depending on number of processor cores
    (limit using the
    mk_add_options MOZ_MAKE_FLAGS="-jN"
    option)

GCC Compatibility
Version 	Status 	Notes
13.x 	Experimental Support 	Not widely tested, but should build.
12.x 	Generally Considered Stable 	Mid-term tested. Build issues may still crop up in some environments.
11.x 	Generally Considered Stable 	Mid-term tested. Build issues may still crop up in some environments.
10.x 	Generally Considered Stable 	Mid-term tested. Build issues may still crop up in some environments.
9.x 	Recommended 	Long-term tested. Currently in-use for MCP Applications.
8.x 	Deprecated 	Mid-term tested.
7.x (7.1+) 	Deprecated 	Long-term tested.
<=7.0 	Unsupported 	Used Pre-Unified XUL Platform.
