Sat Aug 12 15:08:41 CEST 2023

This commit is contained in:
Bert van der Weerd 2023-08-12 15:08:42 +02:00
parent 31bbd3addc
commit 0d534e81fc
34 changed files with 92704 additions and 0 deletions

102
Makefile Normal file
View file

@ -0,0 +1,102 @@
PORTNAME= librewolf
DISTVERSION= 109.0.1.2
PORTREVISION= 8
CATEGORIES= www wayland
MASTER_SITES= https://gitlab.com/api/v4/projects/32320088/packages/generic/librewolf-source/${DISTVERSION:R}-2/
DISTNAME= ${PORTNAME}-${DISTVERSION:R}-2.source.
EXTRACT_SUFX= tar.gz
PATCH_SITES= https://gitlab.com/librewolf-community/browser/source/-/raw/d114d4f8e8271adcb854082060c387b16ac56352/
PATCHFILES= patches/unity_kde/unity-menubar.patch?inline=false:-p1
MAINTAINER= freebsd@sysctl.cz
COMMENT= Custom version of Firefox, focused on privacy, security and freedom
WWW= https://librewolf.net/
BUILD_DEPENDS= nspr>=4.32:devel/nspr \
nss>=3.84:security/nss \
icu>=71.1:devel/icu \
libevent>=2.1.8:devel/libevent \
harfbuzz>=4.4.1:print/harfbuzz \
graphite2>=1.3.14:graphics/graphite2 \
png>=1.6.37:graphics/png \
dav1d>=1.0.0:multimedia/dav1d \
libvpx>=1.12.0:multimedia/libvpx \
${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \
v4l_compat>0:multimedia/v4l_compat \
autoconf2.13:devel/autoconf2.13 \
nasm:devel/nasm \
yasm:devel/yasm \
zip:archivers/zip
.include "${.CURDIR}/../../www/firefox/Makefile.options"
.include <bsd.port.options.mk>
.if ${ARCH} != powerpc64
BUILD_DEPENDS+= ${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a:devel/wasi-libcxx \
${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc.a:devel/wasi-libc \
${LOCALBASE}/llvm${LLVM_DEFAULT}/lib/clang/${LLVM_VERSION}/lib/wasi/libclang_rt.builtins-wasm32.a:devel/wasi-compiler-rt${LLVM_DEFAULT}
.endif
USE_GECKO= gecko
USE_MOZILLA= -sqlite
CFLAGS_powerpc64le= -DSQLITE_BYTEORDER=1234
# 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"
CONFIGURE_ENV+= MOZ_REQUIRE_SIGNING=""
MOZ_EXPORT+= MOZ_TELEMETRY_REPORTING="" \
MOZILLA_OFFICIAL="1" \
MOZ_OFFICIAL_BRANDING="1" \
MOZ_APP_DISPLAYNAME="Librewolf" \
MOZ_APP_NAME="librewolf"
MOZ_OPTIONs= --enable-application=browser \
--allow-addon-sideload \
--disable-crashreporter \
--disable-debug \
--disable-default-browser-agent \
--disable-tests \
--disable-updater \
--enable-hardening \
--enable-optimize \
--enable-release \
--enable-rust-simd \
--with-app-name=librewolf \
--with-branding=browser/branding/librewolf \
--with-unsigned-addon-scopes=app,system \
--with-l10n-base=$PWD/browser/locales/l10n \
--enable-bootstrap \
MOZ_CRASHREPORTER=0 \
MOZ_DATA_REPORTING=0 \
MOZ_SERVICES_HEALTHREPORT=0
# helpful when testing beta
WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION:R}-2
FIREFOX_ICON_SRC= ${PREFIX}/lib/${MOZILLA}/browser/chrome/icons/default/default48.png
FIREFOX_DESKTOP= ${MOZSRC}/taskcluster/docker/firefox-snap/firefox.desktop
.if ${ARCH} == powerpc64
MOZ_OPTIONS+= --without-wasm-sandboxed-libraries
.else
BUILD_DEPENDS+= ${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a:devel/wasi-libcxx \
${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc.a:devel/wasi-libc \
${LOCALBASE}/llvm${LLVM_DEFAULT}/lib/clang/${LLVM_VERSION}/lib/wasi/libclang_rt.builtins-wasm32.a:devel/wasi-compiler-rt${LLVM_DEFAULT}
MOZ_OPTIONS+= --with-wasi-sysroot=${LOCALBASE}/share/wasi-sysroot
.endif
post-patch:
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/browser/app/nsBrowserApp.cpp
@${RM} ${WRKSRC}/mozconfig
post-install:
${CP} ${FIREFOX_DESKTOP} ${STAGEDIR}${PREFIX}/share/applications/librewolf.desktop
${REINPLACE_CMD} -e 's|Firefox|Librewolf|g' ${STAGEDIR}${PREFIX}/share/applications/librewolf.desktop
${REINPLACE_CMD} -e 's|firefox|librewolf|g' ${STAGEDIR}${PREFIX}/share/applications/librewolf.desktop
${REINPLACE_CMD} -e 's|Icon=.*|Icon=${FIREFOX_ICON_SRC}|g' ${STAGEDIR}${PREFIX}/share/applications/librewolf.desktop
.include <bsd.port.mk>

5
distinfo Normal file
View file

@ -0,0 +1,5 @@
TIMESTAMP = 1676816988
SHA256 (librewolf-109.0.1-2.source.tar.gz) = 33573e6286334a2322bf39f573b5e9fbc526127fa04806b388a796e706dbdd87
SIZE (librewolf-109.0.1-2.source.tar.gz) = 821281100
SHA256 (patches/unity_kde/unity-menubar.patch?inline=false) = 2c3d1a778fa07a15a21232b84c6c598330d5a38cfe8f0ec602aee66ac204b8e0
SIZE (patches/unity_kde/unity-menubar.patch?inline=false) = 163548

53
files/patch-addon-search Normal file
View file

@ -0,0 +1,53 @@
https://github.com/mozilla/addons/issues/708
https://github.com/mozilla/addons-frontend/issues/4610
diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
index af08811..77a3b18 100644
--- browser/app/profile/firefox.js
+++ browser/app/profile/firefox.js
@@ -38,7 +38,7 @@ pref("extensions.postDownloadThirdPartyPrompt", true);
// Preferences for AMO integration
pref("extensions.getAddons.cache.enabled", true);
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%");
-pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
+pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%");
pref("extensions.getAddons.discovery.api_url", "https://services.addons.mozilla.org/api/v4/discovery/?lang=%LOCALE%&edition=%DISTRIBUTION%");
@@ -193,8 +193,8 @@ pref("app.update.langpack.enabled", true);
// .. etc ..
//
pref("extensions.update.enabled", true);
-pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
-pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.interval", 86400); // Check for updates to Extensions and
// Themes every day
diff --git toolkit/mozapps/extensions/internal/AddonRepository.jsm toolkit/mozapps/extensions/internal/AddonRepository.jsm
index 661c902..a41b32f 100644
--- toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -592,7 +592,7 @@ var AddonRepository = {
addon.version = String(aEntry.current_version.version);
if (Array.isArray(aEntry.current_version.files)) {
for (let file of aEntry.current_version.files) {
- if (file.platform == "all" || file.platform == lazy.PLATFORM) {
+ if (file.platform == "all" || file.platform == "linux" || file.platform == lazy.PLATFORM) {
if (file.url) {
addon.sourceURI = NetUtil.newURI(file.url);
}
diff --git toolkit/mozapps/extensions/internal/XPIDatabase.jsm toolkit/mozapps/extensions/internal/XPIDatabase.jsm
index f8c99c7..c6ba8a1 100644
--- toolkit/mozapps/extensions/internal/XPIDatabase.jsm
+++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm
@@ -520,7 +520,7 @@ class AddonInternal {
// Something is causing errors in here
try {
for (let platform of this.targetPlatforms) {
- if (platform.os == Services.appinfo.OS) {
+ if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
if (platform.abi) {
needsABI = true;
if (platform.abi === abi) {

View file

@ -0,0 +1,14 @@
diff --git browser/app/nsBrowserApp.cpp browser/app/nsBrowserApp.cpp
index 87c2e16..a41f1d9 100644
--- browser/app/nsBrowserApp.cpp
+++ browser/app/nsBrowserApp.cpp
@@ -337,6 +337,9 @@ int main(int argc, char* argv[], char* envp[]) {
}
#endif
+ setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
+ setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
+
#ifdef HAS_DLL_BLOCKLIST
DllBlocklist_Initialize(gBlocklistInitFlags);
#endif

View file

@ -0,0 +1,43 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1269654#c5
https://bug1269654.bmoattachments.org/attachment.cgi?id=8749234
handle big-endian formats in Cairo format conversions
# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1462463631 14400
# Thu May 05 11:53:51 2016 -0400
# Node ID 8da374804a09977c8f89af5e6e0cb37cb074595d
# Parent 29662e28a9c93ac67ee0b8ddfb65a9f29bbf73f5
handle big-endian formats in Cairo format conversions
--- gfx/2d/HelpersCairo.h.orig 2019-12-02 17:51:16.633474000 +0100
+++ gfx/2d/HelpersCairo.h 2019-12-02 17:52:44.939998000 +0100
@@ -147,7 +147,14 @@ static inline cairo_format_t GfxFormatToCairoFormat(Su
case SurfaceFormat::R5G6B5_UINT16:
return CAIRO_FORMAT_RGB16_565;
default:
- gfxCriticalError() << "Unknown image format " << (int)format;
+ // _UINT32 formats don't match B8G8R8[AX]8 on big-endian platforms,
+ // and Moz2d uses B8G8R8[AX]8 as if it was _UINT32.
+ // See bug 1269654
+ if (format == SurfaceFormat::B8G8R8X8) {
+ return CAIRO_FORMAT_RGB24;
+ } else if (format != SurfaceFormat::B8G8R8A8) {
+ gfxCriticalError() << "Unknown image format " << (int)format;
+ }
return CAIRO_FORMAT_ARGB32;
}
}
@@ -177,7 +184,11 @@ static inline cairo_content_t GfxFormatToCairoContent(
case SurfaceFormat::A8:
return CAIRO_CONTENT_ALPHA;
default:
- gfxCriticalError() << "Unknown image content format " << (int)format;
+ if (format == SurfaceFormat::B8G8R8X8) {
+ return CAIRO_CONTENT_COLOR;
+ } else if (format != SurfaceFormat::B8G8R8A8) {
+ gfxCriticalError() << "Unknown image content format " << (int)format;
+ }
return CAIRO_CONTENT_COLOR_ALPHA;
}
}

View file

@ -0,0 +1,36 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c10
https://bug1504834.bmoattachments.org/attachment.cgi?id=9111147
mozilla-bmo1504834-part4.patch
# HG changeset patch
# Parent 46ea866ca3acb8bb5e1709ceb799b9c94f591dec
Problem description: Tab-titles that are too long to fit into a tab get faded out.
On big endian this is broken and instead of fading out, the
tab gets white and the font transparent, leading to an unreadable
tab-title
Solution: This is not a real solution, but a hack. The real solution would have been
to byte-swap the correct buffer, but I could not find it.
So the next best thing is to deactivate the fading-effect. Now all tab-titles
are readable, albeit not as pretty to look at as they could be.
Side-effects: I have not yet found an unwanted side-effect.
diff --git gfx/2d/DrawTargetSkia.cpp gfx/2d/DrawTargetSkia.cpp
index 6bbef8d..161b96f 100644
--- gfx/2d/DrawTargetSkia.cpp
+++ gfx/2d/DrawTargetSkia.cpp
@@ -1903,6 +1903,14 @@ void DrawTargetSkia::PushLayerWithBlend(bool aOpaque, Float aOpacity,
SkCanvas::kPreserveLCDText_SaveLayerFlag |
(aCopyBackground ? SkCanvas::kInitWithPrevious_SaveLayerFlag : 0));
+#if MOZ_BIG_ENDIAN()
+ // Pushing a layer where an aMask is defined produces wrong output.
+ // We _should_ endian swap the data, but I couldn't find a workable way to do so
+ // Therefore I deactivate those layers in the meantime.
+ // The result is: Tab-titles that are longer than the available space should be faded out.
+ // The fading doesn't work, so we deactivate the fading-effect here.
+ if (!aMask)
+#endif
mCanvas->saveLayer(saveRec);
SetPermitSubpixelAA(aOpaque);

View file

@ -0,0 +1,85 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c5
https://bugzilla.mozilla.org/attachment.cgi?id=9028600
Rough progress patch
diff --git gfx/2d/DrawTargetSkia.cpp gfx/2d/DrawTargetSkia.cpp
index 6bbef8d..82b04ba 100644
--- gfx/2d/DrawTargetSkia.cpp
+++ gfx/2d/DrawTargetSkia.cpp
@@ -154,8 +154,7 @@ static IntRect CalculateSurfaceBounds(const IntSize& aSize, const Rect* aBounds,
return surfaceBounds.Intersect(bounds);
}
-static const int kARGBAlphaOffset =
- SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
+static const int kARGBAlphaOffset = 0;
static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
const int32_t aStride, SurfaceFormat aFormat) {
diff --git gfx/2d/Types.h gfx/2d/Types.h
index 6b3bdc7..7c6c342 100644
--- gfx/2d/Types.h
+++ gfx/2d/Types.h
@@ -90,15 +90,8 @@ enum class SurfaceFormat : int8_t {
// The following values are endian-independent synonyms. The _UINT32 suffix
// indicates that the name reflects the layout when viewed as a uint32_t
// value.
-#if MOZ_LITTLE_ENDIAN()
A8R8G8B8_UINT32 = B8G8R8A8, // 0xAARRGGBB
X8R8G8B8_UINT32 = B8G8R8X8, // 0x00RRGGBB
-#elif MOZ_BIG_ENDIAN()
- A8R8G8B8_UINT32 = A8R8G8B8, // 0xAARRGGBB
- X8R8G8B8_UINT32 = X8R8G8B8, // 0x00RRGGBB
-#else
-# error "bad endianness"
-#endif
// The following values are OS and endian-independent synonyms.
//
diff --git gfx/skia/skia/third_party/skcms/skcms.cc gfx/skia/skia/third_party/skcms/skcms.cc
index 6b4d87b..7c0559d 100644
--- gfx/skia/skia/third_party/skcms/skcms.cc
+++ gfx/skia/skia/third_party/skcms/skcms.cc
@@ -30,6 +30,8 @@
#include <avx512fintrin.h>
#include <avx512dqintrin.h>
#endif
+#else
+ #define SKCMS_PORTABLE
#endif
// sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
@@ -280,20 +282,28 @@ enum {
static uint16_t read_big_u16(const uint8_t* ptr) {
uint16_t be;
memcpy(&be, ptr, sizeof(be));
-#if defined(_MSC_VER)
- return _byteswap_ushort(be);
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ return be;
#else
+ #if defined(_MSC_VER)
+ return _byteswap_ushort(be);
+ #else
return __builtin_bswap16(be);
+ #endif
#endif
}
static uint32_t read_big_u32(const uint8_t* ptr) {
uint32_t be;
memcpy(&be, ptr, sizeof(be));
-#if defined(_MSC_VER)
- return _byteswap_ulong(be);
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
+ return be;
#else
+ #if defined(_MSC_VER)
+ return _byteswap_ulong(be);
+ #else
return __builtin_bswap32(be);
+ #endif
#endif
}

View file

@ -0,0 +1,49 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c9
https://bugzilla.mozilla.org/attachment.cgi?id=9111146
mozilla-bmo1504834-part3.patch
# HG changeset patch
# Parent aecb4600e5da17443b224c79eee178c1d8e155e3
For FF68, AntiAliasing of XULTexts seem to be broken on big endian (s390x). Text and icons of the sandwich-menu to the
right of the address bar, as well as plugin-windows appears transparant, which usually means unreadable (white on white).
diff -r aecb4600e5da gfx/skia/skia/include/private/SkNx.h
--- gfx/skia/skia/include/private/SkNx.h Tue Aug 20 09:46:55 2019 +0200
+++ gfx/skia/skia/include/private/SkNx.h Mon Sep 09 10:04:06 2019 +0200
@@ -238,7 +238,18 @@
AI SkNx operator*(const SkNx& y) const { return fVal * y.fVal; }
AI SkNx operator/(const SkNx& y) const { return fVal / y.fVal; }
+ // On Big endian the commented out variant doesn't work,
+ // and honestly, I have no idea why it exists in the first place.
+ // The reason its broken is, I think, that it defaults to the double-variant of ToBits()
+ // which gets a 64-bit integer, and FromBits returns 32-bit,
+ // cutting off the wrong half again.
+ // Overall, I see no reason to have ToBits and FromBits at all (even for floats/doubles).
+ // Still we are only "fixing" this for big endian and leave little endian alone (never touch a running system)
+#ifdef SK_CPU_BENDIAN
+ AI SkNx operator&(const SkNx& y) const { return fVal & y.fVal; }
+#else
AI SkNx operator&(const SkNx& y) const { return FromBits(ToBits(fVal) & ToBits(y.fVal)); }
+#endif
AI SkNx operator|(const SkNx& y) const { return FromBits(ToBits(fVal) | ToBits(y.fVal)); }
AI SkNx operator^(const SkNx& y) const { return FromBits(ToBits(fVal) ^ ToBits(y.fVal)); }
diff -r aecb4600e5da gfx/skia/skia/src/opts/SkBlitMask_opts.h
--- gfx/skia/skia/src/opts/SkBlitMask_opts.h Tue Aug 20 09:46:55 2019 +0200
+++ gfx/skia/skia/src/opts/SkBlitMask_opts.h Mon Sep 09 10:04:06 2019 +0200
@@ -203,7 +203,13 @@
// ~~~>
// a = 1*aa + d(1-1*aa) = aa + d(1-aa)
// c = 0*aa + d(1-1*aa) = d(1-aa)
+
+ // For big endian we have to swap the alpha-mask from 0,0,0,255 to 255,0,0,0
+#ifdef SK_CPU_BENDIAN
+ return Sk4px(Sk16b(aa) & Sk16b(255,0,0,0, 255,0,0,0, 255,0,0,0, 255,0,0,0))
+#else
return Sk4px(Sk16b(aa) & Sk16b(0,0,0,255, 0,0,0,255, 0,0,0,255, 0,0,0,255))
+#endif
+ d.approxMulDiv255(aa.inv());
};
while (h --> 0) {

123
files/patch-bug1559213 Normal file
View file

@ -0,0 +1,123 @@
commit 717bba28411c
Author: Jory A. Pratt <anarchy@gentoo.org>
Date: Thu Jun 13 11:53:00 2019 -0700
Bug 1559213 - Allow to use system av1 libs instead of bundled.
---
config/external/moz.build | 5 +++--
config/system-headers.mozbuild | 8 ++++++++
dom/media/platforms/moz.build | 5 +++++
toolkit/moz.configure | 19 ++++++++++++++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git config/external/moz.build config/external/moz.build
index ab77121..75595d9 100644
--- config/external/moz.build
+++ config/external/moz.build
@@ -49,8 +49,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
external_dirs += ["media/libvpx"]
if CONFIG["MOZ_AV1"]:
- external_dirs += ["media/libaom"]
- external_dirs += ["media/libdav1d"]
+ if not CONFIG["MOZ_SYSTEM_AV1"]:
+ external_dirs += ["media/libaom"]
+ external_dirs += ["media/libdav1d"]
if not CONFIG["MOZ_SYSTEM_PNG"]:
external_dirs += ["media/libpng"]
diff --git config/system-headers.mozbuild config/system-headers.mozbuild
index a1b58eb..65729f9 100644
--- config/system-headers.mozbuild
+++ config/system-headers.mozbuild
@@ -1289,6 +1289,14 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
'proxy.h',
]
+if CONFIG['MOZ_SYSTEM_AV1']:
+ system_headers += [
+ 'aom/aom_decoder.h',
+ 'aom/aomdx.h',
+ 'aom/aom_image.h',
+ 'dav1d/dav1d.h',
+ ]
+
if CONFIG['MOZ_SYSTEM_LIBVPX']:
system_headers += [
'vpx_mem/vpx_mem.h',
diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
index 8509aec..eb6f129 100644
--- dom/media/platforms/moz.build
+++ dom/media/platforms/moz.build
@@ -78,6 +78,11 @@ if CONFIG["MOZ_AV1"]:
"agnostic/AOMDecoder.cpp",
"agnostic/DAV1DDecoder.cpp",
]
+ if CONFIG['MOZ_SYSTEM_AV1']:
+ CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
+ CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
if CONFIG["MOZ_OMX"]:
EXPORTS += [
diff --git media/ffvpx/libavcodec/moz.build media/ffvpx/libavcodec/moz.build
index 0069865..e806fc8 100644
--- media/ffvpx/libavcodec/moz.build.orig
+++ media/ffvpx/libavcodec/moz.build
@@ -108,10 +108,14 @@
'vp9prob.c',
'vp9recon.c'
]
- USE_LIBS += [
- 'dav1d',
- 'media_libdav1d_asm',
- ]
+ if CONFIG["MOZ_SYSTEM_AV1"]:
+ CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
+ else:
+ USE_LIBS += [
+ 'dav1d',
+ 'media_libdav1d_asm',
+ ]
if CONFIG['MOZ_WAYLAND']:
LOCAL_INCLUDES += ['/media/mozva']
SOURCES += [
diff --git toolkit/moz.configure toolkit/moz.configure
index 0069865..e806fc8 100644
--- toolkit/moz.configure
+++ toolkit/moz.configure
@@ -523,7 +523,23 @@ def av1(value):
return True
-@depends(target, when=av1 & compile_environment)
+option("--with-system-av1",
+ help="Use system av1 (located with pkgconfig)")
+
+system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
+ when="--with-system-av1")
+
+system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
+ when="--with-system-av1")
+
+@depends(system_libaom_info, system_libdav1d_info)
+def system_av1(system_libaom_info, system_libdav1d_info):
+ has_av1_libs = False
+ if system_libaom_info and system_libdav1d_info:
+ has_av1_libs = True
+ return has_av1_libs
+
+@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
def dav1d_asm(target):
if target.cpu in ("aarch64", "x86", "x86_64"):
return True
@@ -539,6 +555,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
set_define("MOZ_DAV1D_ASM", dav1d_asm)
set_config("MOZ_AV1", av1)
set_define("MOZ_AV1", av1)
+set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
# JXL Image Codec Support
# ==============================================================

View file

@ -0,0 +1,191 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1612181
https://bug1612181.bmoattachments.org/attachment.cgi?id=9123550
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S.orig 2020-01-29 19:25:30.967574000 +0100
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S 2020-01-29 19:26:50.465737000 +0100
@@ -62,11 +62,11 @@ NS_InvokeByIndex:
.NS_InvokeByIndex:
#endif
mflr 0
- std 0,16(r1)
+ std 0,16(%r1)
- std r29,-24(r1)
- std r30,-16(r1)
- std r31,-8(r1)
+ std r29,-24(%r1)
+ std r30,-16(%r1)
+ std r31,-8(%r1)
mr r29,r3 # Save 'that' in r29
mr r30,r4 # Save 'methodIndex' in r30
@@ -79,7 +79,7 @@ NS_InvokeByIndex:
#
# | (fixed area + | | 7 GP | 13 FP | 3 NV |
# | param. save) |(params)........| regs | regs | regs |
- # (r1)......(+STACK_PARAMS)... (-23*8).(-16*8).(-3*8)..(r31)
+ # (%r1)......(+STACK_PARAMS)... (-23*8).(-16*8).(-3*8)..(%r31)
# +stack frame, -unused stack params, +regs storage, +1 for alignment
addi r7,r5,((STACK_PARAMS/8)-7+7+13+3+1)
@@ -105,56 +105,56 @@ NS_InvokeByIndex:
# Set up to invoke function
- ld r9,0(r29) # vtable (r29 is 'that')
+ ld r9,0(%r29) # vtable (%r29 is 'that')
mr r3,r29 # self is first arg, obviously
sldi r30,r30,3 # Find function descriptor
add r9,r9,r30
- ld r12,0(r9)
+ ld r12,0(%r9)
- std r2,STACK_TOC(r1) # Save r2 (TOC pointer)
+ std r2,STACK_TOC(%r1) # Save r2 (TOC pointer)
#if _CALL_ELF == 2
mtctr r12
#else
- ld r0,0(r12) # Actual address from fd.
+ ld r0,0(%r12) # Actual address from fd.
mtctr 0
- ld r11,16(r12) # Environment pointer from fd.
- ld r2,8(r12) # TOC pointer from fd.
+ ld r11,16(%r12) # Environment pointer from fd.
+ ld r2,8(%r12) # TOC pointer from fd.
#endif
# Load FP and GP registers as required
- ld r4, -(23*8)(r31)
- ld r5, -(22*8)(r31)
- ld r6, -(21*8)(r31)
- ld r7, -(20*8)(r31)
- ld r8, -(19*8)(r31)
- ld r9, -(18*8)(r31)
- ld r10, -(17*8)(r31)
+ ld r4, -(23*8)(%r31)
+ ld r5, -(22*8)(%r31)
+ ld r6, -(21*8)(%r31)
+ ld r7, -(20*8)(%r31)
+ ld r8, -(19*8)(%r31)
+ ld r9, -(18*8)(%r31)
+ ld r10, -(17*8)(%r31)
- lfd f1, -(16*8)(r31)
- lfd f2, -(15*8)(r31)
- lfd f3, -(14*8)(r31)
- lfd f4, -(13*8)(r31)
- lfd f5, -(12*8)(r31)
- lfd f6, -(11*8)(r31)
- lfd f7, -(10*8)(r31)
- lfd f8, -(9*8)(r31)
- lfd f9, -(8*8)(r31)
- lfd f10, -(7*8)(r31)
- lfd f11, -(6*8)(r31)
- lfd f12, -(5*8)(r31)
- lfd f13, -(4*8)(r31)
+ lfd f1, -(16*8)(%r31)
+ lfd f2, -(15*8)(%r31)
+ lfd f3, -(14*8)(%r31)
+ lfd f4, -(13*8)(%r31)
+ lfd f5, -(12*8)(%r31)
+ lfd f6, -(11*8)(%r31)
+ lfd f7, -(10*8)(%r31)
+ lfd f8, -(9*8)(%r31)
+ lfd f9, -(8*8)(%r31)
+ lfd f10, -(7*8)(%r31)
+ lfd f11, -(6*8)(%r31)
+ lfd f12, -(5*8)(%r31)
+ lfd f13, -(4*8)(%r31)
bctrl # Do it
- ld r2,STACK_TOC(r1) # Load our own TOC pointer
- ld r1,0(r1) # Revert stack frame
- ld 0,16(r1) # Reload lr
+ ld r2,STACK_TOC(%r1) # Load our own TOC pointer
+ ld r1,0(%r1) # Revert stack frame
+ ld 0,16(%r1) # Reload lr
mtlr 0
- ld 29,-24(r1) # Restore NVGPRS
- ld 30,-16(r1)
- ld 31,-8(r1)
+ ld 29,-24(%r1) # Restore NVGPRS
+ ld 30,-16(%r1)
+ ld 31,-8(%r1)
blr
#if _CALL_ELF == 2
--- xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S.orig 2020-01-29 19:25:51.465953000 +0100
+++ xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S 2020-01-29 19:28:53.055137000 +0100
@@ -58,35 +58,35 @@ SharedStub:
#endif
mflr r0
- std r4, -56(r1) # Save all GPRS
- std r5, -48(r1)
- std r6, -40(r1)
- std r7, -32(r1)
- std r8, -24(r1)
- std r9, -16(r1)
- std r10, -8(r1)
+ std r4, -56(%r1) # Save all GPRS
+ std r5, -48(%r1)
+ std r6, -40(%r1)
+ std r7, -32(%r1)
+ std r8, -24(%r1)
+ std r9, -16(%r1)
+ std r10, -8(%r1)
- stfd f13, -64(r1) # ... and FPRS
- stfd f12, -72(r1)
- stfd f11, -80(r1)
- stfd f10, -88(r1)
- stfd f9, -96(r1)
- stfd f8, -104(r1)
- stfd f7, -112(r1)
- stfd f6, -120(r1)
- stfd f5, -128(r1)
- stfd f4, -136(r1)
- stfd f3, -144(r1)
- stfd f2, -152(r1)
- stfd f1, -160(r1)
+ stfd f13, -64(%r1) # ... and FPRS
+ stfd f12, -72(%r1)
+ stfd f11, -80(%r1)
+ stfd f10, -88(%r1)
+ stfd f9, -96(%r1)
+ stfd f8, -104(%r1)
+ stfd f7, -112(%r1)
+ stfd f6, -120(%r1)
+ stfd f5, -128(%r1)
+ stfd f4, -136(%r1)
+ stfd f3, -144(%r1)
+ stfd f2, -152(%r1)
+ stfd f1, -160(%r1)
subi r6,r1,56 # r6 --> gprData
subi r7,r1,160 # r7 --> fprData
addi r5,r1,STACK_PARAMS # r5 --> extra stack args
- std r0, 16(r1)
+ std r0, 16(%r1)
- stdu r1,-288(r1)
+ stdu r1,-288(%r1)
# r3 has the 'self' pointer
# already
@@ -97,8 +97,8 @@ SharedStub:
bl PrepareAndDispatch
nop
- ld 1,0(r1) # restore stack
- ld r0,16(r1) # restore LR
+ ld 1,0(%r1) # restore stack
+ ld r0,16(%r1) # restore LR
mtlr r0
blr

92
files/patch-bug1626236 Normal file
View file

@ -0,0 +1,92 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1626236
https://bug1626236.bmoattachments.org/attachment.cgi?id=9137096
# HG changeset patch
# User msirringhaus@suse.de
# Date 1582805876 -3600
# Thu Feb 27 13:17:56 2020 +0100
# Node ID cc3d09abea31068e57f1ab918782f9f86fc6a158
# Parent 9cd90914846f667f18babc491a74c164ae5d6e9f
imported patch decoder_workaround.patch
diff --git image/decoders/nsGIFDecoder2.cpp image/decoders/nsGIFDecoder2.cpp
index ebb0b7d..d52ef47 100644
--- image/decoders/nsGIFDecoder2.cpp
+++ image/decoders/nsGIFDecoder2.cpp
@@ -422,6 +422,9 @@ void nsGIFDecoder2::ConvertColormap(uint32_t* aColormap, uint32_t aColors) {
MOZ_ASSERT(mSwizzleFn);
uint8_t* data = reinterpret_cast<uint8_t*>(aColormap);
mSwizzleFn(data, data, aColors);
+#if MOZ_BIG_ENDIAN()
+ SwizzleRow(SurfaceFormat::A8R8G8B8, SurfaceFormat::B8G8R8A8)(data, data, aColors);
+#endif
}
LexerResult nsGIFDecoder2::DoDecode(SourceBufferIterator& aIterator,
diff --git image/decoders/nsJPEGDecoder.cpp image/decoders/nsJPEGDecoder.cpp
index 9ea4403..d82772c 100644
--- image/decoders/nsJPEGDecoder.cpp
+++ image/decoders/nsJPEGDecoder.cpp
@@ -257,6 +257,9 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
case JCS_YCbCr:
// By default, we will output directly to BGRA. If we need to apply
// special color transforms, this may change.
+#if MOZ_BIG_ENDIAN()
+ mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
+#else
switch (SurfaceFormat::OS_RGBX) {
case SurfaceFormat::B8G8R8X8:
mInfo.out_color_space = JCS_EXT_BGRX;
@@ -271,6 +274,7 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
mState = JPEG_ERROR;
return Transition::TerminateFailure();
}
+#endif
break;
case JCS_CMYK:
case JCS_YCCK:
diff --git image/decoders/nsPNGDecoder.cpp image/decoders/nsPNGDecoder.cpp
index e3e4ef4..3cc7315 100644
--- image/decoders/nsPNGDecoder.cpp
+++ image/decoders/nsPNGDecoder.cpp
@@ -356,7 +356,7 @@ LexerResult nsPNGDecoder::DoDecode(SourceBufferIterator& aIterator,
IResumable* aOnResume) {
MOZ_ASSERT(!HasError(), "Shouldn't call DoDecode after error!");
- return mLexer.Lex(aIterator, aOnResume,
+ LexerResult res = mLexer.Lex(aIterator, aOnResume,
[=](State aState, const char* aData, size_t aLength) {
switch (aState) {
case State::PNG_DATA:
@@ -366,6 +366,14 @@ LexerResult nsPNGDecoder::DoDecode(SourceBufferIterator& aIterator,
}
MOZ_CRASH("Unknown State");
});
+
+#if MOZ_BIG_ENDIAN()
+ if(res.is<TerminalState>() && res.as<TerminalState>() == TerminalState::SUCCESS) {
+ NativeEndian::swapToLittleEndianInPlace<uint32_t>((uint32_t*)(mImageData), mImageDataLength / 4);
+ }
+#endif
+
+ return res;
}
LexerTransition<nsPNGDecoder::State> nsPNGDecoder::ReadPNGData(
diff --git image/decoders/nsWebPDecoder.cpp image/decoders/nsWebPDecoder.cpp
index e58ca92..2056ebb 100644
--- image/decoders/nsWebPDecoder.cpp
+++ image/decoders/nsWebPDecoder.cpp
@@ -247,7 +247,12 @@ nsresult nsWebPDecoder::CreateFrame(const OrientedIntRect& aFrameRect) {
// WebP doesn't guarantee that the alpha generated matches the hint in the
// header, so we always need to claim the input is BGRA. If the output is
// BGRX, swizzling will mask off the alpha channel.
+#if MOZ_BIG_ENDIAN()
+ mBuffer.colorspace = MODE_ARGB;
+ SurfaceFormat inFormat = mFormat;
+#else
SurfaceFormat inFormat = SurfaceFormat::OS_RGBA;
+#endif
SurfacePipeFlags pipeFlags = SurfacePipeFlags();
if (mFormat == SurfaceFormat::OS_RGBA &&

32
files/patch-bug1628567 Normal file
View file

@ -0,0 +1,32 @@
Don't pass --target when CC/CXX contains clang
diff --git third_party/rust/cc/src/lib.rs third_party/rust/cc/src/lib.rs
index 8cafd2a..f40b746 100644
--- third_party/rust/cc/src/lib.rs
+++ third_party/rust/cc/src/lib.rs
@@ -2796,24 +2796,7 @@ impl Tool {
}
fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self {
- // Try to detect family of the tool from its name, falling back to Gnu.
- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
- if fname.contains("clang-cl") {
- ToolFamily::Msvc { clang_cl: true }
- } else if fname.ends_with("cl") || fname == "cl.exe" {
- ToolFamily::Msvc { clang_cl: false }
- } else if fname.contains("clang") {
- match clang_driver {
- Some("cl") => ToolFamily::Msvc { clang_cl: true },
- _ => ToolFamily::Clang,
- }
- } else {
- ToolFamily::Gnu
- }
- } else {
- ToolFamily::Gnu
- };
-
+ let family = ToolFamily::Gnu;
Tool {
path: path,
cc_wrapper_path: None,

17
files/patch-bug1640982 Normal file
View file

@ -0,0 +1,17 @@
Unbreak build with Rust 1.45.0
error: options `-C embed-bitcode=no` and `-C lto` are incompatible
diff --git config/makefiles/rust.mk config/makefiles/rust.mk
index 75570d3..94ec33f 100644
--- config/makefiles/rust.mk
+++ config/makefiles/rust.mk
@@ -97,7 +97,7 @@ ifndef rustflags_sancov
# Never enable when coverage is enabled to work around https://github.com/rust-lang/rust/issues/90045.
ifndef MOZ_CODE_COVERAGE
ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
-cargo_rustc_flags += -Clto
+cargo_rustc_flags +=
endif
# We need -Cembed-bitcode=yes for all crates when using -Clto.
RUSTFLAGS += -Cembed-bitcode=yes

35
files/patch-bug1659612 Normal file
View file

@ -0,0 +1,35 @@
media/libcubeb/src/cubeb_alsa.c:613:9: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned int, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
r = snprintf(node_name, sizeof(node_name), "pcm.%s", string);
^
media/libcubeb/src/cubeb_alsa.c:613:9: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
media/libcubeb/src/cubeb_alsa.c:1168:3: error: implicitly declaring library function 'alloca' with type 'void *(unsigned int)' [-Werror,-Wimplicit-function-declaration]
snd_pcm_hw_params_alloca(&hw_params);
^
/usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
^
/usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
^
media/libcubeb/src/cubeb_alsa.c:1168:3: note: include the header <stdlib.h> or explicitly provide a declaration for 'alloca'
/usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
^
/usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
^
2 errors generated.
--- media/libcubeb/src/cubeb_alsa.c.orig 2021-08-31 14:26:24.530548000 +0200
+++ media/libcubeb/src/cubeb_alsa.c 2021-08-31 14:26:43.081470000 +0200
@@ -5,9 +5,7 @@
* accompanying file LICENSE for details.
*/
#undef NDEBUG
-#define _DEFAULT_SOURCE
-#define _BSD_SOURCE
-#define _XOPEN_SOURCE 500
+#define _GNU_SOURCE 1
#include "cubeb-internal.h"
#include "cubeb/cubeb.h"
#include <alsa/asoundlib.h>

388
files/patch-bug1680982 Normal file
View file

@ -0,0 +1,388 @@
commit 3204512f58a1
Author: Greg V <greg@unrelenting.technology>
Date: Sun Dec 6 22:07:00 2020 +0000
Bug 1680982 - Use evdev instead of the Linux legacy joystick API for gamepads
Using evdev is a prerequisite for adding rumble (haptic feedback) and LED support.
- BTN_GAMEPAD semantic buttons are interpreted directly,
since all kernel drivers are supposed to use them correctly:
https://www.kernel.org/doc/html/latest/input/gamepad.html
- BTN_JOYSTICK legacy style numbered buttons use the model specific remappers
- we support even strange devices that combine both styles in one device
- the Linux gamepad module is enabled on FreeBSD and DragonFly, because
these kernels provide evdev, and libudev-devd provides enough of libudev
(evdev headers are provided by the devel/evdev-proto package)
Differential Revision: https://phabricator.services.mozilla.com/D98868
---
dom/gamepad/linux/LinuxGamepad.cpp | 262 ++++++++++++++++++++++++++++++++-----
dom/gamepad/moz.build | 2 +-
2 files changed, 229 insertions(+), 35 deletions(-)
diff --git dom/gamepad/linux/LinuxGamepad.cpp dom/gamepad/linux/LinuxGamepad.cpp
index deee47b9d267..31f0aad7ae4a 100644
--- dom/gamepad/linux/LinuxGamepad.cpp
+++ dom/gamepad/linux/LinuxGamepad.cpp
@@ -5,15 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
- * LinuxGamepadService: A Linux backend for the GamepadService.
- * Derived from the kernel documentation at
- * http://www.kernel.org/doc/Documentation/input/joystick-api.txt
+ * LinuxGamepadService: An evdev backend for the GamepadService.
+ *
+ * Ref: https://www.kernel.org/doc/html/latest/input/gamepad.html
*/
#include <algorithm>
+#include <unordered_map>
#include <cstddef>
#include <glib.h>
-#include <linux/joystick.h>
+#include <linux/input.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/ioctl.h>
@@ -21,10 +22,14 @@
#include "nscore.h"
#include "mozilla/dom/GamepadHandle.h"
#include "mozilla/dom/GamepadPlatformService.h"
+#include "mozilla/dom/GamepadRemapping.h"
#include "mozilla/Tainting.h"
#include "mozilla/UniquePtr.h"
#include "udev.h"
+#define LONG_BITS (sizeof(long) * 8)
+#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
+
namespace {
using namespace mozilla::dom;
@@ -36,19 +41,29 @@ using mozilla::udev_list_entry;
using mozilla::udev_monitor;
using mozilla::UniquePtr;
-static const float kMaxAxisValue = 32767.0;
-static const char kJoystickPath[] = "/dev/input/js";
+static const char kEvdevPath[] = "/dev/input/event";
+
+static inline bool TestBit(const unsigned long* arr, int bit) {
+ return !!(arr[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
+}
+
+static inline double ScaleAxis(const input_absinfo& info, int value) {
+ return 2.0 * (value - info.minimum) / (double)(info.maximum - info.minimum) -
+ 1.0;
+}
// TODO: should find a USB identifier for each device so we can
// provide something that persists across connect/disconnect cycles.
-typedef struct {
+struct Gamepad {
GamepadHandle handle;
- guint source_id;
- int numAxes;
- int numButtons;
- char idstring[256];
- char devpath[PATH_MAX];
-} Gamepad;
+ RefPtr<GamepadRemapper> remapper = nullptr;
+ guint source_id = UINT_MAX;
+ char idstring[256] = {0};
+ char devpath[PATH_MAX] = {0};
+ uint8_t key_map[KEY_MAX] = {0};
+ uint8_t abs_map[ABS_MAX] = {0};
+ std::unordered_map<uint16_t, input_absinfo> abs_info;
+};
class LinuxGamepadService {
public:
@@ -66,7 +81,7 @@ class LinuxGamepadService {
bool is_gamepad(struct udev_device* dev);
void ReadUdevChange();
- // handler for data from /dev/input/jsN
+ // handler for data from /dev/input/eventN
static gboolean OnGamepadData(GIOChannel* source, GIOCondition condition,
gpointer data);
@@ -114,8 +129,14 @@ void LinuxGamepadService::AddDevice(struct udev_device* dev) {
g_io_channel_set_encoding(channel, nullptr, nullptr);
g_io_channel_set_buffered(channel, FALSE);
int fd = g_io_channel_unix_get_fd(channel);
+
+ struct input_id id {};
+ if (ioctl(fd, EVIOCGID, &id) == -1) {
+ return;
+ }
+
char name[128];
- if (ioctl(fd, JSIOCGNAME(sizeof(name)), &name) == -1) {
+ if (ioctl(fd, EVIOCGNAME(sizeof(name)), &name) == -1) {
strcpy(name, "unknown");
}
const char* vendor_id =
@@ -131,20 +152,86 @@ void LinuxGamepadService::AddDevice(struct udev_device* dev) {
model_id = mUdev.udev_device_get_sysattr_value(parent, "id/product");
}
}
+ if (!vendor_id && id.vendor != 0) {
+ vendor_id = (const char*)alloca(5);
+ snprintf((char*)vendor_id, 5, "%04x", id.vendor);
+ }
+ if (!model_id && id.product != 0) {
+ model_id = (const char*)alloca(5);
+ snprintf((char*)model_id, 5, "%04x", id.product);
+ }
snprintf(gamepad->idstring, sizeof(gamepad->idstring), "%s-%s-%s",
vendor_id ? vendor_id : "unknown", model_id ? model_id : "unknown",
name);
char numAxes = 0, numButtons = 0;
- ioctl(fd, JSIOCGAXES, &numAxes);
- gamepad->numAxes = numAxes;
- ioctl(fd, JSIOCGBUTTONS, &numButtons);
- gamepad->numButtons = numButtons;
+ unsigned long key_bits[NLONGS(KEY_CNT)] = {0};
+ unsigned long abs_bits[NLONGS(ABS_CNT)] = {0};
+ ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits);
+ ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
+
+ /* Here, we try to support even strange cases where proper semantic
+ * BTN_GAMEPAD button are combined with arbitrary extra buttons. */
+ for (uint16_t i = BTN_JOYSTICK; i < KEY_MAX; i++) {
+ /* Do not map semantic buttons, they are handled directly */
+ if (i == BTN_GAMEPAD) {
+ i = BTN_THUMBR + 1;
+ continue;
+ }
+ if (i == BTN_DPAD_UP) {
+ i = BTN_DPAD_RIGHT + 1;
+ continue;
+ }
+ if (TestBit(key_bits, i)) {
+ gamepad->key_map[i] = numButtons++;
+ }
+ }
+ for (uint16_t i = 0; i < BTN_JOYSTICK; i++) {
+ if (TestBit(key_bits, i)) {
+ gamepad->key_map[i] = numButtons++;
+ }
+ }
+ for (uint16_t i = BTN_GAMEPAD; i <= BTN_THUMBR; i++) {
+ /* But if any semantic event exists, count them all */
+ if (TestBit(key_bits, i)) {
+ numButtons += BUTTON_INDEX_COUNT;
+ break;
+ }
+ }
+ for (uint16_t i = 0; i < ABS_MAX; ++i) {
+ if (TestBit(abs_bits, i)) {
+ gamepad->abs_info.emplace(i, input_absinfo{});
+ if (ioctl(fd, EVIOCGABS(i), &gamepad->abs_info[i]) < 0) {
+ continue;
+ }
+ if (gamepad->abs_info[i].minimum == gamepad->abs_info[i].maximum) {
+ gamepad->abs_info.erase(i);
+ continue;
+ }
+ gamepad->abs_map[i] = numAxes++;
+ }
+ }
+
+ if (numAxes == 0) {
+ NS_WARNING("Gamepad with zero axes detected?");
+ }
+ if (numButtons == 0) {
+ NS_WARNING("Gamepad with zero buttons detected?");
+ }
+
+ bool defaultRemapper = false;
+ RefPtr<GamepadRemapper> remapper =
+ GetGamepadRemapper(id.vendor, id.product, defaultRemapper);
+ MOZ_ASSERT(remapper);
+ remapper->SetAxisCount(numAxes);
+ remapper->SetButtonCount(numButtons);
gamepad->handle = service->AddGamepad(
- gamepad->idstring, mozilla::dom::GamepadMappingType::_empty,
- mozilla::dom::GamepadHand::_empty, gamepad->numButtons, gamepad->numAxes,
- 0, 0, 0); // TODO: Bug 680289, implement gamepad haptics for Linux.
+ gamepad->idstring, remapper->GetMappingType(), GamepadHand::_empty,
+ remapper->GetButtonCount(), remapper->GetAxisCount(), 0,
+ remapper->GetLightIndicatorCount(), remapper->GetTouchEventCount());
+ gamepad->remapper = remapper.forget();
+ // TODO: Bug 680289, implement gamepad haptics for Linux.
// TODO: Bug 1523355, implement gamepad lighindicator and touch for Linux.
gamepad->source_id =
@@ -257,7 +344,7 @@ bool LinuxGamepadService::is_gamepad(struct udev_device* dev) {
if (!devpath) {
return false;
}
- if (strncmp(kJoystickPath, devpath, sizeof(kJoystickPath) - 1) != 0) {
+ if (strncmp(kEvdevPath, devpath, sizeof(kEvdevPath) - 1) != 0) {
return false;
}
@@ -292,7 +379,7 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
if (condition & G_IO_ERR || condition & G_IO_HUP) return FALSE;
while (true) {
- struct js_event event;
+ struct input_event event {};
gsize count;
GError* err = nullptr;
if (g_io_channel_read_chars(source, (gchar*)&event, sizeof(event), &count,
@@ -301,18 +388,125 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
break;
}
- // TODO: store device state?
- if (event.type & JS_EVENT_INIT) {
- continue;
- }
-
switch (event.type) {
- case JS_EVENT_BUTTON:
- service->NewButtonEvent(gamepad->handle, event.number, !!event.value);
+ case EV_KEY:
+ switch (event.code) {
+ /* The gamepad events are meaningful, and according to
+ * https://www.kernel.org/doc/html/latest/input/gamepad.html
+ * "No other devices, that do not look/feel like a gamepad, shall
+ * report these events" */
+ case BTN_SOUTH:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_PRIMARY,
+ !!event.value);
+ break;
+ case BTN_EAST:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_SECONDARY,
+ !!event.value);
+ break;
+ case BTN_NORTH:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_QUATERNARY,
+ !!event.value);
+ break;
+ case BTN_WEST:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_TERTIARY,
+ !!event.value);
+ break;
+ case BTN_TL:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_SHOULDER,
+ !!event.value);
+ break;
+ case BTN_TR:
+ service->NewButtonEvent(gamepad->handle,
+ BUTTON_INDEX_RIGHT_SHOULDER, !!event.value);
+ break;
+ case BTN_TL2:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_TRIGGER,
+ !!event.value);
+ break;
+ case BTN_TR2:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_RIGHT_TRIGGER,
+ !!event.value);
+ break;
+ case BTN_SELECT:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_BACK_SELECT,
+ !!event.value);
+ break;
+ case BTN_START:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_START,
+ !!event.value);
+ break;
+ case BTN_MODE:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_META,
+ !!event.value);
+ break;
+ case BTN_THUMBL:
+ service->NewButtonEvent(
+ gamepad->handle, BUTTON_INDEX_LEFT_THUMBSTICK, !!event.value);
+ break;
+ case BTN_THUMBR:
+ service->NewButtonEvent(
+ gamepad->handle, BUTTON_INDEX_RIGHT_THUMBSTICK, !!event.value);
+ break;
+ case BTN_DPAD_UP:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_UP,
+ !!event.value);
+ break;
+ case BTN_DPAD_DOWN:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
+ !!event.value);
+ break;
+ case BTN_DPAD_LEFT:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
+ !!event.value);
+ break;
+ case BTN_DPAD_RIGHT:
+ service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
+ !!event.value);
+ break;
+ default:
+ /* For non-gamepad events, this is the "anything goes" numbered
+ * handling that should be handled with remappers. */
+ gamepad->remapper->RemapButtonEvent(
+ gamepad->handle, gamepad->key_map[event.code], !!event.value);
+ break;
+ }
break;
- case JS_EVENT_AXIS:
- service->NewAxisMoveEvent(gamepad->handle, event.number,
- ((float)event.value) / kMaxAxisValue);
+ case EV_ABS:
+ if (!gamepad->abs_info.count(event.code)) continue;
+ switch (event.code) {
+ case ABS_HAT0X:
+ service->NewButtonEvent(
+ gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
+ AxisNegativeAsButton(
+ ScaleAxis(gamepad->abs_info[event.code], event.value)));
+ service->NewButtonEvent(
+ gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
+ AxisPositiveAsButton(
+ ScaleAxis(gamepad->abs_info[event.code], event.value)));
+ break;
+ case ABS_HAT0Y:
+ service->NewButtonEvent(
+ gamepad->handle, BUTTON_INDEX_DPAD_UP,
+ AxisNegativeAsButton(
+ ScaleAxis(gamepad->abs_info[event.code], event.value)));
+ service->NewButtonEvent(
+ gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
+ AxisPositiveAsButton(
+ ScaleAxis(gamepad->abs_info[event.code], event.value)));
+ break;
+ case ABS_HAT1X:
+ case ABS_HAT1Y:
+ case ABS_HAT2X:
+ case ABS_HAT2Y:
+ case ABS_HAT3X:
+ case ABS_HAT3Y:
+ break;
+ default:
+ gamepad->remapper->RemapAxisMoveEvent(
+ gamepad->handle, gamepad->abs_map[event.code],
+ ScaleAxis(gamepad->abs_info[event.code], event.value));
+ break;
+ }
break;
}
}
diff --git dom/gamepad/moz.build dom/gamepad/moz.build
index 5f55d5a95e96..544b7f927736 100644
--- dom/gamepad/moz.build
+++ dom/gamepad/moz.build
@@ -59,7 +59,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
UNIFIED_SOURCES += ["windows/WindowsGamepad.cpp"]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
UNIFIED_SOURCES += ["android/AndroidGamepad.cpp"]
-elif CONFIG["OS_ARCH"] == "Linux":
+elif CONFIG["OS_ARCH"] in ("Linux", "FreeBSD", "DragonFly"):
UNIFIED_SOURCES += ["linux/LinuxGamepad.cpp"]
else:
UNIFIED_SOURCES += ["fallback/FallbackGamepad.cpp"]

56
files/patch-bug1716707 Normal file
View file

@ -0,0 +1,56 @@
commit ce7a2f400d4f599c72e32e2635fee7ea94c0848c
Author: Christoph Moench-Tegeder <cmt@burggraben.net>
Date: Wed Apr 13 14:44:46 2022 +0200
big-endian color fixes, but without breaking little-endian
as le is what most people actually use
diff --git gfx/webrender_bindings/RenderCompositorSWGL.cpp gfx/webrender_bindings/RenderCompositorSWGL.cpp
index dbf137c849ee..243a01ff9cf3 100644
--- gfx/webrender_bindings/RenderCompositorSWGL.cpp
+++ gfx/webrender_bindings/RenderCompositorSWGL.cpp
@@ -7,6 +7,7 @@
#include "RenderCompositorSWGL.h"
#include "mozilla/gfx/Logging.h"
+#include "mozilla/gfx/Swizzle.h"
#include "mozilla/widget/CompositorWidget.h"
#ifdef MOZ_WIDGET_GTK
@@ -235,6 +236,13 @@ void RenderCompositorSWGL::CommitMappedBuffer(bool aDirty) {
}
mDT->Flush();
+#if MOZ_BIG_ENDIAN()
+ // One swizzle to rule them all.
+ gfx::SwizzleData(mMappedData, mMappedStride, gfx::SurfaceFormat::B8G8R8A8,
+ mMappedData, mMappedStride, gfx::SurfaceFormat::A8R8G8B8,
+ mDT->GetSize());
+#endif
+
// Done with the DT. Hand it back to the widget and clear out any trace of it.
mWidget->EndRemoteDrawingInRegion(mDT, mDirtyRegion);
mDirtyRegion.SetEmpty();
diff --git image/imgFrame.cpp image/imgFrame.cpp
index e58c3dd5b2d4..c1e7e77c362b 100644
--- image/imgFrame.cpp
+++ image/imgFrame.cpp
@@ -372,6 +372,17 @@ nsresult imgFrame::InitWithDrawable(gfxDrawable* aDrawable,
return NS_ERROR_OUT_OF_MEMORY;
}
+#if MOZ_BIG_ENDIAN()
+ if (aBackend == gfx::BackendType::SKIA && canUseDataSurface) {
+ // SKIA is lying about what format it returns on big endian
+ for (int ii=0; ii < mRawSurface->GetSize().Height()*mRawSurface->Stride() / 4; ++ii) {
+ uint32_t *vals = (uint32_t*)(mRawSurface->GetData());
+ uint32_t val = ((vals[ii] << 8) & 0xFF00FF00 ) | ((vals[ii] >> 8) & 0xFF00FF );
+ vals[ii] = (val << 16) | (val >> 16);
+ }
+ }
+#endif
+
if (!canUseDataSurface) {
// We used an offscreen surface, which is an "optimized" surface from
// imgFrame's perspective.

288
files/patch-bug847568 Normal file
View file

@ -0,0 +1,288 @@
# Allow building against system-wide graphite2/harfbuzz.
diff --git config/system-headers.mozbuild config/system-headers.mozbuild
index a1b58eb..a0a0943 100644
--- config/system-headers.mozbuild
+++ config/system-headers.mozbuild
@@ -1289,6 +1289,19 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
'proxy.h',
]
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+ system_headers += [
+ 'graphite2/Font.h',
+ 'graphite2/Segment.h',
+ ]
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ system_headers += [
+ 'harfbuzz/hb-glib.h',
+ 'harfbuzz/hb-ot.h',
+ 'harfbuzz/hb.h',
+ ]
+
if CONFIG['MOZ_SYSTEM_LIBVPX']:
system_headers += [
'vpx_mem/vpx_mem.h',
diff --git dom/base/moz.build dom/base/moz.build
index d390adf..4508f19 100644
--- dom/base/moz.build
+++ dom/base/moz.build
@@ -576,6 +576,9 @@ FINAL_LIBRARY = "xul"
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
GeneratedFile(
"UseCounterList.h",
script="gen-usecounters.py",
diff --git gfx/graphite2/geckoextra/moz.build gfx/graphite2/geckoextra/moz.build
new file mode 100644
index 0000000..24e8d7a
--- /dev/null
+++ gfx/graphite2/geckoextra/moz.build
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+EXPORTS.graphite2 += [
+ 'include/GraphiteExtra.h',
+ 'include/GraphiteStructsForRLBox.h',
+]
+
+UNIFIED_SOURCES += [
+ '../geckoextra/src/GraphiteExtra.cpp',
+]
+
+CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
+
+# Match bundled graphite2 configuration
+AllowCompilerWarnings()
+
+FINAL_LIBRARY = 'gkmedias'
diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
index b91d9c1..a97e6eb 100755
--- gfx/graphite2/moz-gr-update.sh
+++ gfx/graphite2/moz-gr-update.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# Script used to update the Graphite2 library in the mozilla source tree
+# and bump version for --with-system-graphite2
# This script lives in gfx/graphite2, along with the library source,
# but must be run from the top level of the mozilla-central tree.
@@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
#find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
#find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+# chase version for --with-system-graphite2
+perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
+ if /GR2_VERSION_REQUIRE/" old-configure.in
+
# summarize what's been touched
echo Updated to $RELEASE.
echo Here is what changed in the gfx/graphite2 directory:
echo
-hg stat gfx/graphite2
+hg stat old-configure.in gfx/graphite2
echo
echo If gfx/graphite2/src/files.mk has changed, please make corresponding
diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
index 3180257..4587a3b 100644
--- /dev/null
+++ gfx/harfbuzz/README-mozilla.fbsd
@@ -0,0 +1,4 @@
+The in-tree copy may be omitted during build by --with-system-harfbuzz.
+Make sure to keep pkg-config version check within toolkit/moz.configure in sync
+with checkout version or increment latest tag by one if it's not based
+on upstream release.
diff --git gfx/moz.build gfx/moz.build
index 4d6d63d..cd57b0c 100644
--- gfx/moz.build
+++ gfx/moz.build
@@ -10,6 +10,14 @@ with Files("**"):
with Files("wr/**"):
BUG_COMPONENT = ("Core", "Graphics: WebRender")
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ DIRS += ["graphite2/geckoextra"]
+else:
+ DIRS += ["graphite2/src" ]
+
+if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ DIRS += ["harfbuzz/src"]
+
DIRS += [
"cairo",
"2d",
@@ -19,8 +27,6 @@ DIRS += [
"qcms",
"gl",
"layers",
- "graphite2/src",
- "harfbuzz/src",
"ots/src",
"thebes",
"ipc",
diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
index 5e0fd17..860b80a 100755
--- gfx/skia/generate_mozbuild.py
+++ gfx/skia/generate_mozbuild.py
@@ -96,6 +96,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
'-Wno-unused-private-field',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
LOCAL_INCLUDES += [
"/gfx/cairo/cairo/src",
diff --git gfx/skia/moz.build gfx/skia/moz.build
index 524bd28..615c93b 100755
--- gfx/skia/moz.build
+++ gfx/skia/moz.build
@@ -488,6 +488,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
'-Wno-unused-private-field',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
LOCAL_INCLUDES += [
"/gfx/cairo/cairo/src",
diff --git gfx/thebes/moz.build gfx/thebes/moz.build
index baa6f09..4f02a9e 100644
--- gfx/thebes/moz.build
+++ gfx/thebes/moz.build
@@ -286,7 +286,13 @@ if CONFIG["MOZ_WAYLAND"]:
LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
-DEFINES["GRAPHITE2_STATIC"] = True
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
+else:
+ DEFINES["GRAPHITE2_STATIC"] = True
+
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
if CONFIG["CC_TYPE"] == "clang":
# Suppress warnings from Skia header files.
diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
index 301eb9a..7cece5e 100644
--- intl/unicharutil/util/moz.build
+++ intl/unicharutil/util/moz.build
@@ -25,6 +25,9 @@ UNIFIED_SOURCES += [
"nsUnicodeProperties.cpp",
]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
include("/ipc/chromium/chromium-config.mozbuild")
GeneratedFile(
diff --git netwerk/dns/moz.build netwerk/dns/moz.build
index f769e27..315bdd4 100644
--- netwerk/dns/moz.build
+++ netwerk/dns/moz.build
@@ -102,6 +102,9 @@ GeneratedFile(
"etld_data.inc", script="prepare_tlds.py", inputs=["effective_tld_names.dat"]
)
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
# need to include etld_data.inc
LOCAL_INCLUDES += [
"/netwerk/base",
diff --git old-configure.in old-configure.in
index d147957..d332b34 100644
--- old-configure.in
+++ old-configure.in
@@ -1335,6 +1335,27 @@ fi
AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
AC_SUBST(MOZ_MACBUNDLE_ID)
+dnl ========================================================
+dnl Check for graphite2
+dnl ========================================================
+if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
+ dnl graphite2.pc has bogus version, check manually
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
+ AC_TRY_COMPILE([ #include <graphite2/Font.h>
+ #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
+ ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
+ * 100 + GR2_VERSION_BUGFIX >= \
+ (major) * 10000 + (minor) * 100 + (bugfix) )
+ ], [
+ #if !GR2_VERSION_REQUIRE(1,3,14)
+ #error "Insufficient graphite2 version."
+ #endif
+ ], [],
+ [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
+ CFLAGS=$_SAVE_CFLAGS
+fi
+
dnl ========================================================
dnl = Child Process Name for IPC
dnl ========================================================
diff --git toolkit/library/moz.build toolkit/library/moz.build
index 2c3f869..e8a9d23 100644
--- toolkit/library/moz.build
+++ toolkit/library/moz.build
@@ -269,6 +269,12 @@ if CONFIG["MOZ_SYSTEM_PNG"]:
if CONFIG["MOZ_SYSTEM_WEBP"]:
OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
+
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
+
if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
diff --git toolkit/moz.configure toolkit/moz.configure
index 0069865..9bb1864 100644
--- toolkit/moz.configure
+++ toolkit/moz.configure
@@ -1058,6 +1058,25 @@ def geckodriver_default(enable_tests, target, cross_compile, hazard, asan, autom
return False
return True
+# Graphite2
+# ==============================================================
+option("--with-system-graphite2",
+ help="Use system graphite2 (located with pkgconfig)")
+
+system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2",
+ when="--with-system-graphite2")
+
+set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True))
+
+# HarfBuzz
+# ==============================================================
+option("--with-system-harfbuzz",
+ help="Use system harfbuzz (located with pkgconfig)")
+
+system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 2.7.4",
+ when="--with-system-harfbuzz")
+
+set_config("MOZ_SYSTEM_HARFBUZZ", depends_if(system_harfbuzz)(lambda _: True))
option(
"--enable-geckodriver",

View file

@ -0,0 +1,23 @@
Enable FLAC on platforms without ffvpx like powerpc*
--- dom/media/flac/FlacDecoder.cpp.orig 2021-04-15 19:44:28 UTC
+++ dom/media/flac/FlacDecoder.cpp
@@ -7,6 +7,7 @@
#include "FlacDecoder.h"
#include "MediaContainerType.h"
#include "mozilla/StaticPrefs_media.h"
+#include "PDMFactory.h"
namespace mozilla {
@@ -14,6 +15,10 @@ namespace mozilla {
bool FlacDecoder::IsEnabled() {
#ifdef MOZ_FFVPX
return StaticPrefs::media_flac_enabled();
+#elif defined(MOZ_FFMPEG)
+ RefPtr<PDMFactory> platform = new PDMFactory();
+ return StaticPrefs::media_flac_enabled() &&
+ (platform->SupportsMimeType("audio/flac"_ns) != media::DecodeSupport::Unsupported);
#else
return false;
#endif

View file

@ -0,0 +1,15 @@
# On FreeBSD/i386's LLVM, actual alignment for atomic types requires
# stricter alignment rules, mostly on 8 byte boundaries instead of 4 byte
# as indicated by max_align_t.
--- ./toolkit/components/protobuf/src/google/protobuf/arena_impl.h.orig 2022-08-20 20:07:57.096818000 +0200
+++ ./toolkit/components/protobuf/src/google/protobuf/arena_impl.h 2022-08-20 21:40:47.821690000 +0200
@@ -640,7 +640,7 @@
#ifdef _MSC_VER
#pragma warning(disable : 4324)
#endif
- struct alignas(kCacheAlignment) CacheAlignedLifecycleIdGenerator {
+ struct alignas(alignof(std::atomic<LifecycleIdAtomic>)) CacheAlignedLifecycleIdGenerator {
std::atomic<LifecycleIdAtomic> id;
};
static CacheAlignedLifecycleIdGenerator lifecycle_id_generator_;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,264 @@
From ebc07ec32002c53702eb6e53ee1532ad2e0dc2bd Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Fri, 12 Mar 2021 23:27:16 +0100
Subject: [PATCH 1/2] wav: Swap header fields as needed
---
third_party/webrtc/common_audio/wav_header.cc | 48 +++++++++++++++++--
1 file changed, 44 insertions(+), 4 deletions(-)
--- third_party/libwebrtc/common_audio/wav_header.cc
+++ third_party/libwebrtc/common_audio/wav_header.cc
@@ -26,10 +26,6 @@
namespace webrtc {
namespace {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Code not working properly for big endian platforms."
-#endif
-
#pragma pack(2)
struct ChunkHeader {
uint32_t ID;
@@ -111,9 +107,15 @@ static_assert(sizeof(WavHeaderIeeeFloat) == kIeeeFloatWavHeaderSize,
"no padding in header");
uint32_t PackFourCC(char a, char b, char c, char d) {
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ uint32_t packed_value =
+ static_cast<uint32_t>(a) << 24 | static_cast<uint32_t>(b) << 16 |
+ static_cast<uint32_t>(c) << 8 | static_cast<uint32_t>(d);
+#else
uint32_t packed_value =
static_cast<uint32_t>(a) | static_cast<uint32_t>(b) << 8 |
static_cast<uint32_t>(c) << 16 | static_cast<uint32_t>(d) << 24;
+#endif
return packed_value;
}
@@ -172,6 +174,9 @@ bool FindWaveChunk(ChunkHeader* chunk_header,
if (readable->Read(chunk_header, sizeof(*chunk_header)) !=
sizeof(*chunk_header))
return false; // EOF.
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ chunk_header->Size = __builtin_bswap32(chunk_header->Size);
+#endif
if (ReadFourCC(chunk_header->ID) == sought_chunk_id)
return true; // Sought chunk found.
// Ignore current chunk by skipping its payload.
@@ -185,6 +190,14 @@ bool ReadFmtChunkData(FmtPcmSubchunk* fmt_subchunk, WavHeaderReader* readable) {
if (readable->Read(&(fmt_subchunk->AudioFormat), kFmtPcmSubchunkSize) !=
kFmtPcmSubchunkSize)
return false;
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ fmt_subchunk->AudioFormat = __builtin_bswap16(fmt_subchunk->AudioFormat);
+ fmt_subchunk->NumChannels = __builtin_bswap16(fmt_subchunk->NumChannels);
+ fmt_subchunk->SampleRate = __builtin_bswap32(fmt_subchunk->SampleRate);
+ fmt_subchunk->ByteRate = __builtin_bswap32(fmt_subchunk->ByteRate);
+ fmt_subchunk->BlockAlign = __builtin_bswap16(fmt_subchunk->BlockAlign);
+ fmt_subchunk->BitsPerSample = __builtin_bswap16(fmt_subchunk->BitsPerSample);
+#endif
const uint32_t fmt_size = fmt_subchunk->header.Size;
if (fmt_size != kFmtPcmSubchunkSize) {
// There is an optional two-byte extension field permitted to be present
@@ -225,6 +238,17 @@ void WritePcmWavHeader(size_t num_channels,
header.fmt.BitsPerSample = static_cast<uint16_t>(8 * bytes_per_sample);
header.data.header.ID = PackFourCC('d', 'a', 't', 'a');
header.data.header.Size = static_cast<uint32_t>(bytes_in_payload);
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ header.riff.header.Size = __builtin_bswap32(header.riff.header.Size);
+ header.fmt.header.Size = __builtin_bswap32(header.fmt.header.Size);
+ header.fmt.AudioFormat = __builtin_bswap16(header.fmt.AudioFormat);
+ header.fmt.NumChannels = __builtin_bswap16(header.fmt.NumChannels);
+ header.fmt.SampleRate = __builtin_bswap32(header.fmt.SampleRate);
+ header.fmt.ByteRate = __builtin_bswap32(header.fmt.ByteRate);
+ header.fmt.BlockAlign = __builtin_bswap16(header.fmt.BlockAlign);
+ header.fmt.BitsPerSample = __builtin_bswap16(header.fmt.BitsPerSample);
+ header.data.header.Size = __builtin_bswap32(header.data.header.Size);
+#endif
// Do an extra copy rather than writing everything to buf directly, since buf
// might not be correctly aligned.
@@ -261,6 +285,19 @@ void WriteIeeeFloatWavHeader(size_t num_channels,
header.fact.SampleLength = static_cast<uint32_t>(num_channels * num_samples);
header.data.header.ID = PackFourCC('d', 'a', 't', 'a');
header.data.header.Size = static_cast<uint32_t>(bytes_in_payload);
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ header.riff.header.Size = __builtin_bswap32(header.riff.header.Size);
+ header.fmt.header.Size = __builtin_bswap32(header.fmt.header.Size);
+ header.fmt.AudioFormat = __builtin_bswap16(header.fmt.AudioFormat);
+ header.fmt.NumChannels = __builtin_bswap16(header.fmt.NumChannels);
+ header.fmt.SampleRate = __builtin_bswap32(header.fmt.SampleRate);
+ header.fmt.ByteRate = __builtin_bswap32(header.fmt.ByteRate);
+ header.fmt.BlockAlign = __builtin_bswap16(header.fmt.BlockAlign);
+ header.fmt.BitsPerSample = __builtin_bswap16(header.fmt.BitsPerSample);
+ header.fact.header.Size = __builtin_bswap32(header.fact.header.Size);
+ header.fact.SampleLength = __builtin_bswap32(header.fact.SampleLength);
+ header.data.header.Size = __builtin_bswap32(header.data.header.Size);
+#endif
// Do an extra copy rather than writing everything to buf directly, since buf
// might not be correctly aligned.
@@ -387,6 +424,9 @@ bool ReadWavHeader(WavHeaderReader* readable,
return false;
if (ReadFourCC(header.riff.Format) != "WAVE")
return false;
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ header.riff.header.Size = __builtin_bswap32(header.riff.header.Size);
+#endif
// Find "fmt " and "data" chunks. While the official Wave file specification
// does not put requirements on the chunks order, it is uncommon to find the
--
2.26.3
From 28adaefe12a045a4adf7fdf56eb4e57db46dbe5e Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Fri, 12 Mar 2021 23:28:25 +0100
Subject: [PATCH 2/2] wav: Implement sample swapping
---
third_party/webrtc/common_audio/wav_file.cc | 50 ++++++++++++++-------
1 file changed, 34 insertions(+), 16 deletions(-)
--- third_party/libwebrtc/common_audio/wav_file.cc
+++ third_party/libwebrtc/common_audio/wav_file.cc
@@ -89,10 +89,6 @@ void WavReader::Reset() {
size_t WavReader::ReadSamples(const size_t num_samples,
int16_t* const samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to big-endian when reading from WAV file"
-#endif
-
size_t num_samples_left_to_read = num_samples;
size_t next_chunk_start = 0;
while (num_samples_left_to_read > 0 && num_unread_samples_ > 0) {
@@ -107,6 +103,9 @@ size_t WavReader::ReadSamples(const size_t num_samples,
num_samples_read = num_bytes_read / sizeof(samples_to_convert[0]);
for (size_t j = 0; j < num_samples_read; ++j) {
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ *(uint32_t*)&samples_to_convert[j] = __builtin_bswap32(*(uint32_t*)&samples_to_convert[j]);
+#endif
samples[next_chunk_start + j] = FloatToS16(samples_to_convert[j]);
}
} else {
@@ -114,6 +113,11 @@ size_t WavReader::ReadSamples(const size_t num_samples,
num_bytes_read = file_.Read(&samples[next_chunk_start],
chunk_size * sizeof(samples[0]));
num_samples_read = num_bytes_read / sizeof(samples[0]);
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ for (size_t j = 0; j < num_samples_read; ++j) {
+ samples[next_chunk_start + j] = __builtin_bswap16(samples[next_chunk_start + j]);
+ }
+#endif
}
RTC_CHECK(num_samples_read == 0 || (num_bytes_read % num_samples_read) == 0)
<< "Corrupt file: file ended in the middle of a sample.";
@@ -129,10 +133,6 @@ size_t WavReader::ReadSamples(const size_t num_samples,
}
size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to big-endian when reading from WAV file"
-#endif
-
size_t num_samples_left_to_read = num_samples;
size_t next_chunk_start = 0;
while (num_samples_left_to_read > 0 && num_unread_samples_ > 0) {
@@ -147,8 +147,13 @@ size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
num_samples_read = num_bytes_read / sizeof(samples_to_convert[0]);
for (size_t j = 0; j < num_samples_read; ++j) {
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ samples[next_chunk_start + j] =
+ static_cast<float>(static_cast<int16_t>(__builtin_bswap16(samples_to_convert[j])));
+#else
samples[next_chunk_start + j] =
static_cast<float>(samples_to_convert[j]);
+#endif
}
} else {
RTC_CHECK_EQ(format_, WavFormat::kWavFormatIeeeFloat);
@@ -157,6 +162,9 @@ size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
num_samples_read = num_bytes_read / sizeof(samples[0]);
for (size_t j = 0; j < num_samples_read; ++j) {
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ *(uint32_t*)&samples[next_chunk_start + j] = __builtin_bswap32(*(uint32_t*)&samples[next_chunk_start + j]);
+#endif
samples[next_chunk_start + j] =
FloatToFloatS16(samples[next_chunk_start + j]);
}
@@ -213,23 +221,31 @@ WavWriter::WavWriter(FileWrapper file,
}
void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to little-endian when writing to WAV file"
-#endif
-
for (size_t i = 0; i < num_samples; i += kMaxChunksize) {
const size_t num_remaining_samples = num_samples - i;
const size_t num_samples_to_write =
std::min(kMaxChunksize, num_remaining_samples);
if (format_ == WavFormat::kWavFormatPcm) {
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ std::array<int16_t, kMaxChunksize> converted_samples;
+ for (size_t j = 0; j < num_samples_to_write; ++j) {
+ converted_samples[j] = __builtin_bswap16(samples[i + j]);
+ }
+ RTC_CHECK(
+ file_.Write(converted_samples.data(), num_samples_to_write * sizeof(samples[0])));
+#else
RTC_CHECK(
file_.Write(&samples[i], num_samples_to_write * sizeof(samples[0])));
+#endif
} else {
RTC_CHECK_EQ(format_, WavFormat::kWavFormatIeeeFloat);
std::array<float, kMaxChunksize> converted_samples;
for (size_t j = 0; j < num_samples_to_write; ++j) {
converted_samples[j] = S16ToFloat(samples[i + j]);
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ *(uint32_t*)&converted_samples[j] = __builtin_bswap32(*(uint32_t*)&converted_samples[j]);
+#endif
}
RTC_CHECK(
file_.Write(converted_samples.data(),
@@ -243,10 +259,6 @@ void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) {
}
void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to little-endian when writing to WAV file"
-#endif
-
for (size_t i = 0; i < num_samples; i += kMaxChunksize) {
const size_t num_remaining_samples = num_samples - i;
const size_t num_samples_to_write =
@@ -256,6 +268,9 @@ void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
std::array<int16_t, kMaxChunksize> converted_samples;
for (size_t j = 0; j < num_samples_to_write; ++j) {
converted_samples[j] = FloatS16ToS16(samples[i + j]);
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ converted_samples[j] = __builtin_bswap16(converted_samples[j]);
+#endif
}
RTC_CHECK(
file_.Write(converted_samples.data(),
@@ -265,6 +280,9 @@ void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
std::array<float, kMaxChunksize> converted_samples;
for (size_t j = 0; j < num_samples_to_write; ++j) {
converted_samples[j] = FloatS16ToFloat(samples[i + j]);
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ *(uint32_t*)&converted_samples[j] = __builtin_bswap32(*(uint32_t*)&converted_samples[j]);
+#endif
}
RTC_CHECK(
file_.Write(converted_samples.data(),
--
2.26.3

View file

@ -0,0 +1,69 @@
--- memory/mozalloc/throw_gcc.h.orig 2022-02-02 17:33:38 UTC
+++ memory/mozalloc/throw_gcc.h
@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
mozalloc_abort("fatal: STL threw bad_function_call");
}
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error(
const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error(
const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_invalid_argument(const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(
const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error(
const char* msg) {
mozalloc_abort(msg);
}
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error(
const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_overflow_error(const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
+#if !defined(_LIBCPP_VERSION)
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_underflow_error(const char* msg) {
mozalloc_abort(msg);
}
+#endif // _LIBCPP_VERSION
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure(
const char* msg) {

120
files/patch-pipewire_init Normal file
View file

@ -0,0 +1,120 @@
Chase ABI from multimedia/pipewire/files/patch-src_pipewire_pipewire_init
Ref: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1819
diff --git third_party/libwebrtc/modules/desktop_capture/linux/wayland/moz_base_capturer_pipewire.cc third_party/libwebrtc/modules/desktop_capture/linux/wayland/moz_base_capturer_pipewire.cc
index 9bd7cec7ff22..811c4eb33e7c 100644
--- third_party/libwebrtc/modules/desktop_capture/linux/wayland/moz_base_capturer_pipewire.cc
+++ third_party/libwebrtc/modules/desktop_capture/linux/wayland/moz_base_capturer_pipewire.cc
@@ -382,7 +382,7 @@ void BaseCapturerPipeWire::InitPipeWire() {
}
#endif // defined(WEBRTC_DLOPEN_PIPEWIRE)
- pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
+ pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
diff --git third_party/libwebrtc/modules/desktop_capture/linux/wayland/pipewire.sigs third_party/libwebrtc/modules/desktop_capture/linux/wayland/pipewire.sigs
index 06a97b8f294e..ea14a8014431 100644
--- third_party/libwebrtc/modules/desktop_capture/linux/wayland/pipewire.sigs
+++ third_party/libwebrtc/modules/desktop_capture/linux/wayland/pipewire.sigs
@@ -15,7 +15,7 @@ pw_loop * pw_loop_new(const spa_dict *props);
// pipewire.h
-void pw_init(int *argc, char **argv[]);
+void pipewire_init(int *argc, char **argv[]);
const char* pw_get_library_version();
// properties.h
diff --git third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 12c8e7a9347d..00e3a9c76758 100644
--- third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -388,7 +388,7 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
pw_stream_node_id_ = stream_node_id;
- pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
+ pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
diff --git third_party/pipewire/libpipewire/mozpipewire.cpp third_party/pipewire/libpipewire/mozpipewire.cpp
index 1ecfc3196af1..6f44b35964d0 100644
--- third_party/pipewire/libpipewire/mozpipewire.cpp
+++ third_party/pipewire/libpipewire/mozpipewire.cpp
@@ -58,7 +58,7 @@ struct pw_context * (*pw_context_new_fn)(struct pw_loop *main_loop,
struct pw_properties *props,
size_t user_data_size);
static int (*pw_core_disconnect_fn)(struct pw_core *core);
-static void (*pw_init_fn)(int *argc, char **argv[]);
+static void (*pipewire_init_fn)(int *argc, char **argv[]);
static void (*pw_stream_add_listener_fn)(struct pw_stream *stream,
struct spa_hook *listener,
const struct pw_stream_events *events,
@@ -96,7 +96,7 @@ bool IsPwLibraryLoaded() {
IS_FUNC_LOADED(pw_context_destroy_fn) &&
IS_FUNC_LOADED(pw_context_new_fn) &&
IS_FUNC_LOADED(pw_core_disconnect_fn) &&
- IS_FUNC_LOADED(pw_init_fn) &&
+ IS_FUNC_LOADED(pipewire_init_fn) &&
IS_FUNC_LOADED(pw_stream_add_listener_fn) &&
IS_FUNC_LOADED(pw_stream_connect_fn) &&
IS_FUNC_LOADED(pw_stream_dequeue_buffer_fn) &&
@@ -133,7 +133,7 @@ bool LoadPWLibrary() {
GET_FUNC(pw_context_destroy, pwLib);
GET_FUNC(pw_context_new, pwLib);
GET_FUNC(pw_core_disconnect, pwLib);
- GET_FUNC(pw_init, pwLib);
+ GET_FUNC(pipewire_init, pwLib);
GET_FUNC(pw_stream_add_listener, pwLib);
GET_FUNC(pw_stream_connect, pwLib);
GET_FUNC(pw_stream_dequeue_buffer, pwLib);
@@ -207,12 +207,12 @@ pw_core_disconnect(struct pw_core *core)
}
void
-pw_init(int *argc, char **argv[])
+pipewire_init(int *argc, char **argv[])
{
if (!LoadPWLibrary()) {
return;
}
- return pw_init_fn(argc, argv);
+ return pipewire_init_fn(argc, argv);
}
void
diff --git third_party/pipewire/pipewire/log.h third_party/pipewire/pipewire/log.h
index 26ffc20f9a0d..0357bdffbb7e 100644
--- third_party/pipewire/pipewire/log.h
+++ third_party/pipewire/pipewire/log.h
@@ -50,8 +50,8 @@ extern enum spa_log_level pw_log_level;
extern struct spa_log_topic *PW_LOG_TOPIC_DEFAULT;
/** Configure a logging module. This is usually done automatically
- * in pw_init() but you can install a custom logger before calling
- * pw_init(). */
+ * in pipewire_init() but you can install a custom logger before calling
+ * pipewire_init(). */
void pw_log_set(struct spa_log *log);
/** Get the log interface */
diff --git third_party/pipewire/pipewire/pipewire.h third_party/pipewire/pipewire/pipewire.h
index b932103f46e6..2c88e28421ec 100644
--- third_party/pipewire/pipewire/pipewire.h
+++ third_party/pipewire/pipewire/pipewire.h
@@ -69,9 +69,9 @@ extern "C" {
* \{
*/
void
-pw_init(int *argc, char **argv[]);
+pipewire_init(int *argc, char **argv[]);
-void pw_deinit(void);
+void pipewire_deinit(void);
bool
pw_debug_is_category_enabled(const char *name);

View file

@ -0,0 +1,39 @@
--- python/mozbuild/mozbuild/gn_processor.py.orig 2022-11-03 22:19:40.000000000 +0100
+++ python/mozbuild/mozbuild/gn_processor.py 2022-11-07 21:11:42.596355000 +0100
@@ -166,6 +166,7 @@
}
oses = {
"android": "Android",
+ "freebsd": "FreeBSD",
"linux": "Linux",
"mac": "Darwin",
"openbsd": "OpenBSD",
@@ -662,15 +663,15 @@
vars_set = []
for is_debug in (True, False):
- for target_os in ("android", "linux", "mac", "openbsd", "win"):
+ for target_os in ("freebsd",):
target_cpus = ["x64"]
- if target_os in ("android", "linux", "mac", "win", "openbsd"):
+ if target_os in ("android", "freebsd", "linux", "mac", "win", "openbsd"):
target_cpus.append("arm64")
if target_os in ("android", "linux"):
target_cpus.append("arm")
- if target_os in ("android", "linux", "win"):
+ if target_os in ("android", "freebsd", "linux", "win"):
target_cpus.append("x86")
- if target_os == "linux":
+ if target_os in ("freebsd", "linux"):
target_cpus.append("ppc64")
for target_cpu in target_cpus:
vars = {
@@ -679,7 +680,7 @@
"target_cpu": target_cpu,
"target_os": target_os,
}
- if target_os == "linux":
+ if target_os in ("freebsd", "linux"):
for use_x11 in (True, False):
vars["use_x11"] = use_x11
vars_set.append(vars.copy())

33
files/patch-rust-1.70.0 Normal file
View file

@ -0,0 +1,33 @@
https://github.com/mozilla/mp4parse-rust/commit/8b5b652d38e007e736bb442ccd5aa5ed699db100
From 8b5b652d38e007e736bb442ccd5aa5ed699db100 Mon Sep 17 00:00:00 2001
From: Matthew Gregan <kinetik@flim.org>
Date: Thu, 16 Jun 2022 13:54:02 +1200
Subject: [PATCH] Fix `unstable-name-collisions` warning by using fully
qualified path.
---
mp4parse/src/lib.rs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mp4parse/src/lib.rs b/mp4parse/src/lib.rs
index 567ee21d..4f3d7153 100644
--- third_party/rust/mp4parse/src/lib.rs
+++ third_party/rust/mp4parse/src/lib.rs
@@ -3506,8 +3506,13 @@ macro_rules! impl_mul {
type Output = $output;
fn mul(self, rhs: $rhs) -> Self::Output {
- static_assertions::const_assert!(<$output>::MAX <= <$inner>::MAX as u64);
- static_assertions::const_assert!(<$lhs>::MAX * <$rhs>::MAX <= <$output>::MAX);
+ static_assertions::const_assert!(
+ <$output as UpperBounded>::MAX <= <$inner>::MAX as u64
+ );
+ static_assertions::const_assert!(
+ <$lhs as UpperBounded>::MAX * <$rhs as UpperBounded>::MAX
+ <= <$output as UpperBounded>::MAX
+ );
let lhs: $inner = self.get().into();
let rhs: $inner = rhs.get().into();

View file

@ -0,0 +1,37 @@
--- third_party/libwebrtc/build/config/BUILDCONFIG.gn.orig 2022-10-09 20:42:58.113963000 +0200
+++ third_party/libwebrtc/build/config/BUILDCONFIG.gn 2022-10-09 20:46:16.128220000 +0200
@@ -132,6 +132,7 @@
# Set to true when compiling with the Clang compiler.
is_clang = current_os != "linux" || current_os == "openbsd" ||
+ current_os == "freebsd" ||
(current_cpu != "s390x" && current_cpu != "s390" &&
current_cpu != "ppc64" && current_cpu != "ppc" &&
current_cpu != "mips" && current_cpu != "mips64" &&
@@ -184,7 +185,7 @@
# TODO(dpranke): Add some sort of assert here that verifies that
# no toolchain omitted host_toolchain from its toolchain_args().
- if (host_os == "linux" || host_os == "openbsd") {
+ if (host_os == "linux" || host_os == "openbsd" || host_os == "freebsd") {
if (target_os != "linux") {
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
} else if (is_clang) {
@@ -222,7 +223,7 @@
assert(host_os == "linux" || host_os == "mac",
"Android builds are only supported on Linux and Mac hosts.")
_default_toolchain = "//build/toolchain/android:android_clang_$target_cpu"
-} else if (target_os == "chromeos" || target_os == "linux" || target_os == "openbsd") {
+} else if (target_os == "chromeos" || target_os == "linux" || target_os == "openbsd" || target_os == "freebsd") {
# See comments in build/toolchain/cros/BUILD.gn about board compiles.
if (is_clang) {
_default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
@@ -288,7 +289,7 @@
is_fuchsia = current_os == "fuchsia"
is_ios = current_os == "ios"
is_linux = current_os == "linux"
-is_bsd = current_os == "openbsd"
+is_bsd = current_os == "openbsd" || current_os == "freebsd"
is_mac = current_os == "mac"
is_nacl = current_os == "nacl"
is_win = current_os == "win" || current_os == "winuwp"

View file

@ -0,0 +1,23 @@
commit d1f5a45c1906e9f1e6a51f3b44c52d981bb3958c
Author: Christoph Moench-Tegeder <cmt@burggraben.net>
Date: Wed Oct 12 19:57:20 2022 +0200
pull in sys/types.h for u_XXX typedefs on FreeBSD 12
In file included from /wrkdirs/usr/ports/www/firefox/work/firefox-106.0/third_party/libwebrtc/rtc_base/ip_address.cc:20:
/usr/include/netinet/ip.h:53:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ip_hl:4, /* header length */
diff --git third_party/libwebrtc/rtc_base/ip_address.cc third_party/libwebrtc/rtc_base/ip_address.cc
index d544b611e149..ef9b742dac5f 100644
--- third_party/libwebrtc/rtc_base/ip_address.cc
+++ third_party/libwebrtc/rtc_base/ip_address.cc
@@ -11,6 +11,8 @@
#if defined(WEBRTC_POSIX)
#include <netinet/in.h>
#include <sys/socket.h>
+/* for u_char/u_short etc on FreeBSD 12 */
+#include <sys/types.h>
#include "absl/strings/string_view.h"
#ifdef OPENBSD

View file

@ -0,0 +1,10 @@
--- third_party/libwebrtc/third_party/pffft/src/pffft.c.orig 2022-02-10 18:57:48 UTC
+++ third_party/libwebrtc/third_party/pffft/src/pffft.c
@@ -100,6 +100,7 @@
Altivec support macros
*/
#if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
+#include <altivec.h>
typedef vector float v4sf;
# define SIMD_SZ 4
# define VZERO() ((vector float) vec_splat_u8(0))

View file

@ -0,0 +1,12 @@
--- third_party/sqlite3/src/moz.build.old 2021-08-09 16:08:59.381182000 -0500
+++ third_party/sqlite3/src/moz.build 2021-08-09 16:10:25.370954000 -0500
@@ -92,7 +92,8 @@
# Enabling sqlite math functions
DEFINES['SQLITE_ENABLE_MATH_FUNCTIONS'] = True
-if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android":
+if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android" or \
+ CONFIG["OS_TARGET"] == "FreeBSD":
OS_LIBS += [
"m"
]

View file

@ -0,0 +1,17 @@
--- toolkit/xre/glxtest.cpp.orig
+++ toolkit/xre/glxtest.cpp
@@ -270,9 +270,14 @@
#define PCI_BASE_CLASS_DISPLAY 0x03
static void get_pci_status() {
+#if defined(__FreeBSD__)
+ if (access("/dev/pci", F_OK) != 0) {
+ record_warning("cannot access /dev/pci");
+#else
if (access("/sys/bus/pci/", F_OK) != 0 &&
access("/sys/bus/pci_express/", F_OK) != 0) {
record_warning("cannot access /sys/bus/pci");
+#endif
return;
}

View file

@ -0,0 +1,11 @@
--- toolkit/xre/nsXREDirProvider.cpp.orig
+++ toolkit/xre/nsXREDirProvider.cpp
@@ -1614,6 +1614,7 @@
rv = AppendProfileString(aFile, folder.BeginReading());
} else {
+ appName = nsAutoCString("librewolf");
if (!vendor.IsEmpty()) {
folder.Append(vendor);
ToLowerCase(folder);

View file

@ -0,0 +1,51 @@
commit 45a7951cb6a9b1735b9b6cec89db69b5933715c7
Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>
Date: Mon Mar 28 21:54:35 2022 +0200
FreeBSD can use sched_getcpu() from 1400046/1300524 on
diff --git tools/profiler/core/platform.cpp tools/profiler/core/platform.cpp
index 92bcc1100687..2f17a88942a8 100644
--- tools/profiler/core/platform.cpp
+++ tools/profiler/core/platform.cpp
@@ -111,6 +111,20 @@
# include <cpuid.h>
#endif
+#if defined(GP_OS_freebsd)
+#include <sys/param.h>
+// "after making CPU_SET macros compatible with glibc"
+# if __FreeBSD_version > 1400045 || (__FreeBSD_version > 1300523 && __FreeBSD_version < 1400000)
+# include <sched.h>
+# else
+# if __x86_64__ || __i386__
+// similar cpuid_count() trick as on Darwin, using LLVM
+// but not for all CPUs
+# include <cpuid.h>
+# endif
+# endif
+#endif
+
#if defined(GP_OS_windows)
# include <processthreadsapi.h>
@@ -6368,6 +6382,19 @@ void profiler_mark_thread_awake() {
cpuId = ebx >> 24;
}
# endif
+#elif defined(GP_OS_freebsd)
+# if __FreeBSD_version > 1400045 || (__FreeBSD_version > 1300523 && __FreeBSD_version < 1400000)
+ cpuId = sched_getcpu();
+# elif defined(__amd64__)
+ unsigned int eax, ebx, ecx, edx;
+ __cpuid_count(1, 0, eax, ebx, ecx, edx);
+ // Check if we have an APIC.
+ if ((edx & (1 << 9))) {
+ // APIC ID is bits 24-31 of EBX
+ cpuId = ebx >> 24;
+ }
+# endif
+// the fallthrough is cpuID = 0
#else
cpuId = sched_getcpu();
#endif

11
pkg-descr Normal file
View file

@ -0,0 +1,11 @@
LibreWolf is a free and open source web browser descended from the
Mozilla Application Suite. It is small, fast and easy to use, and offers
many advanced features:
o Popup Blocking
o Tabbed Browsing
o Live Bookmarks (ie. RSS)
o Extensions
o Themes
o FastFind
o Improved Security

50
pkg-message Normal file
View file

@ -0,0 +1,50 @@
[
{ type: install
message: <<EOM
## Missing features
Some features found on Windows, macOS and Linux are not implemented:
- Encrypted Media Extensions (requires Widevine CDM binary)
- Process sandboxing (requires Capsicum backend)
- Reduced memory usage (requires mozjemalloc)
- Crash Reporter (requires Google Breakpad and reproducible builds)
- WebVR (requires open source runtime)
- TCP fast open
- `about:networking` (requires link state notification)
## Audio backend
Currently used audio backend can be inspected on `about:support` page.
Supported backends and default probing order is as follows:
- `pulse-rust` if `pulseaudio` package is installed (PULSEAUDIO option)
- `jack` if `jackit` package is installed (JACK option)
- `sndio` if `sndio` package is installed (SNDIO option)
- `alsa` if `alsa-lib` package is installed (ALSA option)
- `oss` (always available)
To force a specific backend open `about:config` page and create
`media.cubeb.backend` preference.
Microphone selection only works in `oss`, `pulse`, `pulse-rust` backends.
Other backends are limited to `default` which is usually `/dev/dsp`,
so use virtual_oss to reroute microphones from non-default devices.
## Gamepad API
Requires evdev(4) joystick support. On FreeBSD 13.0 enable hgame(4)
while older versions can use sysutils/iichid or multimedia/webcamd.
## smb:// issues
Network group, machine, and share browsing does not work correctly.
## sftp://
Only sftp access using public key authentication works. To easily
setup public key authentication to `remote_host`:
$ ssh-keygen
$ cat ~/.ssh/id_rsa.pub | ssh remote_host "cat >> .ssh/authorized_keys"
The SSH server on `remote_host` must allow pub key authentication.
EOM
}
]