Hi everyone,

the following patch makes www/librewolf a standalone port, instead of re-using www/mozilla. it's the opposite of what i was going for earlier.

librewolf makes a number of extensive changes to firefox, and i want to make a lot more changes in the future to how it builds, in ways that make treading carefully around the www/mozilla architecture a bit troublesome.

i removed mozconfig, now i generate it programatically

i removed the policy patch because it's redundant. librewolf already does all of openbsd's hardening. my patch to it only locked the AI settings, but AI is still turned off by default in librewolf. i think the user should have a choice whether to turn it back on if they want to anyway. it's not for me to decide what someone does with their computer, which by extension means their web browser.

to make it standalone, i cherry-picked only what i needed from the mozilla/ module

i removed some global variables in the makefile (MOZ ones that i had introduced), because they were ugly. the logic now looks more similar to the firefox port

this is basically a massive cleanup patch for librewolf. this is how i should have implemented the port originally, and in fact was how i implemented an earlier version of the port before openbsd merged it. i will of course still sync with changes to the firefox port where appropriate, but this new design gives me a lot more flexibility to modify the port without stepping on Landry's toes

it builds and runs perfectly.

some of those hardened configure options could be added to the firefox port, and i will investigate this at a later date

--
Company director, Minifree Ltd
Registered in England, No. 9361826 | VAT No. GB202190462
Registered Office: 19 Hilton Road, Canvey Island, Essex SS8 9QA, UK

From 39412c3b36b5597ba0ecb565a9cf933c543e486c Mon Sep 17 00:00:00 2001
From: Leah Rowe <[email protected]>
Date: Wed, 2 Sep 2026 13:59:41 +0100
Subject: [PATCH 1/1] make www/librewolf a standalone port

i dropped mozconfig patching again. now it's generated
from CONFIGURE_ARGS.

i dropped the policy patch, because it's mostly redundant.
all it really does is lock some AI settings, preventing
them from being enabled; disabled is the default, upstream,
and i think the user should be allowed to enable if they wish.
(this differs from the firefox port which locks them, and
that is why i initially did so in this part, but i changed
my mind. my policy in librewolf is to allow user choice)

a bunch of variables outside of targets were empty when
used inside targets, especially ones that are used in
paths, leading to some whacky results. i'm not sure what's
up with that, but i didn't look all those dirty variables
anyway. i went back to hardcoding several things inside
logic like the firefox port does.

librewolf is now a standalone port, no longer using the
www/mozilla module, for the reason mentioned above, and
also because i generally want to have more control over the
port, possibly for some quite invasive changes at a later
date. doing it this way makes it far less likely that i'll
interfere, even unwittingly, with Landry's work.

Signed-off-by: Leah Rowe <[email protected]>
---
 www/librewolf/Makefile                       | 425 +++++++++++--------
 www/librewolf/files/mozconfig.template       |   9 +
 www/librewolf/patches/patch-lw_policies_json |  81 ----
 www/librewolf/patches/patch-mozconfig        |  64 ---
 4 files changed, 266 insertions(+), 313 deletions(-)
 create mode 100644 www/librewolf/files/mozconfig.template
 delete mode 100644 www/librewolf/patches/patch-lw_policies_json
 delete mode 100644 www/librewolf/patches/patch-mozconfig

diff --git a/www/librewolf/Makefile b/www/librewolf/Makefile
index b892a47885f..18142757eed 100644
--- a/www/librewolf/Makefile
+++ b/www/librewolf/Makefile
@@ -1,119 +1,251 @@
 COMMENT =	LibreWolf web browser
 ONLY_FOR_ARCHS =	amd64 aarch64 riscv64
 
-# This port was implemented by copying www/mozilla-firefox and modifying it.
-
-# LibreWolf uses mozconfig, so CONFIGURE_ARGS has no effect. Instead, we patch
-# mozconfig at build time (via pre-configure). We stay in sync with upstream's
-# mozconfig, and OpenBSD's versioning, patching and configuration for Firefox,
-# thereby syncing vicariously with the LibreWolf upstream.
-
-# Please also know that www/firefox-i18n is unused as LibreWolf hardcodes use
-# of en-US, irrespective of the main system language, for anti-fingerprinting.
+MAINTAINER =		Leah Rowe <[email protected]>
 
-# If upstream adds revision number -x, it will become plx in OpenBSD, e.g.
-# librewolf-149.0.2-2 (upstream) becomes librewolf-149.0.2pl2 (patch level 2)
 MOZILLA_DIST_VERSION =	155.0-1
 MOZILLA_VERSION =	${MOZILLA_DIST_VERSION:C/-([0-9]+)$/pl\1/}
