From 50f4de8095e59015c31f9372136758b4cbbcc018 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Wed, 25 Jun 2025 15:30:32 +0300 Subject: [PATCH 1/5] devel/qt6-base: Use dlsym to access environ This allows to avoid undefined references during linking with -Wl,-no-undefined See https://reviews.freebsd.org/D30842 --- .../patch-src_corelib_io_qprocess__unix.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 devel/qt6-base/files/patch-src_corelib_io_qprocess__unix.cpp diff --git a/devel/qt6-base/files/patch-src_corelib_io_qprocess__unix.cpp b/devel/qt6-base/files/patch-src_corelib_io_qprocess__unix.cpp new file mode 100644 index 0000000000000..344defd164ee1 --- /dev/null +++ b/devel/qt6-base/files/patch-src_corelib_io_qprocess__unix.cpp @@ -0,0 +1,27 @@ +--- src/corelib/io/qprocess_unix.cpp.orig 2025-08-11 04:54:51 UTC ++++ src/corelib/io/qprocess_unix.cpp +@@ -59,10 +59,9 @@ + # define _PATH_TTY _PATH_DEV "tty" + #endif + +-#ifdef Q_OS_FREEBSD +-__attribute__((weak)) +-#endif ++#ifndef Q_OS_FREEBSD + extern char **environ; ++#endif + + QT_BEGIN_NAMESPACE + +@@ -74,6 +73,11 @@ QProcessEnvironment QProcessEnvironment::systemEnviron + { + QProcessEnvironment env; + const char *entry; ++#ifdef Q_OS_FREEBSD ++ static char* nullenv = nullptr; ++ char ***environ_p = reinterpret_cast(dlsym(RTLD_DEFAULT, "environ")); ++ char **environ = environ_p ? *environ_p : &nullenv; ++#endif + for (int count = 0; (entry = environ[count]); ++count) { + const char *equal = strchr(entry, '='); + if (!equal) From e03fd034e77a6f75c4536d0e85f9be0e3e80af69 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Wed, 25 Jun 2025 15:48:59 +0300 Subject: [PATCH 2/5] www/qt6-webengine: Use dlsym to access environ This allows to avoid undefined references during linking with -Wl,-no-undefined Note that the similar patch for www/chromium is not required because the extern char** environ usage ends up in the executable, not a library. See https://reviews.freebsd.org/D30842 --- www/qt6-webengine/Makefile | 2 +- ...rty_chromium_base_process_launch__posix.cc | 38 ++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/www/qt6-webengine/Makefile b/www/qt6-webengine/Makefile index 9939ff2dc4d5f..12ad6438bcf9d 100644 --- a/www/qt6-webengine/Makefile +++ b/www/qt6-webengine/Makefile @@ -14,7 +14,7 @@ PORTNAME?= webengine DISTVERSION= ${QT6_VERSION} # This is the parent port of print/qt6-pdf. Please always keep 'PORTREVISION?=' # and reset the value to '0' only after increasing QT6_VERSION in Mk/Uses/qt.mk. -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES?= www PKGNAMEPREFIX= qt6- diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_process_launch__posix.cc b/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_process_launch__posix.cc index 54e4c77bf3968..5304232f2f8f1 100644 --- a/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_process_launch__posix.cc +++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_base_process_launch__posix.cc @@ -1,12 +1,40 @@ ---- src/3rdparty/chromium/base/process/launch_posix.cc.orig 2024-10-22 08:31:56 UTC +--- src/3rdparty/chromium/base/process/launch_posix.cc.orig 2025-08-18 00:53:11 UTC +++ src/3rdparty/chromium/base/process/launch_posix.cc -@@ -67,6 +67,9 @@ +@@ -67,7 +67,9 @@ #error "macOS should use launch_mac.cc" #endif -+#if defined(OS_FREEBSD) -+#pragma weak environ -+#endif ++#if !defined(OS_FREEBSD) extern char** environ; ++#endif namespace base { + +@@ -88,13 +90,27 @@ char** GetEnvironment() { + // Get the process's "environment" (i.e. the thing that setenv/getenv + // work with). + char** GetEnvironment() { ++#if !defined(OS_FREEBSD) + return environ; ++#else ++ static char* nullenv = nullptr; ++ char ***environ_p = reinterpret_cast(dlsym(RTLD_DEFAULT, "environ")); ++ char **environ = environ_p ? *environ_p : &nullenv; ++ return environ; ++#endif + } + + // Set the process's "environment" (i.e. the thing that setenv/getenv + // work with). + void SetEnvironment(char** env) { ++#if !defined(OS_FREEBSD) + environ = env; ++#else ++ char ***environ_p = reinterpret_cast(dlsym(RTLD_DEFAULT, "environ")); ++ if (!environ_p) ++ return; ++ *environ_p = env; ++#endif + } + + // Set the calling thread's signal mask to new_sigmask and return From 5ac73704f6f175e3ec351f0b0ad0a59e454e25a6 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Wed, 25 Jun 2025 23:08:34 +0300 Subject: [PATCH 3/5] devel/qt6-base: Remove no-op patch --- devel/qt6-base/files/patch-cmake_QtRpathHelpers.cmake | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 devel/qt6-base/files/patch-cmake_QtRpathHelpers.cmake diff --git a/devel/qt6-base/files/patch-cmake_QtRpathHelpers.cmake b/devel/qt6-base/files/patch-cmake_QtRpathHelpers.cmake deleted file mode 100644 index 7899d3825fba6..0000000000000 --- a/devel/qt6-base/files/patch-cmake_QtRpathHelpers.cmake +++ /dev/null @@ -1,11 +0,0 @@ ---- cmake/QtRpathHelpers.cmake.orig 2023-09-21 19:24:26 UTC -+++ cmake/QtRpathHelpers.cmake -@@ -8,6 +8,8 @@ function(qt_internal_get_relative_rpath_base_token out - set(rpath_rel_base "@loader_path") - elseif(LINUX OR SOLARIS OR FREEBSD OR HURD OR OPENBSD) - set(rpath_rel_base "$ORIGIN") -+ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") -+ set(rpath_rel_base "$ORIGIN") - else() - set(rpath_rel_base "NO_KNOWN_RPATH_REL_BASE") - endif() From fca66f1c983c7a5ef082dea2a078e8e1d0a4373e Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Thu, 26 Jun 2025 21:55:55 +0300 Subject: [PATCH 4/5] devel/qt6-base: Remove obsolete patch --- ...patch-src_corelib_global_qcomparehelpers.h | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 devel/qt6-base/files/patch-src_corelib_global_qcomparehelpers.h diff --git a/devel/qt6-base/files/patch-src_corelib_global_qcomparehelpers.h b/devel/qt6-base/files/patch-src_corelib_global_qcomparehelpers.h deleted file mode 100644 index 5d37ac721415b..0000000000000 --- a/devel/qt6-base/files/patch-src_corelib_global_qcomparehelpers.h +++ /dev/null @@ -1,27 +0,0 @@ -Suppress spurious zero as null pointer constant warnings which cause errors -in www/dooble due to -Werror being passed. This is the same problem as in -qcompare.h that upstream suppresses for GCC. - -/usr/local/include/qt6/QtCore/qfloat16.h:209:5: error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant] -... -/usr/local/include/qt6/QtCore/qcomparehelpers.h:211:43: note: expanded from macro 'QT_DECLARE_ORDERING_HELPER_TEMPLATE' - 211 | { return compareThreeWay(lhs, rhs) >= 0; } - ---- src/corelib/global/qcomparehelpers.h.orig 2025-02-19 13:05:34 UTC -+++ src/corelib/global/qcomparehelpers.h -@@ -316,6 +316,7 @@ orderingFlagsFor(T t) noexcept - - #define QT_DECLARE_ORDERING_HELPER_TEMPLATE(OrderingType, LeftType, RightType, Constexpr, \ - Noexcept, ...) \ -+ QT_WARNING_DISABLE_CLANG("-Wzero-as-null-pointer-constant") \ - __VA_ARGS__ \ - friend Constexpr bool operator<(LeftType const &lhs, RightType const &rhs) Noexcept \ - { \ -@@ -357,6 +358,7 @@ orderingFlagsFor(T t) noexcept - // Helpers for reversed ordering, using the existing compareThreeWay() function. - #define QT_DECLARE_REVERSED_ORDERING_HELPER_TEMPLATE(OrderingType, LeftType, RightType, Constexpr, \ - Noexcept, ...) \ -+ QT_WARNING_DISABLE_CLANG("-Wzero-as-null-pointer-constant") \ - __VA_ARGS__ \ - friend Constexpr bool operator<(RightType const &lhs, LeftType const &rhs) Noexcept \ - { return is_gt(compareThreeWay(rhs, lhs)); } \ From a56a8fa2d209e71015ca6cca923e9ccc1d7f41d4 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Wed, 25 Jun 2025 12:01:56 +0300 Subject: [PATCH 5/5] =?UTF-8?q?devel/qt6-base:=20Remove=20our=20custom=20p?= =?UTF-8?q?atch=20that=20disables=20-Wl,=E2=80=94no-undefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was added to workaround the "extern char** environ" problem [1], which is now fixed in other way. [1] https://reviews.freebsd.org/D30842 --- devel/qt6-base/Makefile | 1 + .../files/patch-cmake_QtFlagHandlingHelpers.cmake | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 devel/qt6-base/files/patch-cmake_QtFlagHandlingHelpers.cmake diff --git a/devel/qt6-base/Makefile b/devel/qt6-base/Makefile index ec92164f3f97c..c2cfe072a1ce9 100644 --- a/devel/qt6-base/Makefile +++ b/devel/qt6-base/Makefile @@ -1,5 +1,6 @@ PORTNAME= base DISTVERSION= ${QT6_VERSION} +PORTREVISION= 1 CATEGORIES= devel PKGNAMEPREFIX= qt6- diff --git a/devel/qt6-base/files/patch-cmake_QtFlagHandlingHelpers.cmake b/devel/qt6-base/files/patch-cmake_QtFlagHandlingHelpers.cmake deleted file mode 100644 index 561cc85a2ecd2..0000000000000 --- a/devel/qt6-base/files/patch-cmake_QtFlagHandlingHelpers.cmake +++ /dev/null @@ -1,13 +0,0 @@ ---- cmake/QtFlagHandlingHelpers.cmake.orig 2024-09-18 16:48:24 UTC -+++ cmake/QtFlagHandlingHelpers.cmake -@@ -177,6 +177,10 @@ function(qt_internal_add_link_flags_no_undefined targe - set(no_undefined_flag "-Wl,--no-undefined") - endif() - -+ if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") -+ set(no_undefined_flag "") -+ endif() -+ - set(CMAKE_REQUIRED_LINK_OPTIONS ${previous_CMAKE_REQUIRED_LINK_OPTIONS}) - - if (NOT HAVE_DASH_UNDEFINED_SYMBOLS AND NOT HAVE_DASH_DASH_NO_UNDEFINED)