tce-load -i compiletc clang python3.11-setuptools readline-dev cbindgen icu78-dev perl5

wget https://archive.mozilla.org/pub/firefox/releases/140.9.0esr/source/firefox-140.9.0esr.source.tar.xz

cd firefox-140.9.0

mkdir obj
cd obj

CC="gcc -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe" CXX="g++ -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe -fno-exceptions -fno-rtti" ../js/src/configure --prefix=/usr/local --disable-debug-symbols --disable-jemalloc --enable-readline --enable-rust-simd --with-intl-api --with-system-icu --with-system-zlib --enable-lto=full

[-flto fails]

find . -name autoconf.mk -type f -exec sed -i 's/-O3//g' {} \;
find . -name backend.mk -type f -exec sed -i 's/-O3//g' {} \;
find . -name autoconf.mk -type f -exec sed -i 's/FLAGS = -g/FLAGS = /g' {} \;
find . -name autoconf.mk -type f -exec sed -i 's/ -g//g' {} \;
find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \;

make [43m 33.92s]
sudo make install

sudo rm -v /usr/local/lib/libjs_static.ajs
sudo sed -i '/@NSPR_CFLAGS@/d' /usr/local/bin/js140-config
sudo sed '$i#define XP_UNIX' -i /usr/local/include/mozjs-140/js-config.h
