diff --git a/www/qt6-webengine/Makefile b/www/qt6-webengine/Makefile index 1785daecb9f1..2e4d8f546493 100644 --- a/www/qt6-webengine/Makefile +++ b/www/qt6-webengine/Makefile @@ -1,144 +1,144 @@ # QtWebEngine itself is a very thin layer of Qt code on top of a large part of # Chromium (everything up to the content/ layer). As such, most of the work in # this port revolves around taming Chromium and getting it to build on FreeBSD. # While it does build at the moment, there are several items that should be # investigated or improved: # - We are using several stub files, especially in Chromium's base/ and net/ # layers. We should look at implementing the missing bits instead. # - We are currently not using any sandboxing mechanism. # - The process of porting QtWebEngine needs to be documented so we can move to # newer releases more easily. # # Also note that, due to the insane amount of patches this port needs, it tends # to lag behind the rest of the official Qt6 ones, which is why we set # QT6_VERSION and DISTINFO_FILE here. PORTNAME= webengine DISTVERSION= ${QT6_VERSION} -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= www PKGNAMEPREFIX= qt6- MAINTAINER= kde@FreeBSD.org COMMENT= Qt 6 library to render web content BUILD_DEPENDS= ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \ ${PYTHON_PKGNAMEPREFIX}html5lib>0:www/py-html5lib@${PY_FLAVOR} \ ${LOCALBASE}/include/vulkan/vulkan.h:graphics/vulkan-headers LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg \ libdbus-1.so:devel/dbus \ libevent.so:devel/libevent \ libexpat.so:textproc/expat2 \ libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libharfbuzz.so:print/harfbuzz \ liblcms2.so:graphics/lcms2 \ libnspr4.so:devel/nspr \ libnss3.so:security/nss \ libopenh264.so:multimedia/openh264 \ libopus.so:audio/opus \ libpci.so:devel/libpci \ libpng.so:graphics/png \ libre2.so:devel/re2 \ libsnappy.so:archivers/snappy \ libvpx.so:multimedia/libvpx \ libwebp.so:graphics/webp \ libxkbcommon.so:x11/libxkbcommon USES= bison cmake gl gnome gperf jpeg localbase:ldflags minizip ninja:build \ nodejs:build,lts pkgconfig python:build qt-dist:6,webengine xorg USE_GL= gl USE_GNOME= glib20 libxml2 libxslt USE_QT= base declarative:run positioning quick3d:build webchannel USE_XORG= x11 xcb xcomposite xcursor xdamage xext xfixes xi xkbfile \ xrandr xrender xscrnsaver xshmfence xtst CMAKE_ON= QT_FEATURE_webengine_system_ffmpeg QT_FEATURE_webengine_proprietary_codecs # The build system reads the environment variable $NINJA_PATH to decide whether # to boostrap ninja or not (and also to invoke it afterwards). CC and CXX are # read by some Chromium code to determine which compiler to invoke when running # some configuration tests. CONFIGURE_ENV+= NINJAFLAGS="-j${MAKE_JOBS_NUMBER}" \ NINJA_PATH="${LOCALBASE}/bin/ninja" \ PATH=${CONFIGURE_WRKSRC}/bin:${LOCALBASE}/bin:${PATH} MAKE_ENV+= CC="${CC}" CXX="${CXX}" \ C_INCLUDE_PATH=${LOCALBASE}/include \ CPLUS_INCLUDE_PATH=${LOCALBASE}/include \ ${CONFIGURE_ENV} # Avoid running multiple make(1) jobs, but only those. Otherwise the build # fails intermittently due race conditions if multiple ninja instances are # running at the same time (mostly for the targets "WebEngineCore" and # "convert_dict"). # # MAKE_JOBS_UNSAFE is too invasive because it also affects the number of jobs # for ninja(1) and would slow everything down which we don't want. We pass the # real number of make jobs via MAKE_JOBS_NUMBER to ninja(1) to CONFIGURE_ENV. DO_MAKE_BUILD= ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} -j1 ${MAKE_ARGS:N${DESTDIRNAME}=*} BINARY_ALIAS= python=${PYTHON_CMD} # Add extra-patch-no-mempcpy-nasm only when there's no mempcpy() in base. # Nested variable expansion avoids executing the test when not needed for # expanding EXTRA_PATCHES. # mempcpy was introduced in ee37f64cf875255338f917a9da76c643cf59786c EXTRA_PATCHES+= ${"${:!${GREP} mempcpy ${CROSS_SYSROOT}/usr/include/string.h \ || ${TRUE}!}" == "":?${PATCHDIR}/extra-patch-no-mempcpy-nasm:} DISTINFO_FILE= ${.CURDIR}/distinfo QT6_VERSION= 6.4.2 OPTIONS_DEFAULT= ALSA OPTIONS_SINGLE= AUDIO OPTIONS_SINGLE_AUDIO= ALSA PULSEAUDIO SNDIO AUDIO_DESC= Audio backend # Need the alsa plugins to get sound at runtime, otherwise messages # that the pcm_oss plugin can't be opened. ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib ALSA_RUN_DEPENDS= alsa-plugins>=0:audio/alsa-plugins ALSA_CMAKE_ON= -DQT_FEATURE_webengine_system_alsa:BOOL=ON ALSA_CMAKE_OFF= -DQT_FEATURE_webengine_system_alsa:BOOL=OFF PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PULSEAUDIO_CMAKE_ON= -DQT_FEATURE_webengine_system_pulseaudio:BOOL=ON PULSEAUDIO_CMAKE_OFF= -DQT_FEATURE_webengine_system_pulseaudio:BOOL=OFF SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio SNDIO_CMAKE_ON= -DQT_FEATURE_webengine_system_sndio:BOOL=ON SNDIO_CMAKE_OFF= -DQT_FEATURE_webengine_system_sndio:BOOL=OFF .include -.if ${ARCH} == i386 -EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-i386-compress_files_js +.if ${ARCH} == i386 || ${ARCH} == armv7 +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-32bit-compress_files_js .endif post-extract: @${MKDIR} ${WRKSRC}/src/3rdparty/chromium/media/audio/sndio \ ${WRKSRC}/src/3rdparty/chromium/sandbox/policy/freebsd \ ${WRKSRC}/src/3rdparty/chromium/sandbox/policy/openbsd post-patch: @${REINPLACE_CMD} -e 's|%%DISTVERSION%%|${DISTVERSION}|' \ ${WRKSRC}/CMakeLists.txt @${REINPLACE_CMD} -e 's|%%CPPFLAGS%%|${CPPFLAGS}|;s|%%CXXFLAGS%%|${CXXFLAGS}|;s|%%LDFLAGS%%|${LDFLAGS}|' \ ${WRKSRC}/src/host/BUILD.toolchain.gn.in @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \ ${WRKSRC}/src/3rdparty/chromium/third_party/pdfium/core/fxge/linux/fx_linux_impl.cpp \ ${WRKSRC}/src/3rdparty/chromium/third_party/wayland/features.gni \ ${WRKSRC}/src/3rdparty/chromium/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc pre-configure: # We used to remove bundled libraries to be sure that webengine uses # system libraries and not shipped ones. # # Leads to missing header errors: icu, libvpx, libwebp, re2, snappy, zlib # No-Op: flac # # cd ${WRKSRC} && ${PYTHON_CMD} \ # ./build/linux/unbundle/remove_bundled_libraries.py [list of preserved] cd ${WRKSRC}/src/3rdparty/chromium && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \ ./build/linux/unbundle/replace_gn_files.py --system-libraries \ fontconfig freetype harfbuzz-ng libdrm libevent libpng libxml libxslt openh264 opus || ${FALSE} .include diff --git a/www/qt6-webengine/files/extra-patch-i386-compress_files_js b/www/qt6-webengine/files/extra-patch-32bit-compress_files_js similarity index 92% rename from www/qt6-webengine/files/extra-patch-i386-compress_files_js rename to www/qt6-webengine/files/extra-patch-32bit-compress_files_js index 80ea9a241cf1..f8841846ef6c 100644 --- a/www/qt6-webengine/files/extra-patch-i386-compress_files_js +++ b/www/qt6-webengine/files/extra-patch-32bit-compress_files_js @@ -1,14 +1,14 @@ Reduce Brotli compression on i386 to have more memory available. Otherwise, node.js stops with either SIGSEGV or SIGABRT after ~530 processed files. --- src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/compress_files.js.orig 2023-01-10 09:16:05 UTC +++ src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/compress_files.js @@ -52,7 +52,7 @@ async function brotli(sourceData, compressedFilename) output.write(Buffer.from(brotliConst)); output.write(Buffer.from(sizeHeader)); return new Promise((resolve, reject) => { - pipeline(Readable.from(sourceData), zlib.createBrotliCompress(), output, err => { -+ pipeline(Readable.from(sourceData), zlib.createBrotliCompress({ params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 5 } }), output, err => { ++ pipeline(Readable.from(sourceData), zlib.createBrotliCompress({ params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 4 } }), output, err => { return err ? reject(err) : resolve(); }); }); diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_BUILD.generated.gni b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_BUILD.generated.gni index d56bf128afe3..bf3f823921b2 100644 --- a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_BUILD.generated.gni +++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_BUILD.generated.gni @@ -1,18 +1,21 @@ ---- src/3rdparty/chromium/third_party/boringssl/BUILD.generated.gni.orig 2022-09-26 10:05:50 UTC +--- src/3rdparty/chromium/third_party/boringssl/BUILD.generated.gni.orig 2022-12-12 18:53:13 UTC +++ src/3rdparty/chromium/third_party/boringssl/BUILD.generated.gni -@@ -81,6 +81,7 @@ crypto_sources = [ +@@ -81,8 +81,10 @@ crypto_sources = [ "src/crypto/cpu_aarch64_apple.c", "src/crypto/cpu_aarch64_fuchsia.c", "src/crypto/cpu_aarch64_linux.c", + "src/crypto/cpu_aarch64_openbsd.c", "src/crypto/cpu_aarch64_win.c", "src/crypto/cpu_arm.c", ++ "src/crypto/cpu_arm_freebsd.c", "src/crypto/cpu_arm_linux.c", -@@ -186,6 +187,7 @@ crypto_sources = [ + "src/crypto/cpu_arm_linux.h", + "src/crypto/cpu_intel.c", +@@ -186,6 +188,7 @@ crypto_sources = [ "src/crypto/rand_extra/deterministic.c", "src/crypto/rand_extra/forkunsafe.c", "src/crypto/rand_extra/fuchsia.c", + "src/crypto/rand_extra/arc4random.c", "src/crypto/rand_extra/passive.c", "src/crypto/rand_extra/rand_extra.c", "src/crypto/rand_extra/windows.c", diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_src_crypto_cpu__arm__freebsd.c b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_src_crypto_cpu__arm__freebsd.c new file mode 100644 index 000000000000..adc47e13ece5 --- /dev/null +++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_boringssl_src_crypto_cpu__arm__freebsd.c @@ -0,0 +1,55 @@ +--- src/3rdparty/chromium/third_party/boringssl/src/crypto/cpu_arm_freebsd.c.orig 2023-06-03 08:17:28 UTC ++++ src/3rdparty/chromium/third_party/boringssl/src/crypto/cpu_arm_freebsd.c +@@ -0,0 +1,52 @@ ++/* Copyright (c) 2016, Google Inc. ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ++ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION ++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN ++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ ++ ++#include "internal.h" ++ ++#if defined(OPENSSL_ARM) && defined(OPENSSL_FREEBSD) && \ ++ !defined(OPENSSL_STATIC_ARMCAP) ++#include ++#include ++ ++#include ++#include ++ ++extern uint32_t OPENSSL_armcap_P; ++ ++void OPENSSL_cpuid_setup(void) { ++ unsigned long hwcap = 0, hwcap2 = 0; ++ ++ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); ++ elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2); ++ ++ // Matching OpenSSL, only report other features if NEON is present. ++ if (hwcap & HWCAP_NEON) { ++ OPENSSL_armcap_P |= ARMV7_NEON; ++ ++ if (hwcap2 & HWCAP2_AES) { ++ OPENSSL_armcap_P |= ARMV8_AES; ++ } ++ if (hwcap2 & HWCAP2_PMULL) { ++ OPENSSL_armcap_P |= ARMV8_PMULL; ++ } ++ if (hwcap2 & HWCAP2_SHA1) { ++ OPENSSL_armcap_P |= ARMV8_SHA1; ++ } ++ if (hwcap2 & HWCAP2_SHA2) { ++ OPENSSL_armcap_P |= ARMV8_SHA256; ++ } ++ } ++} ++ ++#endif // OPENSSL_ARM && OPENSSL_OPENBSD && !OPENSSL_STATIC_ARMCAP diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp index 9eec9fed6607..d7a0a931b2aa 100644 --- a/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp +++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp @@ -1,45 +1,68 @@ ---- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig 2022-09-26 10:05:50 UTC +--- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig 2022-06-10 05:40:07 UTC +++ src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp @@ -73,6 +73,42 @@ return features; } +#elif defined(SK_CPU_ARM64) && defined(__OpenBSD__) + #include + #include + #include + + static uint32_t read_cpu_features() { + int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; + size_t len = sizeof(uint64_t); + uint64_t cpu_id = 0; + uint32_t features = 0; + + if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) == 0) { + if (ID_AA64ISAR0_CRC32(cpu_id) >= ID_AA64ISAR0_CRC32_BASE) + features |= SkCpu::CRC32; + } + + return features; + } + +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__) + #include + #ifndef ID_AA64ISAR0_CRC32_VAL + #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 + #endif + + static uint32_t read_cpu_features() { + uint32_t features = 0; + uint64_t id_aa64isar0; + + id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); + if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) { + features |= SkCpu::CRC32; + } + return features; + } + #elif defined(SK_CPU_ARM64) && __has_include() #include +@@ -115,6 +151,22 @@ + return features; + } + ++#elif defined(SK_CPU_ARM32) && defined(__FreeBSD__) ++ #include ++ ++ static uint32_t read_cpu_features() { ++ unsigned long hwcaps = 0; ++ uint32_t features = 0; ++ ++ elf_aux_info(AT_HWCAP, (void *)&hwcaps, sizeof hwcaps); ++ if (hwcaps & HWCAP_NEON) { ++ features |= SkCpu::NEON; ++ if (hwcaps & HWCAP_VFPv4) { ++ features |= SkCpu::NEON_FMA|SkCpu::VFP_FP16; ++ } ++ } ++ return features; ++ } + #elif defined(SK_CPU_ARM32) && __has_include() && \ + (!defined(__ANDROID_API__) || __ANDROID_API__ >= 18) + // sys/auxv.h will always be present in the Android NDK due to unified diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_v8_src_base_platform_platform-freebsd.cc b/www/qt6-webengine/files/patch-src_3rdparty_chromium_v8_src_base_platform_platform-freebsd.cc index 63441114dca2..eb34b5eb35c5 100644 --- a/www/qt6-webengine/files/patch-src_3rdparty_chromium_v8_src_base_platform_platform-freebsd.cc +++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_v8_src_base_platform_platform-freebsd.cc @@ -1,32 +1,32 @@ --- src/3rdparty/chromium/v8/src/base/platform/platform-freebsd.cc.orig 2022-09-26 10:05:50 UTC +++ src/3rdparty/chromium/v8/src/base/platform/platform-freebsd.cc @@ -43,14 +43,10 @@ TimezoneCache* OS::CreateTimezoneCache() { return new PosixDefaultTimezoneCache(); } -static unsigned StringToLong(char* buffer) { - return static_cast(strtol(buffer, nullptr, 16)); -} - std::vector OS::GetSharedLibraryAddresses() { std::vector result; int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; - size_t miblen = sizeof(mib) / sizeof(mib[0]); + unsigned int miblen = sizeof(mib) / sizeof(mib[0]); size_t buffer_size; if (sysctl(mib, miblen, nullptr, &buffer_size, nullptr, 0) == 0) { // Overallocate the buffer by 1/3 to account for concurrent @@ -82,8 +78,13 @@ std::vector OS::GetSharedLib lib_name = std::string(path); } result.push_back(SharedLibraryAddress( -+#if defined(__i386__) || defined(OS_FREEBSD) ++#if defined(__i386__) || defined(__arm__) || defined(OS_FREEBSD) + lib_name, static_cast(map->kve_start), + static_cast(map->kve_end))); +#else lib_name, reinterpret_cast(map->kve_start), reinterpret_cast(map->kve_end))); +#endif } start += ssize;