View | Details | Raw Unified | Return to bug 293476
Collapse All | Expand All

(-)b/www/zen-browser/.cargo/config.toml.disabled (+107 lines)
Added Link Here
1
[source.cargo]
2
directory = '/home/berke/workdir/www/zen-browser/work/cargo-crates'
3
[source.crates-io]
4
replace-with = 'cargo'
5
[patch.'https://github.com/mozilla/midir.git']
6
midir = { path = '/home/berke/workdir/www/zen-browser/work/midir-37ad39de3382c2aad0758dab49ba545331a2257d' }
7
[patch.'https://github.com/mozilla/neqo']
8
mtu = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/mtu' }
9
neqo-bin = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-bin' }
10
neqo-common = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-common' }
11
neqo-crypto = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-crypto' }
12
neqo-http3 = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-http3' }
13
neqo-qpack = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-qpack' }
14
neqo-transport = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-transport' }
15
neqo-udp = { path = '/home/berke/workdir/www/zen-browser/work/neqo-0.16.1/neqo-udp' }
16
[patch.'https://github.com/mozilla/audioipc']
17
audioipc2 = { path = '/home/berke/workdir/www/zen-browser/work/audioipc-82fe7fa7e3aaa35468137239a0e4c2f867457214/audioipc' }
18
audioipc2-client = { path = '/home/berke/workdir/www/zen-browser/work/audioipc-82fe7fa7e3aaa35468137239a0e4c2f867457214/client' }
19
audioipc2-server = { path = '/home/berke/workdir/www/zen-browser/work/audioipc-82fe7fa7e3aaa35468137239a0e4c2f867457214/server' }
20
[patch.'https://github.com/FirefoxGraphics/aa-stroke']
21
aa-stroke = { path = '/home/berke/workdir/www/zen-browser/work/aa-stroke-a821fa621c2def48e90c82774b4c6563b5a8ea4a' }
22
[patch.'https://github.com/glandium/rust-objc']
23
objc = { path = '/home/berke/workdir/www/zen-browser/work/rust-objc-4de89f5aa9851ceca4d40e7ac1e2759410c04324' }
24
[patch.'https://github.com/beurdouche/mls-platform-api']
25
mls-platform-api = { path = '/home/berke/workdir/www/zen-browser/work/mls-platform-api-5d88241b9765cae3669aba21f0946bd3700f7db1' }
26
[patch.'https://github.com/rust-lang/rust-bindgen']
27
bindgen = { path = '/home/berke/workdir/www/zen-browser/work/rust-bindgen-9366e0af8da529c958b4cd4fcbe492d951c86f5c/bindgen' }
28
[patch.'https://github.com/mozilla/cubeb-pulse-rs']
29
cubeb-pulse = { path = '/home/berke/workdir/www/zen-browser/work/cubeb-pulse-rs-4e3ea4bbc582705a4e7d9220679525283c035a7e' }
30
pulse = { path = '/home/berke/workdir/www/zen-browser/work/cubeb-pulse-rs-4e3ea4bbc582705a4e7d9220679525283c035a7e/pulse-rs' }
31
pulse-ffi = { path = '/home/berke/workdir/www/zen-browser/work/cubeb-pulse-rs-4e3ea4bbc582705a4e7d9220679525283c035a7e/pulse-ffi' }
32
[patch.'https://github.com/mozilla/cubeb-coreaudio-rs']
33
coreaudio-sys-utils = { path = '/home/berke/workdir/www/zen-browser/work/cubeb-coreaudio-rs-7b996ab09d0a57a2345cd1c4509f0a8491cd3d66/coreaudio-sys-utils' }
34
cubeb-coreaudio = { path = '/home/berke/workdir/www/zen-browser/work/cubeb-coreaudio-rs-7b996ab09d0a57a2345cd1c4509f0a8491cd3d66' }
35
[patch.'https://github.com/franziskuskiefer/cose-rust']
36
cose = { path = '/home/berke/workdir/www/zen-browser/work/cose-rust-43c22248d136c8b38fe42ea709d08da6355cf04b' }
37
[patch.'https://github.com/hsivonen/any_all_workaround']
38
any_all_workaround = { path = '/home/berke/workdir/www/zen-browser/work/any_all_workaround-7fb1b7034c9f172aade21ee1c8554e8d8a48af80' }
39
[patch.'https://github.com/erichdongubler-contrib/hashlink']
40
hashlink = { path = '/home/berke/workdir/www/zen-browser/work/hashlink-76dc47a12af5829c1e8bf4834e38b410dec2aeff' }
41
[patch.'https://github.com/mozilla/application-services']
42
context_id = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/context_id' }
43
error-support = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/error' }
44
error-support-macros = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/error/macros' }
45
filter_adult = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/filter_adult' }
46
firefox-versioning = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/firefox-versioning' }
47
init_rust_components = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/init_rust_components' }
48
interrupt-support = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/interrupt' }
49
jwcrypto = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/jwcrypto' }
50
logins = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/logins' }
51
nss = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/rc_crypto/nss' }
52
nss_build_common = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/rc_crypto/nss/nss_build_common' }
53
nss_sys = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/rc_crypto/nss/nss_sys' }
54
payload-support = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/payload' }
55
rc_crypto = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/rc_crypto' }
56
relevancy = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/relevancy' }
57
remote_settings = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/remote_settings' }
58
search = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/search' }
59
sql-support = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/sql' }
60
suggest = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/suggest' }
61
sync-guid = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/guid' }
62
sync15 = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/sync15' }
63
tabs = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/tabs' }
64
tracing-support = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/tracing' }
65
types = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/support/types' }
66
viaduct = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/viaduct' }
67
webext-storage = { path = '/home/berke/workdir/www/zen-browser/work/application-services-cd04a4d1a74294ab08434d7a5a8152d25d25e53c/components/webext-storage' }
68
[patch.'https://github.com/hsivonen/chardetng_c']
69
chardetng_c = { path = '/home/berke/workdir/www/zen-browser/work/chardetng_c-2f0aba284677d098de14f91ffe5a9e5b9a4922c2' }
70
[patch.'https://github.com/FirefoxGraphics/wpf-gpu-raster']
71
wpf-gpu-raster = { path = '/home/berke/workdir/www/zen-browser/work/wpf-gpu-raster-99979da091fd58fba8477e7fcdf5ec0727102916' }
72
[patch.'https://github.com/hsivonen/chardetng']
73
chardetng = { path = '/home/berke/workdir/www/zen-browser/work/chardetng-a07d20273ce36146adaf76bd667dd57bd7b3508b' }
74
[patch.'https://github.com/beurdouche/nss-gk-api']
75
nss-gk-api = { path = '/home/berke/workdir/www/zen-browser/work/nss-gk-api-e48a946811ffd64abc78de3ee284957d8d1c0d63' }
76
[patch.'https://github.com/jfkthame/mapped_hyph.git']
77
mapped_hyph = { path = '/home/berke/workdir/www/zen-browser/work/mapped_hyph-eff105f6ad7ec9b79816cfc1985a28e5340ad14b' }
78
[patch.'https://github.com/glandium/allocator-api2']
79
allocator-api2 = { path = '/home/berke/workdir/www/zen-browser/work/allocator-api2-ad5f3d56a5a4519eff52af4ff85293431466ef5c' }
80
[patch.'https://github.com/martinthomson/ohttp.git']
81
bhttp = { path = '/home/berke/workdir/www/zen-browser/work/ohttp-bf6a983845cc0b540effb3a615e92d914dfcfd0b/bhttp' }
82
ohttp = { path = '/home/berke/workdir/www/zen-browser/work/ohttp-bf6a983845cc0b540effb3a615e92d914dfcfd0b/ohttp' }
83
[patch.'https://github.com/beurdouche/mls-rs']
84
mls-rs = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs' }
85
mls-rs-codec = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-codec' }
86
mls-rs-codec-derive = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-codec-derive' }
87
mls-rs-core = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-core' }
88
mls-rs-crypto-hpke = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-crypto-hpke' }
89
mls-rs-crypto-nss = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-crypto-nss' }
90
mls-rs-crypto-traits = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-crypto-traits' }
91
mls-rs-identity-x509 = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-identity-x509' }
92
mls-rs-provider-sqlite = { path = '/home/berke/workdir/www/zen-browser/work/mls-rs-b747d7efb85a776b97ad8afa8d1b32893fa5efa3/mls-rs-provider-sqlite' }
93
[patch.'https://github.com/servo/unicode-bidi']
94
unicode-bidi = { path = '/home/berke/workdir/www/zen-browser/work/unicode-bidi-ca612daf1c08c53abe07327cb3e6ef6e0a760f0c' }
95
[patch.'https://github.com/servo/rust-cssparser']
96
cssparser = { path = '/home/berke/workdir/www/zen-browser/work/rust-cssparser-958a3f098acb92ddacdce18a7ef2c4a87ac3326f' }
97
cssparser-macros = { path = '/home/berke/workdir/www/zen-browser/work/rust-cssparser-958a3f098acb92ddacdce18a7ef2c4a87ac3326f/macros' }
98
[patch.'https://github.com/gfx-rs/wgpu']
99
naga = { path = '/home/berke/workdir/www/zen-browser/work/wgpu-6beea7c20df563883848933f70cdd0ea99fc7144/naga' }
100
wgpu-core = { path = '/home/berke/workdir/www/zen-browser/work/wgpu-6beea7c20df563883848933f70cdd0ea99fc7144/wgpu-core' }
101
wgpu-core-deps-apple = { path = '/home/berke/workdir/www/zen-browser/work/wgpu-6beea7c20df563883848933f70cdd0ea99fc7144/wgpu-core/platform-deps/apple' }
102
wgpu-core-deps-windows-linux-android = { path = '/home/berke/workdir/www/zen-browser/work/wgpu-6beea7c20df563883848933f70cdd0ea99fc7144/wgpu-core/platform-deps/windows-linux-android' }
103
wgpu-hal = { path = '/home/berke/workdir/www/zen-browser/work/wgpu-6beea7c20df563883848933f70cdd0ea99fc7144/wgpu-hal' }
104
wgpu-types = { path = '/home/berke/workdir/www/zen-browser/work/wgpu-6beea7c20df563883848933f70cdd0ea99fc7144/wgpu-types' }
105
[patch.'https://github.com/mozilla/mp4parse-rust']
106
mp4parse = { path = '/home/berke/workdir/www/zen-browser/work/mp4parse-rust-f955be5d2a04a631c0f1777d6f35370ea1a99e2d/mp4parse' }
107
mp4parse_capi = { path = '/home/berke/workdir/www/zen-browser/work/mp4parse-rust-f955be5d2a04a631c0f1777d6f35370ea1a99e2d/mp4parse_capi' }
(-)b/www/zen-browser/Makefile (+174 lines)
Added Link Here
1
PORTNAME=	zen-browser
2
DISTVERSION=	1.18.5b
3
CATEGORIES=	www wayland
4
MASTER_SITES=	https://github.com/zen-browser/desktop/releases/download/${DISTVERSION}/
5
DISTFILES=	zen.source.tar.zst
6
7
MAINTAINER=	berke.nar@proton.me	
8
COMMENT=	Zen Browser - Firefox-based privacy-focused browser
9
WWW=		https://zen-browser.app
10
11
LICENSE=	MPL20
12
13
BUILD_DEPENDS=	rust>=1.0:lang/rust \
14
		nspr>=4.32:devel/nspr \
