Skip to content

Commit

Permalink
[libpng] update to 1.7.38 (microsoft#27721)
Browse files Browse the repository at this point in the history
* [libpng] update to 1.7.38

* update version

* update patch

* update version
  • Loading branch information
JonLiu1993 authored Nov 11, 2022
1 parent 895072c commit 174be48
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 144 deletions.
24 changes: 5 additions & 19 deletions ports/libpng/cmake.patch
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8e5100..0ccac52 100644
index 8652564..d0681d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,11 +40,11 @@ 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_DIR})
+ set(ZLIB_LIBRARY ZLIB::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 "")
@@ -557,7 +557,7 @@ if(PNG_STATIC)
@@ -614,7 +614,7 @@ if(PNG_STATIC)
# MSVC doesn't use a different file extension for shared vs. static
# libs. We are able to change OUTPUT_NAME to remove the _static
# libs. We are able to change OUTPUT_NAME to remove the _static
# for all other platforms.
- if(NOT MSVC)
+ if(1)
set_target_properties(png_static PROPERTIES
OUTPUT_NAME "${PNG_LIB_NAME}"
CLEAN_DIRECT_OUTPUT 1)
OUTPUT_NAME "${PNG_LIB_NAME}"
CLEAN_DIRECT_OUTPUT 1)
22 changes: 11 additions & 11 deletions ports/libpng/fix-export-targets.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3931f12..b570fa8 100644
index c01cdcb..0ad4ba4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -909,6 +909,12 @@ 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)
@@ -1033,6 +1033,12 @@ if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
install(EXPORT libpng
DESTINATION lib/libpng
FILE lib${PNG_LIB_NAME}.cmake)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libpng-config.cmake" "
+include(CMakeFindDependencyMacro)
+find_dependency(ZLIB)
+include(\"\${CMAKE_CURRENT_LIST_DIR}/lib${PNG_LIB_NAME}.cmake\")
+")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libpng-config.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/libpng")
+ include(CMakeFindDependencyMacro)
+ find_dependency(ZLIB)
+ include(\"\${CMAKE_CURRENT_LIST_DIR}/lib${PNG_LIB_NAME}.cmake\")
+ ")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libpng-config.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/libpng")
endif()

# what's with libpng-manual.txt and all the extra files?
# TODO: Create MSVC import lib for MinGW-compiled shared lib.
25 changes: 12 additions & 13 deletions ports/libpng/fix-msa-support-for-mips.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c1d632..a2a0d0d 100644
index a249d42..1176c60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,8 +158,8 @@ endif()
# set definitions and sources for MIPS
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
@@ -171,8 +171,8 @@ endif()
# Set definitions and sources for MIPS.
if(TARGET_ARCH MATCHES "mipsel*" OR
TARGET_ARCH MATCHES "mips64el*")
- set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
- set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
- set(PNG_MIPS_MSA "on"
+ set(PNG_MIPS_MSA_POSSIBLE_VALUES on off check)
+ set(PNG_MIPS_MSA "check" CACHE STRING "Enable MIPS_MSA optimizations:
off: disable the optimizations")
set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS
${PNG_MIPS_MSA_POSSIBLE_VALUES})
@@ -173,6 +173,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
mips/filter_msa_intrinsics.c)
+ set(PNG_MIPS_MSA "check"
CACHE STRING "Enable MIPS_MSA optimizations: on|off; on is default")
set_property(CACHE PNG_MIPS_MSA
PROPERTY STRINGS ${PNG_MIPS_MSA_POSSIBLE_VALUES})
@@ -185,6 +185,8 @@ if(TARGET_ARCH MATCHES "mipsel*" OR
mips/filter_msa_intrinsics.c)
if(${PNG_MIPS_MSA} STREQUAL "on")
add_definitions(-DPNG_MIPS_MSA_OPT=2)
+ else()
+ add_definitions(-DPNG_MIPS_MSA_CHECK_SUPPORTED)
endif()
else()
add_definitions(-DPNG_MIPS_MSA_OPT=0)

62 changes: 0 additions & 62 deletions ports/libpng/macos-arch-fix.patch

This file was deleted.

