diff --git a/ports/libpng/CONTROL b/ports/libpng/CONTROL index e7e3f3f0e2e..d03709b0080 100644 --- a/ports/libpng/CONTROL +++ b/ports/libpng/CONTROL @@ -1,5 +1,5 @@ Source: libpng -Version: 1.6.37-5 +Version: 1.6.37-6 Build-Depends: zlib Homepage: https://github.com/glennrp/libpng Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files. diff --git a/ports/libpng/cmake.patch b/ports/libpng/cmake.patch new file mode 100644 index 00000000000..f2eb6aa8e10 --- /dev/null +++ b/ports/libpng/cmake.patch @@ -0,0 +1,47 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6451fcf..6599e1d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -44,7 +44,7 @@ if(NOT PNG_BUILD_ZLIB) + endif() + + if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) +- find_library(M_LIBRARY m) ++ set(M_LIBRARY m) + else() + # libm is not needed and/or not available + set(M_LIBRARY "") +@@ -551,21 +551,14 @@ endif() + + if(PNG_STATIC) + # does not work without changing name +- set(PNG_LIB_NAME_STATIC png_static) + add_library(png_static STATIC ${libpng_sources}) + add_dependencies(png_static genfiles) + # MSVC doesn't use a different file extension for shared vs. static + # libs. We are able to change OUTPUT_NAME to remove the _static + # for all other platforms. +- if(NOT MSVC) +- set_target_properties(png_static PROPERTIES +- OUTPUT_NAME "${PNG_LIB_NAME}" +- CLEAN_DIRECT_OUTPUT 1) +- else() +- set_target_properties(png_static PROPERTIES +- OUTPUT_NAME "${PNG_LIB_NAME}_static" +- CLEAN_DIRECT_OUTPUT 1) +- endif() ++ set_target_properties(png_static PROPERTIES ++ OUTPUT_NAME "${PNG_LIB_NAME}" ++ CLEAN_DIRECT_OUTPUT 1) + list(APPEND PNG_LIB_TARGETS png_static) + if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name +@@ -915,7 +908,7 @@ endif() + + # Create an export file that CMake users can include() to import our targets. + if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL) +- install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake) ++ install(EXPORT libpng DESTINATION lib/libpng FILE libpngConfig.cmake) + endif() + + # what's with libpng-manual.txt and all the extra files? diff --git a/ports/libpng/fix-libm-unix.patch b/ports/libpng/fix-libm-unix.patch deleted file mode 100644 index 0abd20879e7..00000000000 --- a/ports/libpng/fix-libm-unix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2019-04-14 20:10:32.000000000 +0200 -+++ b/CMakeLists.txt 2019-09-06 14:14:39.425498139 +0200 -@@ -44,7 +44,7 @@ - endif() - - if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) -- find_library(M_LIBRARY m) -+ set(M_LIBRARY m) - else() - # libm is not needed and/or not available - set(M_LIBRARY "") diff --git a/ports/libpng/libpngConfig.cmake b/ports/libpng/libpngConfig.cmake deleted file mode 100644 index 18108035a32..00000000000 --- a/ports/libpng/libpngConfig.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# The upstream CMakeLists.txt exports libpng's targets to a file named `libpng16.cmake`. -# However, `find_package(libpng CONFIG)` expects a file named `libpngConfig.cmake` to exist instead. -# -# By including `libpng.cmake` from this file, `find_package(libpng CONFIG)` will work. -get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -include("${_DIR}/libpng16.cmake") diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake index 829719d3f60..e9a20045547 100644 --- a/ports/libpng/portfile.cmake +++ b/ports/libpng/portfile.cmake @@ -13,17 +13,17 @@ if ("apng" IN_LIST FEATURES) FILENAME "${LIBPNG_APG_PATCH_NAME}.gz" SHA512 226adcb3a8c60f2267fe2976ab531329ae43c2603dab4d0cf8f16217d64069936b879f3d6516b75d259c47d6f5c5b1f24f887602206c8e46abde0fb7f5c7946b ) - + vcpkg_find_acquire_program(7Z) - + vcpkg_execute_required_process( COMMAND ${7Z} x ${LIBPNG_APNG_PATCH_ARCHIVE} -aoa WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src LOGNAME extract-patch.log ) endif() - - set(APNG_EXTRA_PATCH ${LIBPNG_APG_PATCH_PATH}) + + set(APNG_EXTRA_PATCH ${LIBPNG_APG_PATCH_PATH}) set(LIBPNG_APNG_OPTION "-DPNG_PREFIX=a") endif() @@ -34,8 +34,8 @@ vcpkg_from_github( SHA512 ccb3705c23b2724e86d072e2ac8cfc380f41fadfd6977a248d588a8ad57b6abe0e4155e525243011f245e98d9b7afbe2e8cc7fd4ff7d82fcefb40c0f48f88918 HEAD_REF master PATCHES - use-abort-on-all-platforms.patch - fix-libm-unix.patch + use_abort.patch + cmake.patch ${APNG_EXTRA_PATCH} ) @@ -58,37 +58,14 @@ vcpkg_configure_cmake( -DSKIP_INSTALL_PROGRAMS=ON -DSKIP_INSTALL_EXECUTABLES=ON -DSKIP_INSTALL_FILES=ON - -DSKIP_INSTALL_SYMLINK=ON - OPTIONS_DEBUG - -DSKIP_INSTALL_HEADERS=ON + OPTIONS_DEBUG + -DSKIP_INSTALL_HEADERS=ON ) vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/libpng) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/libpng16_static.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpng16_static.lib ${CURRENT_PACKAGES_DIR}/lib/libpng16.lib) - endif() - if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16_staticd.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16_staticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16d.lib) - endif() - - foreach(FILE ${CURRENT_PACKAGES_DIR}/share/libpng/libpng16-release.cmake ${CURRENT_PACKAGES_DIR}/share/libpng/libpng16-debug.cmake) - file(READ ${FILE} _contents) - string(REGEX REPLACE "libpng16_static.lib" "libpng16.lib" _contents "${_contents}") - string(REGEX REPLACE "libpng16_staticd.lib" "libpng16d.lib" _contents "${_contents}") - file(WRITE ${FILE} "${_contents}") - endforeach() -endif() - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share/) -file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/libpngConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) - -if(NOT VCPKG_TARGET_IS_WINDOWS) - file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/png) -endif() - vcpkg_copy_pdbs() + file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/libpng/skip-install-symlink.patch b/ports/libpng/skip-install-symlink.patch deleted file mode 100644 index c250759416e..00000000000 --- a/ports/libpng/skip-install-symlink.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 48c6fa2..589e5f9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -853,7 +853,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -- if(PNG_SHARED) -+ if(PNG_SHARED AND NOT SKIP_INSTALL_SYMLINK) - # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin - if(CYGWIN OR MINGW) - create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png) -@@ -868,7 +868,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - endif() - endif() - -- if(PNG_STATIC) -+ if(PNG_STATIC AND NOT SKIP_INSTALL_SYMLINK) - if(NOT WIN32 OR CYGWIN OR MINGW) - create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) - install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/ports/libpng/use-abort-on-all-platforms.patch b/ports/libpng/use_abort.patch similarity index 87% rename from ports/libpng/use-abort-on-all-platforms.patch rename to ports/libpng/use_abort.patch index 0a629e05924..c52df5c2b78 100644 --- a/ports/libpng/use-abort-on-all-platforms.patch +++ b/ports/libpng/use_abort.patch @@ -1,8 +1,8 @@ diff --git a/pngpriv.h b/pngpriv.h -index fe3355d..5a049b5 100644 +index 583c26f..135651c 100644 --- a/pngpriv.h +++ b/pngpriv.h -@@ -457,11 +457,7 @@ +@@ -556,11 +556,7 @@ /* Memory model/platform independent fns */ #ifndef PNG_ABORT diff --git a/ports/libpng/vcpkg-cmake-wrapper.cmake b/ports/libpng/vcpkg-cmake-wrapper.cmake deleted file mode 100644 index cb9c74f3240..00000000000 --- a/ports/libpng/vcpkg-cmake-wrapper.cmake +++ /dev/null @@ -1,6 +0,0 @@ -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../lib/libpng16.a") - set(PNG_LIBRARY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../../lib/libpng16.a" CACHE FILEPATH "") -elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../lib/libpng16${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(PNG_LIBRARY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../../lib/libpng16${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE FILEPATH "") -endif() -_find_package(${ARGS})