From 63ccf1eeca81f099f73d64f961d04a60a8aa89d1 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 30 Aug 2026 09:20:53 +0100 Subject: [PATCH 1/1] www/librewolf: Patch mozconfig directly We currently maintain files/mozconfig-openbsd, which means that upstream mozconfig changes must be synced manually. With this change, we can just update mozconfig using: make update-patches (or manually) This reduces the probability that mozconfig-openbsd goes out of sync with upstream, thereby somewhat automating the maintenance process. We still need to configure it at build time. It is important that stale variables do not persist on re-builds, or that variables are not repeated. Therefore, a copy is created of the mozconfig on first build, and restored on subsequent builds subject to build-time configuration. This causes no behavioural change. It is being done to make maintenance easier. One other, more minor change: MOZILLA_PROJECT is no longer used in mozconfig. This is part of a general effort, as shown by this patch, to simplify the maintenance of LibreWolf in OpenBSD. Signed-off-by: Leah Rowe --- www/librewolf/Makefile | 11 +++- www/librewolf/files/mozconfig-openbsd | 81 --------------------------- www/librewolf/patches/patch-mozconfig | 68 ++++++++++++++++++++++ 3 files changed, 76 insertions(+), 84 deletions(-) delete mode 100644 www/librewolf/files/mozconfig-openbsd create mode 100644 www/librewolf/patches/patch-mozconfig diff --git a/www/librewolf/Makefile b/www/librewolf/Makefile index 7ad98e9ae31..55a7bad687b 100644 --- a/www/librewolf/Makefile +++ b/www/librewolf/Makefile @@ -15,7 +15,7 @@ ONLY_FOR_ARCHS = amd64 aarch64 riscv64 # librewolf-149.0.2-2 (upstream) becomes librewolf-149.0.2pl2 (patch level 2) MOZILLA_DIST_VERSION = 154.0.1-3 MOZILLA_VERSION = ${MOZILLA_DIST_VERSION:C/-([0-9]+)$/pl\1/} -REVISION = 0 +REVISION = 1 MOZILLA_PROJECT = librewolf MOZILLA_CODENAME = browser @@ -127,9 +127,14 @@ do-test: ./mach xpcshell-test --sequential --keep-going MOZCONFIG = ${WRKSRC}/mozconfig +MOZCONFIG_ORIG = ${WRKSRC}/mozconfig.obsd pre-configure: - cp "${FILESDIR}/mozconfig-openbsd" "${MOZCONFIG}" - sed -i -e "s,%%MOZILLA_PROJECT%%,${MOZILLA_PROJECT},g" "${MOZCONFIG}" + if [ ! -f "${MOZCONFIG_ORIG}" ]; \ + then \ + cp "${MOZCONFIG}" "${MOZCONFIG_ORIG}" ; \ + fi + + cp "${MOZCONFIG_ORIG}" "${MOZCONFIG}" sed -i -e "s,%%PREFIX%%,${PREFIX},g" "${MOZCONFIG}" sed -i -e "s,%%LOCALBASE%%,${LOCALBASE},g" "${MOZCONFIG}" .if defined(DEBUG) diff --git a/www/librewolf/files/mozconfig-openbsd b/www/librewolf/files/mozconfig-openbsd deleted file mode 100644 index eb5b8aebe8f..00000000000 --- a/www/librewolf/files/mozconfig-openbsd +++ /dev/null @@ -1,81 +0,0 @@ -# Maintenance notes: %%VARIABLE%% is populated from the Makefile. -# This file closely matches upstream's mozconfig, with only surgical -# changes made for integration with the OpenBSD ports system. Changes, -# relative to upstream, are annotated where appropriate. Please ensure -# that this file is updated appropriately, tracking upstream changes. - -ac_add_options --enable-application=browser - -# OpenBSD www/mozilla-firefox doesn't allow sideloading, but upstream -# librewolf does. We disable it in the OpenBSD LibreWolf port. -# ac_add_options --allow-addon-sideload -ac_add_options --disable-crashreporter -# upstream sets this unconditionally. we set conditionally in our Makefile -# ac_add_options --disable-debug -ac_add_options --disable-default-browser-agent -# Upstream adds this, but we set it conditionally in our Makefile -# ac_add_options --disable-tests -ac_add_options --disable-updater -ac_add_options --disable-cargo-incremental -ac_add_options --enable-hardening -ac_add_options --enable-stl-hardening -ac_add_options --enable-optimize -ac_add_options --enable-release -# upstream uses --enable-rust-simd but www/mozilla-firefox does not. -# --enable-rust-simd caused a build error in librewolf 150.0-1 -# ac_add_options --enable-rust-simd -# allow replacing malloc manually, will not affect regular systems -# not compatible with ac_add_options --disable-jemalloc, which only works when preloading custom malloc -# ac_add_options --enable-replace-malloc -# ac_add_options --enable-jemalloc -# -# ...but openbsd is not a member of "regular systems", so we comment these; -# mozjemalloc neither compiles nor runs safely, on OpenBSD (porting required) - -# upstream does: --with-app-name=librewolf -ac_add_options --with-app-name=%%MOZILLA_PROJECT%% -# upstream does: ac_add_options --with-branding=browser/branding/librewolf -ac_add_options --with-branding=browser/branding/%%MOZILLA_PROJECT%% - -# LibreWolf upstream adds these, but we remove these for OpenBSD hardening -# ac_add_options --with-unsigned-addon-scopes=app,system - -ac_add_options --with-l10n-base=$PWD/lw/l10n - -# OpenBSD www/firefox doesn't use this, so we won't. Disabling. -# ac_add_options --enable-bootstrap - -# upstream does: MOZ_TELEMETRY_REPORTING= -# upstream does: MOZ_REQUIRE_SIGNING= -# upstream does: MOZILLA_OFFICIAL=1 -# upstream does: export MOZ_APP_REMOTINGNAME=LibreWolf - -export MOZ_APP_REMOTINGNAME=LibreWolf - -mk_add_options MOZ_CRASHREPORTER=0 -mk_add_options MOZ_DATA_REPORTING=0 -mk_add_options MOZ_SERVICES_HEALTHREPORT=0 -mk_add_options MOZ_TELEMETRY_REPORTING=0 - -export CFLAGS="-ftrivial-auto-var-init=zero -fwrapv -Wno-backend-plugin $CFLAGS" -export CXXFLAGS="-ftrivial-auto-var-init=zero -fwrapv -Wno-backend-plugin $CXXFLAGS" -# upstream comments this, but we uncomment it for the ports system: -export LDFLAGS="$LDFLAGS" - -# Everything below the line are OpenBSD *additions* -# ----------------------------------------------------- - -# The types of additions here are ones that should always -# be hardcoded, on OpenBSD. Additions subject to configuration -# are handled inside the Makefile, via pre-configure. - -# OpenBSD uses e.g. -fno-ret-protector -export CPPFLAGS="$CPPFLAGS" - -ac_add_options --prefix=%%PREFIX%% -ac_add_options --enable-sandbox -ac_add_options --enable-forkserver -ac_add_options --with-wasi-sysroot=%%LOCALBASE%%/share/wasi-sysroot - -# ff/lw >= 46 defaults to gtk+3 -ac_add_options --enable-default-toolkit=cairo-gtk3 diff --git a/www/librewolf/patches/patch-mozconfig b/www/librewolf/patches/patch-mozconfig new file mode 100644 index 00000000000..011bd84fadf --- /dev/null +++ b/www/librewolf/patches/patch-mozconfig @@ -0,0 +1,68 @@ +OpenBSD-specific build-time configuration for the LibreWolf Web Browser port + +The mozconfig is conditionally modified at build time, by the OpenBSD LibreWolf +port Makefile, e.g. add --enable-dbus if MOZILLA_USE_DBUS is set. + +Makefile-based configuration is done in pre-configure, on a copy of mozconfig +created when the build is first conducted. The originally patched mozconfig is +restored on re-builds, matching what was produced by this patch. + +Index: mozconfig +--- mozconfig.orig ++++ mozconfig +@@ -1,20 +1,29 @@ ++# %%VARIABLE%% is replaced with a string set by the ++# OpenBSD port Makefile at build time. In addition to ++# these changes, the LibreWolf OpenBSD port Makefile ++# inserts conditional changes at build-time. ++ + ac_add_options --enable-application=browser + + ac_add_options --disable-crashreporter +-ac_add_options --disable-debug ++# OpenBSD configures this in the port Makefile: ++# ac_add_options --disable-debug + ac_add_options --disable-default-browser-agent +-ac_add_options --disable-tests ++# OpenBSD configures this in the port Makefile: ++# ac_add_options --disable-tests + ac_add_options --disable-updater + ac_add_options --disable-cargo-incremental + ac_add_options --enable-hardening + ac_add_options --enable-stl-hardening + ac_add_options --enable-optimize + ac_add_options --enable-release +-ac_add_options --enable-rust-simd ++# Rust SIMD option causes build errors on OpenBSD: ++# ac_add_options --enable-rust-simd + # allow replacing malloc manually, will not affect regular systems + # not compatible with ac_add_options --disable-jemalloc, which only works when preloading custom malloc +-ac_add_options --enable-replace-malloc +-ac_add_options --enable-jemalloc ++# NOTE: mozjemalloc is broken on OpenBSD, so we disable it there. ++# ac_add_options --enable-replace-malloc ++# ac_add_options --enable-jemalloc + + ac_add_options --with-app-name=librewolf + ac_add_options --with-branding=browser/branding/librewolf +@@ -33,7 +42,19 @@ + + export CFLAGS="-ftrivial-auto-var-init=zero -fwrapv -Wno-backend-plugin $CFLAGS" + export CXXFLAGS="-ftrivial-auto-var-init=zero -fwrapv -Wno-backend-plugin $CXXFLAGS" +-#export LDFLAGS= ++# Uncommented and populated for the ports system ++export LDFLAGS="$LDFLAGS" + + # Add your own stuff, libraries, architecture, etc.. + # ex: `cat mozconfig.orig mozconfig.my > mozconfig` ++ ++# OpenBSD uses e.g. -fno-ret-protector ++export CPPFLAGS="$CPPFLAGS" ++ ++ac_add_options --prefix=%%PREFIX%% ++ac_add_options --enable-sandbox ++ac_add_options --enable-forkserver ++ac_add_options --with-wasi-sysroot=%%LOCALBASE%%/share/wasi-sysroot ++ ++# ff/lw >= 46 defaults to gtk+3 ++ac_add_options --enable-default-toolkit=cairo-gtk3 -- 2.47.3