mkxp-z/subprojects/packagefiles/libpng-deps.patch
2025-02-24 15:32:02 -05:00

60 lines
2.2 KiB
Diff

# Prevents libpng's build system from trying to look for zlib externally since Meson already handles that.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,7 +114,7 @@ if(PNG_BUILD_ZLIB)
endif()
endif()
-find_package(ZLIB REQUIRED)
+
if(UNIX
AND NOT (APPLE OR BEOS OR HAIKU)
@@ -628,7 +628,7 @@ if(PNG_SHARED)
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_include_directories(png_shared SYSTEM
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}>)
- target_link_libraries(png_shared PUBLIC ZLIB::ZLIB ${M_LIBRARY})
+ target_link_libraries(png_shared PUBLIC ${M_LIBRARY})
endif()
if(PNG_STATIC)
@@ -644,7 +644,7 @@ if(PNG_STATIC)
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_include_directories(png_static SYSTEM
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}>)
- target_link_libraries(png_static PUBLIC ZLIB::ZLIB ${M_LIBRARY})
+ target_link_libraries(png_static PUBLIC ${M_LIBRARY})
endif()
if(PNG_FRAMEWORK AND NOT APPLE)
@@ -675,7 +675,7 @@ if(PNG_FRAMEWORK)
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_include_directories(png_framework SYSTEM
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}>)
- target_link_libraries(png_framework PUBLIC ZLIB::ZLIB ${M_LIBRARY})
+ target_link_libraries(png_framework PUBLIC ${M_LIBRARY})
endif()
if(NOT PNG_LIBRARY_TARGETS)
@@ -864,7 +864,7 @@ if(PNG_SHARED AND PNG_TOOLS)
set(PNG_BIN_TARGETS pngfix)
add_executable(png-fix-itxt ${png_fix_itxt_sources})
- target_link_libraries(png-fix-itxt PRIVATE ZLIB::ZLIB ${M_LIBRARY})
+ target_link_libraries(png-fix-itxt PRIVATE ${M_LIBRARY})
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
endif()
--- a/pngstruct.h
+++ b/pngstruct.h
@@ -26,7 +26,7 @@
/* We must ensure that zlib uses 'const' in declarations. */
# define ZLIB_CONST
#endif
-#include "zlib.h"
+#include "../zlib/zlib.h"
#ifdef const
/* zlib.h sometimes #defines const to nothing, undo this. */
# undef const