-
 MOZILLA_PROJECT =	librewolf
 MOZILLA_CODENAME =	browser
-MAINTAINER =		Leah Rowe <[email protected]>
-REVISION = 0
-
-# LibreWolf doesn't provide PGO data, but we use the data
-# provided by FireFox releases, re-using the OpenBSD distfile
+# task ID from mozilla taskherder. we re-use firefox PGO artifacts
 MOZILLA_PROFDATA_TASKID =	cNOKkWdaQfOqEzllBpy9Rw
-FFVERSION =			${MOZILLA_DIST_VERSION:C/-([0-9]+)$//}
-FFDIST =			firefox-${FFVERSION}.source
-DISTFILES.profdata = ${FFDIST}-profdata.tar.xz{profdata.tar.xz}
+REVISION = 1
+
+PKGNAME =	${MOZILLA_PROJECT}-${MOZILLA_VERSION:S/b/beta/}
 
 HOMEPAGE =	https://librewolf.net/
-SO_VERSION =	4.0
+SO_VERSION =	5.0
 # Bump minor ver if shlibs deleted in components dir to avoid pkg_add -r issues
 MOZILLA_LIBS =	mozavcodec mozavutil mozgtk mozinference mozwayland xul \
 		clearkey gkcodecs lgpllibs mozsqlite3
 
 CATEGORIES =	www
+PORTHOME =	${WRKSRC}
+
+# mozilla public license
+PERMIT_PACKAGE=	Yes
+
+# ff/lw 53 and above needs rust
+MODULES =	lang/python lang/rust
 
 MOZSITE =	https://librewolf.dev/api/packages/librewolf/generic
 SITES =		${MOZSITE}/librewolf-source/${MOZILLA_DIST_VERSION}/
 EXTRACT_SUFX =	.tar.gz
 
-# mozilla public license
-PERMIT_PACKAGE=	Yes
-
-# We rely on www/mozilla for build logic
-MODULES =	www/mozilla lang/python
+MOZILLA_DIST =	${MOZILLA_PROJECT}
+DISTNAME =	${MOZILLA_DIST}-${MOZILLA_DIST_VERSION}.source
+WRKDIST =	${WRKDIR}/${MOZILLA_DIST}-${MOZILLA_DIST_VERSION}
+# reuse mozilla directory so we can reuse profdata
+DIST_SUBDIR =	mozilla
 
 MODPY_RUNDEP =	No
 
 COMPILER =	ports-clang
 MODCLANG_VERSION =	22
+USE_GMAKE =	Yes
+USE_NOBTCFI =	Yes #1626955 & #510629
+SEPARATE_BUILD =	Yes # bug #736961
+AUTOCONF_VERSION =	2.13 # autohell?
 
-# 63 requires node because why not #1483595
-BUILD_DEPENDS +=	lang/node
-# 63 requires cbindgen #1478813
-BUILD_DEPENDS +=	devel/cbindgen>=0.29.4
+# XXX badly formed debug ?
+DWZ = :
+DEBUG_PACKAGES =	${BUILD_PACKAGES}
+
+TEST_IS_INTERACTIVE =	x11
+# needs /etc/librewolf for pledge/unveil configs
+TEST_DEPENDS =		${BUILD_PKGPATH}
+# re-use virtualenv from the build instead of creating another virtualenv
+TEST_ENV +=		PATH=/bin:/usr/bin MOZ_OBJDIR="${WRKBUILD}" \
+			MOZ_AUTOMATION=1 HOME="${WRKSRC}"
+
+# NOTE: these variables are further populated with logic further down
+#
+BUILD_DEPENDS +=	lang/node # 63 requires node because why not #1483595
+BUILD_DEPENDS +=	devel/cbindgen>=0.29.4 # 63 needs cbindgen #1478813
 # wasi
 BUILD_DEPENDS +=	lang/wasi-sdk/compiler-rt>=22.1.5p1 \
 			lang/wasi-sdk/libcxx>=21.1.5p1 \
 			lang/wasi-libc>=0.20251114p1
-# mach uses pkg_resources
-BUILD_DEPENDS +=	devel/py-setuptools
+BUILD_DEPENDS +=	devel/py-setuptools # mach uses pkg resources
+RUN_DEPENDS =		graphics/ffmpeg # audio/video support
+WANTLIB += Xrandr # uses pledge()
+
+.if ${MACHINE_ARCH} == "i386"
+MAKE_ENV +=		RUSTFLAGS="-C target-cpu=pentium4 --cfg target_feature=\"sse2\""
+# reduce build memory usage:
+DPB_PROPERTIES +=	lonesome
+.else
+DPB_PROPERTIES +=	parallel
+.endif
 
-# audio/video support
-RUN_DEPENDS =		graphics/ffmpeg
+.for _lib in ${MOZILLA_LIBS}
+SHARED_LIBS +=	${_lib}	${SO_VERSION}
+.endfor
 
-# uses pledge()
-WANTLIB += Xrandr
+# hardened flags for the build
+HARDFLAGS = -ftrivial-auto-var-init=zero -fwrapv -Wno-backend-plugin
+.if ${MACHINE_ARCH} == aarch64
+# retguard leads to segfault at startup on arm64, cf #1973016
+HARDFLAGS += -fno-ret-protector
+.endif
 
 CONFIGURE_STYLE =	simple
 CONFIGURE_SCRIPT =	${MODPY_BIN} ${WRKSRC}/configure.py
 MAKE_ENV +=		BUILD_VERBOSE_LOG="1" CARGOFLAGS="-j${MAKE_JOBS}"
-.if ${MACHINE_ARCH} == aarch64
-# retguard leads to segfault at startup on arm64, cf #1973016
-CONFIGURE_ENV +=	CPPFLAGS="-fno-ret-protector -Wno-backend-plugin"
-.else
-CONFIGURE_ENV +=	CPPFLAGS=-Wno-backend-plugin
-.endif
+CONFIGURE_ENV +=	CFLAGS="${HARDFLAGS}"
+CONFIGURE_ENV +=	CPPFLAGS="${HARDFLAGS}"
+CONFIGURE_ENV +=	CXXFLAGS="${HARDFLAGS}"
 CONFIGURE_ENV +=	LDFLAGS="-Wl,--threads=4 --ld-path=${WRKDIR}/bin/ld"
 # 2026497
 CONFIGURE_ENV +=       MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none
 
 MOZILLA_USE_DBUS =	Yes
 MOZILLA_USE_SYSTEM_AV1 =Yes
-MOZILLA_USE_SYSTEM_ZLIB=Yes
 
-# XXX badly formed debug ?
-DWZ = :
-DEBUG_PACKAGES =	${BUILD_PACKAGES}
+MODMOZ_RUN_DEPENDS =	devel/desktop-file-utils \
+			x11/gtk+4,-guic
+MODMOZ_BUILD_DEPENDS =	archivers/gtar \
+			archivers/unzip \
+			archivers/zip>=2.3
+
+# no --with-system-jpeg starting with fx 18, requires libjpeg-turbo because of bug 791305
+# no --with-system-cairo, removed in #1432751
+# no --with-system-png, apng support not bundled in
+# no --with-system-sqlite, option removed in #1611386 and we need to use bundled sqlite which has SQLITE_ENABLE_FTS3_TOKENIZER (#1252937)
+# no --with-system-dav1d, cf #1493397 comment 12
+# no --enable-system-hunspell, removed in #1460600
+
+DEBUG_CONFIGURE_ARGS +=	--enable-debug-symbols \
+			--disable-install-strip
+
+# firefox >= 46 defaults to gtk+3
+CONFIGURE_ARGS +=	--enable-default-toolkit=cairo-gtk3
+
+# NOTE: pre-configure adds a few more. these are used
+#       to populate a mozconfig file
+#
+CONFIGURE_ARGS +=	--enable-release #1386371
+CONFIGURE_ARGS +=	--disable-debug-symbols \
+			--enable-sandbox \
+			--enable-forkserver \
+			--enable-application=${MOZILLA_CODENAME} \
+			--disable-updater \
+			--disable-crashreporter \
+			--disable-default-browser-agent \
+			--disable-tests \
+			--disable-cargo-incremental \
+			--enable-hardening \
+			--enable-stl-hardening \
+			--enable-rust-simd \
+			--with-app-name=librewolf \
+			--with-branding=browser/branding/librewolf \
+			--with-system-zlib
+
+.if ${MACHINE_ARCH} != riscv64
+# LTO eats too much RAM on riscv64
+CONFIGURE_ARGS +=	--enable-lto=thin
+.endif
+
+.if defined(MOZILLA_PROFDATA_TASKID)
+# LibreWolf doesn't provide PGO data, but we use the data
+# provided by FireFox releases, re-using the OpenBSD distfile
+FFVERSION =			${MOZILLA_DIST_VERSION:C/-([0-9]+)$//}
+FFDIST =			firefox-${FFVERSION}.source
+DISTFILES.profdata = ${FFDIST}-profdata.tar.xz{profdata.tar.xz}
+SITES.profdata =	https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/${MOZILLA_PROFDATA_TASKID}/runs/0/artifacts/public/build/
+.if ${MACHINE_ARCH:Mamd64}
+CONFIGURE_ARGS +=	--enable-profile-use
+.endif
+.endif
+
+.if !defined(MOZILLA_USE_BUNDLED_NSS)
+MODMOZ_LIB_DEPENDS +=	security/nss>=3.115
+MODMOZ_WANTLIB +=	nss3 nssutil3 smime3 ssl3
+CONFIGURE_ARGS +=	--with-system-nss
+.endif
+
+.if !defined(MOZILLA_USE_BUNDLED_NSPR)
+MODMOZ_LIB_DEPENDS +=	devel/nspr>=4.37
+MODMOZ_WANTLIB +=	nspr4 plc4 plds4
+CONFIGURE_ARGS +=	--with-system-nspr
+.endif
+
+.if !defined(MOZILLA_USE_BUNDLED_ICU)
+MODMOZ_LIB_DEPENDS +=	textproc/icu4c>=73.2p0
+MODMOZ_WANTLIB +=	icudata icui18n icuuc
+CONFIGURE_ARGS +=	--with-system-icu
+.endif
+
+.if !defined(MOZILLA_USE_BUNDLED_FFI)
+MODMOZ_LIB_DEPENDS +=	devel/libffi
+MODMOZ_WANTLIB +=	ffi
+CONFIGURE_ARGS +=	--with-system-ffi
+.endif
+
+.if defined(MOZILLA_USE_SYSTEM_AV1)
+MODMOZ_LIB_DEPENDS +=	multimedia/dav1d
+MODMOZ_LIB_DEPENDS +=	multimedia/aom
+MODMOZ_WANTLIB +=	aom dav1d
+CONFIGURE_ARGS +=	--with-system-av1
+.endif
+
+.if !defined(MOZILLA_USE_DBUS)
+CONFIGURE_ARGS +=	--disable-dbus
+.else
+# filepickers via portals need dbus
+MODMOZ_LIB_DEPENDS +=	x11/dbus
+MODMOZ_WANTLIB +=	dbus-1
+CONFIGURE_ARGS +=	--enable-dbus
+.endif
+
+.if ${MACHINE_ARCH:Mi386} || ${MACHINE_ARCH:Mamd64}
+# needed for dav1d since 67
+MODMOZ_BUILD_DEPENDS +=	devel/nasm
+.endif
+
+MODMOZ_WANTLIB +=	${MODRUST_WANTLIB}
+#1670807
+MODMOZ_BUILD_DEPENDS +=	devel/m4
+
+MODMOZ_WANTLIB +=	X11 X11-xcb Xcomposite Xcursor Xdamage Xext Xfixes Xi Xrender \
+			atk-1.0 c cairo fontconfig freetype gdk_pixbuf-2.0 \
+			gio-2.0 glib-2.0 gobject-2.0 harfbuzz intl m \
+			pango-1.0 pangocairo-1.0 sndio z xcb xcb-shm
+MODMOZ_WANTLIB +=	${COMPILER_LIBCXX}
+
+WANTLIB +=	${MODMOZ_WANTLIB}
+BUILD_DEPENDS +=${MODMOZ_BUILD_DEPENDS}
+LIB_DEPENDS +=	${MODMOZ_LIB_DEPENDS}
+RUN_DEPENDS +=	${MODMOZ_RUN_DEPENDS}
 
 # not built on riscv64
-COMMENT_FFVPX ?=
+COMMENT_FFVPX =
 .if ${MACHINE_ARCH} == riscv64
 COMMENT_FFVPX =		@comment # needs a trailing space
 .endif
 SUBST_VARS +=		COMMENT_FFVPX
 
-TEST_IS_INTERACTIVE =	x11
-# needs /etc/librewolf for pledge/unveil configs
-TEST_DEPENDS =		${BUILD_PKGPATH}
-# re-use virtualenv from the build instead of creating another virtualenv
-TEST_ENV +=		PATH=/bin:/usr/bin MOZ_OBJDIR="${WRKBUILD}" \
-			MOZ_AUTOMATION=1 HOME="${WRKSRC}"
+MODMOZ_LIB_DEPENDS +=	x11/gtk+3
+MODMOZ_WANTLIB +=	cairo-gobject gdk-3 gtk-3
+
+# needed for PLIST
+MOZILLA_VER =	${MOZILLA_VERSION:C/b[0-9]*//:C/esr//:C/rc.$//}
+SUBST_VARS +=	MOZILLA_PROJECT MOZILLA_VER MOZILLA_VERSION
 
-# various strings used next in Makefile commands
-MOZLIB = ${PREFIX}/lib/${MOZILLA_PROJECT}
-MOZPREF = ${MOZLIB}/browser/defaults/preferences
-# legacy directory also used, as in www/firefox (possible code smell ?)
-MOZPREF_LEGACY = ${MOZLIB}/browser/defaults/pref
-MOZDIST = ${MOZLIB}/distribution
-MOZAPPS = ${PREFIX}/share/applications
-MOZICONS = ${PREFIX}/share/icons/hicolor
-MOZBRAND = ${WRKSRC}/browser/branding/${MOZILLA_PROJECT}
-MOZPROFDATA = ${WRKDIR}/merged.profdata
-MOZDIST_INI = [Global]\nid=OpenBSD\nversion=${OSREV}\n
+MAKE_ENV +=	MOZILLA_OFFICIAL=1 \
+		MOZ_APP_REMOTINGNAME=${MOZILLA_PROJECT} \
+		SHELL=/bin/sh \
+		SO_VERSION="${SO_VERSION}" \
+		LLVM_CONFIG="${LOCALBASE}/bin/llvm-config-${MODCLANG_VERSION}"
+
+CONFIGURE_ENV +=	${MAKE_ENV}
+# ensure libffi's configure doesnt pick gsed/gmkdir/gawk
+CONFIGURE_ENV +=	ac_cv_path_ax_enable_builddir_sed=/usr/bin/sed
+CONFIGURE_ENV +=	ac_cv_path_SED=/usr/bin/sed
+CONFIGURE_ENV +=	ac_cv_path_mkdir=/bin/mkdir
+CONFIGURE_ENV +=	ac_cv_prog_AWK=/usr/bin/awk
+CONFIGURE_ENV +=	AWK=/usr/bin/awk
+CONFIGURE_ENV +=	M4=/usr/local/bin/gm4
 
 UVCONTENT = /etc/${MOZILLA_PROJECT}/unveil.content
 pre-test:
@@ -132,125 +264,82 @@ do-test:
 		    "${MOZTEST}"*/_virtualenvs/build/bin/python \
 		    ./mach xpcshell-test --sequential --keep-going
 
-MOZCONFIG = ${WRKSRC}/mozconfig
-MOZCONFIG_ORIG = ${WRKSRC}/mozconfig.obsd
 pre-configure:
-	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)
-	# www/mozilla sets DEBUG_CONFIGURE_ARGS, but these
-	# have no effect either, due to use of mozconfig
-	echo "ac_add_options --enable-debug" >> "${MOZCONFIG}"
-	echo "ac_add_options --enable-debug-symbols" >> "${MOZCONFIG}"
-	echo "ac_add_options --disable-install-strip" >> "${MOZCONFIG}"
-.else
-	# these three option greatly reduce binary sizes
-	echo "ac_add_options --disable-debug" >> "${MOZCONFIG}"
-	echo "ac_add_options --disable-debug-symbols" >> "${MOZCONFIG}"
-	echo "ac_add_options --enable-install-strip" >> "${MOZCONFIG}"
-	echo "ac_add_options --disable-tests" >> "${MOZCONFIG}"
-.endif
-.if ${MACHINE_ARCH} != riscv64
-	# LTO eats too much RAM on riscv64
-	echo "ac_add_options --enable-lto=thin" >> "${MOZCONFIG}"
-.endif
-.if !defined(MOZILLA_USE_BUNDLED_NSS)
-	echo "ac_add_options --with-system-nss" >> "${MOZCONFIG}"
-.endif
-.if !defined(MOZILLA_USE_BUNDLED_NSPR)
-	echo "ac_add_options --with-system-nspr" >> "${MOZCONFIG}"
-.endif
-.if !defined(MOZILLA_USE_BUNDLED_ICU)
-	echo "ac_add_options --with-system-icu" >> "${MOZCONFIG}"
-.endif
-.if !defined(MOZILLA_USE_BUNDLED_FFI)
-	echo "ac_add_options --with-system-ffi" >> "${MOZCONFIG}"
-.endif
-.if defined(MOZILLA_USE_SYSTEM_AV1)
-	echo "ac_add_options --with-system-av1" >> "${MOZCONFIG}"
-.endif
-.if defined(MOZILLA_USE_SYSTEM_ZLIB)
-	echo "ac_add_options --with-system-zlib" >> "${MOZCONFIG}"
-.endif
-.if !defined(MOZILLA_USE_DBUS)
-	echo "ac_add_options --disable-dbus" >> "${MOZCONFIG}"
-.else
-	echo "ac_add_options --enable-dbus" >> "${MOZCONFIG}"
-.endif
-.if defined(MOZILLA_PROFDATA_TASKID)
+	# LibreWolf uses a mozconfig, but we have our own environment,
+	# so we will re-build the mozconfig programatically
+	echo "ac_add_options --prefix=${PREFIX}" > "${WRKSRC}/mozconfig"
+	echo "ac_add_options --with-wasi-sysroot=${LOCALBASE}/share/wasi-sysroot" \
+	    >> "${WRKSRC}/mozconfig"
+	echo "ac_add_options --with-l10n-base=${WRKSRC}/lw/l10n" \
+	    >> "${WRKSRC}/mozconfig"
+.for autohellarg in ${CONFIGURE_ARGS}
+	echo "ac_add_options ${autohellarg}" >> "${WRKSRC}/mozconfig"
+.endfor
 .if ${MACHINE_ARCH:Mamd64}
-	echo "ac_add_options --enable-profile-use" >> "${MOZCONFIG}"
-	echo "ac_add_options --with-pgo-profile-path=${MOZPROFDATA}" \
-		>> "${MOZCONFIG}"
-.endif
-.endif
-# from browser/config/mozconfig
-.if ${MOZILLA_CODENAME:Mcomm*}
-	echo "ac_add_options --enable-application=${MOZILLA_CODENAME}" \
-		>> "${MOZCONFIG}"
-.else
-#1801738
-	echo "ac_add_options --enable-project=${MOZILLA_CODENAME}" \
-		>> "${MOZCONFIG}"
+	echo "ac_add_options --with-pgo-profile-path=${WRKDIR}/merged.profdata" \
+	    >> "${WRKSRC}/mozconfig"
 .endif
+	printf "export CFLAGS=\"%s %s\"\n" "${HARDFLAGS}" "${CFLAGS}" \
+	    >> "${WRKSRC}/mozconfig"
+	cat "${FILESDIR}/mozconfig.template" >> "${WRKSRC}/mozconfig"
+	printf "export CXXFLAGS=\"%s %s\"\n" "${HARDFLAGS}" "${CXXFLAGS}" \
+	    >> "${WRKSRC}/mozconfig"
+	printf "export CPPFLAGS=\"%s %s\"\n" "${HARDFLAGS}" "${CPPFLAGS}" \
+	    >> "${WRKSRC}/mozconfig"
+	printf "export LDFLAGS=\"%s\"\n" "${LDFLAGS}" >> "${WRKSRC}/mozconfig"
 
 post-install:
-	${INSTALL_DATA_DIR} ${PREFIX}/man/man1
 	${SUBST_MAN} ${FILESDIR}/${MOZILLA_PROJECT}.1 \
 		${PREFIX}/man/man1/${MOZILLA_PROJECT}.1
+	# install prefs
+	${INSTALL_DATA_DIR} ${PREFIX}/lib/${MOZILLA_PROJECT}/browser/defaults/preferences/
+	${SUBST_DATA} ${FILESDIR}/all-openbsd.js \
+		${PREFIX}/lib/${MOZILLA_PROJECT}/browser/defaults/preferences/all-openbsd.js
+	# install distribution.ini file
+	${INSTALL_DATA_DIR} ${PREFIX}/lib/${MOZILLA_PROJECT}/distribution/
+	echo "[Global]\nid=OpenBSD\nversion=${OSREV}\nabout=Ported by ${MAINTAINER}\n" > \
+		${PREFIX}/lib/${MOZILLA_PROJECT}/distribution/distribution.ini
+	# install desktop file
+	${INSTALL_DATA_DIR} ${PREFIX}/share/applications/
+	${INSTALL_DATA} ${FILESDIR}/${MOZILLA_PROJECT}.desktop \
+	    ${PREFIX}/share/applications/${MOZILLA_PROJECT}.desktop
 
-	# preferences (OpenBSD defaults + sandboxing)
-	${INSTALL_DATA_DIR} ${MOZPREF}
-	${SUBST_DATA} ${FILESDIR}/all-openbsd.js ${MOZPREF}/all-openbsd.js
+	# install policies.json
+	${INSTALL_DATA_DIR} ${PREFIX}/lib/${MOZILLA_PROJECT}/distribution/
+	${INSTALL_DATA} ${WRKDIST}/lw/policies.json \
+	    ${PREFIX}/lib/${MOZILLA_PROJECT}/distribution/policies.json
 
-.for f in pledge unveil
-.for t in content gpu main rdd socket utility
-	${INSTALL_DATA} ${FILESDIR}/${f}.${t} ${MOZPREF}/
-.endfor
+	# make sure TwemojiMozilla.ttf is found
+	${INSTALL_DATA_DIR} ${PREFIX}/share/fonts
+	mv ${PREFIX}/lib/${MOZILLA_PROJECT}/fonts \
+	    ${PREFIX}/share/fonts/${MOZILLA_PROJECT}
+
+	# install icons for desktop file
+.for s in 16 22 24 32 48 64 128 256
+	${INSTALL_DATA_DIR} ${PREFIX}/share/icons/hicolor/${s}x${s}/apps
+	${INSTALL_DATA} ${WRKSRC}/browser/branding/${MOZILLA_PROJECT}/default${s}.png \
+		${PREFIX}/share/icons/hicolor/${s}x${s}/apps/org.${MOZILLA_PROJECT}.png
 .endfor
+	${INSTALL_DATA_DIR} ${PREFIX}/share/icons/hicolor/scalable/apps/
+	${INSTALL_DATA} ${WRKSRC}/browser/branding/${MOZILLA_PROJECT}/content/about-logo.svg \
+		${PREFIX}/share/icons/hicolor/scalable/apps/org.${MOZILLA_PROJECT}.svg
 
-	# distribution metadata
-	${INSTALL_DATA_DIR} ${MOZDIST}
-	echo "${MOZDIST_INI}about=Ported by ${MAINTAINER}\n" \
-	    > "${MOZDIST}/distribution.ini"
+	# link default48.png to default.png to be used by default by non-icccm compliant wm
+	ln -f ${PREFIX}/lib/${MOZILLA_PROJECT}/browser/chrome/icons/default/default{48,}.png
 
 	# librewolf runtime config (tweaks, policy and so on)
-	${INSTALL_DATA_DIR} ${MOZLIB}
-	${INSTALL_DATA} ${WRKDIST}/lw/${MOZILLA_PROJECT}.cfg ${MOZLIB}/
+	${INSTALL_DATA_DIR} ${PREFIX}/lib/${MOZILLA_PROJECT}/
+	${INSTALL_DATA} ${WRKDIST}/lw/${MOZILLA_PROJECT}.cfg \
+	    ${PREFIX}/lib/${MOZILLA_PROJECT}/${MOZILLA_PROJECT}.cfg
 
-	${INSTALL_DATA_DIR} ${MOZDIST}
-	${INSTALL_DATA} ${WRKDIST}/lw/policies.json ${MOZDIST}/policies.json
+	${INSTALL_DATA_DIR} ${PREFIX}/lib/${MOZILLA_PROJECT}/browser/defaults/pref/
+	${INSTALL_DATA} ${FILESDIR}/autoconfig.js \
+	    ${PREFIX}/lib/${MOZILLA_PROJECT}/defaults/pref/autoconfig.js
 
-	${INSTALL_DATA_DIR} ${MOZPREF_LEGACY}
-	${INSTALL_DATA} ${FILESDIR}/autoconfig.js ${MOZLIB}/defaults/pref/
-
-	# desktop and icon files
-	${INSTALL_DATA_DIR} ${MOZAPPS}
-	${INSTALL_DATA} ${FILESDIR}/${MOZILLA_PROJECT}.desktop \
-	    ${MOZAPPS}/${MOZILLA_PROJECT}.desktop
-
-.for s in 16 22 24 32 48 64 128 256
-	${INSTALL_DATA_DIR} ${MOZICONS}/${s}x${s}/apps
-	${INSTALL_DATA} ${MOZBRAND}/default${s}.png \
-	    ${MOZICONS}/${s}x${s}/apps/org.${MOZILLA_PROJECT}.png
+.for f in unveil pledge
+.for t in content gpu main rdd socket utility
+	${INSTALL_DATA} ${FILESDIR}/${f}.${t} ${PREFIX}/lib/${MOZILLA_PROJECT}/browser/defaults/preferences/${f}.${t}
+.endfor
 .endfor
-
-	${INSTALL_DATA_DIR} ${MOZICONS}/scalable/apps
-	${INSTALL_DATA} ${MOZBRAND}/content/about-logo.svg \
-	    ${MOZICONS}/scalable/apps/org.${MOZILLA_PROJECT}.svg
-
-	${INSTALL_DATA_DIR} ${PREFIX}/share/fonts
-	mv ${PREFIX}/lib/${MOZILLA_PROJECT}/fonts \
-	    ${PREFIX}/share/fonts/${MOZILLA_PROJECT}
-
-	# compatibility symlink (non-ICCCM WMs)
-	ln -f ${MOZLIB}/browser/chrome/icons/default/default48.png \
-	    ${MOZLIB}/browser/chrome/icons/default/default.png
 
 .include <bsd.port.mk>
diff --git a/www/librewolf/files/mozconfig.template b/www/librewolf/files/mozconfig.template
new file mode 100644
index 00000000000..720434c953d
--- /dev/null
+++ b/www/librewolf/files/mozconfig.template
@@ -0,0 +1,9 @@
+ac_add_options --enable-optimize="-O2 -pipe"
+export MOZ_TELEMETRY_REPORTING=
+export MOZ_REQUIRE_SIGNING=
+export MOZILLA_OFFICIAL=1
+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
diff --git a/www/librewolf/patches/patch-lw_policies_json b/www/librewolf/patches/patch-lw_policies_json
deleted file mode 100644
index ba045f030c7..00000000000
--- a/www/librewolf/patches/patch-lw_policies_json
+++ /dev/null
@@ -1,81 +0,0 @@
-perhaps send these to librewolf upstream as well
-
-Index: lw/policies.json
---- lw/policies.json.orig
-+++ lw/policies.json
-@@ -1,26 +1,47 @@
- {
-     "__COMMENT__ More Information": "https://github.com/mozilla/policy-templates/blob/master/README.md";,
-     "policies": {
--        "AIControls": {
-+
-+      "GenerativeAI": {
-+        "Enabled": false,
-+        "Chatbot": false,
-+        "LinkPreviews": false,
-+        "TabGroups": false,
-+        "Locked": true
-+      },
-+      "AIControls": {
-+            "Default": {
-+              "Value": "blocked",
-+              "Locked": true
-+            },
-             "Translations": {
--                "Value": "available"
-+              "Value": "blocked",
-+              "Locked": false
-             },
-             "PDFAltText": {
--                "Value": "blocked"
-+              "Value": "blocked",
-+              "Locked": false
-             },
-             "SmartTabGroups": {
--                "Value": "blocked"
-+              "Value": "blocked",
-+              "Locked": true
-             },
-             "LinkPreviewKeyPoints": {
--                "Value": "blocked"
-+              "Value": "blocked",
-+              "Locked": true
-             },
-             "SidebarChatbot": {
--                "Value": "blocked"
-+              "Value": "blocked",
-+              "Locked": true
-             },
-             "SmartWindow": {
--                "Value": "blocked"
-+              "Value": "blocked",
-+              "Locked": true
-             }
--        },
-+
-+          },
-+
-+
-         "AppUpdateURL": "https://localhost";,
-         "DisableAppUpdate": true,
-         "DisableDefaultBrowserAgent": true,
-@@ -73,6 +94,7 @@
-             "EnablePrompting": true
-         },
-         "NoDefaultBookmarks": true,
-+        "GoToIntranetSiteForSingleWordEntryInAddressBar": true,
-         "OverridePostUpdatePage": "",
-         "SkipTermsOfUse": true,
-         "SupportMenu": {
-@@ -84,6 +106,11 @@
-             "SkipOnboarding": true,
-             "MoreFromMozilla": false,
-             "FirefoxLabs": false
-+        },
-+        "SearchEngines": {
-+          "Remove": [
-+            "Perplexity"
-+          ]
-         }
-     }
- }
diff --git a/www/librewolf/patches/patch-mozconfig b/www/librewolf/patches/patch-mozconfig
deleted file mode 100644
index 327fa7440ef..00000000000
--- a/www/librewolf/patches/patch-mozconfig
+++ /dev/null
@@ -1,64 +0,0 @@
-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,9 +1,16 @@
-+# %%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
-@@ -13,8 +20,9 @@ ac_add_options --enable-release
- 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 +41,19 @@ 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"
--#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.55.0

Attachment: OpenPGP_0x5C654067D383B1FF.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to