From 7b9095fd216377fc49d87263cb40460ecebfea41 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Wed, 20 May 2026 18:04:28 +0200 Subject: [PATCH] Port Firefox --- recipes/wip/net/other/nspr/recipe.toml | 2 + recipes/wip/web/firefox/mozconfig | 28 ++++++++++ recipes/wip/web/firefox/recipe.toml | 71 ++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 recipes/wip/web/firefox/mozconfig create mode 100644 recipes/wip/web/firefox/recipe.toml diff --git a/recipes/wip/net/other/nspr/recipe.toml b/recipes/wip/net/other/nspr/recipe.toml index 361c6c93..c99dbaa3 100644 --- a/recipes/wip/net/other/nspr/recipe.toml +++ b/recipes/wip/net/other/nspr/recipe.toml @@ -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" diff --git a/recipes/wip/web/firefox/mozconfig b/recipes/wip/web/firefox/mozconfig new file mode 100644 index 00000000..ec8380b1 --- /dev/null +++ b/recipes/wip/web/firefox/mozconfig @@ -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" diff --git a/recipes/wip/web/firefox/recipe.toml b/recipes/wip/web/firefox/recipe.toml new file mode 100644 index 00000000..80bbce3e --- /dev/null +++ b/recipes/wip/web/firefox/recipe.toml @@ -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 +"""