diff --git a/www/qt5-webengine/Makefile b/www/qt5-webengine/Makefile index f69d3302e4fe..82986332de6c 100644 --- a/www/qt5-webengine/Makefile +++ b/www/qt5-webengine/Makefile @@ -1,174 +1,174 @@ # 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. # - We need to see if more "use_system_" flags can be passed. # - 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 Qt5 ones, which is why we set # QT5_VERSION and DISTINFO_FILE here. # In order to successfully build this port in poudriere you need to add # MAX_FILES_qt5_webengine=4096 to /usr/local/etc/poudriere.conf PORTNAME= webengine PORTVERSION= ${QT5_VERSION}${QT5_KDE_PATCH} -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www PKGNAMEPREFIX= qt5- MAINTAINER= kde@FreeBSD.org COMMENT= Qt 5 library to render web content BUILD_DEPENDS= bison:devel/bison \ ${LOCALBASE}/include/linux/input.h:devel/evdev-proto \ ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \ ${PYTHON_PKGNAMEPREFIX}html5lib>0:www/py-html5lib@${PY_FLAVOR} LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg \ libdbus-1.so:devel/dbus \ libdouble-conversion.so:devel/double-conversion \ libevent.so:devel/libevent \ libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libharfbuzz.so:print/harfbuzz \ libjsoncpp.so:devel/jsoncpp \ 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 DISTINFO_FILE= ${.CURDIR}/distinfo QT5_VERSION= ${_KDE_webengine_VERSION} OPTIONS_SINGLE= AUDIO OPTIONS_SINGLE_AUDIO= ALSA PULSEAUDIO SNDIO OPTIONS_DEFAULT= ALSA 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_VARS= QMAKE_CONFIGURE_ARGS+=-alsa ALSA_VARS_OFF= QMAKE_CONFIGURE_ARGS+=-no-alsa PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PULSEAUDIO_VARS= QMAKE_CONFIGURE_ARGS+=-pulseaudio PULSEAUDIO_VARS_OFF= QMAKE_CONFIGURE_ARGS+=-no-pulseaudio SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio SNDIO_VARS= QMAKE_CONFIGURE_ARGS+=-sndio SNDIO_VARS_OFF= QMAKE_CONFIGURE_ARGS+=-no-sndio # We pass `norecursive' to USES=qmake because src/plugins/plugins.pro checks # whether webenginewidgets is available, which fails when qmake processes all # .pro files at once. USES= gl gnome gperf jpeg minizip ninja:build nodejs:build,lts \ perl5 pkgconfig python:build qmake:norecursive,outsource \ qt-dist:5,webengine shebangfix xorg USE_GL= gl USE_GNOME= glib20 libxml2 libxslt USE_PERL5= build USE_QT= core declarative gui location network printsupport \ webchannel widgets \ buildtools:build designer:build qmake:build USE_XORG= x11 xcb xcomposite xcursor xdamage xext xfixes xi xkbfile \ xorgproto xrandr xrender xscrnsaver xtst USE_LDCONFIG= ${PREFIX}/${QT_LIBDIR_REL} QMAKE_CONFIGURE_ARGS= -proprietary-codecs -system-ffmpeg # We could just set it to an empty string as well. "all" does not account for # dependencies correctly in the generated Makefiles, use the right target here. ALL_TARGET= first # We need ar(1) from ports because the Chromium code uses the @file syntax. # We then need to ensure ld(1) from ports is used because of the archives ar(1) # generated. USE_BINUTILS= yes CC+= "-B${LOCALBASE}/bin" CXX+= "-B${LOCALBASE}/bin" # 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. # Since we use USES=qmake:norecursive, we also need to pass some variables to # MAKE_ENV because part of the configuration process happens during the build. 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} QT_BINARIES= yes .include .if ${ARCH:Mmips*} || ${ARCH:Mpowerpc*} PLIST_SUB+= BE="" LE="@comment " .else PLIST_SUB+= BE="@comment " LE="" .endif post-extract: # Install FreeBSD's freebsd.pri file. ${CP} ${FILESDIR}/freebsd.pri ${WRKSRC}/src/buildtools/config/freebsd.pri post-extract-SNDIO-on: @cd ${WRKSRC}/src/3rdparty/chromium/media/audio && ${MKDIR} sndio openbsd @${CP} ${FILESDIR}/sndio_*put.* \ ${WRKSRC}/src/3rdparty/chromium/media/audio/sndio @${CP} ${FILESDIR}/audio_manager_openbsd.* \ ${WRKSRC}/src/3rdparty/chromium/media/audio/openbsd post-patch: @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \ ${WRKSRC}/src/3rdparty/chromium/base/linux_util.cc \ ${WRKSRC}/src/3rdparty/chromium/base/test/BUILD.gn \ ${WRKSRC}/src/3rdparty/chromium/build/toolchain/gcc_toolchain.gni \ ${WRKSRC}/src/3rdparty/chromium/chrome/common/chrome_paths.cc \ ${WRKSRC}/src/3rdparty/chromium/third_party/pdfium/core/fxge/fx_ge_linux.cpp \ ${WRKSRC}/src/3rdparty/gn/build/gen.py @${REINPLACE_CMD} -E -e 's|^(MODULE_VERSION = ).*|\1${QT5_VERSION}|' \ ${WRKSRC}/.qmake.conf .if ${ARCH:Mmips*} || ${ARCH:Mpowerpc*} @${REINPLACE_CMD} -e 's/icudtl.dat/icudtb.dat/' \ ${WRKSRC}/src/core/core_module.pro .endif pre-configure: # Link in ${PYTHON_CMD} to ${CONFIGURE_WRKSRC}/bin -- the scripts hardcode 'python' # in too many places to reasonably patch. So just link in ${PYTHON_CMD} to work around # $LOCALBASE/bin/python being python3 if the default versions is set to 3.x. ${MKDIR} ${CONFIGURE_WRKSRC}/bin && ${LN} -s ${PYTHON_CMD} ${CONFIGURE_WRKSRC}/bin/python # Unbundle a few dependencies. 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 libwebp libxml libxslt openh264 opus || ${FALSE} # Rerun syncqt.pl -- otherwise the resulting package misses some forwarding headers. cd ${WRKSRC} && ${QT_BINDIR}/syncqt.pl -version ${QT5_VERSION} post-build: # Fix version mismatches for CMake .for module in Pdf PdfWidgets WebEngine WebEngineCore WebEngineWidgets @${REINPLACE_CMD} -e '/${QT5_VERSION} $${_Qt5${module}_FIND_VERSION_EXACT}/s|${QT5_VERSION}|'"$$(${MAKE} -C ../../devel/qt5-core -VQT5_VERSION)"'|' \ ${BUILD_WRKSRC}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake .endfor .include diff --git a/www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_register__context.h b/www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_register__context.h index 0d5fc62fbeea..2ced305b8228 100644 --- a/www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_register__context.h +++ b/www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_register__context.h @@ -1,60 +1,73 @@ ---- src/3rdparty/chromium/base/profiler/register_context.h.orig 2021-12-15 16:12:54 UTC +--- src/3rdparty/chromium/base/profiler/register_context.h.orig 2025-03-06 09:26:10 UTC +++ src/3rdparty/chromium/base/profiler/register_context.h @@ -17,7 +17,7 @@ #include #elif defined(OS_APPLE) #include -#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) +#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) #include #endif -@@ -190,6 +190,48 @@ inline uintptr_t& RegisterContextInstructionPointer(mc +@@ -190,6 +190,61 @@ inline uintptr_t& RegisterContextInstructionPointer(mc } #endif // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) + +#elif defined(OS_FREEBSD) + +using RegisterContext = mcontext_t; + +#if defined(ARCH_CPU_X86_64) +inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { + return AsUintPtr(&context->mc_rsp); +} + +inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { + return AsUintPtr(&context->mc_rbp); +} + +inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { + return AsUintPtr(&context->mc_rip); +} +#elif defined(ARCH_CPU_X86) +inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { + return AsUintPtr(&context->mc_esp); +} + +inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { + return AsUintPtr(&context->mc_ebp); +} + +inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { + return AsUintPtr(&context->mc_eip); +} +#elif defined(ARCH_CPU_ARM64) +inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { + return AsUintPtr(&context->mc_gpregs.gp_sp); +} + +inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { + return AsUintPtr(&context->mc_gpregs.gp_x[29]); +} + +inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { + return AsUintPtr(&context->mc_gpregs.gp_elr); +} ++ ++#elif defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) ++inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { ++ return AsUintPtr(&context->__gregs[_REG_SP]); ++} ++ ++inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { ++ return AsUintPtr(&context->__gregs[_REG_FP]); ++} ++ ++inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { ++ return AsUintPtr(&context->__gregs[_REG_PC]); ++} +#endif #else // #if defined(OS_WIN) diff --git a/www/qt5-webengine/files/patch-src_3rdparty_chromium_build_config_compiler_BUILD.gn b/www/qt5-webengine/files/patch-src_3rdparty_chromium_build_config_compiler_BUILD.gn index 660b06bee167..80fd85c2cac5 100644 --- a/www/qt5-webengine/files/patch-src_3rdparty_chromium_build_config_compiler_BUILD.gn +++ b/www/qt5-webengine/files/patch-src_3rdparty_chromium_build_config_compiler_BUILD.gn @@ -1,129 +1,140 @@ ---- src/3rdparty/chromium/build/config/compiler/BUILD.gn.orig 2023-11-09 11:32:20 UTC +--- src/3rdparty/chromium/build/config/compiler/BUILD.gn.orig 2025-03-06 09:26:10 UTC +++ src/3rdparty/chromium/build/config/compiler/BUILD.gn @@ -134,7 +134,7 @@ declare_args() { # # TODO(crbug.com/977230): Enabling this when 'use_xcode_clang' is true may # call an old clang that doesn't support auto-init. - init_stack_vars = !is_android && !use_xcode_clang + init_stack_vars = !is_android && !use_xcode_clang && !is_bsd # This argument is to control whether enabling text section splitting in the # final binary. When enabled, the separated text sections with prefix @@ -297,7 +297,7 @@ config("compiler") { } # Linker warnings. - if (fatal_linker_warnings && !is_apple && current_os != "aix") { + if (fatal_linker_warnings && !is_apple && !is_bsd && current_os != "aix") { ldflags += [ "-Wl,--fatal-warnings" ] } if (fatal_linker_warnings && is_apple && @@ -310,6 +310,7 @@ config("compiler") { if (use_qt && is_clang) { cflags += [ + "-Wno-enum-constexpr-conversion", "-Wno-unknown-attributes", "-Wno-unknown-pragmas", "-Wno-unknown-warning-option" @@ -408,7 +409,7 @@ config("compiler") { # Compiler instrumentation can introduce dependencies in DSOs to symbols in # the executable they are loaded into, so they are unresolved at link-time. - if (!using_sanitizer) { + if (!using_sanitizer && !is_bsd) { ldflags += [ "-Wl,-z,defs", "-Wl,--as-needed", @@ -566,7 +567,7 @@ config("compiler") { # Override Chromium's default for projects that wish to stay on C++11. cflags_cc += [ "-std=${standard_prefix}++11" ] } else { - cflags_cc += [ "-std=${standard_prefix}++14" ] + cflags_cc += [ "-std=${standard_prefix}++17" ] } } else if (!is_win && !is_nacl) { if (target_os == "android") { @@ -583,7 +584,7 @@ config("compiler") { if (cxx11_override) { cflags_cc += [ "-std=c++11" ] } else { - cflags_cc += [ "-std=c++14" ] + cflags_cc += [ "-std=c++17" ] } } -@@ -796,7 +797,7 @@ config("compiler_cpu_abi") { +@@ -782,10 +783,6 @@ config("compiler_cpu_abi") { + ] + } + } else if (current_cpu == "arm") { +- if (is_clang && !is_android && !is_nacl) { +- cflags += [ "--target=arm-linux-gnueabihf" ] +- ldflags += [ "--target=arm-linux-gnueabihf" ] +- } + if (!is_nacl) { + cflags += [ + "-march=$arm_arch", +@@ -796,7 +793,7 @@ config("compiler_cpu_abi") { cflags += [ "-mtune=$arm_tune" ] } } else if (current_cpu == "arm64") { - if (is_clang && !is_android && !is_nacl && !is_fuchsia) { + if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd) { cflags += [ "--target=aarch64-linux-gnu" ] ldflags += [ "--target=aarch64-linux-gnu" ] } -@@ -1149,7 +1150,7 @@ config("compiler_deterministic") { +@@ -1149,7 +1146,7 @@ config("compiler_deterministic") { "-Xclang", ".", ] - if (!is_win) { + if (!is_win && !is_bsd) { # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) asmflags = [ "-Wa,-fdebug-compilation-dir,." ] } -@@ -1535,6 +1536,10 @@ config("default_warnings") { +@@ -1535,6 +1532,10 @@ config("default_warnings") { # which we no longer use. Check if it makes sense to remove # this as well. http://crbug.com/316352 "-Wno-unneeded-internal-declaration", + + # Reduce build log bloat by about 20MB + "-Wno-deprecated-copy", + "-Wno-implicit-float-conversion", ] # use_xcode_clang only refers to the iOS toolchain, host binaries use -@@ -1551,7 +1556,7 @@ config("default_warnings") { +@@ -1551,7 +1552,7 @@ config("default_warnings") { cflags += [ "-Wno-nonportable-include-path" ] } - if (current_toolchain == host_toolchain || !use_xcode_clang) { + if ((current_toolchain == host_toolchain || !use_xcode_clang) && !is_bsd) { # Flags NaCl (Clang 3.7) and Xcode 9.2 (Clang clang-900.0.39.2) do not # recognize. cflags += [ -@@ -1725,7 +1730,7 @@ config("no_chromium_code") { +@@ -1725,7 +1726,7 @@ config("no_chromium_code") { # suppressing them individually, we just blanket suppress them here. "-Wno-unused-variable", ] - if (!is_nacl && (current_toolchain == host_toolchain || !use_xcode_clang)) { + if (!is_nacl && (current_toolchain == host_toolchain || !use_xcode_clang) && !is_bsd) { cflags += [ # TODO(https://crbug.com/1031169): Clean up and enable. "-Wno-misleading-indentation", -@@ -1803,7 +1808,7 @@ config("thin_archive") { +@@ -1803,7 +1804,7 @@ config("thin_archive") { # Mac and iOS use the mac-specific "libtool" command, not ar, which doesn't # have a "thin archive" mode (it does accept -T, but it means truncating # archive names to 16 characters, which is not what we want). - if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) { + if ((is_posix && !is_nacl && !is_apple && !is_bsd) || is_fuchsia) { arflags = [ "-T" ] } else if (is_win && use_lld) { arflags = [ "/llvmlibthin" ] -@@ -2344,7 +2349,7 @@ config("symbols") { +@@ -2344,7 +2345,7 @@ config("symbols") { # flag, so we can use use -g1 for pnacl and nacl-clang compiles. # gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang. if (!is_nacl || is_clang) { - cflags += [ "-g2" ] + cflags += [ "-g0" ] } # TODO(https://crbug.com/1050118): Investigate missing debug info on mac. -@@ -2386,7 +2391,7 @@ config("symbols") { +@@ -2386,7 +2387,7 @@ config("symbols") { # DWARF info may be corrupt; offsets in a range list entry are in different # sections" there. Maybe just a bug in nacl_switch_32.S. if (!is_apple && !is_nacl && current_cpu != "x86" && - (use_gold || use_lld)) { + (use_gold || use_lld) && !is_bsd) { if (is_clang) { # This flag enables the GNU-format pubnames and pubtypes sections, # which lld needs in order to generate a correct GDB index. diff --git a/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_dav1d_libdav1d_src_arm_cpu.c b/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_dav1d_libdav1d_src_arm_cpu.c new file mode 100644 index 000000000000..2eb80728b1ab --- /dev/null +++ b/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_dav1d_libdav1d_src_arm_cpu.c @@ -0,0 +1,14 @@ +--- src/3rdparty/chromium/third_party/dav1d/libdav1d/src/arm/cpu.c.orig 2025-04-26 20:32:56 UTC ++++ src/3rdparty/chromium/third_party/dav1d/libdav1d/src/arm/cpu.c +@@ -84,10 +84,7 @@ COLD unsigned dav1d_get_cpu_flags_arm(void) { + unsigned flags = 0; + #if defined(__ARM_NEON) || defined(__APPLE__) || defined(_WIN32) || ARCH_AARCH64 + flags |= DAV1D_ARM_CPU_FLAG_NEON; +-#elif defined(HAVE_GETAUXVAL) && ARCH_ARM +- unsigned long hw_cap = getauxval(AT_HWCAP); +- flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0; +-#elif defined(HAVE_ELF_AUX_INFO) && ARCH_ARM ++#elif defined(__FreeBSD__) && ARCH_ARM + unsigned long hw_cap = 0; + elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap)); + flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0; diff --git a/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp b/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp index 107a50ba8f74..3c4ff6b24e36 100644 --- a/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp +++ b/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp @@ -1,26 +1,49 @@ ---- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig 2021-12-15 16:12:54 UTC +--- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig 2025-03-06 09:26:10 UTC +++ src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp @@ -72,6 +72,23 @@ 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 +@@ -110,6 +127,22 @@ + || 0 == memcmp(kMongoose3, buf, SK_ARRAY_COUNT(buf))) { + features &= ~(SkCpu::ASIMDHP); + } ++ } ++ return features; ++ } ++ ++#elif defined(SK_CPU_ARM32) && defined(__FreeBSD__) ++ #include ++ ++ static uint32_t read_cpu_features() { ++ uint32_t features = 0; ++ unsigned long hwcaps = 0; ++ ++ elf_aux_info(AT_HWCAP, &hwcaps, sizeof hwcaps); ++ ++ if (hwcaps & HWCAP_NEON ) { ++ features |= SkCpu::NEON; ++ if (hwcaps & HWCAP_VFPv4) { features |= SkCpu::NEON_FMA|SkCpu::VFP_FP16; } + } + return features; + }