From 7cd7e48e9cfd008542c2f7c7c292bde15837a15e Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 21 Nov 2025 11:13:11 -0800 Subject: [PATCH] fix: Upgrade libpng to fix build on new macs (#1507) This upgrades libpng from v1.6.37 to v1.6.50 This newer libpng doesn't assume the existence of fp.h on Mac (which isn't present on newer ones), but the CMake options for libpng changed and had to be adjusted somewhat. --- .github/workflows/build.yaml | 1 + packager/third_party/CMakeLists.txt | 3 ++- packager/third_party/libpng/CMakeLists.txt | 8 ++++---- packager/third_party/libpng/source | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4d929259f0..cfe84e3b0c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -199,6 +199,7 @@ jobs: fi cmake \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ -DBUILD_SHARED_LIBS="$BUILD_SHARED_LIBS" \ -DFULLY_STATIC="$FULLY_STATIC" \ diff --git a/packager/third_party/CMakeLists.txt b/packager/third_party/CMakeLists.txt index c883c0b7eb..51f8585cce 100644 --- a/packager/third_party/CMakeLists.txt +++ b/packager/third_party/CMakeLists.txt @@ -42,6 +42,8 @@ add_subdirectory(c-ares EXCLUDE_FROM_ALL) add_subdirectory(curl EXCLUDE_FROM_ALL) add_subdirectory(googletest EXCLUDE_FROM_ALL) add_subdirectory(json EXCLUDE_FROM_ALL) +# NOTE: libpng references zlib, so put zlib before libpng +add_subdirectory(zlib EXCLUDE_FROM_ALL) add_subdirectory(libpng EXCLUDE_FROM_ALL) add_subdirectory(libwebm EXCLUDE_FROM_ALL) add_subdirectory(libxml2 EXCLUDE_FROM_ALL) @@ -49,4 +51,3 @@ add_subdirectory(mbedtls EXCLUDE_FROM_ALL) add_subdirectory(mimalloc EXCLUDE_FROM_ALL) add_subdirectory(mongoose EXCLUDE_FROM_ALL) add_subdirectory(protobuf EXCLUDE_FROM_ALL) -add_subdirectory(zlib EXCLUDE_FROM_ALL) diff --git a/packager/third_party/libpng/CMakeLists.txt b/packager/third_party/libpng/CMakeLists.txt index c9d33a828c..02c3ad6f36 100644 --- a/packager/third_party/libpng/CMakeLists.txt +++ b/packager/third_party/libpng/CMakeLists.txt @@ -19,12 +19,12 @@ set(PNG_DEBUG OFF) # Don't install anything. set(SKIP_INSTALL_ALL ON) -# A confusing name, but this means "let us tell you where to find zlib". -set(PNG_BUILD_ZLIB ON) -# Tell libpng where to find zlib headers. +# Tell libpng where to find zlib. +set(ZLIB_FOUND TRUE) set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../zlib/source/") -# Tell libpng where to find zlib library to link to. set(ZLIB_LIBRARY zlibstatic) +add_library(ZLIB::ZLIB ALIAS zlibstatic) + # Tell libpng where to find libm on Linux (-lm). set(M_LIBRARY m) diff --git a/packager/third_party/libpng/source b/packager/third_party/libpng/source index a40189cf88..2b978915d8 160000 --- a/packager/third_party/libpng/source +++ b/packager/third_party/libpng/source @@ -1 +1 @@ -Subproject commit a40189cf881e9f0db80511c382292a5604c3c3d1 +Subproject commit 2b978915d82377df13fcbb1fb56660195ded868a