Port Firefox

This commit is contained in:
Wildan M 2026-05-20 18:04:28 +02:00
parent 8a28ce8da2
commit 7b9095fd21
3 changed files with 101 additions and 0 deletions

View File

@ -18,6 +18,8 @@ COOKBOOK_CONFIGURE_FLAGS+=(
--enable-64bit
--with-pthreads
ac_cv_path_LD="$LD"
ac_cv_func_secure_getenv=no
ac_cv_func___secure_getenv=no
)
COOKBOOK_MAKE_JOBS=1
COOKBOOK_CONFIGURE="$COOKBOOK_SOURCE/mozjs-sys/mozjs/nsprpub/configure"

View File

@ -0,0 +1,28 @@
mk_add_options MOZ_OBJDIR=COOKBOOK_BUILD
mk_add_options MOZ_PARALLEL_BUILD=NPROC
ac_add_options --target=TARGET
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --disable-audio-backends
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-dbus
ac_add_options --disable-profiling
ac_add_options --disable-dmd # dark matter detector
ac_add_options --without-wasm-sandboxed-libraries # need clang wasi
# TODO: cairo-gtk3-x11-wayland or separate cairo-gtk3-wayland-only
ac_add_options --enable-default-toolkit=cairo-gtk3-x11-only
ac_add_options --enable-bootstrap=-clang # only use our clang
ac_add_options --disable-release # todo enable later
ac_add_options --with-system-nspr
ac_add_options --disable-jit # todo verify mcontext work and patch
ac_add_options --disable-hardening
ac_add_options --disable-tests
export MOZ_REQUIRE_SIGNING=
export MOZ_TELEMETRY_REPORTING=
export HOST_CC="sccache gcc"
export HOST_CXX="sccache g++"
export CC="TARGET_CC"
export CXX="TARGET_CXX"

View File

@ -0,0 +1,71 @@
#TODO compiled, need testing
# mach: https://firefox-source-docs.mozilla.org/setup/linux_build.html
# dependencies: https://packages.gentoo.org/packages/www-client/firefox/dependencies
# feature flags: https://wiki.gentoo.org/wiki/Firefox#USE_flags
[source]
git = "https://github.com/willnode/firefox"
branch = "redox-150"
shallow_clone = true
[build]
template = "custom"
dependencies = [
# "fontconfig",
# "atk",
# "cairo",
"dbus",
# "libffi",
# "freetype2",
# "gdk-pixbuf",
# "glib",
"gtk3",
"pango",
"libxkbcommon-x11",
"libice",
"mesa-x11",
"x11proto-kb",
"xcb-proto",
"xextproto",
"nspr",
"libxrandr",
"libsm",
# TODO: Should separate clang library and runtime
"clang21"
# "sqlite3",
# "nss-nspr",
# "startup-notification",
# "zlib",
# "ffmpeg6",
# "expat",
# "libepoxy",
# "pipewire",
]
script = """
DYNAMIC_INIT
cat ${COOKBOOK_RECIPE}/mozconfig > mozconfig
sed -i "s|COOKBOOK_BUILD|${COOKBOOK_BUILD}|g" mozconfig
sed -i "s|TARGET_CC|${CC}|g" mozconfig
sed -i "s|TARGET_CXX|${CXX}|g" mozconfig
sed -i "s|TARGET|${TARGET}|g" mozconfig
sed -i "s|NPROC|${COOKBOOK_MAKE_JOBS}|g" mozconfig
export MOZCONFIG="${COOKBOOK_BUILD}/mozconfig"
export PYTHONDONTWRITEBYTECODE=1
unset CC_WRAPPER
if [[ -z "$CI" ]]; then export MACH_NO_TERMINAL_FOOTER=1; fi;
# clang-sys specifics
PREFIX_INCLUDE="$COOKBOOK_HOST_SYSROOT/$TARGET/include"
export CLANGFLAGS="-I $PREFIX_INCLUDE/c++/13.2.0 -I $PREFIX_INCLUDE/c++/13.2.0/$TARGET -I $PREFIX_INCLUDE/c++/13.2.0/backward"
export CLANGFLAGS="$CLANGFLAGS -I $PREFIX_INCLUDE -I $COOKBOOK_SYSROOT/lib/clang/21/include -D__redox__"
export BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_redox="-target x86_64-unknown-redox -nostdinc $CLANGFLAGS"
export LLVM_CONFIG_PATH="$COOKBOOK_TOOLCHAIN/bin/llvm-config"
# Don't poison the stage1 compiler (host -> host)
unset AR AS CC CXX LD NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP
(cd ${COOKBOOK_SOURCE} && ./mach build -v)
(cd ${COOKBOOK_SOURCE} && ./mach package)
mkdir -p ${COOKBOOK_STAGE}/usr/lib/firefox ${COOKBOOK_STAGE}/usr/bin
rsync -a ./dist/firefox/ ${COOKBOOK_STAGE}/usr/lib/firefox/
ln -s ../lib/firefox/firefox ${COOKBOOK_STAGE}/usr/bin/firefox
"""