15
		nss>=3.118:security/nss \
16
		libevent>=2.1.8:devel/libevent \
17
		harfbuzz>=10.1.0:print/harfbuzz \
18
		graphite2>=1.3.14:graphics/graphite2 \
19
		png>=1.6.45:graphics/png \
20
		dav1d>=1.0.0:multimedia/dav1d \
21
		libvpx>=1.15.0:multimedia/libvpx \
22
		${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \
23
		v4l_compat>0:multimedia/v4l_compat \
24
		nasm:devel/nasm \
25
		yasm:devel/yasm \
26
		zip:archivers/zip \
27
		${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a:devel/wasi-libcxx20 \
28
		${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc.a:devel/wasi-libc@20 \
29
		wasi-compiler-rt20>0:devel/wasi-compiler-rt20
30
31
LIB_DEPENDS=	libsndio.so:audio/sndio
32
33
USES=		tar:zst gmake python:3.11,build compiler:c17-lang \
34
		desktop-file-utils gl gnome localbase:ldflags pkgconfig
35
36
BINARY_ALIAS+=	python3=${PYTHON_CMD}
37
38
USE_GECKO=	gecko
39
USE_MOZILLA=	-sqlite
40
USE_GL=		gl
41
USE_GNOME=	cairo gdkpixbuf2 gtk30
42
43
WRKSRC=		${WRKDIR}
44
BUILD_WRKSRC=	${WRKSRC}/obj-x86_64-unknown-freebsd15.0
45
46
# Zen Browser is built on Firefox, so the compiled binary is named "firefox"
47
MOZILLA=	firefox
48
MOZILLA_BIN=	firefox-bin
49
ELF_FEATURES=	+wxneeded:dist/bin/firefox +wxneeded:dist/bin/firefox-bin
50
51
WASI_SYSROOT=	${LOCALBASE}/share/wasi-sysroot
52
53
LDFLAGS+=	-lpthread
54
55
CONFIGURE_ENV+=	RUSTC=${LOCALBASE}/bin/rustc \
56
		CARGO=${LOCALBASE}/bin/cargo \
57
		WASI_SYSROOT=${WASI_SYSROOT} \
58
		MOZCONFIG=${WRKSRC}/.mozconfig \
59
		LIBS="-lpthread" \
60
		PIP_NO_INDEX=1
61
62
MAKE_ENV+=	RUSTC=${LOCALBASE}/bin/rustc \
63
		CARGO=${LOCALBASE}/bin/cargo \
64
		RUSTUP_HOME=/nonexistent \
65
		CARGO_HOME=/nonexistent \
66
		MOZCONFIG=${WRKSRC}/.mozconfig \
67
		LIBS="-lpthread" \
68
		PIP_NO_INDEX=1 \
69
		PATH=${LOCALBASE}/bin:${LOCALBASE}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
70
71
post-extract:
72
	@if [ -f ${WRKSRC}/media/libcubeb/src/cubeb_alsa.c ]; then \
73
		${SED} -i '' '1s/^/#include <stdlib.h>\n/' ${WRKSRC}/media/libcubeb/src/cubeb_alsa.c; \
74
	fi
75
# Add FreeBSD support to all libwebrtc moz.build files (they only have OpenBSD)
76
	@${ECHO} "Adding FreeBSD to libwebrtc moz.build files..."
77
	@${FIND} ${WRKSRC}/third_party/libwebrtc -name 'moz.build' \
78
		-exec ${SED} -i '' \
79
		-e 's|CONFIG\["OS_TARGET"\] == "OpenBSD"|CONFIG["OS_TARGET"] == "OpenBSD" or CONFIG["OS_TARGET"] == "FreeBSD"|g' \
80
		{} \;
81
82
do-configure:
83
	@${RM} ${WRKSRC}/.mozconfig
84
# Application and Zen branding
85
	@${ECHO} "ac_add_options --enable-application=browser" >> ${WRKSRC}/.mozconfig
86
	@${ECHO} "ac_add_options --with-branding=browser/branding/release" >> ${WRKSRC}/.mozconfig
87
	@${ECHO} "ac_add_options --enable-release" >> ${WRKSRC}/.mozconfig
88
	@${ECHO} "ac_add_options --disable-updater" >> ${WRKSRC}/.mozconfig
89
	@${ECHO} "ac_add_options --disable-tests" >> ${WRKSRC}/.mozconfig
90
	@${ECHO} "ac_add_options --disable-debug" >> ${WRKSRC}/.mozconfig
91
	@${ECHO} "ac_add_options --disable-debug-symbols" >> ${WRKSRC}/.mozconfig
92
# Build toolchain
93
	@${ECHO} "ac_add_options --enable-linker=lld" >> ${WRKSRC}/.mozconfig
94
	@${ECHO} "ac_add_options --with-libclang-path=${LOCALBASE}/llvm${LLVM_VERSION}/lib" >> ${WRKSRC}/.mozconfig
95
	@${ECHO} "ac_add_options --with-wasi-sysroot=${WASI_SYSROOT}" >> ${WRKSRC}/.mozconfig
96
# System libraries
97
	@${ECHO} "ac_add_options --with-system-nspr" >> ${WRKSRC}/.mozconfig
98
	@${ECHO} "ac_add_options --with-system-nss" >> ${WRKSRC}/.mozconfig
99
	@${ECHO} "ac_add_options --with-system-libevent" >> ${WRKSRC}/.mozconfig
100
	@${ECHO} "ac_add_options --with-system-jpeg=${LOCALBASE}" >> ${WRKSRC}/.mozconfig
101
	@${ECHO} "ac_add_options --with-system-png" >> ${WRKSRC}/.mozconfig
102
	@${ECHO} "ac_add_options --with-system-libvpx" >> ${WRKSRC}/.mozconfig
103
	@${ECHO} "ac_add_options --with-system-webp" >> ${WRKSRC}/.mozconfig
104
	@${ECHO} "ac_add_options --with-system-pixman" >> ${WRKSRC}/.mozconfig
105
# Audio/media
106
	@${ECHO} "ac_add_options --enable-sndio" >> ${WRKSRC}/.mozconfig
107
	@${ECHO} "ac_add_options --enable-webrtc" >> ${WRKSRC}/.mozconfig
108
	@${ECHO} "ac_add_options --enable-jemalloc" >> ${WRKSRC}/.mozconfig
109
# Exports
110
	@${ECHO} "export LDFLAGS='${LDFLAGS}'" >> ${WRKSRC}/.mozconfig
111
	@${ECHO} "export LIBS='-lpthread'" >> ${WRKSRC}/.mozconfig
112
	@${ECHO} "mk_add_options MOZ_MAKE_FLAGS='-j${MAKE_JOBS_NUMBER}'" >> ${WRKSRC}/.mozconfig
113
	@${ECHO} "mk_add_options MOZ_OBJDIR=${BUILD_WRKSRC}" >> ${WRKSRC}/.mozconfig
114
	cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} ${WRKSRC}/mach configure
115
116
do-build:
117
	cd ${WRKSRC} && \
118
	${SED} -e '/#ifndef/,/#endif/d' \
119
		-e 's/@REPLACE_NAME@/vendored-sources/g' \
120
		-e 's|@top_srcdir@|${WRKSRC}|g' \
121
		-e 's|@VENDORED_DIRECTORY@|third_party/rust|g' \
122
		.cargo/config.toml.in > .cargo/config.toml && \
123
	${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${WRKSRC}/mach build
124
125
MOZILLA_OBJDIR=	${BUILD_WRKSRC}
126
DISTDIR_BUILD=	${MOZILLA_OBJDIR}/dist/bin
127
128
do-install:
129
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}
130
# Copy dist/bin, resolving symlinks to real files (-L follows symlinks)
131
	cd ${DISTDIR_BUILD} && \
132
		${CP} -RLp . ${STAGEDIR}${PREFIX}/lib/${PORTNAME}
133
# Remove any remaining dangling symlinks
134
	@${FIND} ${STAGEDIR}${PREFIX}/lib/${PORTNAME} -type l ! -exec test -e {} \; -delete 2>/dev/null || true
135
# Remove empty directories left over from build tree
136
	@${FIND} ${STAGEDIR}${PREFIX}/lib/${PORTNAME} -type d -empty -delete 2>/dev/null || true
137
# Fix permissions on executables and shared libraries
138
	${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/${MOZILLA}
139
	${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/${MOZILLA_BIN}
140
	${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/plugin-container
141
	-${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/pingsender
142
	-${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/glxtest
143
	-${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/vaapitest
144
	${FIND} ${STAGEDIR}${PREFIX}/lib/${PORTNAME} -name '*.so' -exec ${CHMOD} +x {} \;
145
# Create wrapper script
146
	${MKDIR} ${STAGEDIR}${PREFIX}/bin
147
	@${ECHO} '#!/bin/sh' > ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
148
	@${ECHO} 'export LD_LIBRARY_PATH=${PREFIX}/lib/${PORTNAME}' >> ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
149
	@${ECHO} 'exec ${PREFIX}/lib/${PORTNAME}/${MOZILLA} "$$@"' >> ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
150
	${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
151
# Install .desktop file
152
	${MKDIR} ${STAGEDIR}${PREFIX}/share/applications
153
	@${ECHO} '[Desktop Entry]' > ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
154
	@${ECHO} 'Type=Application' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
155
	@${ECHO} 'Name=Zen Browser' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
156
	@${ECHO} 'Comment=Web Browser' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
157
	@${ECHO} 'Exec=${PORTNAME} %u' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
158
	@${ECHO} 'Icon=${PORTNAME}' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
159
	@${ECHO} 'Terminal=false' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
160
	@${ECHO} 'Categories=Network;WebBrowser;' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
161
	@${ECHO} 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
162
	@${ECHO} 'StartupNotify=true' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
163
	@${ECHO} 'StartupWMClass=zen-browser' >> ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
164
# Install icon
165
	${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps
166
	if [ -f ${DISTDIR_BUILD}/browser/chrome/icons/default/default128.png ]; then \
167
		${CP} ${DISTDIR_BUILD}/browser/chrome/icons/default/default128.png \
168
			${STAGEDIR}${PREFIX}/share/pixmaps/${PORTNAME}.png; \
169
	elif [ -f ${DISTDIR_BUILD}/browser/chrome/icons/default/default48.png ]; then \
170
		${CP} ${DISTDIR_BUILD}/browser/chrome/icons/default/default48.png \
171
			${STAGEDIR}${PREFIX}/share/pixmaps/${PORTNAME}.png; \
172
	fi
173
174
.include <bsd.port.mk>
(-)b/www/zen-browser/Makefile.options (+15 lines)
Added Link Here
1
# -*- makefile-bsdmake -*-
2
3
OPTIONS_DEFINE+= 	CANBERRA DBUS DEBUG FFMPEG \
4
			LIBPROXY LTO OPTIMIZED_CFLAGS PROFILE TEST
5
6
OPTIONS_DEFAULT+=	DBUS FFMPEG OPTIMIZED_CFLAGS PROFILE \
7
			${OPTIONS_GROUP_AUDIO:NALSA}
8
9
OPTIONS_GROUP+=		AUDIO
10
OPTIONS_GROUP_AUDIO=	ALSA JACK PULSEAUDIO SNDIO
11
12
AUDIO_DESC?=		Extra cubeb audio backends (OSS is always available)
13
CANBERRA_DESC?=		Sound theme alerts
14
LIBPROXY_DESC?=		Proxy support via libproxy
15
LIGHTNING_DESC?=	Calendar extension
(-)b/www/zen-browser/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1770497509
2
SHA256 (zen.source.tar.zst) = e14afc1a552e187becffcb55274a60c452b1fd027e40cc70d9c9d85283372660
3
SIZE (zen.source.tar.zst) = 931480184
(-)b/www/zen-browser/files/PATCHES.md (+240 lines)
Added Link Here
1
# Memory Allocation Patch Reference
2
3
This document provides a detailed reference for each memory allocation patch in the FreeBSD Zen Browser port.
4
5
## Patch Overview
6
7
| Patch File | Target | Purpose |
8
|------------|--------|---------|
9
| `patch-memory_build_Fallback.cpp` | `memory/build/Fallback.cpp` | Include malloc_np.h and define HAVE_MEMALIGN |
10
| `patch-memory_build_mozjemalloc.cpp` | `memory/build/mozjemalloc.cpp` | Remove noexcept(true) and disable RTLD_DEEPBIND |
11
| `patch-memory_build_mozmemory.h` | `memory/build/mozmemory.h` | Conditional noexcept removal |
12
| `patch-memory_build_mozmemory__wrap.cpp` | `memory/build/mozmemory_wrap.cpp` | Adapt wrapper declarations |
13
| `patch-memory_mozalloc_mozalloc.cpp` | `memory/mozalloc/mozalloc.cpp` | Provide memalign() for non-jemalloc builds |
14
| `patch-memory_mozalloc_mozalloc.h` | `memory/mozalloc/mozalloc.h` | Remove noexcept from mozalloc API |
15
16
## Detailed Patch Analysis
17
18
### patch-memory_build_Fallback.cpp
19
20
**Purpose:** Enable the fallback memory allocator to work on FreeBSD
21
22
**Changes:**
23
```cpp
24
+#ifdef __FreeBSD__
25
+#  include <malloc_np.h>
26
+#  define HAVE_MEMALIGN 1
27
+#endif
28
```
29
30
**Rationale:**
31
- Includes FreeBSD's non-portable malloc extensions (`malloc_np.h`)
32
- Defines `HAVE_MEMALIGN` to indicate memalign is available (via our wrapper)
33
- Used when system allocator is preferred over jemalloc
34
35
### patch-memory_build_mozjemalloc.cpp
36
37
**Purpose:** Adapt Mozilla's jemalloc for FreeBSD
38
39
**Changes:**
40
1. Remove `noexcept(true)` from malloc declarations:
41
```cpp
42
+#if defined(__FreeBSD__)
43
+#define NOTHROW_MALLOC_DECL(...) \
44
+  MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (, __VA_ARGS__))
45
+#else
46
 #define NOTHROW_MALLOC_DECL(...) \
47
   MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (noexcept(true), __VA_ARGS__))
48
+#endif
49
```
50
51
2. Disable RTLD_DEEPBIND usage:
52
```cpp
53
-#elif defined(RTLD_DEEPBIND)
54
+#elif defined(RTLD_DEEPBIND) && !defined(__FreeBSD__)
55
```
56
57
**Rationale:**
58
- FreeBSD's C++ ABI handles exception specifications differently
59
- `noexcept(true)` can cause ABI compatibility issues
60
- `RTLD_DEEPBIND` is not available on FreeBSD
61
- These changes allow jemalloc to compile without ABI mismatches
62
63
### patch-memory_build_mozmemory.h
64
65
**Purpose:** Adapt memory API declarations for FreeBSD
66
67
**Changes:**
68
```cpp
69
+#if defined(__FreeBSD__)
70
+#define NOTHROW_MALLOC_DECL(name, return_type, ...) \
71
+  MOZ_JEMALLOC_API return_type name(__VA_ARGS__);
72
+#else
73
 #define NOTHROW_MALLOC_DECL(name, return_type, ...) \
74
   MOZ_JEMALLOC_API return_type name(__VA_ARGS__) noexcept(true);
75
+#endif
76
```
77
78
**Rationale:**
79
- Removes `noexcept(true)` from public API declarations on FreeBSD
80
- Ensures API declarations match implementation (from mozjemalloc.cpp)
81
- Prevents linker errors due to name mangling differences
82
83
### patch-memory_build_mozmemory__wrap.cpp
84
85
**Purpose:** Adapt memory function wrappers for FreeBSD
86
87
**Changes:**
88
```cpp
89
+#if defined(__FreeBSD__)
90
+#define NOTHROW_MALLOC_DECL(name, return_type, ...) \
91
+  MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
92
+#else
93
 #define NOTHROW_MALLOC_DECL(name, return_type, ...) \
94
   MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__) noexcept(true);
95
+#endif
96
```
97
98
**Rationale:**
99
- Wrapper functions use `_impl` suffix internally
100
- Must match exception specifications with actual implementations
101
- Prevents wrapper/implementation ABI mismatches
102
103
### patch-memory_mozalloc_mozalloc.cpp
104
105
**Purpose:** Provide memalign() for builds without jemalloc
106
107
**Changes:**
108
```cpp
109
+#  if defined(__FreeBSD__)
110
+#    include <malloc_np.h>
111
+extern "C" void* memalign(size_t boundary, size_t size) {
112
+  void* ptr = nullptr;
113
+  if (posix_memalign(&ptr, boundary, size) != 0) {
114
+    return nullptr;
115
+  }
116
+  return ptr;
117
+}
118
+#  endif
119
```
120
121
**Rationale:**
122
- When `MOZ_MEMORY` is not defined (jemalloc disabled), need system memalign
123
- FreeBSD doesn't have native memalign(), so we provide a wrapper
124
- Uses `posix_memalign()` which is POSIX standard and available on FreeBSD
125
- Includes `malloc_np.h` for other memory functions needed by mozalloc
126
127
### patch-memory_mozalloc_mozalloc.h
128
129
**Purpose:** Adapt mozalloc API declarations for FreeBSD
130
131
**Changes:**
132
```cpp
133
+#  if defined(__FreeBSD__)
134
+#    define NOTHROW_MALLOC_DECL(name, return_type, ...) \
135
+      MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
136
+#  else
137
 #  define NOTHROW_MALLOC_DECL(name, return_type, ...) \
138
     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__) noexcept(true);
139
+#  endif
140
```
141
142
**Rationale:**
143
- Ensures mozalloc header declarations match implementation
144
- Removes `noexcept(true)` to match FreeBSD ABI requirements
145
- Used by code that includes mozalloc.h
146
147
## Patch Application Order
148
149
Patches are applied in filename alphabetical order by the Makefile:
150
151
1. Fallback.cpp - Sets up fallback allocator
152
2. mozjemalloc.cpp - Core jemalloc implementation
153
3. mozmemory.h - API declarations
154
4. mozmemory_wrap.cpp - Wrapper implementations
155
5. mozalloc_mozalloc.cpp - Alternative allocator implementation
156
6. mozalloc_mozalloc.h - Alternative allocator API
157
158
The order generally doesn't matter since patches target different files, but this ordering is logical (core → API → wrappers → alternatives).
159
160
## Testing Patch Application
161
162
Use the provided verification script:
163
164
```bash
165
cd files
166
./verify_patches.sh
167
```
168
169
This checks:
170
- Proper patch format (unified diff)
171
- No build artifacts in patches
172
- Presence of diff hunks
173
174
## Common Issues and Solutions
175
176
### Issue: Patch Fails to Apply
177
178
**Symptom:** `patch: malformed patch at line N`
179
180
**Solution:**
181
- Check that patch has proper `---` and `+++` headers
182
- Ensure patch is in unified diff format (`diff -u` or `git diff`)
183
- Verify line endings are Unix-style (LF, not CRLF)
184
- Check context lines match the source file
185
186
### Issue: Build Errors After Patching
187
188
**Symptom:** Compilation fails with undefined symbols
189
190
**Solution:**
191
- Ensure wrapper headers (malloc.h, etc.) are in place
192
- Verify `CPPFLAGS += -I${FILESDIR}` in Makefile
193
- Check that all memory patches are applied
194
- Confirm FreeBSD system has malloc_np.h
195
196
### Issue: Runtime Memory Corruption
197
198
**Symptom:** Segfaults or malloc errors during execution
199
200
**Solution:**
201
- Verify memalign() wrapper correctly implements alignment
202
- Check that malloc_usable_size() is from malloc_np.h
203
- Test with `test_malloc_wrapper.c`
204
- Run with malloc debugging: `MALLOC_OPTIONS=AJ ./zen-bin`
205
206
## Version Compatibility
207
208
These patches are designed for:
209
- FreeBSD 13.x and later
210
- Mozilla/Gecko-based browsers (Firefox 100+)
211
- Zen Browser 1.17.x
212
213
Adjustments may be needed for:
214
- Older FreeBSD versions (pre-13.0)
215
- Significantly different Mozilla versions
216
- Other BSD variants (OpenBSD, NetBSD, DragonflyBSD)
217
218
## Contributing Patches
219
220
When creating new memory-related patches:
221
222
1. **Identify the issue** - Understand what fails and why
223
2. **Minimal changes** - Only modify what's necessary
224
3. **Test thoroughly** - Build and run tests
225
4. **Document** - Explain the rationale
226
5. **Follow format** - Use unified diff with `-p0` format
227
228
Example patch creation:
229
```bash
230
cd work/
231
cp path/to/file.cpp path/to/file.cpp.orig
232
# Edit file.cpp
233
diff -u path/to/file.cpp.orig path/to/file.cpp > ../files/patch-path_to_file.cpp
234
```
235
236
## See Also
237
238
- [MEMORY_ALLOCATION.md](../MEMORY_ALLOCATION.md) - High-level architecture
239
- [README.md](README.md) - Wrapper headers documentation
240
- [FreeBSD Porter's Handbook](https://docs.freebsd.org/en/books/porters-handbook/)
(-)b/www/zen-browser/files/README-FREEBSD.md (+67 lines)
Added Link Here
1
# FreeBSD Port & Build Notes ✅
2
3
**Configure phase summary:**
4
5
- Uses Mozilla's Python-based configure system (`configure.py`) and branding script `browser/branding/unofficial/configure.sh`.
6
- Git-based version control detected; no cross-compilation in observed run.
7
- Rust is required at configure-time (not only at build-time).
8
9
**Mach command mapping (FreeBSD port equivalents):**
10
11
| mach command | Purpose | FreeBSD port target |
12
|---|---|---|
13
| `mach configure` | Run configuration | `do-configure` |
14
| `mach build` | Compile the browser | `do-build` |
15
| `mach install` | Install binaries | `do-install` |
16
| `mach package` | Create distribution package | Post-build packaging |
17
18
**Key configuration options observed:**
19
20
- Audio backends: **ALSA, JACK, PulseAudio, sndio (BSD)**, OSS
21
- WebRTC support: `--enable-webrtc`
22
- WASM sandboxing control: `--without-wasm-sandboxed-libraries`
23
- Telemetry toggle: `--disable-telemetry`
24
- LTO/PGO optimization flags and Rust/LLVM integration options
25
- Supports `--with-system-*` for system libraries (zlib, icu, nspr, av1, libvpx, etc.)
26
27
**Critical findings:**
28
29
- The project uses Mozilla's mach architecture (same as Firefox) — port logic maps cleanly to mach actions.
30
- Rust must be available during configuration as well as build.
31
- System library flags (`--with-system-*`) are respected and useful for port packaging.
32
- A FreeBSD-native audio backend (`sndio`) is already supported.
33
34
**System dependency mapping:**
35
36
| Requirement | Minimum / Note | FreeBSD Port | Purpose |
37
|---|---:|---|---|
38
| Git | Any | `devel/git` | Version control, submodules |
39
| Python | 3.x | `lang/python311` | Mach build scripts, automation |
40
| Node.js | 21+ | `www/node21` | npm dependency management |
41
| Rust | Latest | `lang/rust` | Compilation of Rust components |
42
| sccache | Optional | `devel/sccache` | Build artifact caching |
43
44
**Extended build requirements (from Firefox patterns):**
45
46
- `nspr>=4.32` (`devel/nspr`)
47
- `nss>=3.118` (`security/nss`)
48
- `icu>=76.1` (`devel/icu`)
49
- `libevent>=2.1.8` (`devel/libevent`)
50
- `harfbuzz>=10.1.0` (`print/harfbuzz`)
51
- `graphite2>=1.3.14` (`graphics/graphite2`)
52
- `png>=1.6.45` (`graphics/png`)
53
- `dav1d>=1.0.0` (`multimedia/dav1d`)
54
- `libvpx>=1.15.0` (`multimedia/libvpx`)
55
- `sqlite3` (`databases/sqlite3`)
56
- `nasm`, `yasm` (assemblers)
57
- `zip` (packaging)
58
59
**Audio backend options (port notes):**
60
61
- `--enable-sndio`: FreeBSD-native audio (recommended for ports)
62
- `--enable-alsa`: Linux-only; requires compatibility patches on FreeBSD
63
- `--disable-pulseaudio`: Useful to avoid optional network audio dependency
64
65
---
66
67
*This file was added automatically to document observed configuration output and FreeBSD port notes. If you prefer the content merged into `files/README.md`, tell me and I will try again to patch it in place.*
(-)b/www/zen-browser/files/README.md (+128 lines)
Added Link Here
1
# FreeBSD Compatibility Wrappers for Mozilla/Zen Browser
2
3
## Overview
4
5
This directory contains compatibility wrappers and patches to enable Mozilla Firefox/Zen Browser code (which targets glibc) to compile and run on FreeBSD (which uses BSD libc).
6
7
## Memory Allocation Compatibility
8
9
### The Problem
10
11
Mozilla's code (originally developed for Linux/glibc) uses memory allocation functions and conventions that differ from FreeBSD's libc:
12
13
1. **`memalign()` function**: 
14
   - glibc provides `memalign(alignment, size)`
15
   - FreeBSD only provides the POSIX `posix_memalign(ptr, alignment, size)` interface
16
17
2. **`malloc_usable_size()` function**:
18
   - glibc: Available in `<malloc.h>`
19
   - FreeBSD: Available in `<malloc_np.h>` (non-portable extensions)
20
21
3. **C++ ABI differences**:
22
   - `noexcept(true)` specifier not compatible with FreeBSD's C++ ABI in certain contexts
23
24
### The Solution: Wrapper Headers
25
26
We use preprocessor include path priority (`CPPFLAGS += -I${FILESDIR}`) to inject compatibility wrappers:
27
28
#### `malloc.h` - Memory Allocation Wrapper
29
- Includes FreeBSD's `<malloc_np.h>` to get `malloc_usable_size()`
30
- Provides inline `memalign()` wrapper that calls `posix_memalign()`
31
- Enables Mozilla code to use glibc-style APIs seamlessly
32
33
#### `endian.h` - Endianness Wrapper
34
- Redirects glibc's `<endian.h>` to BSD's `<sys/endian.h>`
35
36
#### `byteswap.h` - Byte Swapping Wrapper
37
- Maps glibc's `bswap_16/32/64` to BSD's `bswap16/32/64`
38
- Handles OpenBSD's `swap*` variants as well
39
40
## Mozilla Memory Subsystem Patches
41
42
### Core Memory Patches
43
44
1. **`patch-memory_build_mozjemalloc.cpp`**
45
   - Removes `noexcept(true)` from malloc declarations on FreeBSD
46
   - Disables `RTLD_DEEPBIND` usage (not available on FreeBSD)
47
48
2. **`patch-memory_build_mozmemory.h`**
49
   - Conditionally removes `noexcept(true)` from memory API declarations
50
51
3. **`patch-memory_build_mozmemory__wrap.cpp`**
52
   - Adapts memory wrapper to FreeBSD's C++ ABI
53
54
4. **`patch-memory_build_Fallback.cpp`**
55
   - Includes `<malloc_np.h>` on FreeBSD
56
   - Defines `HAVE_MEMALIGN` to use our wrapper
57
58
5. **`patch-memory_mozalloc_mozalloc.cpp`**
59
   - Provides `memalign()` wrapper for non-jemalloc builds
60
   - Includes `<malloc_np.h>` for malloc_usable_size
61
62
6. **`patch-memory_mozalloc_mozalloc.h`**
63
   - Removes `noexcept(true)` from mozalloc API on FreeBSD
64
65
### Why Multiple Patches?
66
67
Mozilla has multiple memory allocator configurations:
68
- **jemalloc enabled** (default): Uses Mozilla's jemalloc
69
- **jemalloc disabled**: Falls back to system allocator
70
- **Static runtime**: Different symbol resolution
71
72
Each configuration needs FreeBSD-specific adaptations.
73
74
## Build System Integration
75
76
The Makefile enables these wrappers via:
77
78
```make
79
CPPFLAGS += -I${FILESDIR}
80
```
81
82
This ensures our wrapper headers are found **before** system headers, allowing us to intercept and adapt glibc-specific includes.
83
84
## Testing
85
86
### Unit Test
87
88
A test program is provided in `test_malloc_wrapper.c` to verify the wrappers work correctly.
89
90
**On FreeBSD:**
91
```bash
92
cd files
93
cc -I. test_malloc_wrapper.c -o test_malloc_wrapper
94
./test_malloc_wrapper
95
```
96
97
**On Linux (for comparison):**
98
```bash
99
cd files
100
cc test_malloc_wrapper.c -o test_malloc_wrapper
101
./test_malloc_wrapper
102
```
103
104
The test verifies:
105
1. `memalign()` works with various alignment values (8, 16, 32, 64, 128, 256 bytes)
106
2. Returned pointers are properly aligned
107
3. `malloc_usable_size()` returns reasonable values
108
4. Allocated memory is readable and writable
109
110
### Integration Testing
111
112
After applying these patches:
113
1. Mozilla's jemalloc should build with FreeBSD compatibility
114
2. Memory allocation functions work transparently
115
3. No runtime memory corruption or leaks
116
117
You can verify the build with:
118
```bash
119
make clean
120
make configure
121
make build
122
```
123
124
## References
125
126
- FreeBSD malloc_np.h: Non-portable malloc extensions
127
- Mozilla jemalloc: memory/build/
128
- POSIX memalign: https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
(-)b/www/zen-browser/files/byteswap.h (+24 lines)
Added Link Here
1
/*
2
 * glibc byteswap.h compatibility wrapper for FreeBSD
3
 * 
4
 * Provides glibc-style byte swapping function names (bswap_16, bswap_32, bswap_64)
5
 * by mapping them to FreeBSD's native functions (bswap16, bswap32, bswap64)
6
 * or OpenBSD's swap* functions.
7
 */
8
9
#ifndef _BYTESWAP_H
10
#define _BYTESWAP_H
11
12
#include <sys/endian.h>
13
14
#ifdef __OpenBSD__
15
#define bswap_16(x)	swap16(x)
16
#define bswap_32(x)	swap32(x)
17
#define bswap_64(x)	swap64(x)
18
#else
19
/* FreeBSD, NetBSD, and other BSD variants use bswap* naming */
20
#define bswap_16(x)	bswap16(x)
21
#define bswap_32(x)	bswap32(x)
22
#define bswap_64(x)	bswap64(x)
23
#endif
24
#endif /* _BYTESWAP_H */
(-)b/www/zen-browser/files/check_patches.sh (+101 lines)
Added Link Here
1
#!/bin/sh
2
#
3
# check_patches.sh - Check if FreeBSD patches are applied to the source tree
4
#
5
# Usage: ./check_patches.sh [work_directory]
6
#
7
# Returns:
8
#   0 - All patches need to be applied (none applied yet)
9
#   1 - Some or all patches already applied
10
#
11
12
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
13
WORK_DIR="${1:-$(dirname "$SCRIPT_DIR")/work}"
14
15
if [ ! -d "$WORK_DIR" ]; then
16
    echo "ERROR: Work directory not found: $WORK_DIR"
17
    echo "Usage: $0 [work_directory]"
18
    exit 2
19
fi
20
21
echo "=== FreeBSD Patch Status Check ==="
22
echo "Patch directory: $SCRIPT_DIR"
23
echo "Work directory:  $WORK_DIR"
24
echo ""
25
26
APPLIED=0
27
NOT_APPLIED=0
28
FAILED=0
29
30
for patch in "$SCRIPT_DIR"/patch-*; do
31
    [ -f "$patch" ] || continue
32
    
33
    patch_name="$(basename "$patch")"
34
    
35
    # Extract the target file path from the patch header
36
    # Unified diff format: --- path/to/file.orig or --- a/path/to/file
37
    target_file=$(grep -m1 '^--- ' "$patch" | sed -E 's/^--- (a\/)?//; s/\.orig.*//; s/[[:space:]].*//')
38
    
39
    if [ -z "$target_file" ]; then
40
        echo "⚠️  $patch_name: Cannot determine target file"
41
        FAILED=$((FAILED + 1))
42
        continue
43
    fi
44
    
45
    full_path="$WORK_DIR/$target_file"
46
    
47
    if [ ! -f "$full_path" ]; then
48
        echo "❓ $patch_name: Target file not found: $target_file"
49
        FAILED=$((FAILED + 1))
50
        continue
51
    fi
52
    
53
    # Check if .orig file exists (indicates patch was applied by FreeBSD ports)
54
    if [ -f "${full_path}.orig" ]; then
55
        echo "✅ $patch_name: APPLIED (${target_file}.orig exists)"
56
        APPLIED=$((APPLIED + 1))
57
        continue
58
    fi
59
    
60
    # Try to apply the patch in dry-run mode
61
    # If it applies cleanly, the patch hasn't been applied yet
62
    # If it fails or reverses, the patch is already applied
63
    result=$(patch -d "$WORK_DIR" -p0 --dry-run < "$patch" 2>&1)
64
    exit_code=$?
65
    
66
    if echo "$result" | grep -q "Reversed (or previously applied)"; then
67
        echo "✅ $patch_name: APPLIED (patch reversed/already applied)"
68
        APPLIED=$((APPLIED + 1))
69
    elif echo "$result" | grep -q "FAILED\|malformed\|can't find file"; then
70
        echo "⚠️  $patch_name: FAILED to check - $target_file"
71
        echo "   Reason: $(echo "$result" | grep -E 'FAILED|malformed|can.t find' | head -1)"
72
        FAILED=$((FAILED + 1))
73
    elif [ $exit_code -eq 0 ]; then
74
        echo "❌ $patch_name: NOT APPLIED - $target_file"
75
        NOT_APPLIED=$((NOT_APPLIED + 1))
76
    else
77
        echo "⚠️  $patch_name: UNKNOWN status - $target_file"
78
        FAILED=$((FAILED + 1))
79
    fi
80
done
81
82
echo ""
83
echo "=== Summary ==="
84
echo "Applied:     $APPLIED"
85
echo "Not Applied: $NOT_APPLIED"
86
echo "Failed/Unknown: $FAILED"
87
echo ""
88
89
if [ $APPLIED -gt 0 ] && [ $NOT_APPLIED -eq 0 ]; then
90
    echo "Status: All patches are already applied."
91
    exit 1
92
elif [ $NOT_APPLIED -gt 0 ] && [ $APPLIED -eq 0 ]; then
93
    echo "Status: No patches applied yet. Ready to patch."
94
    exit 0
95
elif [ $APPLIED -gt 0 ] && [ $NOT_APPLIED -gt 0 ]; then
96
    echo "Status: MIXED - Some patches applied, some not. Consider 'make clean' first."
97
    exit 1
98
else
99
    echo "Status: Unable to determine patch status."
100
    exit 2
101
fi
(-)b/www/zen-browser/files/endian.h (+11 lines)
Added Link Here
1
/*
2
 * glibc endian.h compatibility wrapper for FreeBSD
3
 * 
4
 * glibc uses <endian.h> while BSD systems use <sys/endian.h>
5
 * This wrapper redirects to the BSD system header
6
 */
7
8
#ifndef _ENDIAN_H
9
#define	_ENDIAN_H
10
#include <sys/endian.h>
11
#endif /* _ENDIAN_H */
(-)b/www/zen-browser/files/malloc.h (+43 lines)
Added Link Here
1
/*
2
 * glibc malloc.h compatibility wrapper for FreeBSD
3
 *
4
 * This wrapper provides glibc-style memory allocation functions
5
 * for FreeBSD's libc, enabling Mozilla/Firefox code to compile
6
 * without modifications.
7
 *
8
 * Key differences handled:
9
 * - memalign() -> posix_memalign() wrapper
10
 * - malloc_usable_size() from malloc_np.h
11
 */
12
13
#ifndef _MALLOC_H
14
#define _MALLOC_H
15
16
#include <stdlib.h>
17
18
#ifdef __FreeBSD__
19
#include <malloc_np.h>
20
21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24
25
/*
26
 * memalign() wrapper for FreeBSD
27
 * glibc provides memalign() but FreeBSD only has posix_memalign()
28
 * This wrapper translates the glibc interface to FreeBSD's POSIX interface
29
 */
30
inline void* memalign(size_t alignment, size_t size) {
31
    void* ptr = NULL;
32
    if (posix_memalign(&ptr, alignment, size) != 0) {
33
        return NULL;
34
    }
35
    return ptr;
36
}
37
38
#ifdef __cplusplus
39
}
40
#endif
41
42
#endif /* __FreeBSD__ */
43
#endif /* _MALLOC_H */
(-)b/www/zen-browser/files/mozconfig (+29 lines)
Added Link Here
1
# FreeBSD Zen Browser mozconfig
2
# This file ensures configuration options are properly applied
3
4
ac_add_options --enable-application=browser
5
ac_add_options --enable-sndio
6
ac_add_options --enable-webrtc
7
ac_add_options --enable-release
8
ac_add_options --enable-jemalloc
9
ac_add_options --enable-linker=lld
10
11
# System libraries
12
ac_add_options --with-system-icu
13
ac_add_options --with-system-nspr
14
ac_add_options --with-system-nss
15
ac_add_options --with-system-av1
16
ac_add_options --with-system-libdrm
17
ac_add_options --with-system-pipewire
18
19
# Disable features that may cause issues
20
ac_add_options --disable-tests
21
ac_add_options --disable-debug
22
ac_add_options --disable-updater
23
24
# FreeBSD-specific: ensure pthread linking
25
export LDFLAGS="-lpthread ${LDFLAGS}"
26
export LIBS="-lpthread"
27
28
# Optimize build
29
mk_add_options MOZ_MAKE_FLAGS="-j${MAKE_JOBS_NUMBER}"
(-)b/www/zen-browser/files/patch-browser_extensions_newtab_mach__commands.py (+17 lines)
Added Link Here
1
--- browser/extensions/newtab/mach_commands.py.orig	2025-02-06 00:00:00 UTC
2
+++ browser/extensions/newtab/mach_commands.py
3
@@ -38,8 +38,12 @@ sys.path.append(
4
 )
5
 WEBEXT_METRICS_PATH = Path("browser", "extensions", "newtab", "webext-glue", "metrics")
6
 sys.path.append(str(WEBEXT_METRICS_PATH.absolute()))
7
-import glean_utils
8
-from run_glean_parser import parse_with_options
9
+try:
10
+    import glean_utils
11
+    from run_glean_parser import parse_with_options
12
+except ImportError:
13
+    glean_utils = None
14
+    parse_with_options = None
15
 
16
 FIREFOX_L10N_REPO = "https://github.com/mozilla-l10n/firefox-l10n.git"
17
 FLUENT_FILE = "newtab.ftl"
(-)b/www/zen-browser/files/patch-dom_media_webrtc_libwebrtc__overrides_moz.build (+11 lines)
Added Link Here
1
--- dom/media/webrtc/libwebrtc_overrides/moz.build.orig	2026-02-07 00:00:00.000000000 +0000
2
+++ dom/media/webrtc/libwebrtc_overrides/moz.build	2026-02-07 00:00:00.000000000 +0000
3
@@ -49,7 +49,7 @@
4
     "call/call_basic_stats.cc",
5
 ]
6
 
7
-if CONFIG["OS_TARGET"] == "OpenBSD":
8
+if CONFIG["OS_TARGET"] in ("OpenBSD", "FreeBSD"):
9
     CXXFLAGS += CONFIG["MOZ_X11_CFLAGS"]
10
     UNIFIED_SOURCES += [
11
         "modules/desktop_capture/linux/x11/x_error_trap.cc",
(-)b/www/zen-browser/files/patch-memory_build_Fallback.cpp (+14 lines)
Added Link Here
1
--- memory/build/Fallback.cpp.orig	2025-01-01 00:00:00.000000000 +0000
2
+++ memory/build/Fallback.cpp	2025-01-01 00:00:00.000000000 +0000
3
@@ -6,6 +6,11 @@
4
 
5
 #include "mozmemory.h"
6
 #include "mozjemalloc.h"
7
+#ifdef __FreeBSD__
8
+#  include <malloc_np.h>
9
+#  define HAVE_MEMALIGN 1
10
+#endif
11
+
12
 #include <stdlib.h>
13
 
14
 #ifndef HAVE_MEMALIGN
(-)b/www/zen-browser/files/patch-memory_build_mozjemalloc.cpp (+27 lines)
Added Link Here
1
--- memory/build/mozjemalloc.cpp.orig	2025-01-01 00:00:00.000000000 +0000
2
+++ memory/build/mozjemalloc.cpp	2025-01-01 00:00:00.000000000 +0000
3
@@ -5103,8 +5103,14 @@
4
                          ##__VA_ARGS__)
5
 #endif
6
 
7
+#if defined(__FreeBSD__)
8
+#define NOTHROW_MALLOC_DECL(...) \
9
+  MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (, __VA_ARGS__))
10
+#else
11
 #define NOTHROW_MALLOC_DECL(...) \
12
   MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (noexcept(true), __VA_ARGS__))
13
+#endif
14
+
15
 #define MALLOC_DECL(...) \
16
   MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (, __VA_ARGS__))
17
 #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC
18
@@ -5139,7 +5145,7 @@
19
 MOZ_EXPORT void* (*__realloc_hook)(void*, size_t) = realloc_impl;
20
 MOZ_EXPORT void* (*__memalign_hook)(size_t, size_t) = memalign_impl;
21
 }
22
 
23
-#elif defined(RTLD_DEEPBIND)
24
+#elif defined(RTLD_DEEPBIND) && !defined(__FreeBSD__)
25
 // XXX On systems that support RTLD_GROUP or DF_1_GROUP, do their
26
 // implementations permit similar inconsistencies?  Should STV_SINGLETON
27
 // visibility be used for interposition where available?
(-)b/www/zen-browser/files/patch-memory_build_mozmemory.h (+17 lines)
Added Link Here
1
--- memory/build/mozmemory.h.orig	2025-01-01 00:00:00.000000000 +0000
2
+++ memory/build/mozmemory.h	2025-01-01 00:00:00.000000000 +0000
3
@@ -67,8 +67,14 @@
4
 
5
 #endif  // MOZ_MEMORY
6
 
7
+#if defined(__FreeBSD__)
8
+#define NOTHROW_MALLOC_DECL(name, return_type, ...) \
9
+  MOZ_JEMALLOC_API return_type name(__VA_ARGS__);
10
+#else
11
 #define NOTHROW_MALLOC_DECL(name, return_type, ...) \
12
   MOZ_JEMALLOC_API return_type name(__VA_ARGS__) noexcept(true);
13
+#endif
14
+
15
 #define MALLOC_DECL(name, return_type, ...) \
16
   MOZ_JEMALLOC_API return_type name(__VA_ARGS__);
17
 #define MALLOC_FUNCS MALLOC_FUNCS_ARENA
(-)b/www/zen-browser/files/patch-memory_build_mozmemory__wrap.cpp (+16 lines)
Added Link Here
1
--- memory/build/mozmemory_wrap.cpp.orig	2025-01-01 00:00:00.000000000 +0000
2
+++ memory/build/mozmemory_wrap.cpp	2025-01-01 00:00:00.000000000 +0000
3
@@ -10,8 +10,14 @@
4
 // Declare malloc implementation functions with the right return and
5
 // argument types.
6
+#if defined(__FreeBSD__)
7
+#define NOTHROW_MALLOC_DECL(name, return_type, ...) \
8
+  MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
9
+#else
10
 #define NOTHROW_MALLOC_DECL(name, return_type, ...) \
11
   MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__) noexcept(true);
12
+#endif
13
+
14
 #define MALLOC_DECL(name, return_type, ...) \
15
   MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
16
 #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC
(-)b/www/zen-browser/files/patch-memory_mozalloc_mozalloc.cpp (+20 lines)
Added Link Here
1
--- memory/mozalloc/mozalloc.cpp.orig	2025-01-01 00:00:00.000000000 +0000
2
+++ memory/mozalloc/mozalloc.cpp	2025-01-01 00:00:00.000000000 +0000
3
@@ -17,6 +17,17 @@
4
 #    include <unistd.h>
5
 #  endif  // if defined(XP_UNIX)
6
 
7
+#  if defined(__FreeBSD__)
8
+#    include <malloc_np.h>
9
+extern "C" void* memalign(size_t boundary, size_t size) {
10
+  void* ptr = nullptr;
11
+  if (posix_memalign(&ptr, boundary, size) != 0) {
12
+    return nullptr;
13
+  }
14
+  return ptr;
15
+}
16
+#  endif
17
+
18
 #  define malloc_impl malloc
19
 #  define calloc_impl calloc
20
 #  define realloc_impl realloc
(-)b/www/zen-browser/files/patch-memory_mozalloc_mozalloc.h (+16 lines)
Added Link Here
1
--- memory/mozalloc/mozalloc.h.orig	2025-01-01 00:00:00.000000000 +0000
2
+++ memory/mozalloc/mozalloc.h	2025-01-01 00:00:00.000000000 +0000
3
@@ -33,8 +33,14 @@
4
 // something like a malloc.h wrapper and allow the use of the functions without
5
 // a _impl suffix. In the meanwhile, this is enough to get by for C++ code.
6
+#  if defined(__FreeBSD__)
7
+#    define NOTHROW_MALLOC_DECL(name, return_type, ...) \
8
+      MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
9
+#  else
10
 #  define NOTHROW_MALLOC_DECL(name, return_type, ...) \
11
     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__) noexcept(true);
12
+#  endif
13
+
14
 #  define MALLOC_DECL(name, return_type, ...) \
15
     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
16
 #  include "malloc_decls.h"
(-)b/www/zen-browser/files/patch-python_sites_mach.txt (+10 lines)
Added Link Here
1
--- python/sites/mach.txt.orig	2025-02-05 13:02:40.597621000 +0100
2
+++ python/sites/mach.txt
3
@@ -57,8 +57,7 @@
4
 pth:xpcom/idl-parser
5
 # glean-sdk may not be installable if a wheel isn't available
6
 # and it has to be built from source.
7
-pypi-optional:glean-sdk==66.2.0:telemetry will not be collected
8
 pypi-optional:orjson>=3.10:json operations will be slower in various tools
9
 # Mach gracefully handles the case where `psutil` is unavailable.
10
 # We aren't (yet) able to pin packages in automation, so we have to
(-)b/www/zen-browser/files/patch-third__party_libwebrtc_modules_desktop__capture_linux_wayland__egl__dmabuf.cc (+19 lines)
Added Link Here
1
commit f53507857647459d4a48935901f80f27a5ae58a9
2
Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>
3
4
    avoid linux-only includes
5
6
diff --git a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
7
index 821fdfb487b7..e000c1c104fe 100644
8
--- third_party/libwebrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
9
+++ third_party/libwebrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
10
@@ -15,7 +15,9 @@
11
 #include <EGL/eglplatform.h>
12
 #include <GL/gl.h>
13
 #include <GL/glext.h>
14
+#if !defined(__FreeBSD__)
15
 #include <asm/ioctl.h>
16
+#endif
17
 #include <dlfcn.h>
18
 #include <fcntl.h>
19
 #include <gbm.h>
(-)b/www/zen-browser/files/patch-third__party_libwebrtc_third__party_pffft_src_pffft.c (+10 lines)
Added Link Here
1
--- third_party/libwebrtc/third_party/pffft/src/pffft.c.orig	2022-02-10 18:57:48 UTC
2
+++ third_party/libwebrtc/third_party/pffft/src/pffft.c
3
@@ -100,6 +100,7 @@
4
    Altivec support macros 
5
 */
6
 #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
7
+#include <altivec.h>
8
 typedef vector float v4sf;
9
 #  define SIMD_SZ 4
10
 #  define VZERO() ((vector float) vec_splat_u8(0))
(-)b/www/zen-browser/files/patch-third_party_libwebrtc_BUILD.gn (+11 lines)
Added Link Here
1
--- third_party/libwebrtc/BUILD.gn.orig	2025-02-05 13:02:40.597621000 +0100
2
+++ third_party/libwebrtc/BUILD.gn
3
@@ -256,7 +256,7 @@
4
       target_gen_dir,
5
     ]
6
   }
7
-  if (is_posix || is_fuchsia) {
8
+  if (is_posix || is_fuchsia || is_bsd) {
9
     defines += [ "WEBRTC_POSIX" ]
10
   }
11
   if (is_ios) {
(-)b/www/zen-browser/files/patch-third_party_libwebrtc_build_config_BUILDCONFIG.gn (+141 lines)
Added Link Here
1
commit e8a3b91abdc00edd7633aabbe5e63bfc0d0825e4
2
Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>
3
4
    enable pipewire on bsd
5
6
diff --git a/third_party/chromium/build/config/BUILDCONFIG.gn b/third_party/chromium/build/config/BUILDCONFIG.gn
7
index 4bb38fe31ff2..b10eb19f521a 100644
8
--- third_party/chromium/build/config/BUILDCONFIG.gn
9
+++ third_party/chromium/build/config/BUILDCONFIG.gn
10
@@ -137,6 +137,7 @@ declare_args() {
11
 
12
   # Set to true when compiling with the Clang compiler.
13
   is_clang = current_os != "linux" || current_os == "openbsd" ||
14
+              current_os == "freebsd" ||
15
              (current_cpu != "s390x" && current_cpu != "s390" &&
16
               current_cpu != "ppc64" && current_cpu != "ppc" &&
17
               current_cpu != "mips" && current_cpu != "mips64" &&
18
@@ -206,7 +207,7 @@ if (host_toolchain == "") {
19
   # TODO(dpranke): Add some sort of assert here that verifies that
20
   # no toolchain omitted host_toolchain from its toolchain_args().
21
 
22
-  if (host_os == "linux" || host_os == "openbsd") {
23
+  if (host_os == "linux" || host_os == "openbsd" || host_os == "freebsd") {
24
     if (target_os != "linux") {
25
       host_toolchain = "//chromium/build/toolchain/linux:clang_$host_cpu"
26
     } else if (is_clang) {
27
@@ -246,7 +247,7 @@ if (target_os == "android") {
28
   # Targeting android on Mac is best-effort and not guaranteed to work.
29
   #assert(host_os == "linux", "Android builds are only supported on Linux.")
30
   _default_toolchain = "//chromium/build/toolchain/android:android_clang_$target_cpu"
31
-} else if (target_os == "chromeos" || target_os == "linux" || target_os == "openbsd") {
32
+} else if (target_os == "chromeos" || target_os == "linux" || target_os == "openbsd" || target_os == "freebsd") {
33
   # See comments in build/toolchain/cros/BUILD.gn about board compiles.
34
   if (is_clang) {
35
     _default_toolchain = "//chromium/build/toolchain/linux:clang_$target_cpu"
36
@@ -314,7 +315,7 @@ is_chromeos = current_os == "chromeos"
37
 is_fuchsia = current_os == "fuchsia"
38
 is_ios = current_os == "ios"
39
 is_linux = current_os == "linux"
40
-is_bsd = current_os == "openbsd"
41
+is_bsd = current_os == "openbsd" || current_os == "freebsd"
42
 is_mac = current_os == "mac"
43
 is_nacl = current_os == "nacl"
44
 is_wasm = current_os == "emscripten"
45
diff --git a/third_party/libwebrtc/BUILD.gn b/third_party/libwebrtc/BUILD.gn
46
index ac8569efaa40..5d6c5953491c 100644
47
--- third_party/libwebrtc/BUILD.gn
48
+++ third_party/libwebrtc/BUILD.gn
49
@@ -111,7 +111,7 @@ if (!build_with_chromium && !build_with_mozilla) {
50
           "tools_webrtc/perf:webrtc_dashboard_upload",
51
         ]
52
       }
53
-      if ((is_linux || is_chromeos) && rtc_use_pipewire) {
54
+      if ((is_linux || is_chromeos || is_bsd) && rtc_use_pipewire) {
55
         deps += [ "modules/desktop_capture:shared_screencast_stream_test" ]
56
       }
57
     }
58
diff --git a/third_party/libwebrtc/modules/desktop_capture/BUILD.gn b/third_party/libwebrtc/modules/desktop_capture/BUILD.gn
59
index 5c843cfc2b6a..0ed9f98a964f 100644
60
--- third_party/libwebrtc/modules/desktop_capture/BUILD.gn
61
+++ third_party/libwebrtc/modules/desktop_capture/BUILD.gn
62
@@ -76,7 +76,7 @@ if (rtc_include_tests) {
63
         "window_finder_unittest.cc",
64
       ]
65
 
66
-      if ((is_linux || is_chromeos) && rtc_use_pipewire) {
67
+      if ((is_linux || is_chromeos || is_bsd) && rtc_use_pipewire) {
68
         configs += [ "../portal:gio" ]
69
       }
70
 
71
@@ -88,7 +88,7 @@ if (rtc_include_tests) {
72
     }
73
   }
74
 
75
-  if ((is_linux || is_chromeos) && rtc_use_pipewire) {
76
+  if ((is_linux || is_chromeos || is_bsd) && rtc_use_pipewire) {
77
     rtc_test("shared_screencast_stream_test") {
78
       testonly = true
79
 
80
@@ -148,7 +148,7 @@ if (rtc_include_tests) {
81
       "test_utils_unittest.cc",
82
     ]
83
 
84
-    if ((is_linux || is_chromeos) && rtc_use_pipewire) {
85
+    if ((is_linux || is_chromeos || is_bsd) && rtc_use_pipewire) {
86
       configs += [ "../portal:gio" ]
87
     }
88
 
89
@@ -215,7 +215,7 @@ if (rtc_include_tests) {
90
       "screen_drawer.h",
91
     ]
92
 
93
-    if (is_linux || is_chromeos) {
94
+    if (is_linux || is_chromeos || is_bsd) {
95
       sources += [ "screen_drawer_linux.cc" ]
96
       libs = [ "X11" ]
97
     }
98
@@ -254,7 +254,7 @@ if (rtc_include_tests) {
99
       "mock_desktop_capturer_callback.h",
100
     ]
101
 
102
-    if ((is_linux || is_chromeos) && rtc_use_pipewire) {
103
+    if ((is_linux || is_chromeos || us_bsd) && rtc_use_pipewire) {
104
       configs += [ "../portal:gio" ]
105
     }
106
 
107
@@ -267,7 +267,7 @@ if (rtc_include_tests) {
108
 }
109
 
110
 # TODO(bugs.webrtc.org/14187): remove when all users are gone
111
-if ((is_linux || is_chromeos) && rtc_use_pipewire) {
112
+if ((is_linux || is_chromeos || is_bsd) && rtc_use_pipewire) {
113
   config("pipewire_config") {
114
     configs = [ "../portal:pipewire_config" ]
115
   }
116
diff --git a/third_party/libwebrtc/modules/portal/BUILD.gn b/third_party/libwebrtc/modules/portal/BUILD.gn
117
index 70b4739ad0c4..99ab95d441f3 100644
118
--- third_party/libwebrtc/modules/portal/BUILD.gn
119
+++ third_party/libwebrtc/modules/portal/BUILD.gn
120
@@ -10,7 +10,7 @@ import("//chromium/build/config/linux/pkg_config.gni")
121
 import("//tools/generate_stubs/rules.gni")
122
 import("../../webrtc.gni")
123
 
124
-if ((is_linux || is_chromeos) && rtc_use_pipewire) {
125
+if ((is_linux || is_chromeos || is_bsd) && rtc_use_pipewire) {
126
 if (!build_with_mozilla) {
127
   pkg_config("gio") {
128
     packages = [
129
diff --git a/third_party/libwebrtc/webrtc.gni b/third_party/libwebrtc/webrtc.gni
130
index 1e87de20e545..77a8a55d8659 100644
131
--- third_party/libwebrtc/webrtc.gni
132
+++ third_party/libwebrtc/webrtc.gni
133
@@ -151,7 +151,7 @@ declare_args() {
134
   # By default it's only enabled on desktop Linux (excludes ChromeOS) and
135
   # only when using the sysroot as PipeWire is not available in older and
136
   # supported Ubuntu and Debian distributions.
137
-  rtc_use_pipewire = is_linux && use_sysroot
138
+  rtc_use_pipewire = (is_linux || is_bsd) && use_sysroot
139
 
140
   # Set this to link PipeWire and required libraries directly instead of using the dlopen.
141
   rtc_link_pipewire = false
(-)b/www/zen-browser/files/test_malloc_wrapper.c (+111 lines)
Added Link Here
1
/*
2
 * Test program to verify glibc compatibility wrappers for FreeBSD
3
 * 
4
 * This test should be run on FreeBSD with:
5
 *   cc -I. test_malloc_wrapper.c -o test_malloc_wrapper
6
 *   ./test_malloc_wrapper
7
 * 
8
 * On Linux, this test uses native glibc functions for comparison.
9
 */
10
11
#include <stdio.h>
12
#include <stdlib.h>
13
#include <stdint.h>
14
#include <string.h>
15
#include <assert.h>
16
17
#ifdef __FreeBSD__
18
/* On FreeBSD, use our compatibility wrapper */
19
#include "malloc.h"
20
#else
21
/* On Linux/glibc, use native headers */
22
#include <malloc.h>
23
#endif
24
25
int main(void) {
26
    printf("Testing memory allocation functions...\n");
27
    
28
#ifdef __FreeBSD__
29
    printf("Running on FreeBSD with compatibility wrapper\n\n");
30
#else
31
    printf("Running on Linux with native glibc (for comparison)\n\n");
32
#endif
33
    
34
    /* Test 1: memalign() */
35
    printf("Test 1: memalign() wrapper\n");
36
    void* aligned_ptr = memalign(64, 1024);
37
    if (aligned_ptr == NULL) {
38
        fprintf(stderr, "FAIL: memalign returned NULL\n");
39
        return 1;
40
    }
41
    
42
    /* Check alignment */
43
    if (((uintptr_t)aligned_ptr % 64) != 0) {
44
        fprintf(stderr, "FAIL: pointer not properly aligned (expected 64-byte alignment)\n");
45
        free(aligned_ptr);
46
        return 1;
47
    }
48
    printf("  PASS: memalign(64, 1024) returned properly aligned pointer: %p\n", aligned_ptr);
49
    
50
    /* Write to the memory to ensure it's usable */
51
    memset(aligned_ptr, 0xAB, 1024);
52
    printf("  PASS: Memory is writable\n");
53
    
54
    /* Test 2: malloc_usable_size() */
55
    printf("\nTest 2: malloc_usable_size()\n");
56
    size_t usable = malloc_usable_size(aligned_ptr);
57
    printf("  malloc_usable_size() returned: %zu bytes\n", usable);
58
    if (usable < 1024) {
59
        fprintf(stderr, "FAIL: usable size (%zu) less than requested (1024)\n", usable);
60
        free(aligned_ptr);
61
        return 1;
62
    }
63
    printf("  PASS: Usable size is at least as large as requested\n");
64
    
65
    free(aligned_ptr);
66
    
67
    /* Test 3: malloc_usable_size() with regular malloc */
68
    printf("\nTest 3: malloc_usable_size() with regular malloc\n");
69
    void* regular_ptr = malloc(512);
70
    if (regular_ptr == NULL) {
71
        fprintf(stderr, "FAIL: malloc returned NULL\n");
72
        return 1;
73
    }
74
    
75
    usable = malloc_usable_size(regular_ptr);
76
    printf("  malloc_usable_size(malloc(512)) returned: %zu bytes\n", usable);
77
    if (usable < 512) {
78
        fprintf(stderr, "FAIL: usable size (%zu) less than requested (512)\n", usable);
79
        free(regular_ptr);
80
        return 1;
81
    }
82
    printf("  PASS: Usable size is valid\n");
83
    
84
    free(regular_ptr);
85
    
86
    /* Test 4: Multiple memalign calls with different alignments */
87
    printf("\nTest 4: Various alignment values\n");
88
    size_t alignments[] = {8, 16, 32, 64, 128, 256};
89
    size_t num_alignments = sizeof(alignments) / sizeof(alignments[0]);
90
    
91
    for (size_t i = 0; i < num_alignments; i++) {
92
        void* ptr = memalign(alignments[i], 100);
93
        if (ptr == NULL) {
94
            fprintf(stderr, "FAIL: memalign(%zu, 100) returned NULL\n", alignments[i]);
95
            return 1;
96
        }
97
        if (((uintptr_t)ptr % alignments[i]) != 0) {
98
            fprintf(stderr, "FAIL: memalign(%zu) not properly aligned\n", alignments[i]);
99
            free(ptr);
100
            return 1;
101
        }
102
        free(ptr);
103
    }
104
    printf("  PASS: All alignment values work correctly\n");
105
    
106
    printf("\n=================================\n");
107
    printf("All tests PASSED!\n");
108
    printf("=================================\n");
109
    
110
    return 0;
111
}
(-)b/www/zen-browser/pkg-descr (+19 lines)
Added Link Here
1
Zen Browser is a high-performance, privacy-focused web browser built on
2
Firefox's Gecko engine. It combines the stability and compatibility of Firefox
3
with enhanced privacy controls, improved user experience, and performance
4
optimizations.
5
6
Key Features:
7
8
- Privacy First: Telemetry disabled by default, enhanced tracking protection
9
- Performance: Optimized compilation with modern C++ toolchain and Rust
10
- Firefox Compatible: Uses the same Gecko engine for excellent web compatibility
11
- WebRTC Support: Full real-time communication support for video/audio
12
- Cross-Platform: Runs on Windows, macOS, Linux, and FreeBSD
13
- Active Development: Regular updates with latest security patches
14
15
Zen Browser prioritizes user privacy and control while maintaining full web
16
compatibility. It includes built-in privacy features, secure defaults, and
17
advanced customization options for power users.
18
19
For more information and documentation, visit https://zen-browser.app

Return to bug 293476