Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@ -0,0 +1,27 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8e5100..0ccac52 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)
# 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)
+ if(1)
set_target_properties(png_static PROPERTIES
OUTPUT_NAME "${PNG_LIB_NAME}"
CLEAN_DIRECT_OUTPUT 1)

View File

@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3931f12..b570fa8 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)
+ 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")
endif()
# what's with libpng-manual.txt and all the extra files?

View File

@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c1d632..a2a0d0d 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*")
- set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
- set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
+ 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)
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)

View File

@ -0,0 +1,62 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6451fcf1b..dbd5016ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,11 +63,22 @@ option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
+# CMake currently sets CMAKE_SYSTEM_PROCESSOR to one of x86_64 or arm64 on macOS,
+# based upon the OS architecture, not the target architecture. As such, we need
+# to check CMAKE_OSX_ARCHITECTURES to identify which hardware-specific flags to
+# enable. Note that this will fail if you attempt to build a universal binary in
+# a single cmake invokation.
+if (APPLE AND CMAKE_OSX_ARCHITECTURES)
+ set(TARGET_ARCH ${CMAKE_OSX_ARCHITECTURES})
+else()
+ set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
+endif()
+
if(PNG_HARDWARE_OPTIMIZATIONS)
# set definitions and sources for arm
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
+if(TARGET_ARCH MATCHES "^arm" OR
+ TARGET_ARCH MATCHES "^aarch64")
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
check: (default) use internal checking code;
@@ -121,8 +132,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
endif()
# set definitions and sources for intel
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
+if(TARGET_ARCH MATCHES "^i?86" OR
+ TARGET_ARCH MATCHES "^x86_64*")
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
off: disable the optimizations")
@@ -171,8 +182,8 @@ endif()
else(PNG_HARDWARE_OPTIMIZATIONS)
# set definitions and sources for arm
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
+if(TARGET_ARCH MATCHES "^arm" OR
+ TARGET_ARCH MATCHES "^aarch64")
add_definitions(-DPNG_ARM_NEON_OPT=0)
endif()
@@ -183,8 +194,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
endif()
# set definitions and sources for intel
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
+if(TARGET_ARCH MATCHES "^i?86" OR
+ TARGET_ARCH MATCHES "^x86_64")
add_definitions(-DPNG_INTEL_SSE_OPT=0)
endif()

View File

@ -0,0 +1,32 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ccac52..218747a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -820,12 +820,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.
-if(NOT WIN32 OR CYGWIN OR MINGW)
+if(1)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
- set(LIBS "-lz -lm")
+ set(LIBS "")
+ if(M_LIBRARY)
+ 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)
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")

View File

@ -0,0 +1,103 @@
set(LIBPNG_VER 1.6.37)
# Download the apng patch
set(LIBPNG_APNG_PATCH_PATH "")
set(LIBPNG_APNG_OPTION "")
if ("apng" IN_LIST FEATURES)
if(VCPKG_HOST_IS_WINDOWS)
# Get (g)awk and gzip installed
vcpkg_acquire_msys(MSYS_ROOT PACKAGES gawk gzip)
set(AWK_EXE_PATH "${MSYS_ROOT}/usr/bin")
vcpkg_add_to_path("${AWK_EXE_PATH}")
endif()
set(LIBPNG_APNG_PATCH_NAME "libpng-${LIBPNG_VER}-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"
FILENAME "${LIBPNG_APNG_PATCH_NAME}.gz"
SHA512 226adcb3a8c60f2267fe2976ab531329ae43c2603dab4d0cf8f16217d64069936b879f3d6516b75d259c47d6f5c5b1f24f887602206c8e46abde0fb7f5c7946b
)
set(LIBPNG_APNG_PATCH_PATH "${CURRENT_BUILDTREES_DIR}/src/${LIBPNG_APNG_PATCH_NAME}")
if (NOT EXISTS "${LIBPNG_APNG_PATCH_PATH}")
file(INSTALL "${LIBPNG_APNG_PATCH_ARCHIVE}" DESTINATION "${CURRENT_BUILDTREES_DIR}/src")
vcpkg_execute_required_process(
COMMAND gzip -d "${LIBPNG_APNG_PATCH_NAME}.gz"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src"
ALLOW_IN_DOWNLOAD_MODE
LOGNAME extract-patch.log
)
endif()
set(LIBPNG_APNG_OPTION "-DPNG_PREFIX=a")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO glennrp/libpng
REF v${LIBPNG_VER}
SHA512 ccb3705c23b2724e86d072e2ac8cfc380f41fadfd6977a248d588a8ad57b6abe0e4155e525243011f245e98d9b7afbe2e8cc7fd4ff7d82fcefb40c0f48f88918
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
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PNG_SHARED)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PNG_STATIC)
vcpkg_list(SET LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION)
if(VCPKG_TARGET_IS_IOS)
vcpkg_list(APPEND LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_HARDWARE_OPTIMIZATIONS=OFF")
endif()
vcpkg_list(SET LD_VERSION_SCRIPT_OPTION)
if(VCPKG_TARGET_IS_ANDROID)
vcpkg_list(APPEND LD_VERSION_SCRIPT_OPTION "-Dld-version-script=OFF")
# for armeabi-v7a, check whether NEON is available
vcpkg_list(APPEND LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_ARM_NEON=check")
else()
vcpkg_list(APPEND LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_ARM_NEON=on")
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${LIBPNG_APNG_OPTION}
${LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION}
${LD_VERSION_SCRIPT_OPTION}
-DPNG_STATIC=${PNG_STATIC}
-DPNG_SHARED=${PNG_SHARED}
-DPNG_TESTS=OFF
-DSKIP_INSTALL_PROGRAMS=ON
-DSKIP_INSTALL_EXECUTABLES=ON
-DSKIP_INSTALL_FILES=OFF
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
MAYBE_UNUSED_VARIABLES
PNG_ARM_NEON
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/libpng)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/png")
vcpkg_fixup_pkgconfig()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" "-lpng16" "-llibpng16d")
file(INSTALL "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" RENAME "libpng.pc")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpng16.pc" "-lpng16" "-llibpng16")
elseif(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" "-lpng16" "-lpng16d")
file(INSTALL "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" RENAME "libpng.pc")
endif()
file(INSTALL "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpng16.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig" RENAME "libpng.pc")
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

4
vcpkg-ports/libpng/usage Normal file
View File

@ -0,0 +1,4 @@
The package libpng is compatible with built-in CMake targets:
find_package(PNG REQUIRED)
target_link_libraries(main PRIVATE PNG::PNG)

View File

@ -0,0 +1,17 @@
diff --git a/pngpriv.h b/pngpriv.h
index 583c26f..135651c 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -556,11 +556,7 @@
/* Memory model/platform independent fns */
#ifndef PNG_ABORT
-# ifdef _WINDOWS_
-# define PNG_ABORT() ExitProcess(0)
-# else
-# define PNG_ABORT() abort()
-# endif
+# define PNG_ABORT() abort()
#endif
/* These macros may need to be architecture dependent. */

View File

@ -0,0 +1,3 @@
find_library(PNG_LIBRARY_RELEASE NAMES png16 libpng16 NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
find_library(PNG_LIBRARY_DEBUG NAMES png16d libpng16d NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
_find_package(${ARGS})

View File

@ -0,0 +1,24 @@
{
"name": "libpng",
"version": "1.6.37",
"port-version": 19,
"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",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
],
"features": {
"apng": {
"description": "This is backward compatible with the regular libpng, both in library usage and format"
}
}
}