aboutsummaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-05-02 16:45:03 +0800
committerfanquake <fanquake@gmail.com>2024-05-30 12:00:05 +0100
commit0a3631fc352eda849290db940844e5ef723436df (patch)
tree69acaabf989eeafcf887190de3e157c522c026b6 /depends
parentb018bd779dd9b2d46c10254a1cf5b819ae8e027c (diff)
downloadbitcoin-0a3631fc352eda849290db940844e5ef723436df.tar.xz
depends: fix Qt macOS build with Clang 18
Patch Qts internal libpng to resolve the failure. I would like to have this patched, so we can continue working on the removal of `FORCE_USE_SYSTEM_CLANG`. Otherwise builds will be broken using the default clang (18) on the current Ubuntu LTS (24.04).
Diffstat (limited to 'depends')
-rw-r--r--depends/packages/qt.mk2
-rw-r--r--depends/patches/qt/clang_18_libpng.patch40
2 files changed, 42 insertions, 0 deletions
diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index 2dba1b41ae..d35139dd2d 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -20,6 +20,7 @@ $(package)_patches += duplicate_lcqpafonts.patch
$(package)_patches += guix_cross_lib_path.patch
$(package)_patches += fix-macos-linker.patch
$(package)_patches += memory_resource.patch
+$(package)_patches += clang_18_libpng.patch
$(package)_patches += utc_from_string_no_optimize.patch
$(package)_patches += windows_lto.patch
$(package)_patches += zlib-timebits64.patch
@@ -229,6 +230,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
patch -p1 -i $($(package)_patch_dir)/no_warnings_for_symbols.patch && \
+ patch -p1 -i $($(package)_patch_dir)/clang_18_libpng.patch && \
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
diff --git a/depends/patches/qt/clang_18_libpng.patch b/depends/patches/qt/clang_18_libpng.patch
new file mode 100644
index 0000000000..e807905b32
--- /dev/null
+++ b/depends/patches/qt/clang_18_libpng.patch
@@ -0,0 +1,40 @@
+fix Qt macOS build with Clang 18
+
+ See:
+ https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24.
+
+ In a similar manner as zlib (madler/zlib#895),
+ libpng contains a header configuration that's no longer valid and
+ hasn't been exercised for the macOS target.
+
+ - The target OS conditional macros are misused. Specifically
+ `TARGET_OS_MAC` covers all Apple targets, including iOS, and it
+ should not be checked with `#if defined` as they would always be
+ defined (to either 1 or 0) on Apple platforms.
+ - `#include <fp.h>` no longer works for the macOS target and results
+ in a compilation failure. macOS ships all required functions in
+ `math.h`, and clients should use `math.h` instead.
+
+--- a/qtbase/src/3rdparty/libpng/pngpriv.h
++++ b/qtbase/src/3rdparty/libpng/pngpriv.h
+@@ -514,18 +514,8 @@
+ */
+ # include <float.h>
+
+-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
+- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
+- /* We need to check that <math.h> hasn't already been included earlier
+- * as it seems it doesn't agree with <fp.h>, yet we should really use
+- * <fp.h> if possible.
+- */
+-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
+-# include <fp.h>
+-# endif
+-# else
+-# include <math.h>
+-# endif
++# include <math.h>
++
+ # if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
+ /* Amiga SAS/C: We must include builtin FPU functions when compiling using
+ * MATH=68881