diff --git a/www/firefox/Makefile b/www/firefox/Makefile index c38afeeb1c50..a3638371b4e5 100644 --- a/www/firefox/Makefile +++ b/www/firefox/Makefile @@ -1,65 +1,66 @@ PORTNAME= firefox DISTVERSION= 154.0.1 +PORTREVISON= 1 PORTEPOCH= 2 CATEGORIES= www wayland MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}${DISTVERSIONSUFFIX}/source \ MOZILLA/${PORTNAME}/candidates/${DISTVERSION}${DISTVERSIONSUFFIX}-candidates/build1/source DISTFILES= ${DISTNAME}.source${EXTRACT_SUFX} MAINTAINER= gecko@FreeBSD.org COMMENT= Web browser based on the browser portion of Mozilla WWW= https://www.firefox.com/ NOT_FOR_ARCHS= i386 NOT_FOR_ARCHS_REASON= fails to build: rust needs more address space than platform can provide BUILD_DEPENDS= nspr>=4.32:devel/nspr \ nss>=3.126:security/nss \ libevent>=2.1.8:devel/libevent \ harfbuzz>=10.1.0:print/harfbuzz \ graphite2>=1.3.14:graphics/graphite2 \ png>=1.6.45:graphics/png \ dav1d>=1.0.0:multimedia/dav1d \ libvpx>=1.15.0:multimedia/libvpx \ ${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \ v4l_compat>0:multimedia/v4l_compat \ nasm:devel/nasm \ yasm:devel/yasm \ zip:archivers/zip \ ${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasip1/libc++abi.a:devel/wasi-libcxx${LLVM_VERSION} \ ${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasip1/libc.a:devel/wasi-libc@${LLVM_VERSION} \ wasi-compiler-rt${LLVM_VERSION}>0:devel/wasi-compiler-rt${LLVM_VERSION} USE_GECKO= gecko CONFLICTS_INSTALL= firefox-esr USE_MOZILLA= -sqlite # work around bindgen not finding ICU, e.g. # dist/include/mozilla/intl/ICU4CGlue.h:8:10: fatal error: 'unicode/uenum.h' file not found, err: true CONFIGURE_ENV+= BINDGEN_CFLAGS="-I${LOCALBASE}/include" USES= tar:xz # helpful when testing beta WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION} FIREFOX_ICON= ${MOZILLA}.png FIREFOX_ICON_SRC= ${PREFIX}/lib/${MOZILLA}/browser/chrome/icons/default/default48.png MOZ_OPTIONS= --enable-application=browser \ --enable-official-branding \ --with-wasi-sysroot=${LOCALBASE}/share/wasi-sysroot .include "${.CURDIR}/../../www/firefox/Makefile.options" post-extract: @${SED} -e 's|@FIREFOX_ICON@|${FIREFOX_ICON:R}|;s|@MOZILLA@|${MOZILLA}|' \ <${FILESDIR}/firefox.desktop.in >${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop post-patch: @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ ${WRKSRC}/browser/app/nsBrowserApp.cpp post-install: ${INSTALL_DATA} ${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop ${STAGEDIR}${PREFIX}/share/applications ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps ${LN} -sf ${FIREFOX_ICON_SRC} ${STAGEDIR}${PREFIX}/share/pixmaps/${FIREFOX_ICON} .include diff --git a/www/firefox/files/patch-enable-webserial b/www/firefox/files/patch-enable-webserial new file mode 100644 index 000000000000..0cf56eb54264 --- /dev/null +++ b/www/firefox/files/patch-enable-webserial @@ -0,0 +1,73 @@ +commit 98cea4a7ca336b4a509cd1e7bcfe69836a9d1f29 +Author: Christoph Moench-Tegeder + + Enable WebSerial for FreeBSD + + https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297874 + + Patch by pcc + +diff --git dom/webserial/PosixSerialPlatformService.cpp dom/webserial/PosixSerialPlatformService.cpp +index 9389ef0d9821..0786bf5f0dd5 100644 +--- dom/webserial/PosixSerialPlatformService.cpp ++++ dom/webserial/PosixSerialPlatformService.cpp +@@ -419,6 +419,32 @@ nsresult PosixSerialPlatformService::EnumeratePortsImpl( + *aLikelyAccessDenied = + aPorts.IsEmpty() && (errors == ErrorKind::eAccessDenied); + } ++#elif defined(XP_FREEBSD) ++ DIR* devDir = opendir("/dev"); ++ if (devDir) { ++ auto cleanupDir = MakeScopeExit([&]() { closedir(devDir); }); ++ while (struct dirent* ent = readdir(devDir)) { ++ const char* name = ent->d_name; ++ bool isTtyU = strncmp(name, "ttyU", 4) == 0; ++ bool isTtyu = strncmp(name, "ttyu", 4) == 0; ++ if ((!isTtyU && !isTtyu) || name[4] < '0' || name[4] > '9') { ++ continue; ++ } ++ nsAutoCString devpath("/dev/"); ++ devpath.Append(name); ++ auto isReal = IsRealSerialPort(devpath.get()); ++ if (isReal.isErr()) { ++ continue; ++ } ++ NS_ConvertUTF8toUTF16 path(devpath); ++ IPCSerialPortInfo info; ++ info.id() = path; ++ info.path() = path; ++ info.friendlyName() = ++ NS_ConvertUTF8toUTF16(nsDependentCString(name)); ++ aPorts.AppendElement(info); ++ } ++ } + #endif + + MOZ_LOG(gWebSerialLog, LogLevel::Debug, +diff --git dom/webserial/SerialPlatformService.cpp dom/webserial/SerialPlatformService.cpp +index 1da19f340514..a7ce888f6d78 100644 +--- dom/webserial/SerialPlatformService.cpp ++++ dom/webserial/SerialPlatformService.cpp +@@ -15,7 +15,8 @@ + namespace mozilla::dom { + + #if !defined(XP_WIN) && !defined(XP_MACOSX) && \ +- !(defined(XP_LINUX) && !defined(ANDROID)) ++ !(defined(XP_LINUX) && !defined(ANDROID)) && \ ++ !defined(XP_FREEBSD) + already_AddRefed + SerialPlatformService::GetInstanceImpl() { + return MakeAndAddRef(); +diff --git dom/webserial/moz.build dom/webserial/moz.build +index bc17c7301d7d..77e4ed2f34ea 100644 +--- dom/webserial/moz.build ++++ dom/webserial/moz.build +@@ -25,7 +25,7 @@ if CONFIG["OS_TARGET"] == "WINNT": + "cfgmgr32", + "setupapi", + ] +-elif (CONFIG["OS_TARGET"] == "Darwin" and CONFIG["TARGET_OS"] != "iOS") or CONFIG[ ++elif (CONFIG["OS_TARGET"] == "Darwin" and CONFIG["TARGET_OS"] != "iOS") or CONFIG["OS_TARGET"] == "FreeBSD" or CONFIG[ + "OS_TARGET" + ] == "Linux": + UNIFIED_SOURCES += [