20 changes: 10 additions & 10 deletions ports/libpng/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ccac52..218747a 100644
index 0ad4ba4..a249d42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -820,12 +820,15 @@ endif()
@@ -932,12 +932,15 @@ endif()
# We use the same files like ./configure, so we have to set its vars.
# Only do this on Windows for Cygwin - the files don't make much sense outside
# of a UNIX look-alike.
# Only do this on Windows for Cygwin - the files don't make much sense
# outside of a UNIX look-alike.
-if(NOT WIN32 OR CYGWIN OR MINGW)
+if(1)
set(prefix ${CMAKE_INSTALL_PREFIX})
Expand All @@ -18,15 +18,15 @@ index 0ccac52..218747a 100644
+ string(APPEND LIBS "-lm")
+ endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
@@ -894,6 +897,9 @@ if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
@ONLY)
@@ -1010,6 +1013,9 @@ if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
endif()

if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+elseif(0)
# Install man pages
if(NOT PNG_MAN_DIR)
set(PNG_MAN_DIR "share/man")
# Install the man pages.
install(FILES libpng.3 libpngpf.3
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
14 changes: 6 additions & 8 deletions ports/libpng/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(LIBPNG_VER 1.6.37)
vcpkg_minimum_required(VERSION 2022-09-15) # for ${VERSION}

# Download the apng patch
set(LIBPNG_APNG_PATCH_PATH "")
Expand All @@ -11,11 +11,11 @@ if ("apng" IN_LIST FEATURES)
vcpkg_add_to_path("${AWK_EXE_PATH}")
endif()

set(LIBPNG_APNG_PATCH_NAME "libpng-${LIBPNG_VER}-apng.patch")
set(LIBPNG_APNG_PATCH_NAME "libpng-${VERSION}-apng.patch")
vcpkg_download_distfile(LIBPNG_APNG_PATCH_ARCHIVE
URLS "https://downloads.sourceforge.net/project/libpng-apng/libpng16/${LIBPNG_VER}/${LIBPNG_APNG_PATCH_NAME}.gz"
URLS "https://downloads.sourceforge.net/project/libpng-apng/libpng16/${VERSION}/${LIBPNG_APNG_PATCH_NAME}.gz"
FILENAME "${LIBPNG_APNG_PATCH_NAME}.gz"
SHA512 226adcb3a8c60f2267fe2976ab531329ae43c2603dab4d0cf8f16217d64069936b879f3d6516b75d259c47d6f5c5b1f24f887602206c8e46abde0fb7f5c7946b
SHA512 e8cb74d9be6bcbc474b6bbd6200ab5d5111e91d3ab601e5fda04213d2800a4051f04152fa5d47db690612ed06a488ff3b2608a8f0bac0cf207d486107d98da1f
)
set(LIBPNG_APNG_PATCH_PATH "${CURRENT_BUILDTREES_DIR}/src/${LIBPNG_APNG_PATCH_NAME}")
if (NOT EXISTS "${LIBPNG_APNG_PATCH_PATH}")
Expand All @@ -33,16 +33,14 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO glennrp/libpng
REF v${LIBPNG_VER}
SHA512 ccb3705c23b2724e86d072e2ac8cfc380f41fadfd6977a248d588a8ad57b6abe0e4155e525243011f245e98d9b7afbe2e8cc7fd4ff7d82fcefb40c0f48f88918
REF v${VERSION}
SHA512 def32a5e597d9f99b6f574193f0b94fe39a45ea69b764b0c2506e59df66e74f94dc313a983f092ec641d58e0c2be95a424a32c2ff019b0815ae51f2473282977
HEAD_REF master
PATCHES
"${LIBPNG_APNG_PATCH_PATH}"
use_abort.patch
cmake.patch
fix-export-targets.patch
pkgconfig.patch
macos-arch-fix.patch
fix-msa-support-for-mips.patch
)

Expand Down
17 changes: 0 additions & 17 deletions ports/libpng/use_abort.patch

This file was deleted.

3 changes: 1 addition & 2 deletions ports/libpng/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "libpng",
"version": "1.6.37",
"port-version": 19,
"version": "1.6.38",
"description": "libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files",
"homepage": "https://github.com/glennrp/libpng",
"license": "libpng-2.0",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4081,8 +4081,8 @@
"port-version": 1
},
"libpng": {
"baseline": "1.6.37",
"port-version": 19
"baseline": "1.6.38",
"port-version": 0
},
"libpopt": {
"baseline": "1.16",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libpng.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "923c99cca2e5f79dfc04e9432ac1146ee6da5b11",
"version": "1.6.38",
"port-version": 0
},
{
"git-tree": "85dc7678690f09c78cc366b1f13498c41be51aff",
"version": "1.6.37",
Expand Down

0 comments on commit 174be48

Please sign in to comment.