diff --git a/png/CMakeLists.txt b/png/CMakeLists.txt index 2a55e23f..ab36a829 100644 --- a/png/CMakeLists.txt +++ b/png/CMakeLists.txt @@ -30,7 +30,8 @@ if (ENABLE_PNG) ExternalProject_Add(PNG_BLD URL "${CMAKE_CURRENT_SOURCE_DIR}/libpng" BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS} - PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/png.patch + PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/png_cmake.patch + COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/png_zlib.patch CMAKE_ARGS -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON ${BUILD_TYPE_SPECIFIER} diff --git a/png/png.patch b/png/png.patch deleted file mode 100644 index 3b69afdf..00000000 --- a/png/png.patch +++ /dev/null @@ -1,215 +0,0 @@ -diff -Naur libpng/CMake/FindZLIB.cmake PNG_BLD/CMake/FindZLIB.cmake ---- libpng/CMake/FindZLIB.cmake 1969-12-31 19:00:00.000000000 -0500 -+++ PNG_BLD/CMake/FindZLIB.cmake 2024-03-06 10:42:37.366757148 -0500 -@@ -0,0 +1,123 @@ -+#.rst: -+# FindZLIB -+# -------- -+# -+# Find the native ZLIB includes and library. -+# -+# IMPORTED Targets -+# ^^^^^^^^^^^^^^^^ -+# -+# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if -+# ZLIB has been found. -+# -+# Result Variables -+# ^^^^^^^^^^^^^^^^ -+# -+# This module defines the following variables: -+# -+# :: -+# -+# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. -+# ZLIB_LIBRARIES - List of libraries when using zlib. -+# ZLIB_FOUND - True if zlib found. -+# -+# :: -+# -+# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) -+# ZLIB_VERSION_MAJOR - The major version of zlib -+# ZLIB_VERSION_MINOR - The minor version of zlib -+# ZLIB_VERSION_PATCH - The patch version of zlib -+# ZLIB_VERSION_TWEAK - The tweak version of zlib -+# -+# Backward Compatibility -+# ^^^^^^^^^^^^^^^^^^^^^^ -+# -+# The following variable are provided for backward compatibility -+# -+# :: -+# -+# ZLIB_MAJOR_VERSION - The major version of zlib -+# ZLIB_MINOR_VERSION - The minor version of zlib -+# ZLIB_PATCH_VERSION - The patch version of zlib -+# -+# Hints -+# ^^^^^ -+# -+# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this -+# module where to look. -+ -+#============================================================================= -+# Copyright 2001-2011 Kitware, Inc. -+# -+# Distributed under the OSI-approved BSD License (the "License"); -+# see accompanying file Copyright.txt for details. -+# -+# This software is distributed WITHOUT ANY WARRANTY; without even the -+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -+# See the License for more information. -+#============================================================================= -+# (To distribute this file outside of CMake, substitute the full -+# License text for the above reference.) -+ -+set(_ZLIB_SEARCHES) -+ -+# Search ZLIB_ROOT first if it is set. -+if(ZLIB_ROOT) -+ set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH) -+ list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) -+endif() -+ -+# Normal search. -+set(_ZLIB_SEARCH_NORMAL -+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]" -+ "$ENV{PROGRAMFILES}/zlib" -+ ) -+list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) -+ -+set(ZLIB_NAMES z_brl z zlib zdll zlib1 zlibd zlibd1) -+ -+# Try each search configuration. -+foreach(search ${_ZLIB_SEARCHES}) -+ find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) -+ find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) -+endforeach() -+ -+mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -+ -+if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") -+ file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") -+ -+ string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") -+ string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") -+ string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") -+ set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") -+ -+ # only append a TWEAK version if it exists: -+ set(ZLIB_VERSION_TWEAK "") -+ if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)") -+ set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") -+ set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") -+ endif() -+ -+ set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") -+ set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") -+ set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") -+endif() -+ -+# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if -+# all listed variables are TRUE -+include(FindPackageHandleStandardArgs) -+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR -+ VERSION_VAR ZLIB_VERSION_STRING) -+ -+if(ZLIB_FOUND) -+ set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) -+ set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) -+ -+ if(NOT TARGET ZLIB::ZLIB) -+ add_library(ZLIB::ZLIB UNKNOWN IMPORTED) -+ set_target_properties(ZLIB::ZLIB PROPERTIES -+ IMPORTED_LOCATION "${ZLIB_LIBRARY}" -+ INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") -+ endif() -+endif() -diff -Naur libpng/CMakeLists.txt PNG_BLD/CMakeLists.txt ---- libpng/CMakeLists.txt 2024-03-06 10:43:33.593760600 -0500 -+++ PNG_BLD/CMakeLists.txt 2024-03-06 10:51:59.356989438 -0500 -@@ -30,6 +30,9 @@ - VERSION ${PNGLIB_VERSION} - LANGUAGES C ASM) - -+# Location of CMake modules -+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") -+ - if(POLICY CMP0074) - # Allow find_package() to use the ZLIB_ROOT variable, if available. - cmake_policy(SET CMP0074 NEW) -@@ -47,8 +50,10 @@ - # Previously, we used to set CMAKE_DEBUG_POSTFIX globally. That variable should - # not be cached, however, because doing so would affect all projects processed - # after libpng, in unexpected and undesirable ways. --set(PNG_DEBUG_POSTFIX "d" -- CACHE STRING "Postfix to append to library file names under the Debug configuration") -+if(NOT PNG_NO_DEBUG_POSTFIX) -+ set(PNG_DEBUG_POSTFIX "d" -+ CACHE STRING "Postfix to append to library file names under the Debug configuration") -+endif(NOT PNG_NO_DEBUG_POSTFIX) - - # Allow the users to import their own extra configuration settings. - set(DFA_XTRA "" -@@ -97,6 +102,7 @@ - option(PNG_BUILD_ZLIB "Custom zlib location, else find_package is used" OFF) - if(NOT PNG_BUILD_ZLIB) - find_package(ZLIB REQUIRED) -+ include_directories(${ZLIB_INCLUDE_DIRS}) - elseif(POLICY CMP0074) - if("x${ZLIB_ROOT}" STREQUAL "x") - message(DEPRECATION -@@ -489,10 +495,9 @@ - - if(PNG_PREFIX) - set(PNGLIBCONF_H_EXTRA_DEPENDS -- "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" -- "${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst") -+ png_scripts_prefix_out) - set(PNGPREFIX_H_EXTRA_DEPENDS -- "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out") -+ png_scripts_intprefix_out) - endif() - - generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" -@@ -676,15 +681,15 @@ - # We are on a Unix or Unix-like toolchain like the GNU toolchain on Windows. - # Library file names are expected to have an implicit prefix such as "lib". - # Let CMake prepend and append its usual prefixes and suffixes by default. -- set(PNG_SHARED_OUTPUT_NAME "png${PNGLIB_ABI_VERSION}") -- set(PNG_STATIC_OUTPUT_NAME "png${PNGLIB_ABI_VERSION}") -+ set(PNG_SHARED_OUTPUT_NAME "png_brl${PNGLIB_ABI_VERSION}") -+ set(PNG_STATIC_OUTPUT_NAME "png_brl${PNGLIB_ABI_VERSION}") - else() - # We are, most likely, on a Windows toolchain like MSVC, Clang on Windows, - # Borland/Embarcadero, etc. We need to specify the "libpng" name explicitly. - # We also need to use a custom suffix, in order to distinguish between the - # shared import library name and the static library name. -- set(PNG_SHARED_OUTPUT_NAME "libpng${PNGLIB_ABI_VERSION}") -- set(PNG_STATIC_OUTPUT_NAME "libpng${PNGLIB_ABI_VERSION}_static") -+ set(PNG_SHARED_OUTPUT_NAME "libpng_brl${PNGLIB_ABI_VERSION}") -+ set(PNG_STATIC_OUTPUT_NAME "libpng_brl${PNGLIB_ABI_VERSION}_static") - endif() - - if(PNG_SHARED) -@@ -1067,16 +1072,16 @@ - if(PNG_SHARED) - # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin - if(NOT WIN32 OR CYGWIN OR MINGW) -- create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared) -- install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} -+ create_symlink(libpng_brl${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared) -+ install(FILES $/libpng_brl${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - endif() - - if(PNG_STATIC) - if(NOT WIN32 OR CYGWIN OR MINGW) -- create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) -- install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} -+ create_symlink(libpng_brl${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) -+ install(FILES $/libpng_brl${CMAKE_STATIC_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - endif() diff --git a/png/png_cmake.patch b/png/png_cmake.patch new file mode 100644 index 00000000..d76eba6a --- /dev/null +++ b/png/png_cmake.patch @@ -0,0 +1,70 @@ +diff -Naur libpng/CMakeLists.txt PNG_BLD/CMakeLists.txt +--- libpng/CMakeLists.txt 2024-10-11 10:39:06.421433191 -0400 ++++ PNG_BLD/CMakeLists.txt 2024-10-11 10:40:45.921699021 -0400 +@@ -47,8 +47,10 @@ + # Previously, we used to set CMAKE_DEBUG_POSTFIX globally. That variable should + # not be cached, however, because doing so would affect all projects processed + # after libpng, in unexpected and undesirable ways. +-set(PNG_DEBUG_POSTFIX "d" +- CACHE STRING "Postfix to append to library file names under the Debug configuration") ++if(NOT PNG_NO_DEBUG_POSTFIX) ++ set(PNG_DEBUG_POSTFIX "d" ++ CACHE STRING "Postfix to append to library file names under the Debug configuration") ++endif(NOT PNG_NO_DEBUG_POSTFIX) + + # Allow the users to import their own extra configuration settings. + set(DFA_XTRA "" +@@ -488,10 +490,9 @@ + + if(PNG_PREFIX) + set(PNGLIBCONF_H_EXTRA_DEPENDS +- "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" +- "${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst") ++ png_scripts_prefix_out) + set(PNGPREFIX_H_EXTRA_DEPENDS +- "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out") ++ png_scripts_intprefix_out) + endif() + + generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" +@@ -675,15 +676,15 @@ + # We are on a Unix or Unix-like toolchain like the GNU toolchain on Windows. + # Library file names are expected to have an implicit prefix such as "lib". + # Let CMake prepend and append its usual prefixes and suffixes by default. +- set(PNG_SHARED_OUTPUT_NAME "png${PNGLIB_ABI_VERSION}") +- set(PNG_STATIC_OUTPUT_NAME "png${PNGLIB_ABI_VERSION}") ++ set(PNG_SHARED_OUTPUT_NAME "png_brl${PNGLIB_ABI_VERSION}") ++ set(PNG_STATIC_OUTPUT_NAME "png_brl${PNGLIB_ABI_VERSION}") + else() + # We are, most likely, on a Windows toolchain like MSVC, Clang on Windows, + # Borland/Embarcadero, etc. We need to specify the "libpng" name explicitly. + # We also need to use a custom suffix, in order to distinguish between the + # shared import library name and the static library name. +- set(PNG_SHARED_OUTPUT_NAME "libpng${PNGLIB_ABI_VERSION}") +- set(PNG_STATIC_OUTPUT_NAME "libpng${PNGLIB_ABI_VERSION}_static") ++ set(PNG_SHARED_OUTPUT_NAME "libpng_brl${PNGLIB_ABI_VERSION}") ++ set(PNG_STATIC_OUTPUT_NAME "libpng_brl${PNGLIB_ABI_VERSION}_static") + endif() + + if(PNG_SHARED) +@@ -1072,16 +1073,16 @@ + if(PNG_SHARED) + # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin + if(NOT WIN32 OR CYGWIN OR MINGW) +- create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared) +- install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} ++ create_symlink(libpng_brl${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared) ++ install(FILES $/libpng_brl${CMAKE_SHARED_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() + + if(PNG_STATIC) + if(NOT WIN32 OR CYGWIN OR MINGW) +- create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) +- install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} ++ create_symlink(libpng_brl${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) ++ install(FILES $/libpng_brl${CMAKE_STATIC_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() diff --git a/png/png_zlib.patch b/png/png_zlib.patch new file mode 100644 index 00000000..248d71a9 --- /dev/null +++ b/png/png_zlib.patch @@ -0,0 +1,12 @@ +diff -Naur libpng/scripts/pnglibconf.dfa PNG_BLD/scripts/pnglibconf.dfa +--- libpng/scripts/pnglibconf.dfa 2024-10-11 10:48:58.913083752 -0400 ++++ PNG_BLD/scripts/pnglibconf.dfa 2024-10-11 10:48:27.026205664 -0400 +@@ -343,7 +343,7 @@ + # The TEXT values are the defaults when writing compressed text (all forms) + + # Include the zlib header so that the defaults below are known +-@# include ++@# include "zlib.h" + + # The '@' here means to substitute the value when pnglibconf.h is built + setting Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION