diff options
Diffstat (limited to 'Build/source/libs/libpng/libpng-src')
87 files changed, 2263 insertions, 957 deletions
diff --git a/Build/source/libs/libpng/libpng-src/ANNOUNCE b/Build/source/libs/libpng/libpng-src/ANNOUNCE index 44d6722d058..bc147adb78b 100644 --- a/Build/source/libs/libpng/libpng-src/ANNOUNCE +++ b/Build/source/libs/libpng/libpng-src/ANNOUNCE @@ -1,5 +1,5 @@ -libpng 1.6.42 - January 29, 2024 -================================ +libpng 1.6.43 - February 23, 2024 +================================= This is a public release of libpng, intended for use in production code. @@ -9,13 +9,13 @@ Files available for download Source files with LF line endings (for Unix/Linux): - * libpng-1.6.42.tar.xz (LZMA-compressed, recommended) - * libpng-1.6.42.tar.gz (deflate-compressed) + * libpng-1.6.43.tar.xz (LZMA-compressed, recommended) + * libpng-1.6.43.tar.gz (deflate-compressed) Source files with CRLF line endings (for Windows): - * lpng1642.7z (LZMA-compressed, recommended) - * lpng1642.zip (deflate-compressed) + * lpng1643.7z (LZMA-compressed, recommended) + * lpng1643.zip (deflate-compressed) Other information: @@ -25,47 +25,36 @@ Other information: * TRADEMARK.md -Changes from version 1.6.41 to version 1.6.42 +Changes from version 1.6.42 to version 1.6.43 --------------------------------------------- - * Fixed the implementation of the macro function `png_check_sig`. - This was an API regression, introduced in libpng-1.6.41. - (Reported by Matthieu Darbois) - - -Changes from version 1.6.40 to version 1.6.41 ---------------------------------------------- - - * Added SIMD-optimized code for the Loongarch LSX hardware. - (Contributed by GuXiWei, JinBo and ZhangLixia) - * Fixed the run-time discovery of MIPS MSA hardware. - (Contributed by Sui Jingfeng) - * Fixed an off-by-one error in the function `png_do_check_palette_indexes`, - which failed to recognize errors that might have existed in the first - column of a broken palette-encoded image. This was a benign regression - accidentally introduced in libpng-1.6.33. No pixel was harmed. - (Contributed by Adam Richter; reviewed by John Bowler) - * Fixed, improved and modernized the contrib/pngminus programs, i.e., - png2pnm.c and pnm2png.c - * Removed old and peculiar portability hacks that were meant to silence - warnings issued by gcc version 7.1 alone. + * Fixed the row width check in png_check_IHDR(). + This corrected a bug that was specific to the 16-bit platforms, + and removed a spurious compiler warning from the 64-bit builds. + (Reported by Jacek Caban; fixed by John Bowler) + * Added eXIf chunk support to the push-mode reader in pngpread.c. + (Contributed by Chris Blume) + * Added contrib/pngexif for the benefit of the users who would like + to inspect the content of eXIf chunks. + * Added contrib/conftest/basic.dfa, a basic build-time configuration. (Contributed by John Bowler) - * Fixed and modernized the CMake file, and raised the minimum required - CMake version from 3.1 to 3.6. - (Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.) - * Allowed the configure script to disable the building of auxiliary tools - and tests, thus catching up with the CMake file. - (Contributed by Carlo Bramini) - * Fixed a build issue on Mac. - (Contributed by Zixu Wang) - * Moved the Autoconf macro files to scripts/autoconf. - * Moved the CMake files (except for the main CMakeLists.txt) to - scripts/cmake and moved the list of their contributing authors to - scripts/cmake/AUTHORS.md - * Updated the CI configurations and scripts. - * Relicensed the CI scripts to the MIT License. - * Improved the test coverage. + * Fixed a preprocessor condition in pngread.c that broke build-time + configurations like contrib/conftest/pngcp.dfa. (Contributed by John Bowler) + * Added CMake build support for LoongArch LSX. + (Contributed by GuXiWei) + * Fixed a CMake build error that occurred under a peculiar state of the + dependency tree. This was a regression introduced in libpng-1.6.41. + (Contributed by Dan Rosser) + * Marked the installed libpng headers as system headers in CMake. + (Contributed by Benjamin Buch) + * Updated the build support for RISCOS. + (Contributed by Cameron Cawley) + * Updated the makefiles to allow cross-platform builds to initialize + conventional make variables like AR and ARFLAGS. + * Added various improvements to the CI scripts in areas like version + consistency verification and text linting. + * Added version consistency verification to pngtest.c also. Send comments/corrections/commendations to png-mng-implement at lists.sf.net. diff --git a/Build/source/libs/libpng/libpng-src/AUTHORS b/Build/source/libs/libpng/libpng-src/AUTHORS index bf962f6e163..544341694a5 100644 --- a/Build/source/libs/libpng/libpng-src/AUTHORS +++ b/Build/source/libs/libpng/libpng-src/AUTHORS @@ -6,6 +6,7 @@ Authors, for copyright and licensing purposes. * Adam Richter * Andreas Dilger + * Chris Blume * Cosmin Truta * Dave Martindale * Eric S. Raymond diff --git a/Build/source/libs/libpng/libpng-src/CHANGES b/Build/source/libs/libpng/libpng-src/CHANGES index 137761a815b..441b57ecf1a 100644 --- a/Build/source/libs/libpng/libpng-src/CHANGES +++ b/Build/source/libs/libpng/libpng-src/CHANGES @@ -6130,7 +6130,7 @@ Version 1.6.40 [June 21, 2023] Cleaned up the code, the build scripts, and the documentation. Version 1.6.41 [January 24, 2024] - Added SIMD-optimized code for the Loongarch LSX hardware. + Added SIMD-optimized code for the LoongArch LSX hardware. (Contributed by GuXiWei, JinBo and ZhangLixia) Fixed the run-time discovery of MIPS MSA hardware. (Contributed by Sui Jingfeng) @@ -6165,6 +6165,36 @@ Version 1.6.42 [January 29, 2024] Fixed the implementation of the macro function png_check_sig(). This was an API regression, introduced in libpng-1.6.41. (Reported by Matthieu Darbois) + Fixed and updated the libpng manual. + +Version 1.6.43 [February 23, 2024] + Fixed the row width check in png_check_IHDR(). + This corrected a bug that was specific to the 16-bit platforms, + and removed a spurious compiler warning from the 64-bit builds. + (Reported by Jacek Caban; fixed by John Bowler) + Added eXIf chunk support to the push-mode reader in pngpread.c. + (Contributed by Chris Blume) + Added contrib/pngexif for the benefit of the users who would like + to inspect the content of eXIf chunks. + Added contrib/conftest/basic.dfa, a basic build-time configuration. + (Contributed by John Bowler) + Fixed a preprocessor condition in pngread.c that broke build-time + configurations like contrib/conftest/pngcp.dfa. + (Contributed by John Bowler) + Added CMake build support for LoongArch LSX. + (Contributed by GuXiWei) + Fixed a CMake build error that occurred under a peculiar state of the + dependency tree. This was a regression introduced in libpng-1.6.41. + (Contributed by Dan Rosser) + Marked the installed libpng headers as system headers in CMake. + (Contributed by Benjamin Buch) + Updated the build support for RISCOS. + (Contributed by Cameron Cawley) + Updated the makefiles to allow cross-platform builds to initialize + conventional make variables like AR and ARFLAGS. + Added various improvements to the CI scripts in areas like version + consistency verification and text linting. + Added version consistency verification to pngtest.c also. Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Subscription is required; visit diff --git a/Build/source/libs/libpng/libpng-src/CMakeLists.txt b/Build/source/libs/libpng/libpng-src/CMakeLists.txt index 0d40ce0b776..ad3f2427dc1 100644 --- a/Build/source/libs/libpng/libpng-src/CMakeLists.txt +++ b/Build/source/libs/libpng/libpng-src/CMakeLists.txt @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.6) set(PNGLIB_MAJOR 1) set(PNGLIB_MINOR 6) -set(PNGLIB_REVISION 41) +set(PNGLIB_REVISION 43) set(PNGLIB_SUBREVISION 0) #set(PNGLIB_SUBREVISION "git") set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_REVISION}) @@ -62,9 +62,18 @@ if(APPLE) endif() # Allow the users to switch on/off the auxiliary build and test artifacts. -# NOTE: These artifacts are NOT part of libpng proper, and are subject to change at any time. +# These artifacts are NOT part of libpng proper, and are subject to change +# at any time. option(PNG_TESTS "Build the libpng tests" ON) -option(PNG_TOOLS "Build the libpng tools" ON) + +# Same as above, but for the third-party tools. +# Although these tools are targetted at development environments only, +# the users are allowed to override the option to build by default. +if (ANDROID OR IOS) + option(PNG_TOOLS "Build the libpng tools" OFF) +else() + option(PNG_TOOLS "Build the libpng tools" ON) +endif() # Maintain backwards compatibility with the deprecated option PNG_EXECUTABLES. option(PNG_EXECUTABLES "[Deprecated; please use PNG_TOOLS]" ON) @@ -89,7 +98,6 @@ option(PNG_BUILD_ZLIB "Custom zlib location, else find_package is used" OFF) if(NOT PNG_BUILD_ZLIB) find_package(ZLIB REQUIRED) elseif(POLICY CMP0074) - # TODO: Remove the policy check if CMake version 3.12 or greater becomes the minimum required. if("x${ZLIB_ROOT}" STREQUAL "x") message(DEPRECATION "The option PNG_BUILD_ZLIB has been deprecated; please use ZLIB_ROOT instead") @@ -249,6 +257,35 @@ if(TARGET_ARCH MATCHES "^(mipsel|mips64el)") endif() endif() +# Set definitions and sources for LoongArch. +if(TARGET_ARCH MATCHES "^(loongarch)") + include(CheckCCompilerFlag) + set(PNG_LOONGARCH_LSX_POSSIBLE_VALUES on off) + set(PNG_LOONGARCH_LSX "on" + CACHE STRING "Enable LOONGARCH_LSX optimizations: on|off; on is default") + set_property(CACHE PNG_LOONGARCH_LSX + PROPERTY STRINGS ${PNG_LOONGARCH_LSX_POSSIBLE_VALUES}) + list(FIND PNG_LOONGARCH_LSX_POSSIBLE_VALUES ${PNG_LOONGARCH_LSX} index) + if(index EQUAL -1) + message(FATAL_ERROR "PNG_LOONGARCH_LSX must be one of [${PNG_LOONGARCH_LSX_POSSIBLE_VALUES}]") + elseif(NOT PNG_LOONGARCH_LSX STREQUAL "off") + CHECK_C_COMPILER_FLAG("-mlsx" COMPILER_SUPPORTS_LSX) + if(COMPILER_SUPPORTS_LSX) + set(libpng_loongarch_sources + loongarch/loongarch_lsx_init.c + loongarch/filter_lsx_intrinsics.c) + set_source_files_properties(${libpng_loongarch_sources} + PROPERTIES + COMPILE_FLAGS "-mlsx") + add_definitions(-DPNG_LOONGARCH_LSX_OPT=1) + else() + message(FATAL_ERROR "Compiler does not support -mlsx option") + endif() + else() + add_definitions(-DPNG_LOONGARCH_LSX_OPT=0) + endif() +endif() + else(PNG_HARDWARE_OPTIMIZATIONS) # Set definitions and sources for ARM. @@ -271,6 +308,11 @@ if(TARGET_ARCH MATCHES "^(mipsel|mips64el)") add_definitions(-DPNG_MIPS_MSA_OPT=0) endif() +# Set definitions and sources for LoongArch. +if(TARGET_ARCH MATCHES "^(loongarch)") + add_definitions(-DPNG_LOONGARCH_LSX_OPT=0) +endif() + endif(PNG_HARDWARE_OPTIMIZATIONS) option(ld-version-script "Enable linker version script" ON) @@ -310,7 +352,15 @@ int main(void) { return 0; } file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map") endif() -find_program(AWK NAMES gawk awk) +# Find an AWK language processor. +# Start with specific AWK implementations like gawk and nawk, which are +# known to work with our scripts, then fall back to the system awk. +find_program(AWK NAMES gawk nawk awk) +if(AWK) + message(STATUS "Found AWK program: ${AWK}") +else() + message(STATUS "Could not find an AWK-compatible program") +endif() include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -352,7 +402,7 @@ else() COMMAND "${CMAKE_COMMAND}" "-DINPUT=${_GC_INPUT}" "-DOUTPUT=${_GC_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/genchk.cmake" DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endfunction() @@ -375,7 +425,7 @@ else() COMMAND "${CMAKE_COMMAND}" "-DINPUT=${_GO_INPUT}" "-DOUTPUT=${_GO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/genout.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/genout.cmake" DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endfunction() @@ -394,7 +444,7 @@ else() add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}" COMMAND "${CMAKE_COMMAND}" "-DOUTPUT=${_GSO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/gensrc.cmake" DEPENDS ${_GSO_DEPENDS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endfunction() @@ -524,7 +574,7 @@ else() add_custom_target(png_genprebuilt COMMAND "${CMAKE_COMMAND}" "-DOUTPUT=scripts/pnglibconf.h.prebuilt" - -P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/gensrc.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") # A single target handles generation of all generated files. @@ -581,6 +631,7 @@ set(libpng_sources ${libpng_intel_sources} ${libpng_mips_sources} ${libpng_powerpc_sources} + ${libpng_loongarch_sources} ) set(pngtest_sources pngtest.c @@ -662,10 +713,9 @@ if(PNG_SHARED) set_target_properties(png_shared PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL) endif() target_include_directories(png_shared - PUBLIC - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_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}) endif() @@ -677,14 +727,19 @@ if(PNG_STATIC) OUTPUT_NAME "${PNG_STATIC_OUTPUT_NAME}" DEBUG_POSTFIX "${PNG_DEBUG_POSTFIX}") target_include_directories(png_static - PUBLIC - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_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}) endif() -if(PNG_FRAMEWORK AND APPLE) +if(PNG_FRAMEWORK AND NOT APPLE) + message(AUTHOR_WARNING + "Setting PNG_FRAMEWORK to OFF, as it only applies to Apple systems") + set(PNG_FRAMEWORK OFF) +endif() + +if(PNG_FRAMEWORK) add_library(png_framework SHARED ${libpng_sources}) add_dependencies(png_framework png_genfiles) list(APPEND PNG_LIBRARY_TARGETS png_framework) @@ -701,10 +756,9 @@ if(PNG_FRAMEWORK AND APPLE) # Avoid CMake's implicit compile definition "-Dpng_framework_EXPORTS". set_target_properties(png_framework PROPERTIES DEFINE_SYMBOL "") target_include_directories(png_framework - PUBLIC - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_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}) endif() @@ -967,13 +1021,13 @@ endfunction() # Create source generation scripts. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genchk.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake + ${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/genchk.cmake @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genout.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/genout.cmake + ${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/genout.cmake @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/gensrc.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake + ${CMAKE_CURRENT_BINARY_DIR}/scripts/cmake/gensrc.cmake @ONLY) # libpng is a library so default to 'lib' diff --git a/Build/source/libs/libpng/libpng-src/README b/Build/source/libs/libpng/libpng-src/README index 0bf27bcfe6c..a6ca3ae9f94 100644 --- a/Build/source/libs/libpng/libpng-src/README +++ b/Build/source/libs/libpng/libpng-src/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.42 +README for libpng version 1.6.43 ================================ See the note about version numbers near the top of `png.h`. @@ -142,10 +142,11 @@ Files included in this distribution pngwrite.c => High-level write functions pngwtran.c => Write data transformations pngwutil.c => Write utility functions - arm/ => Optimized code for the ARM platform - intel/ => Optimized code for the INTEL-SSE2 platform - mips/ => Optimized code for the MIPS platform - powerpc/ => Optimized code for the PowerPC platform + arm/ => Optimized code for ARM Neon + intel/ => Optimized code for INTEL SSE2 + loongarch/ => Optimized code for LoongArch LSX + mips/ => Optimized code for MIPS MSA and MIPS MMI + powerpc/ => Optimized code for PowerPC VSX ci/ => Scripts for continuous integration contrib/ => External contributions arm-neon/ => Optimized code for the ARM-NEON platform @@ -158,6 +159,7 @@ Files included in this distribution libtests/ => Test programs oss-fuzz/ => Files used by the OSS-Fuzz project for fuzz-testing libpng + pngexif/ => Program to inspect the EXIF information in PNG files pngminim/ => Minimal decoder, encoder, and progressive decoder programs demonstrating the use of pngusr.dfa pngminus/ => Simple pnm2png and png2pnm programs diff --git a/Build/source/libs/libpng/libpng-src/ci/.shellcheckrc b/Build/source/libs/libpng/libpng-src/ci/.shellcheckrc index 0260dcca30f..3c035d60c96 100644 --- a/Build/source/libs/libpng/libpng-src/ci/.shellcheckrc +++ b/Build/source/libs/libpng/libpng-src/ci/.shellcheckrc @@ -1,3 +1,7 @@ +# Disable the "expressions don't expand in single quotes, use double quotes" +# advice. We need the regular expressions to remain uninterpolated. +disable=SC2016 + # Disable the "variable appears unused" warning caused by the use of getopts # with an obligatory (but unused) variable name in the main function. disable=SC2034 @@ -5,7 +9,3 @@ disable=SC2034 # Disable all the "quote to prevent globbing or word splitting" advice. # We need word splitting for well-known variables like MAKEFLAGS and CFLAGS. disable=SC2086,SC2206 - -# Disable the "possible misspelling" warnings that might be flagged, e.g., -# inside function ci_trace_build. -disable=SC2153 diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_lint.sh b/Build/source/libs/libpng/libpng-src/ci/ci_lint.sh new file mode 100644 index 00000000000..d1754715d21 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/ci/ci_lint.sh @@ -0,0 +1,140 @@ +#!/usr/bin/env bash +set -o errexit -o pipefail -o posix + +# Copyright (c) 2019-2024 Cosmin Truta. +# +# Use, modification and distribution are subject to the MIT License. +# Please see the accompanying file LICENSE_MIT.txt +# +# SPDX-License-Identifier: MIT + +# shellcheck source=ci/lib/ci.lib.sh +source "$(dirname "$0")/lib/ci.lib.sh" +cd "$CI_TOPLEVEL_DIR" + +# Initialize the global constants CI_{...}{CHECK,CHECKER,LINT}. +CI_SHELLCHECK="${CI_SHELLCHECK:-shellcheck}" +CI_EDITORCONFIG_CHECKER="${CI_EDITORCONFIG_CHECKER:-editorconfig-checker}" +CI_YAMLLINT="${CI_YAMLLINT:-yamllint}" + +# Initialize the global lint status. +CI_LINT_STATUS=0 + +function ci_init_lint { + ci_info "## START OF LINTING ##" + local my_program + # Complete the initialization of CI_SHELLCHECK. + # Set it to the empty string if the shellcheck program is unavailable. + my_program="$(command -v "$CI_SHELLCHECK")" || { + ci_warn "program not found: '$CI_SHELLCHECK'" + } + CI_SHELLCHECK="$my_program" + # Complete the initialization of CI_EDITORCONFIG_CHECKER. + # Set it to the empty string if the editorconfig-checker program is unavailable. + my_program="$(command -v "$CI_EDITORCONFIG_CHECKER")" || { + ci_warn "program not found: '$CI_EDITORCONFIG_CHECKER'" + } + CI_EDITORCONFIG_CHECKER="$my_program" + # Complete the initialization of CI_YAMLLINT. + # Set it to the empty string if the yamllint program is unavailable. + my_program="$(command -v "$CI_YAMLLINT")" || { + ci_warn "program not found: '$CI_YAMLLINT'" + } + CI_YAMLLINT="$my_program" +} + +function ci_finish_lint { + ci_info "## END OF LINTING ##" + if [[ $CI_LINT_STATUS -eq 0 ]] + then + ci_info "## SUCCESS ##" + else + ci_info "linting failed" + fi + return "$CI_LINT_STATUS" +} + +function ci_lint_ci_scripts { + [[ -x $CI_SHELLCHECK ]] || { + ci_warn "## NOT LINTING: CI scripts ##" + return 0 + } + ci_info "## LINTING: CI scripts ##" + ci_spawn "$CI_SHELLCHECK" --version + find ./ci -maxdepth 1 -name "*.sh" | { + local my_file + while IFS="" read -r my_file + do + ci_spawn "$CI_SHELLCHECK" -x "$my_file" || { + # Linting failed. + return 1 + } + done + } +} + +function ci_lint_text_files { + [[ -x $CI_EDITORCONFIG_CHECKER ]] || { + ci_warn "## NOT LINTING: text files ##" + return 0 + } + ci_info "## LINTING: text files ##" + ci_spawn "$CI_EDITORCONFIG_CHECKER" --version + ci_spawn "$CI_EDITORCONFIG_CHECKER" || { + # Linting failed. + return 1 + } +} + +function ci_lint_yaml_files { + [[ -x $CI_YAMLLINT ]] || { + ci_warn "## NOT LINTING: YAML files ##" + return 0 + } + ci_info "## LINTING: YAML files ##" + ci_spawn "$CI_YAMLLINT" --version + find . \( -iname "*.yml" -o -iname "*.yaml" \) -not -path "./out/*" | { + local my_file + while IFS="" read -r my_file + do + ci_spawn "$CI_YAMLLINT" --strict "$my_file" || { + # Linting failed. + return 1 + } + done + } +} + +function ci_lint { + ci_init_lint + ci_lint_ci_scripts || CI_LINT_STATUS=1 + ci_lint_text_files || CI_LINT_STATUS=1 + ci_lint_yaml_files || CI_LINT_STATUS=1 + # TODO: ci_lint_png_files, etc. + ci_finish_lint +} + +function usage { + echo "usage: $CI_SCRIPT_NAME [<options>]" + echo "options: -?|-h|--help" + exit "${@:-0}" +} + +function main { + local opt + while getopts ":" opt + do + # This ain't a while-loop. It only pretends to be. + [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 + ci_err "unknown option: '$1'" + done + shift $((OPTIND - 1)) + [[ $# -eq 0 ]] || { + echo >&2 "error: unexpected argument: '$1'" + usage 2 + } + # And... go! + ci_lint +} + +main "$@" diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_lint_ci.sh b/Build/source/libs/libpng/libpng-src/ci/ci_lint_ci.sh deleted file mode 100644 index 123ed482f10..00000000000 --- a/Build/source/libs/libpng/libpng-src/ci/ci_lint_ci.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Copyright (c) 2019-2024 Cosmin Truta. -# -# Use, modification and distribution are subject to the MIT License. -# Please see the accompanying file LICENSE_MIT.txt -# -# SPDX-License-Identifier: MIT - -# shellcheck source="ci/lib/ci.lib.sh" -source "$(dirname "$0")/lib/ci.lib.sh" -cd "$CI_TOPLEVEL_DIR" - -CI_SHELLCHECK="$(command -v shellcheck || true)" -CI_YAMLLINT="$(command -v yamllint || true)" -CI_LINT_COUNTER=0 - -function ci_lint_ci_config_files { - ci_info "linting: CI config files" - local MY_FILE - if [[ -x $CI_YAMLLINT ]] - then - ci_spawn "$CI_YAMLLINT" --version - for MY_FILE in "$CI_TOPLEVEL_DIR"/.*.yml - do - ci_spawn "$CI_YAMLLINT" --strict "$MY_FILE" || - CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1)) - done - else - ci_warn "program not found: 'yamllint'; skipping checks" - fi -} - -function ci_lint_ci_scripts { - ci_info "linting: CI scripts" - local MY_FILE - if [[ -x $CI_SHELLCHECK ]] - then - ci_spawn "$CI_SHELLCHECK" --version - for MY_FILE in "$CI_SCRIPT_DIR"/*.sh - do - ci_spawn "$CI_SHELLCHECK" -x "$MY_FILE" || - CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1)) - done - else - ci_warn "program not found: 'shellcheck'; skipping checks" - fi -} - -function ci_lint_ci_scripts_license { - ci_info "linting: CI scripts license" - ci_spawn grep -F "MIT License" ci/LICENSE_MIT.txt || { - ci_warn "bad or missing CI license file: '$CI_SCRIPT_DIR/LICENSE_MIT.txt'" - CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1)) - } -} - -function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 -} - -function main { - local opt - while getopts ":" opt - do - # This ain't a while-loop. It only pretends to be. - [[ $1 == -[?h]* || $1 == --help ]] && usage - ci_err "unknown option: '$1'" - done - shift $((OPTIND - 1)) - # And... go! - [[ $# -eq 0 ]] || ci_err "unexpected argument: '$1'" - ci_lint_ci_config_files - ci_lint_ci_scripts - ci_lint_ci_scripts_license - if [[ $CI_LINT_COUNTER -eq 0 ]] - then - ci_info "success!" - exit 0 - else - ci_info "failed on $CI_LINT_COUNTER file(s)" - exit 1 - fi -} - -main "$@" diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_shellify.sh b/Build/source/libs/libpng/libpng-src/ci/ci_shellify.sh new file mode 100644 index 00000000000..e6693af97ae --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/ci/ci_shellify.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -o errexit -o pipefail -o posix + +# Copyright (c) 2019-2024 Cosmin Truta. +# +# Use, modification and distribution are subject to the MIT License. +# Please see the accompanying file LICENSE_MIT.txt +# +# SPDX-License-Identifier: MIT + +# shellcheck source=ci/lib/ci.lib.sh +source "$(dirname "$0")/lib/ci.lib.sh" +cd "$CI_TOPLEVEL_DIR" + +function ci_shellify_c { + # Convert C preprocessor text, specifically originating + # from png.h, to shell scripting text. + # Select only the easy-to-parse definitions of PNG_LIBPNG_*. + sed -n -e '/^\# *define * PNG_LIBPNG_[^ ]* * ["0-9A-Za-z_]/ p' | + sed -e 's/^\# *define * PNG\([^ ]*\) * \([^ ]*\)/PNG\1=\2/' \ + -e 's/=PNG\([0-9A-Za-z_]*\)/=\${PNG\1}/' \ + -e 's/^\([^ ]*=[^ ]*\).*$/export \1;/' +} + +function ci_shellify_autoconf { + # Convert autoconf (M4) text, specifically originating + # from configure.ac, to shell scripting text. + # Select only the easy-to-parse definitions of PNGLIB_*. + sed -n -e '/^ *PNGLIB_[^ ]*=[$"0-9A-Za-z_]/ p' | + sed -e 's/^ *PNG\([0-9A-Za-z_]*\)=\([^# ]*\).*$/PNG\1=\2/' \ + -e 's/^\([^ ]*=[^ ]*\).*$/export \1;/' +} + +function ci_shellify_cmake { + # Convert CMake lists text, specifically originating + # from CMakeLists.txt, to shell scripting text. + # Select only the easy-to-parse definitions of PNGLIB_*. + sed -n -e '/^ *set *(PNGLIB_[^ ]* * [$"0-9A-Za-z_].*)/ p' | + sed -e 's/^ *set *(PNG\([^ ]*\) * \([^() ]*\)).*$/PNG\1=\2/' \ + -e 's/^\([^ ]*=[^ ]*\).*$/export \1;/' +} + +function ci_shellify { + local arg filename + for arg in "$@" + do + test -f "$arg" || ci_err "no such file: '$arg'" + filename="$(basename -- "$arg")" + case "$filename" in + ( *.[ch] ) + [[ $filename == png.h ]] || { + ci_err "unable to shellify: '$filename' (expecting: 'png.h')" + } + ci_shellify_c <"$arg" ;; + ( config* | *.ac ) + [[ $filename == configure.ac ]] || { + ci_err "unable to shellify: '$filename' (expecting: 'configure.ac')" + } + ci_shellify_autoconf <"$arg" ;; + ( *CMake* | *cmake* | *.txt ) + [[ $filename == [Cc][Mm]ake[Ll]ists.txt ]] || { + ci_err "unable to shellify: '$filename' (expecting: 'CMakeLists.txt')" + } + ci_shellify_cmake <"$arg" ;; + ( * ) + ci_err "unable to shellify: '$arg'" ;; + esac + done +} + +function usage { + echo "usage: $CI_SCRIPT_NAME [<options>] <files>..." + echo "options: -?|-h|--help" + echo "files: png.h|configure.ac|CMakeLists.txt" + exit "${@:-0}" +} + +function main { + local opt + while getopts ":" opt + do + # This ain't a while-loop. It only pretends to be. + [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 + ci_err "unknown option: '$1'" + done + shift $((OPTIND - 1)) + [[ $# -eq 0 ]] && usage 2 + # And... go! + ci_shellify "$@" +} + +main "$@" diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_verify_cmake.sh b/Build/source/libs/libpng/libpng-src/ci/ci_verify_cmake.sh index 1d3e9734e69..9fe6340263c 100644 --- a/Build/source/libs/libpng/libpng-src/ci/ci_verify_cmake.sh +++ b/Build/source/libs/libpng/libpng-src/ci/ci_verify_cmake.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -o errexit -o pipefail -o posix # Copyright (c) 2019-2024 Cosmin Truta. # @@ -8,7 +8,7 @@ set -e # # SPDX-License-Identifier: MIT -# shellcheck source="ci/lib/ci.lib.sh" +# shellcheck source=ci/lib/ci.lib.sh source "$(dirname "$0")/lib/ci.lib.sh" cd "$CI_TOPLEVEL_DIR" @@ -28,8 +28,6 @@ function ci_init_build { CI_CMAKE="${CI_CMAKE:-cmake}" CI_CTEST="${CI_CTEST:-ctest}" CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}" - [[ -x $(command -v ninja) ]] && - CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}" if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]] then # Clean up incidental mixtures of Windows and Bash-on-Windows @@ -37,8 +35,12 @@ function ci_init_build { [[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP [[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP # Ensure that CI_CMAKE_GENERATOR_PLATFORM is initialized for this generator. - [[ $CI_CMAKE_GENERATOR_PLATFORM ]] || + [[ $CI_CMAKE_GENERATOR_PLATFORM ]] || { ci_err_internal "missing \$CI_CMAKE_GENERATOR_PLATFORM" + } + elif [[ -x $(command -v ninja) ]] + then + CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}" fi } @@ -67,109 +69,130 @@ function ci_trace_build { ci_info "environment option: \$CI_AR: '$CI_AR'" ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'" ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'" + ci_info "environment option: \$CI_FORCE: '$CI_FORCE'" ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'" ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'" ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'" ci_info "executable: \$CI_CMAKE: $(command -V "$CI_CMAKE")" ci_info "executable: \$CI_CTEST: $(command -V "$CI_CTEST")" - [[ $CI_CC ]] && + [[ $CI_CC ]] && { ci_info "executable: \$CI_CC: $(command -V "$CI_CC")" - [[ $CI_AR ]] && + } + [[ $CI_AR ]] && { ci_info "executable: \$CI_AR: $(command -V "$CI_AR")" - [[ $CI_RANLIB ]] && + } + [[ $CI_RANLIB ]] && { ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")" + } ci_info "## END OF CONFIGURATION ##" } function ci_cleanup_old_build { - if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]] - then - ci_info "## START OF PRE-BUILD CLEANUP ##" + ci_info "## START OF PRE-BUILD CLEANUP ##" + [[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || { ci_spawn rm -fr "$CI_BUILD_DIR" ci_spawn rm -fr "$CI_INSTALL_DIR" - ci_info "## END OF PRE-BUILD CLEANUP ##" - fi + } + ci_info "## END OF PRE-BUILD CLEANUP ##" } function ci_build { ci_info "## START OF BUILD ##" - ci_spawn "$(command -v "$CI_CMAKE")" --version - ci_spawn "$(command -v "$CI_CTEST")" --version - [[ $CI_CMAKE_GENERATOR == *"Ninja"* ]] && - ci_spawn "$(command -v ninja)" --version - # Initialize ALL_CC_FLAGS as a string. - local ALL_CC_FLAGS="$CI_CC_FLAGS" - [[ $CI_SANITIZERS ]] && - ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_CC_FLAGS" - # Initialize ALL_CMAKE_VARS, ALL_CMAKE_BUILD_FLAGS and ALL_CTEST_FLAGS as arrays. - local ALL_CMAKE_VARS=() - [[ $CI_CMAKE_TOOLCHAIN_FILE ]] && - ALL_CMAKE_VARS+=(-DCMAKE_TOOLCHAIN_FILE="$CI_CMAKE_TOOLCHAIN_FILE") - [[ $CI_CC ]] && - ALL_CMAKE_VARS+=(-DCMAKE_C_COMPILER="$CI_CC") - [[ $ALL_CC_FLAGS ]] && - ALL_CMAKE_VARS+=(-DCMAKE_C_FLAGS="$ALL_CC_FLAGS") + # Adjust the CI environment variables, as needed. + CI_CMAKE="$(command -v "$CI_CMAKE")" || ci_err "bad or missing \$CI_CMAKE" + ci_spawn "$CI_CMAKE" --version + CI_CTEST="$(command -v "$CI_CTEST")" || ci_err "bad or missing \$CI_CTEST" + ci_spawn "$CI_CTEST" --version + [[ $CI_CMAKE_GENERATOR == *"Ninja"* ]] && { + CI_NINJA="$(command -v ninja)" || ci_err "bad or missing ninja, no pun intended" + ci_spawn "$CI_NINJA" --version + } [[ $CI_AR ]] && { - # Use the full path of CI_AR to work around a CMake error. - ALL_CMAKE_VARS+=(-DCMAKE_AR="$(command -v "$CI_AR")") + # Use the full path of CI_AR to work around a mysterious CMake error. + CI_AR="$(command -v "$CI_AR")" || ci_err "bad or missing \$CI_AR" } [[ $CI_RANLIB ]] && { - # Use the full path of CI_RANLIB to work around a CMake error. - ALL_CMAKE_VARS+=(-DCMAKE_RANLIB="$(command -v "$CI_RANLIB")") - } - ALL_CMAKE_VARS+=(-DCMAKE_BUILD_TYPE="$CI_CMAKE_BUILD_TYPE") - ALL_CMAKE_VARS+=(-DCMAKE_VERBOSE_MAKEFILE=ON) - ALL_CMAKE_VARS+=($CI_CMAKE_VARS) - local ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS) - local ALL_CTEST_FLAGS=($CI_CTEST_FLAGS) + # Use the full path of CI_RANLIB to work around a mysterious CMake error. + CI_RANLIB="$(command -v "$CI_RANLIB")" || ci_err "bad or missing \$CI_RANLIB" + } # Export the CMake environment variables. - [[ $CI_CMAKE_GENERATOR ]] && + [[ $CI_CMAKE_GENERATOR ]] && { ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR" - [[ $CI_CMAKE_GENERATOR_PLATFORM ]] && + } + [[ $CI_CMAKE_GENERATOR_PLATFORM ]] && { ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM" - # Build! + } + # Initialize and populate the local arrays. + local all_cmake_vars=() + local all_cmake_build_flags=() + local all_ctest_flags=() + [[ $CI_CMAKE_TOOLCHAIN_FILE ]] && { + all_cmake_vars+=("-DCMAKE_TOOLCHAIN_FILE=$CI_CMAKE_TOOLCHAIN_FILE") + } + [[ $CI_CC ]] && { + all_cmake_vars+=("-DCMAKE_C_COMPILER=$CI_CC") + } + [[ $CI_CC_FLAGS || $CI_SANITIZERS ]] && { + [[ $CI_SANITIZERS ]] && CI_CC_FLAGS+="${CI_CC_FLAGS:+" "}-fsanitize=$CI_SANITIZERS" + all_cmake_vars+=("-DCMAKE_C_FLAGS=$CI_CC_FLAGS") + } + [[ $CI_AR ]] && { + all_cmake_vars+=("-DCMAKE_AR=$CI_AR") + } + [[ $CI_RANLIB ]] && { + all_cmake_vars+=("-DCMAKE_RANLIB=$CI_RANLIB") + } + all_cmake_vars+=("-DCMAKE_BUILD_TYPE=$CI_CMAKE_BUILD_TYPE") + all_cmake_vars+=("-DCMAKE_VERBOSE_MAKEFILE=ON") + all_cmake_vars+=($CI_CMAKE_VARS) + all_cmake_build_flags+=($CI_CMAKE_BUILD_FLAGS) + all_ctest_flags+=($CI_CTEST_FLAGS) + # And... build! # Use $CI_BUILD_TO_SRC_RELDIR and $CI_BUILD_TO_INSTALL_RELDIR # instead of $CI_SRC_DIR and $CI_INSTALL_DIR from this point onwards. ci_spawn mkdir -p "$CI_BUILD_DIR" ci_spawn cd "$CI_BUILD_DIR" - [[ $CI_BUILD_TO_SRC_RELDIR -ef $CI_SRC_DIR ]] || + [[ $CI_BUILD_TO_SRC_RELDIR -ef $CI_SRC_DIR ]] || { ci_err_internal "bad or missing \$CI_BUILD_TO_SRC_RELDIR" + } ci_spawn mkdir -p "$CI_INSTALL_DIR" - [[ $CI_BUILD_TO_INSTALL_RELDIR -ef $CI_INSTALL_DIR ]] || + [[ $CI_BUILD_TO_INSTALL_RELDIR -ef $CI_INSTALL_DIR ]] || { ci_err_internal "bad or missing \$CI_BUILD_TO_INSTALL_RELDIR" + } # Spawn "cmake ...". ci_spawn "$CI_CMAKE" -DCMAKE_INSTALL_PREFIX="$CI_BUILD_TO_INSTALL_RELDIR" \ - "${ALL_CMAKE_VARS[@]}" \ + "${all_cmake_vars[@]}" \ "$CI_BUILD_TO_SRC_RELDIR" # Spawn "cmake --build ...". ci_spawn "$CI_CMAKE" --build . \ --config "$CI_CMAKE_BUILD_TYPE" \ - "${ALL_CMAKE_BUILD_FLAGS[@]}" + "${all_cmake_build_flags[@]}" ci_expr $((CI_NO_TEST)) || { # Spawn "ctest" if testing is not disabled. ci_spawn "$CI_CTEST" --build-config "$CI_CMAKE_BUILD_TYPE" \ - "${ALL_CTEST_FLAGS[@]}" + "${all_ctest_flags[@]}" } ci_expr $((CI_NO_INSTALL)) || { # Spawn "cmake --build ... --target install" if installation is not disabled. ci_spawn "$CI_CMAKE" --build . \ --config "$CI_CMAKE_BUILD_TYPE" \ --target install \ - "${ALL_CMAKE_BUILD_FLAGS[@]}" + "${all_cmake_build_flags[@]}" } ci_expr $((CI_NO_CLEAN)) || { # Spawn "make --build ... --target clean" if cleaning is not disabled. ci_spawn "$CI_CMAKE" --build . \ --config "$CI_CMAKE_BUILD_TYPE" \ --target clean \ - "${ALL_CMAKE_BUILD_FLAGS[@]}" + "${all_cmake_build_flags[@]}" } ci_info "## END OF BUILD ##" } function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 + echo "usage: $CI_SCRIPT_NAME [<options>]" + echo "options: -?|-h|--help" + exit "${@:-0}" } function main { @@ -177,15 +200,17 @@ function main { while getopts ":" opt do # This ain't a while-loop. It only pretends to be. - [[ $1 == -[?h]* || $1 == --help ]] && usage + [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 ci_err "unknown option: '$1'" done shift $((OPTIND - 1)) + # And... go! ci_init_build ci_trace_build [[ $# -eq 0 ]] || { - ci_info "note: this program accepts environment options only" - ci_err "unexpected argument: '$1'" + echo >&2 "error: unexpected argument: '$1'" + echo >&2 "note: this program accepts environment options only" + usage 2 } ci_cleanup_old_build ci_build diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_verify_configure.sh b/Build/source/libs/libpng/libpng-src/ci/ci_verify_configure.sh index 9be76d98620..141c7a2834f 100644 --- a/Build/source/libs/libpng/libpng-src/ci/ci_verify_configure.sh +++ b/Build/source/libs/libpng/libpng-src/ci/ci_verify_configure.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -o errexit -o pipefail -o posix # Copyright (c) 2019-2024 Cosmin Truta. # @@ -8,7 +8,7 @@ set -e # # SPDX-License-Identifier: MIT -# shellcheck source="ci/lib/ci.lib.sh" +# shellcheck source=ci/lib/ci.lib.sh source "$(dirname "$0")/lib/ci.lib.sh" cd "$CI_TOPLEVEL_DIR" @@ -26,10 +26,12 @@ function ci_init_build { [[ -x $(command -v cc) ]] && CI_CC="${CI_CC:-cc}" } # Ensure that the CI_ variables that cannot be customized reliably are not initialized. - [[ ! $CI_CONFIGURE_VARS ]] || + [[ ! $CI_CONFIGURE_VARS ]] || { ci_err "unsupported: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'" - [[ ! $CI_MAKE_VARS ]] || + } + [[ ! $CI_MAKE_VARS ]] || { ci_err "unsupported: \$CI_MAKE_VARS='$CI_MAKE_VARS'" + } } function ci_trace_build { @@ -55,31 +57,54 @@ function ci_trace_build { ci_info "environment option: \$CI_LD: '$CI_LD'" ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'" ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'" + ci_info "environment option: \$CI_FORCE: '$CI_FORCE'" ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'" ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'" ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'" ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")" - [[ $CI_CC ]] && + [[ $CI_CC ]] && { ci_info "executable: \$CI_CC: $(command -V "$CI_CC")" - [[ $CI_CPP ]] && + } + [[ $CI_CPP ]] && { ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")" - [[ $CI_AR ]] && + } + [[ $CI_AR ]] && { ci_info "executable: \$CI_AR: $(command -V "$CI_AR")" - [[ $CI_RANLIB ]] && + } + [[ $CI_RANLIB ]] && { ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")" - [[ $CI_LD ]] && + } + [[ $CI_LD ]] && { ci_info "executable: \$CI_LD: $(command -V "$CI_LD")" + } ci_info "## END OF CONFIGURATION ##" } function ci_cleanup_old_build { - if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]] - then - ci_info "## START OF PRE-BUILD CLEANUP ##" + ci_info "## START OF PRE-BUILD CLEANUP ##" + [[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || { ci_spawn rm -fr "$CI_BUILD_DIR" ci_spawn rm -fr "$CI_INSTALL_DIR" - ci_info "## END OF PRE-BUILD CLEANUP ##" - fi + } + [[ ! -e "$CI_SRC_DIR/config.status" ]] || { + ci_warn "unexpected build configuration file: '$CI_SRC_DIR/config.status'" + if ci_expr $((CI_FORCE)) + then + # Delete the old config and (possibly) the old build. + ci_info "note: forcing an in-tree build cleanup" + if [[ -f $CI_SRC_DIR/Makefile ]] + then + ci_spawn make -C "$CI_SRC_DIR" distclean + else + ci_spawn rm -fr "$CI_SRC_DIR"/config.{log,status} + fi + else + # Alert the user, but do not delete their files. + ci_warn "the configure script might fail" + ci_info "hint: consider using the option \$CI_FORCE=1" + fi + } + ci_info "## END OF PRE-BUILD CLEANUP ##" } function ci_build { @@ -94,10 +119,10 @@ function ci_build { [[ $CI_LD ]] && ci_spawn export LD="$CI_LD" [[ $CI_LD_FLAGS ]] && ci_spawn export LDFLAGS="$CI_LD_FLAGS" [[ $CI_SANITIZERS ]] && { - ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS ${CFLAGS:-"-O2"}" - ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS" + ci_spawn export CFLAGS="${CFLAGS:-"-O2"} -fsanitize=$CI_SANITIZERS" + ci_spawn export LDFLAGS="${LDFLAGS}${LDFLAGS:+" "}-fsanitize=$CI_SANITIZERS" } - # Build! + # And... build! ci_spawn mkdir -p "$CI_BUILD_DIR" ci_spawn cd "$CI_BUILD_DIR" # Spawn "configure". @@ -121,8 +146,9 @@ function ci_build { } function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 + echo "usage: $CI_SCRIPT_NAME [<options>]" + echo "options: -?|-h|--help" + exit "${@:-0}" } function main { @@ -130,7 +156,7 @@ function main { while getopts ":" opt do # This ain't a while-loop. It only pretends to be. - [[ $1 == -[?h]* || $1 == --help ]] && usage + [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 ci_err "unknown option: '$1'" done shift $((OPTIND - 1)) @@ -138,8 +164,9 @@ function main { ci_init_build ci_trace_build [[ $# -eq 0 ]] || { - ci_info "note: this program accepts environment options only" - ci_err "unexpected argument: '$1'" + echo >&2 "error: unexpected argument: '$1'" + echo >&2 "note: this program accepts environment options only" + usage 2 } ci_cleanup_old_build ci_build diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_verify_makefiles.sh b/Build/source/libs/libpng/libpng-src/ci/ci_verify_makefiles.sh index beda3b470e6..e0681b4d8c6 100644 --- a/Build/source/libs/libpng/libpng-src/ci/ci_verify_makefiles.sh +++ b/Build/source/libs/libpng/libpng-src/ci/ci_verify_makefiles.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -o errexit -o pipefail -o posix # Copyright (c) 2019-2024 Cosmin Truta. # @@ -8,7 +8,7 @@ set -e # # SPDX-License-Identifier: MIT -# shellcheck source="ci/lib/ci.lib.sh" +# shellcheck source=ci/lib/ci.lib.sh source "$(dirname "$0")/lib/ci.lib.sh" cd "$CI_TOPLEVEL_DIR" @@ -50,19 +50,25 @@ function ci_trace_build { ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'" ci_info "environment option: \$CI_LIBS: '$CI_LIBS'" ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'" + ci_info "environment option: \$CI_FORCE: '$CI_FORCE'" ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'" ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'" ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")" - [[ $CI_CC ]] && + [[ $CI_CC ]] && { ci_info "executable: \$CI_CC: $(command -V "$CI_CC")" - [[ $CI_CPP ]] && + } + [[ $CI_CPP ]] && { ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")" - [[ $CI_AR ]] && + } + [[ $CI_AR ]] && { ci_info "executable: \$CI_AR: $(command -V "$CI_AR")" - [[ $CI_RANLIB ]] && + } + [[ $CI_RANLIB ]] && { ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")" - [[ $CI_LD ]] && + } + [[ $CI_LD ]] && { ci_info "executable: \$CI_LD: $(command -V "$CI_LD")" + } ci_info "## END OF CONFIGURATION ##" } @@ -74,61 +80,87 @@ function ci_cleanup_old_build { # Fortunately, for a clean makefiles-based build, it should be # sufficient to remove the old object files only. ci_info "## START OF PRE-BUILD CLEANUP ##" - local MY_FILE - find "$CI_SRC_DIR" -maxdepth 1 \( -iname "*.o" -o -iname "*.obj" \) | - while IFS="" read -r MY_FILE - do - ci_spawn rm -fr "$MY_FILE" - done - ci_info "## END OF PRE-BUILD CLEANUP ##" + local find_args=(-maxdepth 1 \( -iname "*.o" -o -iname "*.obj" \)) + [[ ! $(find "$CI_SRC_DIR" "${find_args[@]}" | head -n1) ]] || { + ci_warn "unexpected build found in '$CI_SRC_DIR'" + if ci_expr $((CI_FORCE)) + then + # Delete the old build. + local my_file + find "$CI_SRC_DIR" "${find_args[@]}" | + while IFS="" read -r my_file + do + ci_spawn rm -fr "$my_file" + done + ci_info "## END OF PRE-BUILD CLEANUP ##" + else + # Alert the user, but do not delete their existing files, + # and do not mess up their existing build. + ci_info "hint: consider using the option \$CI_FORCE=1" + ci_err "unable to continue" + fi + } } function ci_build { ci_info "## START OF BUILD ##" - # Initialize ALL_CC_FLAGS and ALL_LD_FLAGS as strings. - local ALL_CC_FLAGS="$CI_CC_FLAGS" - local ALL_LD_FLAGS="$CI_LD_FLAGS" - [[ $CI_SANITIZERS ]] && { - ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS ${ALL_CC_FLAGS:-"-O2"}" - ALL_LD_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_LD_FLAGS" - } - # Initialize ALL_MAKE_FLAGS and ALL_MAKE_VARS as arrays. - local ALL_MAKE_FLAGS=($CI_MAKE_FLAGS) - local ALL_MAKE_VARS=() - [[ $CI_CC ]] && ALL_MAKE_VARS+=(CC="$CI_CC") - [[ $ALL_CC_FLAGS ]] && ALL_MAKE_VARS+=(CFLAGS="$ALL_CC_FLAGS") - [[ $CI_CPP ]] && ALL_MAKE_VARS+=(CPP="$CI_CPP") - [[ $CI_CPP_FLAGS ]] && ALL_MAKE_VARS+=(CPPFLAGS="$CI_CPP_FLAGS") - [[ $CI_AR ]] && ALL_MAKE_VARS+=( - AR="${CI_AR:-ar}" - AR_RC="${CI_AR:-ar} rc" - ) - [[ $CI_RANLIB ]] && ALL_MAKE_VARS+=(RANLIB="$CI_RANLIB") - [[ $CI_LD ]] && ALL_MAKE_VARS+=(LD="$CI_LD") - [[ $ALL_LD_FLAGS ]] && ALL_MAKE_VARS+=(LDFLAGS="$ALL_LD_FLAGS") - [[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS") - ALL_MAKE_VARS+=($CI_MAKE_VARS) - # Build! - local MY_MAKEFILE - for MY_MAKEFILE in $CI_MAKEFILES + # Initialize and populate the local arrays. + local all_make_flags=() + local all_make_vars=() + [[ $CI_MAKE_FLAGS ]] && { + all_make_flags+=($CI_MAKE_FLAGS) + } + [[ $CI_CC ]] && { + all_make_vars+=("CC=$CI_CC") + } + [[ $CI_CC_FLAGS || $CI_SANITIZERS ]] && { + [[ $CI_SANITIZERS ]] && CI_CC_FLAGS="${CI_CC_FLAGS:-"-O2"} -fsanitize=$CI_SANITIZERS" + all_make_vars+=("CFLAGS=$CI_CC_FLAGS") + } + [[ $CI_CPP ]] && { + all_make_vars+=("CPP=$CI_CPP") + } + [[ $CI_CPP_FLAGS ]] && { + all_make_vars+=("CPPFLAGS=$CI_CPP_FLAGS") + } + [[ $CI_AR ]] && { + all_make_vars+=("AR=$CI_AR") + } + [[ $CI_RANLIB ]] && { + all_make_vars+=("RANLIB=$CI_RANLIB") + } + [[ $CI_LD ]] && { + all_make_vars+=("LD=$CI_LD") + } + [[ $CI_LD_FLAGS || $CI_SANITIZERS ]] && { + [[ $CI_SANITIZERS ]] && CI_LD_FLAGS+="${CI_LD_FLAGS:+" "}-fsanitize=$CI_SANITIZERS" + all_make_vars+=("LDFLAGS=$CI_LD_FLAGS") + } + [[ $CI_LIBS ]] && { + all_make_vars+=("LIBS=$CI_LIBS") + } + all_make_vars+=($CI_MAKE_VARS) + # And... build! + local my_makefile + for my_makefile in $CI_MAKEFILES do - ci_info "using makefile: $MY_MAKEFILE" + ci_info "using makefile: $my_makefile" # Spawn "make". - ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \ - "${ALL_MAKE_FLAGS[@]}" \ - "${ALL_MAKE_VARS[@]}" + ci_spawn "$CI_MAKE" -f "$my_makefile" \ + "${all_make_flags[@]}" \ + "${all_make_vars[@]}" ci_expr $((CI_NO_TEST)) || { # Spawn "make test" if testing is not disabled. - ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \ - "${ALL_MAKE_FLAGS[@]}" \ - "${ALL_MAKE_VARS[@]}" \ + ci_spawn "$CI_MAKE" -f "$my_makefile" \ + "${all_make_flags[@]}" \ + "${all_make_vars[@]}" \ test } ci_expr $((CI_NO_CLEAN)) || { # Spawn "make clean" if cleaning is not disabled. - ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \ - "${ALL_MAKE_FLAGS[@]}" \ - "${ALL_MAKE_VARS[@]}" \ + ci_spawn "$CI_MAKE" -f "$my_makefile" \ + "${all_make_flags[@]}" \ + "${all_make_vars[@]}" \ clean } done @@ -136,8 +168,9 @@ function ci_build { } function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 + echo "usage: $CI_SCRIPT_NAME [<options>]" + echo "options: -?|-h|--help" + exit "${@:-0}" } function main { @@ -145,7 +178,7 @@ function main { while getopts ":" opt do # This ain't a while-loop. It only pretends to be. - [[ $1 == -[?h]* || $1 == --help ]] && usage + [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 ci_err "unknown option: '$1'" done shift $((OPTIND - 1)) @@ -153,8 +186,9 @@ function main { ci_init_build ci_trace_build [[ $# -eq 0 ]] || { - ci_info "note: this program accepts environment options only" - ci_err "unexpected argument: '$1'" + echo >&2 "error: unexpected argument: '$1'" + echo >&2 "note: this program accepts environment options only" + usage 2 } ci_cleanup_old_build ci_build diff --git a/Build/source/libs/libpng/libpng-src/ci/ci_verify_version.sh b/Build/source/libs/libpng/libpng-src/ci/ci_verify_version.sh new file mode 100644 index 00000000000..c786f06acdf --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/ci/ci_verify_version.sh @@ -0,0 +1,163 @@ +#!/usr/bin/env bash +set -o errexit -o pipefail -o posix + +# Copyright (c) 2019-2024 Cosmin Truta. +# +# Use, modification and distribution are subject to the MIT License. +# Please see the accompanying file LICENSE_MIT.txt +# +# SPDX-License-Identifier: MIT + +# shellcheck source=ci/lib/ci.lib.sh +source "$(dirname "$0")/lib/ci.lib.sh" +cd "$CI_TOPLEVEL_DIR" + +function ci_init_shellify { + [[ -f $CI_SCRIPT_DIR/ci_shellify.sh ]] || { + ci_err_internal "missing script: '$CI_SCRIPT_DIR/ci_shellify.sh'" + } +} + +function ci_run_shellify { + ci_info "shellifying:" "$@" + local my_result + "$BASH" "$CI_SCRIPT_DIR/ci_shellify.sh" "$@" + echo "$my_result" | "$BASH" --posix || ci_err "bad shellify output" + echo "$my_result" +} + +function ci_verify_version { + ci_info "## START OF VERIFICATION ##" + local my_env_libpng_ver my_env_autoconf_ver my_env_cmake_ver my_expect + ci_init_shellify + my_env_libpng_ver="$(ci_run_shellify png.h)" + echo "$my_env_libpng_ver" + my_env_autoconf_ver="$(ci_run_shellify configure.ac)" + echo "$my_env_autoconf_ver" + my_env_cmake_ver="$(ci_run_shellify CMakeLists.txt)" + echo "$my_env_cmake_ver" + ci_info "## VERIFYING: png.h version definitions ##" + eval "$my_env_libpng_ver" + local my_expect="${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}" + if [[ "$PNG_LIBPNG_VER_STRING" == "$my_expect"* ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_STRING == $my_expect*" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_STRING != $my_expect*" + fi + my_expect=$((PNG_LIBPNG_VER_MAJOR*10000 + PNG_LIBPNG_VER_MINOR*100 + PNG_LIBPNG_VER_RELEASE)) + if [[ "$PNG_LIBPNG_VER" == "$my_expect" ]] + then + ci_info "matched: \$PNG_LIBPNG_VER == $my_expect" + else + ci_err "mismatched: \$PNG_LIBPNG_VER != $my_expect" + fi + my_expect=$((PNG_LIBPNG_VER_MAJOR*10 + PNG_LIBPNG_VER_MINOR)) + if [[ "$PNG_LIBPNG_VER_SHAREDLIB" == "$my_expect" ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_SHAREDLIB == $my_expect" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_SHAREDLIB != $my_expect" + fi + if [[ "$PNG_LIBPNG_VER_SONUM" == "$my_expect" ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_SONUM == $my_expect" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_SONUM != $my_expect" + fi + if [[ "$PNG_LIBPNG_VER_DLLNUM" == "$my_expect" ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_DLLNUM == $my_expect" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_DLLNUM != $my_expect" + fi + if [[ "$PNG_LIBPNG_VER_BUILD" == [01] ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_BUILD == [01]" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_BUILD != [01]" + fi + ci_info "## VERIFYING: png.h build definitions ##" + my_expect="${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}" + if [[ "$PNG_LIBPNG_VER_STRING" == "$my_expect" ]] + then + if [[ $PNG_LIBPNG_VER_BUILD -eq 0 ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_BUILD -eq 0" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_BUILD -ne 0" + fi + if [[ $PNG_LIBPNG_BUILD_BASE_TYPE -eq $PNG_LIBPNG_BUILD_STABLE ]] + then + ci_info "matched: \$PNG_LIBPNG_BUILD_BASE_TYPE -eq \$PNG_LIBPNG_BUILD_BETA" + else + ci_err "mismatched: \$PNG_LIBPNG_BUILD_BASE_TYPE -ne \$PNG_LIBPNG_BUILD_BETA" + fi + elif [[ "$PNG_LIBPNG_VER_STRING" == "$my_expect".git ]] + then + if [[ $PNG_LIBPNG_VER_BUILD -ne 0 ]] + then + ci_info "matched: \$PNG_LIBPNG_VER_BUILD -ne 0" + else + ci_err "mismatched: \$PNG_LIBPNG_VER_BUILD -eq 0" + fi + if [[ $PNG_LIBPNG_BUILD_BASE_TYPE -eq $PNG_LIBPNG_BUILD_BETA ]] + then + ci_info "matched: \$PNG_LIBPNG_BUILD_BASE_TYPE -eq \$PNG_LIBPNG_BUILD_BETA" + else + ci_err "mismatched: \$PNG_LIBPNG_BUILD_BASE_TYPE -ne \$PNG_LIBPNG_BUILD_BETA" + fi + else + ci_err "unexpected: \$PNG_LIBPNG_VER_STRING == '$PNG_LIBPNG_VER_STRING'" + fi + ci_info "## VERIFYING: png.h type definitions ##" + my_expect="$(echo "png_libpng_version_${PNG_LIBPNG_VER_STRING}" | tr . _)" + ci_spawn grep -w -e "$my_expect" png.h + ci_info "## VERIFYING: configure.ac version definitions ##" + eval "$my_env_autoconf_ver" + if [[ "$PNGLIB_VERSION" == "$PNG_LIBPNG_VER_STRING" ]] + then + ci_info "matched: \$PNGLIB_VERSION == \$PNG_LIBPNG_VER_STRING" + else + ci_err "mismatched: \$PNGLIB_VERSION != \$PNG_LIBPNG_VER_STRING" + fi + ci_info "## VERIFYING: CMakeLists.txt version definitions ##" + eval "$my_env_cmake_ver" + if [[ "$PNGLIB_VERSION" == "$PNG_LIBPNG_VER_STRING" && "$PNGLIB_SUBREVISION" == 0 ]] + then + ci_info "matched: \$PNGLIB_VERSION == \$PNG_LIBPNG_VER_STRING" + ci_info "matched: \$PNGLIB_SUBREVISION == 0" + elif [[ "$PNGLIB_VERSION.$PNGLIB_SUBREVISION" == "$PNG_LIBPNG_VER_STRING" ]] + then + ci_info "matched: \$PNGLIB_VERSION.\$PNGLIB_SUBREVISION == \$PNG_LIBPNG_VER_STRING" + else + ci_err "mismatched: \$PNGLIB_VERSION != \$PNG_LIBPNG_VER_STRING" + fi + ci_info "## END OF VERIFICATION ##" + ci_info "success!" +} + +function usage { + echo "usage: $CI_SCRIPT_NAME [<options>]" + echo "options: -?|-h|--help" + exit "${@:-0}" +} + +function main { + local opt + while getopts ":" opt + do + # This ain't a while-loop. It only pretends to be. + [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 + ci_err "unknown option: '$1'" + done + shift $((OPTIND - 1)) + [[ $# -eq 0 ]] || { + echo >&2 "error: unexpected argument: '$1'" + usage 2 + } + # And... go! + ci_verify_version +} + +main "$@" diff --git a/Build/source/libs/libpng/libpng-src/ci/lib/ci.lib.sh b/Build/source/libs/libpng/libpng-src/ci/lib/ci.lib.sh index 1f3c698b5d7..03e866b5c36 100644 --- a/Build/source/libs/libpng/libpng-src/ci/lib/ci.lib.sh +++ b/Build/source/libs/libpng/libpng-src/ci/lib/ci.lib.sh @@ -5,10 +5,12 @@ # # SPDX-License-Identifier: MIT -test -f "$BASH_SOURCE" || +test -f "$BASH_SOURCE" || { echo >&2 "warning: this module requires Bash version 3 or newer" -test "${#BASH_SOURCE[@]}" -gt 1 || +} +test "${#BASH_SOURCE[@]}" -gt 1 || { echo >&2 "warning: this module should be sourced from a Bash script" +} # Reset the locale to avoid surprises from locale-dependent commands. export LC_ALL=C @@ -72,19 +74,29 @@ function ci_spawn { } # Ensure that the internal initialization is correct. -[[ $CI_TOPLEVEL_DIR/ci/lib/ci.lib.sh -ef ${BASH_SOURCE[0]} ]] || +[[ $CI_TOPLEVEL_DIR/ci/lib/ci.lib.sh -ef ${BASH_SOURCE[0]} ]] || { ci_err_internal "bad or missing \$CI_TOPLEVEL_DIR" -[[ $CI_SCRIPT_DIR/$CI_SCRIPT_NAME -ef $0 ]] || +} +[[ $CI_SCRIPT_DIR/$CI_SCRIPT_NAME -ef $0 ]] || { ci_err_internal "bad or missing \$CI_SCRIPT_DIR/\$CI_SCRIPT_NAME" -[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] || +} +[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] || { ci_err_internal "missing \$CI_BUILD_ARCH or \$CI_BUILD_SYSTEM" -[[ $CI_TARGET_ARCH && $CI_TARGET_SYSTEM ]] || +} +[[ $CI_TARGET_ARCH && $CI_TARGET_SYSTEM ]] || { ci_err_internal "missing \$CI_TARGET_ARCH or \$CI_TARGET_SYSTEM" +} # Ensure that the user initialization is correct. -[[ ${CI_NO_TEST:-0} == [01] ]] || +[[ ${CI_FORCE:-0} == [01] ]] || { + ci_err "bad boolean option: \$CI_FORCE: '$CI_FORCE'" +} +[[ ${CI_NO_TEST:-0} == [01] ]] || { ci_err "bad boolean option: \$CI_NO_TEST: '$CI_NO_TEST'" -[[ ${CI_NO_INSTALL:-0} == [01] ]] || +} +[[ ${CI_NO_INSTALL:-0} == [01] ]] || { ci_err "bad boolean option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'" -[[ ${CI_NO_CLEAN:-0} == [01] ]] || +} +[[ ${CI_NO_CLEAN:-0} == [01] ]] || { ci_err "bad boolean option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'" +} diff --git a/Build/source/libs/libpng/libpng-src/configure.ac b/Build/source/libs/libpng/libpng-src/configure.ac index 61242340622..505d72ff60d 100644 --- a/Build/source/libs/libpng/libpng-src/configure.ac +++ b/Build/source/libs/libpng/libpng-src/configure.ac @@ -25,7 +25,7 @@ AC_PREREQ([2.68]) dnl Version number stuff here: -AC_INIT([libpng],[1.6.42],[png-mng-implement@lists.sourceforge.net]) +AC_INIT([libpng],[1.6.43],[png-mng-implement@lists.sourceforge.net]) AC_CONFIG_MACRO_DIR([scripts/autoconf]) # libpng does not follow GNU file name conventions (hence 'foreign') @@ -46,17 +46,17 @@ dnl automake, so the following is not necessary (and is not defined anyway): dnl AM_PREREQ([1.11.2]) dnl stop configure from automagically running automake -PNGLIB_VERSION=1.6.42 +PNGLIB_VERSION=1.6.43 PNGLIB_MAJOR=1 PNGLIB_MINOR=6 -PNGLIB_RELEASE=41 +PNGLIB_RELEASE=43 dnl End of version number stuff AC_CONFIG_SRCDIR([pngget.c]) AC_CONFIG_HEADERS([config.h]) -# Checks for programs. +# Check for basic programs. AC_LANG([C]) AC_PROG_CC AM_PROG_AS @@ -72,16 +72,19 @@ dnl compatible later version may be used LT_INIT([win32-dll]) LT_PREREQ([2.4.2]) -# Some awks crash when confronted with pnglibconf.dfa, do a test run now -# to make sure this doesn't happen -AC_MSG_CHECKING([that AWK works]) +dnl Declare the AWK variable. +AC_ARG_VAR(AWK, [AWK language processor]) + +# Some awk implementations crash when confronted with pnglibconf.dfa. +# Run a test now, to make sure this doesn't happen. +AC_MSG_CHECKING([if awk ($AWK) works]) if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ ${srcdir}/pngusr.dfa 1>&2 then - AC_MSG_RESULT([ok]) + AC_MSG_RESULT([yes]) else - AC_MSG_FAILURE([failed], 1) + AC_MSG_FAILURE([no], 1) fi # This is a remnant of the old cc -E validation, where it may have been @@ -111,7 +114,7 @@ AM_CONDITIONAL([ENABLE_TOOLS], # (it checks the compiler with a program that generates a warning). # Add the following option to deal with this: AC_ARG_VAR(PNG_COPTS, - [additional flags for the C compiler, use this for options that would] + [additional flags for the C compiler, to be used for options that would] [cause configure itself to fail]) AC_ARG_ENABLE(werror, AS_HELP_STRING([[[--enable-werror[=OPT]]]], @@ -223,9 +226,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") if test "$have_ld_version_script" = "yes"; then AC_MSG_CHECKING([for symbol prefix]) SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ - | ${CPP-${CC-gcc} -E} - 2>&1 \ - | ${EGREP-grep} "^PREFIX=" \ - | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` + | ${CPP:-${CC:-gcc} -E} - 2>&1 \ + | ${EGREP:-grep} "^PREFIX=" \ + | ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` AC_SUBST(SYMBOL_PREFIX) AC_MSG_RESULT($SYMBOL_PREFIX) fi @@ -318,7 +321,7 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], # AC_ARG_ENABLE([hardware-optimizations], AS_HELP_STRING([[[--enable-hardware-optimizations]]], - [Enable hardware optimizations: =no/off, yes/on:]), + [Enable hardware optimizations: =no/off, yes/on.]), [case "$enableval" in no|off) # disable hardware optimization on all systems: @@ -376,17 +379,16 @@ AC_ARG_ENABLE([hardware-optimizations], ;; esac]) -# ARM -# === -# -# ARM NEON (SIMD) support. +# ARM NEON +# ======== AC_ARG_ENABLE([arm-neon], AS_HELP_STRING([[[--enable-arm-neon]]], - [Enable ARM NEON optimizations: =no/off, check, api, yes/on:] - [no/off: disable the optimizations; check: use internal checking code] - [(deprecated and poorly supported); api: disable by default, enable by] - [a call to png_set_option; yes/on: turn on unconditionally.] + [Enable ARM NEON optimizations: =no/off, check, api, yes/on.] + [no/off: disable the optimizations;] + [check: use internal checking code (deprecated and poorly supported);] + [api: disable by default, enable by a call to png_set_option;] + [yes/on: turn on unconditionally.] [If not specified: determined by the compiler.]), [case "$enableval" in no|off) @@ -404,16 +406,17 @@ AC_ARG_ENABLE([arm-neon], yes|on) AC_DEFINE([PNG_ARM_NEON_OPT], [2], [Enable ARM Neon optimizations]) - AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if] - [you want the optimizations unconditionally pass -mfpu=neon] - [to the compiler.]);; + AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';] + [if you want the optimizations unconditionally,] + [pass '-mfpu=neon' to the compiler.]);; *) - AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value]) + AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:] + [invalid argument]) esac]) # Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or -# where ARM optimizations were explicitly requested (this allows a fallback -# if a future host CPU does not match 'arm*') +# where ARM optimizations were explicitly requested. (This allows a fallback +# if a future host CPU does not match 'arm*'.) AM_CONDITIONAL([PNG_ARM_NEON], [test "$enable_arm_neon" != 'no' && @@ -422,17 +425,16 @@ AM_CONDITIONAL([PNG_ARM_NEON], *) test "$enable_arm_neon" != '' ;; esac]) -# MIPS -# ==== -# -# MIPS MSA (SIMD) support. +# MIPS MSA +# ======== AC_ARG_ENABLE([mips-msa], AS_HELP_STRING([[[--enable-mips-msa]]], - [Enable MIPS MSA optimizations: =no/off, check, api, yes/on:] - [no/off: disable the optimizations; check: use internal checking code] - [(deprecated and poorly supported); api: disable by default, enable by] - [a call to png_set_option; yes/on: turn on unconditionally.] + [Enable MIPS MSA optimizations: =no/off, check, api, yes/on.] + [no/off: disable the optimizations;] + [check: use internal checking code (deprecated and poorly supported);] + [api: disable by default, enable by a call to png_set_option;] + [yes/on: turn on unconditionally.] [If not specified: determined by the compiler.]), [case "$enableval" in no|off) @@ -450,16 +452,17 @@ AC_ARG_ENABLE([mips-msa], yes|on) AC_DEFINE([PNG_MIPS_MSA_OPT], [2], [Enable MIPS MSA optimizations]) - AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if] - [you want the optimizations unconditionally pass '-mmsa -mfp64'] - [to the compiler.]);; + AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';] + [if you want the optimizations unconditionally,] + [pass '-mmsa -mfp64' to the compiler.]);; *) - AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value]) + AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:] + [invalid argument]) esac]) # Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or -# where MIPS optimizations were explicitly requested (this allows a fallback -# if a future host CPU does not match 'mips*') +# where MIPS optimizations were explicitly requested. (This allows a fallback +# if a future host CPU does not match 'mips*'.) AM_CONDITIONAL([PNG_MIPS_MSA], [test "$enable_mips_msa" != 'no' && @@ -467,17 +470,16 @@ AM_CONDITIONAL([PNG_MIPS_MSA], mipsel*|mips64el*) : ;; esac]) -# MIPS -# === -# -# MIPS MMI (SIMD) support. +# MIPS MMI +# ======== AC_ARG_ENABLE([mips-mmi], AS_HELP_STRING([[[--enable-mips-mmi]]], - [Enable MIPS MMI optimizations: =no/off, check, api, yes/on:] - [no/off: disable the optimizations; check: use internal checking code] - [(deprecated and poorly supported); api: disable by default, enable by] - [a call to png_set_option; yes/on: turn on unconditionally.] + [Enable MIPS MMI optimizations: =no/off, check, api, yes/on.] + [no/off: disable the optimizations;] + [check: use internal checking code (deprecated and poorly supported);] + [api: disable by default, enable by a call to png_set_option;] + [yes/on: turn on unconditionally.] [If not specified: determined by the compiler.]), [case "$enableval" in no|off) @@ -495,31 +497,30 @@ AC_ARG_ENABLE([mips-mmi], yes|on) AC_DEFINE([PNG_MIPS_MMI_OPT], [1], [Enable MIPS MMI optimizations]) - AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api', if] - [you want the optimizations unconditionally pass '-mloongson-mmi -march=loongson3a'] - [to the compiler.]);; + AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api';] + [if you want the optimizations unconditionally] + [pass '-mloongson-mmi -march=loongson3a' to the compiler.]);; *) - AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}: invalid value]) + AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}:] + [invalid argument]) esac]) # Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or -# where MIPS optimizations were explicitly requested (this allows a fallback if a -# future host CPU does not match 'mips*') +# where MIPS optimizations were explicitly requested. (This allows a fallback +# if a future host CPU does not match 'mips*'.) AM_CONDITIONAL([PNG_MIPS_MMI], [test "$enable_mips_mmi" != 'no' && case "$host_cpu" in - mipsel*|mips64el*) :;; + mipsel*|mips64el*) : ;; esac]) -# INTEL -# ===== -# -# INTEL SSE (SIMD) support. +# INTEL SSE +# ========= AC_ARG_ENABLE([intel-sse], AS_HELP_STRING([[[--enable-intel-sse]]], - [Enable Intel SSE optimizations: =no/off, yes/on:] + [Enable Intel SSE optimizations: =no/off, yes/on.] [no/off: disable the optimizations;] [yes/on: enable the optimizations.] [If not specified: determined by the compiler.]), @@ -534,12 +535,13 @@ AC_ARG_ENABLE([intel-sse], AC_DEFINE([PNG_INTEL_SSE_OPT], [1], [Enable Intel SSE optimizations]);; *) - AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value]) + AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:] + [invalid argument]) esac]) # Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or -# where Intel optimizations were explicitly requested (this allows a fallback -# if a future host CPU does not match 'x86*') +# where Intel optimizations were explicitly requested. (This allows a fallback +# if a future host CPU does not match 'x86*'.) AM_CONDITIONAL([PNG_INTEL_SSE], [test "$enable_intel_sse" != 'no' && case "$host_cpu" in @@ -547,16 +549,15 @@ AM_CONDITIONAL([PNG_INTEL_SSE], *) test "$enable_intel_sse" != '' ;; esac]) -# PowerPC -# ======= -# -# PowerPC VSX (SIMD) support. +# POWERPC VSX +# =========== AC_ARG_ENABLE([powerpc-vsx], AS_HELP_STRING([[[--enable-powerpc-vsx]]], - [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:] - [no/off: disable the optimizations; check: use internal checking code] - [api: disable by default, enable by a call to png_set_option] + [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.] + [no/off: disable the optimizations;] + [check: use internal checking code;] + [api: disable by default, enable by a call to png_set_option;] [yes/on: turn on unconditionally.] [If not specified: determined by the compiler.]), [case "$enableval" in @@ -569,24 +570,25 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]], check) AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [], [Check for POWERPC VSX support at run-time]) - AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file] - [for the list of supported OSes.]);; + AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README] + [for the list of supported systems.]);; api) AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [], [Turn on POWERPC VSX optimizations at run-time]);; yes|on) AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], [Enable POWERPC VSX optimizations]) - AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if] - [you want the optimizations unconditionally pass '-maltivec -mvsx'] - [or '-mcpu=power8' to the compiler.]);; + AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';] + [if you want the optimizations unconditionally,] + [pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);; *) - AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value]) + AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:] + [invalid argument]) esac]) -# Add PowerPC-specific files to all builds where $host_cpu is powerpc('powerpc*') -# or where PowerPC optimizations were explicitly requested (this allows a fallback -# if a future host CPU does not match 'powerpc*') +# Add PowerPC-specific files to all builds where $host_cpu is powerpc +# ('powerpc*') or where PowerPC optimizations were explicitly requested. +# (This allows a fallback if a future host CPU does not match 'powerpc*'.) AM_CONDITIONAL([PNG_POWERPC_VSX], [test "$enable_powerpc_vsx" != 'no' && @@ -594,28 +596,8 @@ AM_CONDITIONAL([PNG_POWERPC_VSX], powerpc*|ppc64*) : ;; esac]) -# LOONGARCH -# === -# -# LOONGARCH LSX (SIMD) support - -if test "$LSX_CFLAGS" = ''; then - LSX_CFLAGS="-mlsx" -fi - -compiler_support_loongarch_lsx=no -AC_MSG_CHECKING(whether to use loongarch LSX intrinsics) -save_CFLAGS=$CFLAGS -CFLAGS="$CFLAGS $LSX_CFLAGS" -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -#include<lsxintrin.h> -int main(){ - __m128i a, b, c; - a = __lsx_vadd_w(b, c); - return 0; -}]])],compiler_support_loongarch_lsx=yes) -CFLAGS=$save_CFLAGS -AC_MSG_RESULT($compiler_support_loongarch_lsx) +# LOONGARCH LSX +# ============= AC_ARG_ENABLE([loongarch-lsx], AS_HELP_STRING([[[--enable-loongarch-lsx]]], @@ -635,26 +617,48 @@ AC_ARG_ENABLE([loongarch-lsx], [Enable LOONGARCH LSX optimizations]) ;; *) - AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}: invalid value]) + AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}:] + [invalid argument]) esac]) -if test "$enable_loongarch_lsx" != 'no'; then - if test $compiler_support_loongarch_lsx = yes; then - AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1], [Enable LOONGARCH LSX optimizations]) +if test "$enable_loongarch_lsx" != "no" && + case "$host_cpu" in + loongarch*) : ;; + *) test "$enable_loongarch_lsx" != '' ;; + esac +then + compiler_support_loongarch_lsx=no + AC_MSG_CHECKING(whether to use LoongArch LSX intrinsics) + save_CFLAGS="$CFLAGS" + LSX_CFLAGS="${LSX_CFLAGS:-"-mlsx"}" + CFLAGS="$CFLAGS $LSX_CFLAGS" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include <lsxintrin.h> +int main(){ + __m128i a, b, c; + a = __lsx_vadd_w(b, c); + return 0; +}]])],compiler_support_loongarch_lsx=yes) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($compiler_support_loongarch_lsx) + if test "$compiler_support_loongarch_lsx" = "yes"; then + AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1], + [Enable LOONGARCH LSX optimizations]) else AC_MSG_WARN([Compiler does not support loongarch LSX.]) fi fi -# Add LOONGARCH specific files to all builds where the host_cpu is loongarch ('loongarch*') or -# where LOONGARCH optimizations were explicitly requested (this allows a fallback if a -# future host CPU does not match 'loongarch*') +# Add LoongArch specific files to all builds where the host_cpu is loongarch +# ('loongarch*') or where LoongArch optimizations were explicitly requested. +# (This allows a fallback if a future host CPU does not match 'loongarch*'.) AM_CONDITIONAL([PNG_LOONGARCH_LSX], - [test "$enable_loongarch_lsx" != 'no' && test $compiler_support_loongarch_lsx = yes && + [test "$enable_loongarch_lsx" != "no" && + test "$compiler_support_loongarch_lsx" = "yes" && case "$host_cpu" in - loongarch*) :;; - *) test "$enable_loongarch_lsx" != '';; + loongarch*) : ;; + *) test "$enable_loongarch_lsx" != '' ;; esac]) AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) diff --git a/Build/source/libs/libpng/libpng-src/contrib/.editorconfig b/Build/source/libs/libpng/libpng-src/contrib/.editorconfig new file mode 100644 index 00000000000..e1b551df739 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/.editorconfig @@ -0,0 +1,7 @@ +# https://editorconfig.org + +root = false + +[*.[ch]] +max_doc_length = unset +max_line_length = unset diff --git a/Build/source/libs/libpng/libpng-src/contrib/conftest/basic.dfa b/Build/source/libs/libpng/libpng-src/contrib/conftest/basic.dfa new file mode 100644 index 00000000000..f9ae5c34661 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/conftest/basic.dfa @@ -0,0 +1,133 @@ +# basic.dfa +# Build time configuration of libpng +# +# Author: John Bowler +# Copyright: (c) John Bowler, 2024 +# Usage rights: +# To the extent possible under law, the author has waived all copyright and +# related or neighboring rights to this work. This work is published from: +# United States. +# +# Build libpng with basic read and write support. This enables the lowest +# level libpng read and write APIs - the "row-by-row" ones. +# +# Support is enabled only for those transformations that are observed to be +# required by widely used apps or are in the v3 specification. +# + +everything = off + +# The sequential read code is enabled here; the progressive code can be used +# instead but there is no point enabling both. + +option READ on +option SEQUENTIAL_READ on +option EASY_ACCESS on +option SET_USER_LIMITS on +option INFO_IMAGE on +option READ_16BIT on + +# Errors: these can be disabled but then there won't be any error messages +# just failures and the error messages are really needed for apps: +option WARNINGS on +option ERROR_TEXT on +option BENIGN_READ_ERRORS on + +# Required for many display programs such as web browsers: +option PROGRESSIVE_READ on + +# Switch on the write code - this makes a minimalist encoder but with +# interlace support turned on; otherwise png_read_png..png_write_png will +# fail on an interlaced image. +option WRITE on +option WRITE_INTERLACING on +option WRITE_16BIT on + +# Usages of the 'fixed' APIs are relatively rare but they do occur +# one or the other for both the API and the internal math. + +#Fixed point: +option FIXED_POINT on + +#Floating point: +option FLOATING_POINT on +option FLOATING_ARITHMETIC on + +# Basic error handling, IO and user memory support. The latter allows the +# application program to provide its own implementations of 'malloc' and 'free'. +option SETJMP on +option STDIO on +option USER_MEM on + +# Gamma handling: this needs to be on for the gamma handling +option READ_GAMMA on + +# The supported chunks +chunk bKGD on +chunk cHRM on +chunk eXIf on +chunk gAMA on +chunk iCCP on +chunk iTXt on +chunk pHYs on +chunk sBIT on +chunk sRGB on +chunk tEXt on +chunk tIME on +chunk tRNS on +chunk zTXt on + +# These don't seem to be used anywhere: +# chunk pCAL +# chunk sCAL +# chunk sPLT + +# The rest of this is app dependent: none of these options are required for +# read/write of the full range of PNG files and the normal chunk handling on +# read. +option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on +option WRITE_CUSTOMIZE_COMPRESSION on + +option READ_EXPAND on +option READ_FILLER on +option READ_GRAY_TO_RGB on +option READ_INVERT on +option READ_PACK on +option READ_RGB_TO_GRAY on +option READ_SCALE_16_TO_8 on +option READ_SHIFT on +option READ_STRIP_16_TO_8 on +option READ_STRIP_ALPHA on +option READ_SWAP on + +option CONVERT_tIME on + +# optipng +option IO_STATE on +option STORE_UNKNOWN_CHUNKS on +option HANDLE_AS_UNKNOWN on + +# pngcrush +option READ_USER_TRANSFORM on +option WRITE_FLUSH on + +# pnmtopng +chunk hIST on + +# cairo +option WRITE_PACKSWAP on +option WRITE_USER_TRANSFORM on + +# graphicsmagick +option READ_USER_CHUNKS on + +# Qt5.15 qtgui (gentoo package split) Qt6.6 qtbase +option READ_BGR on +option WRITE_BGR on +option READ_SWAP_ALPHA on +option WRITE_SWAP_ALPHA on +chunk oFFs on + +# ghostscript-gpl +option WRITE_INVERT_ALPHA on +option WRITE_INVERT on diff --git a/Build/source/libs/libpng/libpng-src/contrib/examples/iccfrompng.c b/Build/source/libs/libpng/libpng-src/contrib/examples/iccfrompng.c index 00056abfd71..0f86714a817 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/examples/iccfrompng.c +++ b/Build/source/libs/libpng/libpng-src/contrib/examples/iccfrompng.c @@ -80,7 +80,7 @@ extract(FILE *fp, png_uint_32 *proflen) } else - result = no_profile; + result = no_profile; } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); @@ -155,7 +155,7 @@ extract_one_file(const char *filename) } else if (verbose && profile == no_profile) - printf("%s has no profile\n", filename); + printf("%s has no profile\n", filename); } else diff --git a/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng-x.c b/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng-x.c index 92effaa6d29..2fc9272c642 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng-x.c +++ b/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng-x.c @@ -21,7 +21,7 @@ - 1.10: added support for non-default visuals; fixed X pixel-conversion - 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed command-line parsing bug - - 1.12: fixed some small X memory leaks (thanks to François Petitjean) + - 1.12: fixed some small X memory leaks (thanks to François Petitjean) - 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche) - 1.14: added support for X resources (thanks to Gerhard Niklasch) - 2.00: dual-licensed (added GNU GPL) diff --git a/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng2-x.c b/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng2-x.c index af944c0f2bf..1375dc9a6df 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng2-x.c +++ b/Build/source/libs/libpng/libpng-src/contrib/gregbook/rpng2-x.c @@ -27,7 +27,7 @@ - 1.11: added -usleep option for demos; fixed command-line parsing bug - 1.12: added -pause option for demos and testing - 1.20: added runtime MMX-enabling/disabling and new -mmx* options - - 1.21: fixed some small X memory leaks (thanks to François Petitjean) + - 1.21: fixed some small X memory leaks (thanks to François Petitjean) - 1.22: fixed XFreeGC() crash bug (thanks to Patrick Welche) - 1.23: added -bgpat 0 mode (std white/gray checkerboard, 8x8 squares) - 1.30: added -loop option for -bgpat (ifdef FEATURE_LOOP); fixed bpp = diff --git a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c index 6a7422e8861..3d66154dd42 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c +++ b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c @@ -70,9 +70,12 @@ #endif /* pngvalid requires write support and one of the fixed or floating point APIs. + * progressive read is also required currently as the progressive read pointer + * is used to record the 'display' structure. */ -#if defined(PNG_WRITE_SUPPORTED) &&\ - (defined(PNG_FIXED_POINT_SUPPORTED) || defined(PNG_FLOATING_POINT_SUPPORTED)) +#if defined PNG_WRITE_SUPPORTED &&\ + (defined PNG_PROGRESSIVE_READ_SUPPORTED) &&\ + (defined PNG_FIXED_POINT_SUPPORTED || defined PNG_FLOATING_POINT_SUPPORTED) #if PNG_LIBPNG_VER < 10500 /* This deliberately lacks the const. */ @@ -10009,9 +10012,12 @@ gamma_component_validate(const char *name, const validate_info *vi, case ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN: case ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED: # endif /* ALPHA_MODE_SUPPORTED */ +# if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\ + (defined PNG_READ_ALPHA_MODE_SUPPORTED) do_compose = (alpha > 0 && alpha < 1); use_input = (alpha != 0); break; +# endif default: break; @@ -11924,7 +11930,14 @@ int main(int argc, char **argv) pm.test_gamma_alpha_mode = 0; else if (strcmp(*argv, "--expand16") == 0) - pm.test_gamma_expand16 = 1; + { +# ifdef PNG_READ_EXPAND_16_SUPPORTED + pm.test_gamma_expand16 = 1; +# else + fprintf(stderr, "pngvalid: --expand16: no read support\n"); + return SKIP; +# endif + } else if (strcmp(*argv, "--noexpand16") == 0) pm.test_gamma_expand16 = 0; @@ -11939,10 +11952,15 @@ int main(int argc, char **argv) pm.test_lbg_gamma_transform = pm.test_lbg_gamma_sbit = pm.test_lbg_gamma_composition = 0; -# ifdef PNG_WRITE_tRNS_SUPPORTED - else if (strcmp(*argv, "--tRNS") == 0) + else if (strcmp(*argv, "--tRNS") == 0) + { +# ifdef PNG_WRITE_tRNS_SUPPORTED pm.test_tRNS = 1; -# endif +# else + fprintf(stderr, "pngvalid: --tRNS: no write support\n"); + return SKIP; +# endif + } else if (strcmp(*argv, "--notRNS") == 0) pm.test_tRNS = 0; diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/.editorconfig b/Build/source/libs/libpng/libpng-src/contrib/pngexif/.editorconfig new file mode 100644 index 00000000000..ce8fbbfc1be --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/.editorconfig @@ -0,0 +1,11 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +insert_final_newline = true +max_doc_length = 79 +max_line_length = 79 +trim_trailing_whitespace = true diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/.gitignore b/Build/source/libs/libpng/libpng-src/contrib/pngexif/.gitignore new file mode 100644 index 00000000000..016f70a8030 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +*.py[co] +*$py.class diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/.pylintrc b/Build/source/libs/libpng/libpng-src/contrib/pngexif/.pylintrc new file mode 100644 index 00000000000..50cf1152dab --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/.pylintrc @@ -0,0 +1,8 @@ +[COMPATIBILITY] +disable=consider-using-f-string + +[COMPLEXITY] +disable=too-many-branches,too-many-instance-attributes + +[STYLE] +disable=consider-using-in diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/LICENSE_MIT.txt b/Build/source/libs/libpng/libpng-src/contrib/pngexif/LICENSE_MIT.txt new file mode 100644 index 00000000000..9cf106272ac --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/LICENSE_MIT.txt @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/README.md b/Build/source/libs/libpng/libpng-src/contrib/pngexif/README.md new file mode 100644 index 00000000000..c9ff88b647a --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/README.md @@ -0,0 +1,20 @@ +pngexifinfo +=========== + +Show the EXIF information embedded in a PNG file. + + +Sample usage +------------ + +Show the EXIF info inside a PNG file: + + pngexifinfo /path/to/file.png + +Show the EXIF info inside a raw `.exif` file, using base 16 for the EXIF tags: + + pngexifinfo --hex /path/to/file.exif + +Show the help text: + + pngexifinfo --help diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/bytepack.py b/Build/source/libs/libpng/libpng-src/contrib/pngexif/bytepack.py new file mode 100644 index 00000000000..93af21994a9 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/bytepack.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +""" +Byte packing and unpacking utilities. + +Copyright (C) 2017-2020 Cosmin Truta. + +Use, modification and distribution are subject to the MIT License. +Please see the accompanying file LICENSE_MIT.txt +""" + +from __future__ import absolute_import, division, print_function + +import struct + + +def unpack_uint32be(buffer, offset=0): + """Unpack an unsigned int from its 32-bit big-endian representation.""" + return struct.unpack(">I", buffer[offset:offset + 4])[0] + + +def unpack_uint32le(buffer, offset=0): + """Unpack an unsigned int from its 32-bit little-endian representation.""" + return struct.unpack("<I", buffer[offset:offset + 4])[0] + + +def unpack_uint16be(buffer, offset=0): + """Unpack an unsigned int from its 16-bit big-endian representation.""" + return struct.unpack(">H", buffer[offset:offset + 2])[0] + + +def unpack_uint16le(buffer, offset=0): + """Unpack an unsigned int from its 16-bit little-endian representation.""" + return struct.unpack("<H", buffer[offset:offset + 2])[0] + + +def unpack_uint8(buffer, offset=0): + """Unpack an unsigned int from its 8-bit representation.""" + return struct.unpack("B", buffer[offset:offset + 1])[0] + + +if __name__ == "__main__": + # For testing only. + assert unpack_uint32be(b"ABCDEF", 1) == 0x42434445 + assert unpack_uint32le(b"ABCDEF", 1) == 0x45444342 + assert unpack_uint16be(b"ABCDEF", 1) == 0x4243 + assert unpack_uint16le(b"ABCDEF", 1) == 0x4342 + assert unpack_uint8(b"ABCDEF", 1) == 0x42 diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/exifinfo.py b/Build/source/libs/libpng/libpng-src/contrib/pngexif/exifinfo.py new file mode 100644 index 00000000000..1bf754cb4f7 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/exifinfo.py @@ -0,0 +1,306 @@ +#!/usr/bin/env python + +""" +Show the EXIF information. + +Copyright (C) 2017-2020 Cosmin Truta. + +Use, modification and distribution are subject to the MIT License. +Please see the accompanying file LICENSE_MIT.txt +""" + +from __future__ import absolute_import, division, print_function + +import sys + +from bytepack import (unpack_uint32be, + unpack_uint32le, + unpack_uint16be, + unpack_uint16le, + unpack_uint8) + + +# Generously allow the TIFF file to occupy up to a quarter-gigabyte. +# TODO: Reduce this limit to 64K and use file seeking for anything larger. +_READ_DATA_SIZE_MAX = 256 * 1024 * 1024 + +_TIFF_TAG_TYPES = { + 1: "byte", + 2: "ascii", + 3: "short", + 4: "long", + 5: "rational", + 6: "sbyte", + 7: "undefined", + 8: "sshort", + 9: "slong", + 10: "srational", + 11: "float", + 12: "double", +} + +# See http://www.digitalpreservation.gov/formats/content/tiff_tags.shtml +_TIFF_TAGS = { + 0x00fe: "Subfile Type", + 0x0100: "Width", + 0x0101: "Height", + 0x0102: "Bits per Sample", + 0x0103: "Compression", + 0x0106: "Photometric", + 0x010d: "Document Name", + 0x010e: "Image Description", + 0x010f: "Make", + 0x0110: "Model", + 0x0111: "Strip Offsets", + 0x0112: "Orientation", + 0x0115: "Samples per Pixel", + 0x0116: "Rows per Strip", + 0x0117: "Strip Byte Counts", + 0x0118: "Min Sample Value", + 0x0119: "Max Sample Value", + 0x011a: "X Resolution", + 0x011b: "Y Resolution", + 0x011c: "Planar Configuration", + 0x011d: "Page Name", + 0x011e: "X Position", + 0x011f: "Y Position", + 0x0128: "Resolution Unit", + 0x0129: "Page Number", + 0x0131: "Software", + 0x0132: "Date Time", + 0x013b: "Artist", + 0x013c: "Host Computer", + 0x013d: "Predictor", + 0x013e: "White Point", + 0x013f: "Primary Chromaticities", + 0x0140: "Color Map", + 0x0141: "Half-Tone Hints", + 0x0142: "Tile Width", + 0x0143: "Tile Length", + 0x0144: "Tile Offsets", + 0x0145: "Tile Byte Counts", + 0x0211: "YCbCr Coefficients", + 0x0212: "YCbCr Subsampling", + 0x0213: "YCbCr Positioning", + 0x0214: "Reference Black White", + 0x022f: "Strip Row Counts", + 0x02bc: "XMP", + 0x8298: "Copyright", + 0x83bb: "IPTC", + 0x8769: "EXIF IFD", + 0x8773: "ICC Profile", + 0x8825: "GPS IFD", + 0xa005: "Interoperability IFD", + 0xc4a5: "Print IM", + + # EXIF IFD tags + 0x829a: "Exposure Time", + 0x829d: "F-Number", + 0x8822: "Exposure Program", + 0x8824: "Spectral Sensitivity", + 0x8827: "ISO Speed Ratings", + 0x8828: "OECF", + 0x9000: "EXIF Version", + 0x9003: "DateTime Original", + 0x9004: "DateTime Digitized", + 0x9101: "Components Configuration", + 0x9102: "Compressed Bits Per Pixel", + 0x9201: "Shutter Speed Value", + 0x9202: "Aperture Value", + 0x9203: "Brightness Value", + 0x9204: "Exposure Bias Value", + 0x9205: "Max Aperture Value", + 0x9206: "Subject Distance", + 0x9207: "Metering Mode", + 0x9208: "Light Source", + 0x9209: "Flash", + 0x920a: "Focal Length", + 0x9214: "Subject Area", + 0x927c: "Maker Note", + 0x9286: "User Comment", + # ... TODO + 0xa000: "Flashpix Version", + 0xa001: "Color Space", + 0xa002: "Pixel X Dimension", + 0xa003: "Pixel Y Dimension", + 0xa004: "Related Sound File", + # ... TODO + + # GPS IFD tags + # ... TODO +} + +_TIFF_EXIF_IFD = 0x8769 +_GPS_IFD = 0x8825 +_INTEROPERABILITY_IFD = 0xa005 + + +class ExifInfo: + """EXIF reader and information lister.""" + + _endian = None + _buffer = None + _offset = 0 + _global_ifd_offset = 0 + _exif_ifd_offset = 0 + _gps_ifd_offset = 0 + _interoperability_ifd_offset = 0 + _hex = False + + def __init__(self, buffer, **kwargs): + """Initialize the EXIF data reader.""" + self._hex = kwargs.get("hex", False) + self._verbose = kwargs.get("verbose", False) + if not isinstance(buffer, bytes): + raise RuntimeError("invalid EXIF data type") + if buffer.startswith(b"MM\x00\x2a"): + self._endian = "MM" + elif buffer.startswith(b"II\x2a\x00"): + self._endian = "II" + else: + raise RuntimeError("invalid EXIF header") + self._buffer = buffer + self._offset = 4 + self._global_ifd_offset = self._ui32() + + def endian(self): + """Return the endianness of the EXIF data.""" + return self._endian + + def _tags_for_ifd(self, ifd_offset): + """Yield the tags found at the given TIFF IFD offset.""" + if ifd_offset < 8: + raise RuntimeError("invalid TIFF IFD offset") + self._offset = ifd_offset + ifd_size = self._ui16() + for _ in range(0, ifd_size): + tag_id = self._ui16() + tag_type = self._ui16() + count = self._ui32() + value_or_offset = self._ui32() + if self._endian == "MM": + # FIXME: + # value_or_offset requires a fixup under big-endian encoding. + if tag_type == 2: + # 2 --> "ascii" + value_or_offset >>= 24 + elif tag_type == 3: + # 3 --> "short" + value_or_offset >>= 16 + else: + # ... FIXME + pass + if count == 0: + raise RuntimeError("unsupported count=0 in tag 0x%x" % tag_id) + if tag_id == _TIFF_EXIF_IFD: + if tag_type != 4: + raise RuntimeError("incorrect tag type for EXIF IFD") + self._exif_ifd_offset = value_or_offset + elif tag_id == _GPS_IFD: + if tag_type != 4: + raise RuntimeError("incorrect tag type for GPS IFD") + self._gps_ifd_offset = value_or_offset + elif tag_id == _INTEROPERABILITY_IFD: + if tag_type != 4: + raise RuntimeError("incorrect tag type for Interop IFD") + self._interoperability_ifd_offset = value_or_offset + yield (tag_id, tag_type, count, value_or_offset) + + def tags(self): + """Yield all TIFF/EXIF tags.""" + if self._verbose: + print("TIFF IFD : 0x%08x" % self._global_ifd_offset) + for tag in self._tags_for_ifd(self._global_ifd_offset): + yield tag + if self._exif_ifd_offset > 0: + if self._verbose: + print("EXIF IFD : 0x%08x" % self._exif_ifd_offset) + for tag in self._tags_for_ifd(self._exif_ifd_offset): + yield tag + if self._gps_ifd_offset > 0: + if self._verbose: + print("GPS IFD : 0x%08x" % self._gps_ifd_offset) + for tag in self._tags_for_ifd(self._gps_ifd_offset): + yield tag + if self._interoperability_ifd_offset > 0: + if self._verbose: + print("Interoperability IFD : 0x%08x" % + self._interoperability_ifd_offset) + for tag in self._tags_for_ifd(self._interoperability_ifd_offset): + yield tag + + def tagid2str(self, tag_id): + """Return an informative string representation of a TIFF tag id.""" + idstr = _TIFF_TAGS.get(tag_id, "[Unknown]") + if self._hex: + idnum = "0x%04x" % tag_id + else: + idnum = "%d" % tag_id + return "%s (%s)" % (idstr, idnum) + + @staticmethod + def tagtype2str(tag_type): + """Return an informative string representation of a TIFF tag type.""" + typestr = _TIFF_TAG_TYPES.get(tag_type, "[unknown]") + return "%d:%s" % (tag_type, typestr) + + def tag2str(self, tag_id, tag_type, count, value_or_offset): + """Return an informative string representation of a TIFF tag tuple.""" + return "%s (type=%s) (count=%d) : 0x%08x" \ + % (self.tagid2str(tag_id), self.tagtype2str(tag_type), count, + value_or_offset) + + def _ui32(self): + """Decode a 32-bit unsigned int found at the current offset; + advance the offset by 4. + """ + if self._offset + 4 > len(self._buffer): + raise RuntimeError("out-of-bounds uint32 access in EXIF") + if self._endian == "MM": + result = unpack_uint32be(self._buffer, self._offset) + else: + result = unpack_uint32le(self._buffer, self._offset) + self._offset += 4 + return result + + def _ui16(self): + """Decode a 16-bit unsigned int found at the current offset; + advance the offset by 2. + """ + if self._offset + 2 > len(self._buffer): + raise RuntimeError("out-of-bounds uint16 access in EXIF") + if self._endian == "MM": + result = unpack_uint16be(self._buffer, self._offset) + else: + result = unpack_uint16le(self._buffer, self._offset) + self._offset += 2 + return result + + def _ui8(self): + """Decode an 8-bit unsigned int found at the current offset; + advance the offset by 1. + """ + if self._offset + 1 > len(self._buffer): + raise RuntimeError("out-of-bounds uint8 access in EXIF") + result = unpack_uint8(self._buffer, self._offset) + self._offset += 1 + return result + + +def print_raw_exif_info(buffer, **kwargs): + """Print the EXIF information found in a raw byte stream.""" + lister = ExifInfo(buffer, **kwargs) + print("EXIF (endian=%s)" % lister.endian()) + for (tag_id, tag_type, count, value_or_offset) in lister.tags(): + print(lister.tag2str(tag_id=tag_id, + tag_type=tag_type, + count=count, + value_or_offset=value_or_offset)) + + +if __name__ == "__main__": + # For testing only. + for arg in sys.argv[1:]: + with open(arg, "rb") as test_stream: + test_buffer = test_stream.read(_READ_DATA_SIZE_MAX) + print_raw_exif_info(test_buffer, hex=True, verbose=True) diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo b/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo new file mode 100644 index 00000000000..16f8eaab142 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo @@ -0,0 +1,10 @@ +#!/bin/sh +set -eu + +my_python="$(command -v python3 || command -v python)" || { + echo >&2 "error: program not found: Python interpreter" + exit 127 +} +my_python_flags="-BES" + +exec "$my_python" "$my_python_flags" "$(dirname "$0")/pngexifinfo.py" "$@" diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo.bat b/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo.bat new file mode 100644 index 00000000000..ab8bd358cc7 --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo.bat @@ -0,0 +1,4 @@ +@echo off +@setlocal enableextensions + +python.exe -BES %~dp0.\pngexifinfo.py %* diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo.py b/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo.py new file mode 100644 index 00000000000..37d4c4bcd8a --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/pngexif/pngexifinfo.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python + +""" +Show the PNG EXIF information. + +Copyright (C) 2017-2020 Cosmin Truta. + +Use, modification and distribution are subject to the MIT License. +Please see the accompanying file LICENSE_MIT.txt +""" + +from __future__ import absolute_import, division, print_function + +import argparse +import io +import re +import sys +import zlib + +from bytepack import unpack_uint32be, unpack_uint8 +from exifinfo import print_raw_exif_info + +_PNG_SIGNATURE = b"\x89PNG\x0d\x0a\x1a\x0a" +_PNG_CHUNK_SIZE_MAX = 0x7fffffff +_READ_DATA_SIZE_MAX = 0x3ffff + + +def print_error(msg): + """Print an error message to stderr.""" + sys.stderr.write("%s: error: %s\n" % (sys.argv[0], msg)) + + +def print_debug(msg): + """Print a debug message to stderr.""" + sys.stderr.write("%s: debug: %s\n" % (sys.argv[0], msg)) + + +def _check_png(condition, chunk_sig=None): + """Check a PNG-specific assertion.""" + if condition: + return + if chunk_sig is None: + raise RuntimeError("bad PNG data") + raise RuntimeError("bad PNG data in '%s'" % chunk_sig) + + +def _check_png_crc(data, checksum, chunk_sig): + """Check a CRC32 value inside a PNG stream.""" + if unpack_uint32be(data) == (checksum & 0xffffffff): + return + raise RuntimeError("bad PNG checksum in '%s'" % chunk_sig) + + +def _extract_png_exif(data, **kwargs): + """Extract the EXIF header and data from a PNG chunk.""" + debug = kwargs.get("debug", False) + if unpack_uint8(data, 0) == 0: + if debug: + print_debug("found compressed EXIF, compression method 0") + if (unpack_uint8(data, 1) & 0x0f) == 0x08: + data = zlib.decompress(data[1:]) + elif unpack_uint8(data, 1) == 0 \ + and (unpack_uint8(data, 5) & 0x0f) == 0x08: + if debug: + print_debug("found uncompressed-length EXIF field") + data_len = unpack_uint32be(data, 1) + data = zlib.decompress(data[5:]) + if data_len != len(data): + raise RuntimeError( + "incorrect uncompressed-length field in PNG EXIF") + else: + raise RuntimeError("invalid compression method in PNG EXIF") + if data.startswith(b"MM\x00\x2a") or data.startswith(b"II\x2a\x00"): + return data + raise RuntimeError("invalid TIFF/EXIF header in PNG EXIF") + + +def print_png_exif_info(instream, **kwargs): + """Print the EXIF information found in the given PNG datastream.""" + debug = kwargs.get("debug", False) + has_exif = False + while True: + chunk_hdr = instream.read(8) + _check_png(len(chunk_hdr) == 8) + chunk_len = unpack_uint32be(chunk_hdr, offset=0) + chunk_sig = chunk_hdr[4:8].decode("latin_1", errors="ignore") + _check_png(re.search(r"^[A-Za-z]{4}$", chunk_sig), chunk_sig=chunk_sig) + _check_png(chunk_len < _PNG_CHUNK_SIZE_MAX, chunk_sig=chunk_sig) + if debug: + print_debug("processing chunk: %s" % chunk_sig) + if chunk_len <= _READ_DATA_SIZE_MAX: + # The chunk size does not exceed an arbitrary, reasonable limit. + chunk_data = instream.read(chunk_len) + chunk_crc = instream.read(4) + _check_png(len(chunk_data) == chunk_len and len(chunk_crc) == 4, + chunk_sig=chunk_sig) + checksum = zlib.crc32(chunk_hdr[4:8]) + checksum = zlib.crc32(chunk_data, checksum) + _check_png_crc(chunk_crc, checksum, chunk_sig=chunk_sig) + else: + # The chunk is too big. Skip it. + instream.seek(chunk_len + 4, io.SEEK_CUR) + continue + if chunk_sig == "IEND": + _check_png(chunk_len == 0, chunk_sig=chunk_sig) + break + if chunk_sig.lower() in ["exif", "zxif"] and chunk_len > 8: + has_exif = True + exif_data = _extract_png_exif(chunk_data, **kwargs) + print_raw_exif_info(exif_data, **kwargs) + if not has_exif: + raise RuntimeError("no EXIF data in PNG stream") + + +def print_exif_info(file, **kwargs): + """Print the EXIF information found in the given file.""" + with open(file, "rb") as stream: + header = stream.read(4) + if header == _PNG_SIGNATURE[0:4]: + if stream.read(4) != _PNG_SIGNATURE[4:8]: + raise RuntimeError("corrupted PNG file") + print_png_exif_info(instream=stream, **kwargs) + elif header == b"II\x2a\x00" or header == b"MM\x00\x2a": + data = header + stream.read(_READ_DATA_SIZE_MAX) + print_raw_exif_info(data, **kwargs) + else: + raise RuntimeError("not a PNG file") + + +def main(): + """The main function.""" + parser = argparse.ArgumentParser( + prog="pngexifinfo", + usage="%(prog)s [options] [--] files...", + description="Show the PNG EXIF information.") + parser.add_argument("files", + metavar="file", + nargs="*", + help="a PNG file or a raw EXIF blob") + parser.add_argument("-x", + "--hex", + dest="hex", + action="store_true", + help="show EXIF tags in base 16") + parser.add_argument("-v", + "--verbose", + dest="verbose", + action="store_true", + help="run in verbose mode") + parser.add_argument("--debug", + dest="debug", + action="store_true", + help="run in debug mode") + args = parser.parse_args() + if not args.files: + parser.error("missing file operand") + result = 0 + for file in args.files: + try: + print_exif_info(file, + hex=args.hex, + debug=args.debug, + verbose=args.verbose) + except (IOError, OSError) as err: + print_error(str(err)) + result = 66 # os.EX_NOINPUT + except RuntimeError as err: + print_error("%s: %s" % (file, str(err))) + result = 69 # os.EX_UNAVAILABLE + parser.exit(result) + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + sys.stderr.write("INTERRUPTED\n") + sys.exit(130) # SIGINT diff --git a/Build/source/libs/libpng/libpng-src/contrib/pngminim/decoder/makefile b/Build/source/libs/libpng/libpng-src/contrib/pngminim/decoder/makefile index 4acf3c1779b..bbacea4bb82 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/pngminim/decoder/makefile +++ b/Build/source/libs/libpng/libpng-src/contrib/pngminim/decoder/makefile @@ -54,7 +54,7 @@ ZOBJS = adler32$(O) crc32$(O) \ PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \ pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \ pngset$(C) pngtrans$(C) - + # Standard headers PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h diff --git a/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c b/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c index 025e68790e2..8d5dc46c22e 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c +++ b/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c @@ -133,11 +133,6 @@ /* Is it safe to copy? */ #define SAFE_TO_COPY(chunk) (((chunk) & PNG_U32(0,0,0,32)) != 0) -/* Fix ups for builds with limited read support */ -#ifndef PNG_ERROR_TEXT_SUPPORTED -# define png_error(a,b) png_err(a) -#endif - /********************************* UTILITIES **********************************/ /* UNREACHED is a value to cause an assert to fail. Because of the way the * assert macro is written the string "UNREACHED" is produced in the error diff --git a/Build/source/libs/libpng/libpng-src/contrib/visupng/.editorconfig b/Build/source/libs/libpng/libpng-src/contrib/visupng/.editorconfig new file mode 100644 index 00000000000..d946b14461c --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/contrib/visupng/.editorconfig @@ -0,0 +1,22 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = unset +indent_style = unset +insert_final_newline = true +max_doc_length = 80 +max_line_length = 100 +trim_trailing_whitespace = true + +[*.rc] +end_of_line = crlf +trim_trailing_whitespace = unset + +[*.ds[pw]] +end_of_line = crlf +max_doc_length = unset +max_line_length = unset +trim_trailing_whitespace = unset diff --git a/Build/source/libs/libpng/libpng-src/libpng-manual.txt b/Build/source/libs/libpng/libpng-src/libpng-manual.txt index eb24ef48312..79880575994 100644 --- a/Build/source/libs/libpng/libpng-src/libpng-manual.txt +++ b/Build/source/libs/libpng/libpng-src/libpng-manual.txt @@ -9,7 +9,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng version 1.6.36, December 2018, through 1.6.42 - January 2024 + libpng version 1.6.36, December 2018, through 1.6.43 - February 2024 Updated and distributed by Cosmin Truta Copyright (c) 2018-2024 Cosmin Truta @@ -1178,11 +1178,11 @@ where row_pointers is an array of pointers to the pixel data for each row: If you know your image size and pixel size ahead of time, you can allocate row_pointers prior to calling png_read_png() with - if (height > PNG_UINT_32_MAX/(sizeof (png_byte))) + if (height > PNG_UINT_32_MAX / (sizeof (png_bytep))) png_error(png_ptr, "Image is too tall to process in memory"); - if (width > PNG_UINT_32_MAX/pixel_size) + if (width > PNG_UINT_32_MAX / pixel_size) png_error(png_ptr, "Image is too wide to process in memory"); diff --git a/Build/source/libs/libpng/libpng-src/libpng.3 b/Build/source/libs/libpng/libpng-src/libpng.3 index 57d06f2db69..45e76e4837c 100644 --- a/Build/source/libs/libpng/libpng-src/libpng.3 +++ b/Build/source/libs/libpng/libpng-src/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "January 29, 2024" +.TH LIBPNG 3 "February 23, 2024" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.42 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.43 .SH SYNOPSIS \fB#include <png.h>\fP @@ -528,7 +528,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng version 1.6.36, December 2018, through 1.6.42 - January 2024 + libpng version 1.6.36, December 2018, through 1.6.43 - February 2024 Updated and distributed by Cosmin Truta Copyright (c) 2018-2024 Cosmin Truta @@ -1697,11 +1697,11 @@ where row_pointers is an array of pointers to the pixel data for each row: If you know your image size and pixel size ahead of time, you can allocate row_pointers prior to calling png_read_png() with - if (height > PNG_UINT_32_MAX/(sizeof (png_byte))) + if (height > PNG_UINT_32_MAX / (sizeof (png_bytep))) png_error(png_ptr, "Image is too tall to process in memory"); - if (width > PNG_UINT_32_MAX/pixel_size) + if (width > PNG_UINT_32_MAX / pixel_size) png_error(png_ptr, "Image is too wide to process in memory"); diff --git a/Build/source/libs/libpng/libpng-src/libpngpf.3 b/Build/source/libs/libpng/libpng-src/libpngpf.3 index a4692050303..0abec74a2dd 100644 --- a/Build/source/libs/libpng/libpng-src/libpngpf.3 +++ b/Build/source/libs/libpng/libpng-src/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "January 29, 2024" +.TH LIBPNGPF 3 "February 23, 2024" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.42 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.43 (private functions) .SH SYNOPSIS diff --git a/Build/source/libs/libpng/libpng-src/loongarch/.editorconfig b/Build/source/libs/libpng/libpng-src/loongarch/.editorconfig new file mode 100644 index 00000000000..de2e98ab42c --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/loongarch/.editorconfig @@ -0,0 +1,8 @@ +# https://editorconfig.org + +root = false + +# FIXME +[*.[ch]] +max_doc_length = unset +max_line_length = unset diff --git a/Build/source/libs/libpng/libpng-src/mips/.editorconfig b/Build/source/libs/libpng/libpng-src/mips/.editorconfig new file mode 100644 index 00000000000..de2e98ab42c --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/mips/.editorconfig @@ -0,0 +1,8 @@ +# https://editorconfig.org + +root = false + +# FIXME +[*.[ch]] +max_doc_length = unset +max_line_length = unset diff --git a/Build/source/libs/libpng/libpng-src/png.5 b/Build/source/libs/libpng/libpng-src/png.5 index 1737ba51056..a8a681813ff 100644 --- a/Build/source/libs/libpng/libpng-src/png.5 +++ b/Build/source/libs/libpng/libpng-src/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "January 29, 2024" +.TH PNG 5 "February 23, 2024" .SH NAME png \- Portable Network Graphics (PNG) format diff --git a/Build/source/libs/libpng/libpng-src/png.c b/Build/source/libs/libpng/libpng-src/png.c index cf9f361070f..9ed31570092 100644 --- a/Build/source/libs/libpng/libpng-src/png.c +++ b/Build/source/libs/libpng/libpng-src/png.c @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_42 Your_png_h_is_not_version_1_6_42; +typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -794,7 +794,7 @@ png_get_copyright(png_const_structrp png_ptr) return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.42" PNG_STRING_NEWLINE \ + "libpng version 1.6.43" PNG_STRING_NEWLINE \ "Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ @@ -1821,14 +1821,14 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace, } # ifdef PNG_WARNINGS_SUPPORTED else - { - char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */ + { + char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */ - pos = png_safecat(message, (sizeof message), pos, - png_format_number(number, number+(sizeof number), - PNG_NUMBER_FORMAT_x, value)); - pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */ - } + pos = png_safecat(message, (sizeof message), pos, + png_format_number(number, number+(sizeof number), + PNG_NUMBER_FORMAT_x, value)); + pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */ + } # endif /* The 'reason' is an arbitrary message, allow +79 maximum 195 */ pos = png_safecat(message, (sizeof message), pos, reason); @@ -2511,17 +2511,6 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr) #endif /* COLORSPACE */ -#ifdef __GNUC__ -/* This exists solely to work round a warning from GNU C. */ -static int /* PRIVATE */ -png_gt(size_t a, size_t b) -{ - return a > b; -} -#else -# define png_gt(a,b) ((a) > (b)) -#endif - void /* PRIVATE */ png_check_IHDR(png_const_structrp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, @@ -2543,8 +2532,16 @@ png_check_IHDR(png_const_structrp png_ptr, error = 1; } - if (png_gt(((width + 7) & (~7U)), - ((PNG_SIZE_MAX + /* The bit mask on the first line below must be at least as big as a + * png_uint_32. "~7U" is not adequate on 16-bit systems because it will + * be an unsigned 16-bit value. Casting to (png_alloc_size_t) makes the + * type of the result at least as bit (in bits) as the RHS of the > operator + * which also avoids a common warning on 64-bit systems that the comparison + * of (png_uint_32) against the constant value on the RHS will always be + * false. + */ + if (((width + 7) & ~(png_alloc_size_t)7) > + (((PNG_SIZE_MAX - 48 /* big_row_buf hack */ - 1) /* filter byte */ / 8) /* 8-byte RGBA pixels */ diff --git a/Build/source/libs/libpng/libpng-src/png.h b/Build/source/libs/libpng/libpng-src/png.h index f537c5bb089..83d39031260 100644 --- a/Build/source/libs/libpng/libpng-src/png.h +++ b/Build/source/libs/libpng/libpng-src/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.42 + * libpng version 1.6.43 * * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson @@ -15,7 +15,7 @@ * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson - * libpng versions 1.6.36, December 2018, through 1.6.42, January 2024: + * libpng versions 1.6.36, December 2018, through 1.6.43, February 2024: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -239,7 +239,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.42 16 10641 16.so.16.41[.0] + * 1.6.43 16 10643 16.so.16.43[.0] * * Henceforth the source version will match the shared-library major and * minor numbers; the shared-library major version number will be used for @@ -255,9 +255,6 @@ * to the info_ptr or png_ptr members through png.h, and the compiled * application is loaded with a different version of the library. * - * DLLNUM will change each time there are forward or backward changes - * in binary compatibility (e.g., when a new feature is added). - * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as a W3C Recommendation and as an ISO/IEC Standard; see * <https://www.w3.org/TR/2003/REC-PNG-20031110/> @@ -278,19 +275,21 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.42" +#define PNG_LIBPNG_VER_STRING "1.6.43" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" -#define PNG_LIBPNG_VER_SONUM 16 -#define PNG_LIBPNG_VER_DLLNUM 16 +/* The versions of shared library builds should stay in sync, going forward */ +#define PNG_LIBPNG_VER_SHAREDLIB 16 +#define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */ +#define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 41 +#define PNG_LIBPNG_VER_RELEASE 43 /* This should be zero for a public release, or non-zero for a - * development version. [Deprecated] + * development version. */ #define PNG_LIBPNG_VER_BUILD 0 @@ -318,7 +317,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10641 /* 1.6.42 */ +#define PNG_LIBPNG_VER 10643 /* 1.6.43 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -428,7 +427,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_42; +typedef char* png_libpng_version_1_6_43; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff --git a/Build/source/libs/libpng/libpng-src/pngconf.h b/Build/source/libs/libpng/libpng-src/pngconf.h index 99851f4f9c8..000d7b1a8a6 100644 --- a/Build/source/libs/libpng/libpng-src/pngconf.h +++ b/Build/source/libs/libpng/libpng-src/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine-configurable file for libpng * - * libpng version 1.6.42 + * libpng version 1.6.43 * * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson diff --git a/Build/source/libs/libpng/libpng-src/pnglibconf.h b/Build/source/libs/libpng/libpng-src/pnglibconf.h index 330453c1391..83f09fbe773 100644 --- a/Build/source/libs/libpng/libpng-src/pnglibconf.h +++ b/Build/source/libs/libpng/libpng-src/pnglibconf.h @@ -1,6 +1,6 @@ /* pnglibconf.h - library build configuration */ -/* libpng version 1.6.42 */ +/* libpng version 1.6.43 */ /* Copyright (c) 2018-2024 Cosmin Truta */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ diff --git a/Build/source/libs/libpng/libpng-src/pngpread.c b/Build/source/libs/libpng/libpng-src/pngpread.c index be640f77a9b..ffab19c08c0 100644 --- a/Build/source/libs/libpng/libpng-src/pngpread.c +++ b/Build/source/libs/libpng/libpng-src/pngpread.c @@ -295,6 +295,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) } #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (png_ptr->chunk_name == png_eXIf) + { + PNG_PUSH_SAVE_BUFFER_IF_FULL + png_handle_eXIf(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif #ifdef PNG_READ_sRGB_SUPPORTED else if (chunk_name == png_sRGB) { diff --git a/Build/source/libs/libpng/libpng-src/pngread.c b/Build/source/libs/libpng/libpng-src/pngread.c index 008a41856b6..07a39df6e2e 100644 --- a/Build/source/libs/libpng/libpng-src/pngread.c +++ b/Build/source/libs/libpng/libpng-src/pngread.c @@ -568,7 +568,11 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) #endif #ifdef PNG_READ_TRANSFORMS_SUPPORTED - if (png_ptr->transformations || png_ptr->num_palette_max >= 0) + if (png_ptr->transformations +# ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED + || png_ptr->num_palette_max >= 0 +# endif + ) png_do_read_transformations(png_ptr, &row_info); #endif diff --git a/Build/source/libs/libpng/libpng-src/pngrtran.c b/Build/source/libs/libpng/libpng-src/pngrtran.c index 16474741aac..1526123e025 100644 --- a/Build/source/libs/libpng/libpng-src/pngrtran.c +++ b/Build/source/libs/libpng/libpng-src/pngrtran.c @@ -297,14 +297,13 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode, output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/); - /* Validate the value to ensure it is in a reasonable range. The value + /* Validate the value to ensure it is in a reasonable range. The value * is expected to be 1 or greater, but this range test allows for some - * viewing correction values. The intent is to weed out users of this API - * who use the inverse of the gamma value accidentally! Since some of these - * values are reasonable this may have to be changed: + * viewing correction values. The intent is to weed out the API users + * who might use the inverse of the gamma value accidentally! * - * 1.6.x: changed from 0.07..3 to 0.01..100 (to accommodate the optimal 16-bit - * gamma of 36, and its reciprocal.) + * In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate + * the optimal 16-bit gamma of 36 and its reciprocal. */ if (output_gamma < 1000 || output_gamma > 10000000) png_error(png_ptr, "output gamma out of expected range"); @@ -441,7 +440,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, int i; png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); for (i = 0; i < num_palette; i++) png_ptr->quantize_index[i] = (png_byte)i; } @@ -458,7 +457,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize an array to sort colors */ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) @@ -592,11 +591,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * - (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * - (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); /* Initialize the sort array */ for (i = 0; i < num_palette; i++) @@ -761,12 +758,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, size_t num_entries = ((size_t)1 << total_bits); png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr, - (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); + (png_alloc_size_t)(num_entries)); - distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries * - (sizeof (png_byte)))); + distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)num_entries); - memset(distance, 0xff, num_entries * (sizeof (png_byte))); + memset(distance, 0xff, num_entries); for (i = 0; i < num_palette; i++) { diff --git a/Build/source/libs/libpng/libpng-src/pngtest.c b/Build/source/libs/libpng/libpng-src/pngtest.c index d9675010249..45ef66a7015 100644 --- a/Build/source/libs/libpng/libpng-src/pngtest.c +++ b/Build/source/libs/libpng/libpng-src/pngtest.c @@ -1,5 +1,5 @@ -/* pngtest.c - a simple test program to test libpng +/* pngtest.c - a test program for libpng * * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson @@ -37,73 +37,91 @@ #include <stdlib.h> #include <string.h> -/* Defined so I can write to a file on gui/windowing platforms */ -/* #define STDERR stderr */ -#define STDERR stdout /* For DOS */ +#ifdef PNG_ZLIB_HEADER +# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */ +#else +# include <zlib.h> +#endif #include "png.h" -/* Known chunks that exist in pngtest.png must be supported or pngtest will fail - * simply as a result of re-ordering them. This may be fixed in 1.7 +/* Generate a compiler error if there is an old png.h in the search path. */ +typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43; + +/* Ensure that all version numbers in png.h are consistent with one another. */ +#if (PNG_LIBPNG_VER != PNG_LIBPNG_VER_MAJOR * 10000 + \ + PNG_LIBPNG_VER_MINOR * 100 + \ + PNG_LIBPNG_VER_RELEASE) || \ + (PNG_LIBPNG_VER_SHAREDLIB != PNG_LIBPNG_VER_MAJOR * 10 + \ + PNG_LIBPNG_VER_MINOR) || \ + (PNG_LIBPNG_VER_SHAREDLIB != PNG_LIBPNG_VER_SONUM) || \ + (PNG_LIBPNG_VER_SHAREDLIB != PNG_LIBPNG_VER_DLLNUM) +# error "Inconsistent version numbers in png.h" +#endif + +/* In version 1.6.1, we added support for the configure test harness, which + * uses 77 to indicate a skipped test. On the other hand, in cmake build tests, + * we still need to succeed on a skipped test, so: + */ +#if defined(HAVE_CONFIG_H) +# define SKIP 77 +#else +# define SKIP 0 +#endif + +/* Known chunks that exist in pngtest.png must be supported, or pngtest will + * fail simply as a result of re-ordering them. This may be fixed in the next + * generation of libpng. * * pngtest allocates a single row buffer for each row and overwrites it, * therefore if the write side doesn't support the writing of interlaced images * nothing can be done for an interlaced image (and the code below will fail * horribly trying to write extra data after writing garbage). */ -#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\ - defined PNG_READ_bKGD_SUPPORTED &&\ - defined PNG_READ_cHRM_SUPPORTED &&\ - defined PNG_READ_gAMA_SUPPORTED &&\ - defined PNG_READ_oFFs_SUPPORTED &&\ - defined PNG_READ_pCAL_SUPPORTED &&\ - defined PNG_READ_pHYs_SUPPORTED &&\ - defined PNG_READ_sBIT_SUPPORTED &&\ - defined PNG_READ_sCAL_SUPPORTED &&\ - defined PNG_READ_sRGB_SUPPORTED &&\ - defined PNG_READ_sPLT_SUPPORTED &&\ - defined PNG_READ_tEXt_SUPPORTED &&\ - defined PNG_READ_tIME_SUPPORTED &&\ - defined PNG_READ_zTXt_SUPPORTED &&\ - (defined PNG_WRITE_INTERLACING_SUPPORTED || PNG_LIBPNG_VER >= 10700) - -#ifdef PNG_ZLIB_HEADER -# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */ -#else -# include "zlib.h" -#endif +#if defined PNG_READ_SUPPORTED && /* else nothing can be done */ \ + defined PNG_READ_bKGD_SUPPORTED && \ + defined PNG_READ_cHRM_SUPPORTED && \ + defined PNG_READ_gAMA_SUPPORTED && \ + defined PNG_READ_oFFs_SUPPORTED && \ + defined PNG_READ_pCAL_SUPPORTED && \ + defined PNG_READ_pHYs_SUPPORTED && \ + defined PNG_READ_sBIT_SUPPORTED && \ + defined PNG_READ_sCAL_SUPPORTED && \ + defined PNG_READ_sRGB_SUPPORTED && \ + defined PNG_READ_sPLT_SUPPORTED && \ + defined PNG_READ_tEXt_SUPPORTED && \ + defined PNG_READ_tIME_SUPPORTED && \ + defined PNG_READ_zTXt_SUPPORTED && \ + (defined PNG_WRITE_INTERLACING_SUPPORTED || PNG_LIBPNG_VER >= 10700) /* Copied from pngpriv.h but only used in error messages below. */ #ifndef PNG_ZBUF_SIZE # define PNG_ZBUF_SIZE 8192 #endif -#define FCLOSE(file) fclose(file) #ifndef PNG_STDIO_SUPPORTED -typedef FILE * png_FILE_p; +typedef FILE * png_FILE_p; #endif -/* Makes pngtest verbose so we can find problems. */ +/* This hack was introduced for historical reasons, and we are + * still keeping it in libpng-1.6.x for compatibility reasons. + */ +#define STDERR stdout + #ifndef PNG_DEBUG # define PNG_DEBUG 0 #endif #if PNG_DEBUG > 1 -# define pngtest_debug(m) ((void)fprintf(stderr, m "\n")) -# define pngtest_debug1(m,p1) ((void)fprintf(stderr, m "\n", p1)) -# define pngtest_debug2(m,p1,p2) ((void)fprintf(stderr, m "\n", p1, p2)) -#else -# define pngtest_debug(m) ((void)0) -# define pngtest_debug1(m,p1) ((void)0) -# define pngtest_debug2(m,p1,p2) ((void)0) -#endif - -#if !PNG_DEBUG -# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */ -#endif - -#ifndef PNG_UNUSED -# define PNG_UNUSED(param) (void)param; +# define pngtest_debug(m) ((void)fprintf(stderr, m "\n")) +# define pngtest_debug1(m, p1) ((void)fprintf(stderr, m "\n", p1)) +# define pngtest_debug2(m, p1, p2) ((void)fprintf(stderr, m "\n", p1, p2)) +#elif PNG_DEBUG == 0 || PNG_DEBUG == 1 +# define pngtest_debug(m) ((void)0) +# define pngtest_debug1(m, p1) ((void)0) +# define pngtest_debug2(m, p1, p2) ((void)0) +#else /* PNG_DEBUG < 0 */ +# error "Bad PNG_DEBUG value" #endif /* Turn on CPU timing @@ -120,25 +138,11 @@ static float t_start, t_stop, t_decode, t_encode, t_misc; #endif #ifdef PNG_TIME_RFC1123_SUPPORTED -#define PNG_tIME_STRING_LENGTH 29 static int tIME_chunk_present = 0; -static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present"; - -#if PNG_LIBPNG_VER < 10619 -#define png_convert_to_rfc1123_buffer(ts, t) tIME_to_str(read_ptr, ts, t) - -static int -tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t) -{ - png_const_charp str = png_convert_to_rfc1123(png_ptr, t); - - if (str == NULL) - return 0; - - strcpy(ts, str); - return 1; -} -#endif /* older libpng */ +static char tIME_string[29] = "tIME chunk is not present"; +/* This use case is deprecated. + * See the declaration of png_convert_to_rfc1123_buffer for more details. + */ #endif static int verbose = 0; @@ -149,22 +153,6 @@ static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */ static int error_count = 0; /* count calls to png_error */ static int warning_count = 0; /* count calls to png_warning */ -/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */ -#ifndef png_jmpbuf -# define png_jmpbuf(png_ptr) png_ptr->jmpbuf -#endif - -/* Defines for unknown chunk handling if required. */ -#ifndef PNG_HANDLE_CHUNK_ALWAYS -# define PNG_HANDLE_CHUNK_ALWAYS 3 -#endif -#ifndef PNG_HANDLE_CHUNK_IF_SAFE -# define PNG_HANDLE_CHUNK_IF_SAFE 2 -#endif - -/* Utility to save typing/errors, the argument must be a name */ -#define MEMZERO(var) ((void)memset(&var, 0, sizeof var)) - /* Example of using row callbacks to make a simple progress meter */ static int status_pass = 1; static int status_dots_requested = 0; @@ -173,8 +161,13 @@ static int status_dots = 1; static void PNGCBAPI read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { - if (png_ptr == NULL || row_number > PNG_UINT_31_MAX) - return; + /* The callback should always receive correct parameters. */ + if (png_ptr == NULL) + png_error(png_ptr, "read_row_callback: bad png_ptr"); + if (row_number > PNG_UINT_31_MAX) + png_error(png_ptr, "read_row_callback: bad row number"); + if (pass < 0 || pass > 7) + png_error(png_ptr, "read_row_callback: bad pass"); if (status_pass != pass) { @@ -188,7 +181,7 @@ read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) if (status_dots == 0) { fprintf(stdout, "\n "); - status_dots=30; + status_dots = 30; } fprintf(stdout, "r"); @@ -198,8 +191,13 @@ read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) static void PNGCBAPI write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { - if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) - return; + /* The callback should always receive correct parameters. */ + if (png_ptr == NULL) + png_error(png_ptr, "write_row_callback: bad png_ptr"); + if (row_number > PNG_UINT_31_MAX) + png_error(png_ptr, "write_row_callback: bad row number"); + if (pass < 0 || pass > 7) + png_error(png_ptr, "write_row_callback: bad pass"); fprintf(stdout, "w"); } @@ -212,9 +210,13 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) static void PNGCBAPI read_user_callback(png_structp png_ptr, png_row_infop row_info, png_bytep data) { - PNG_UNUSED(png_ptr) - PNG_UNUSED(row_info) - PNG_UNUSED(data) + /* The callback should always receive correct parameters. */ + if (png_ptr == NULL) + png_error(png_ptr, "read_user_callback: bad png_ptr"); + if (row_info == NULL) + png_error(png_ptr, "read_user_callback: bad row info"); + if (data == NULL) + png_error(png_ptr, "read_user_callback: bad data"); } #endif @@ -229,8 +231,14 @@ static void PNGCBAPI count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) { png_bytep dp = data; + + /* The callback should always receive correct parameters. */ if (png_ptr == NULL) - return; + png_error(png_ptr, "count_zero_samples: bad png_ptr"); + if (row_info == NULL) + png_error(png_ptr, "count_zero_samples: bad row info"); + if (data == NULL) + png_error(png_ptr, "count_zero_samples: bad data"); /* Contents of row_info: * png_uint_32 width width of row @@ -248,7 +256,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) int pos = 0; png_uint_32 n, nstop; - for (n = 0, nstop=row_info->width; n<nstop; n++) + for (n = 0, nstop = row_info->width; n < nstop; n++) { if (row_info->bit_depth == 1) { @@ -294,7 +302,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) { if ((*dp | *(dp+1)) == 0) zero_samples++; - dp+=2; + dp += 2; } } } @@ -306,7 +314,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) if (row_info->color_type > 3) color_channels--; - for (n = 0, nstop=row_info->width; n<nstop; n++) + for (n = 0, nstop = row_info->width; n < nstop; n++) { for (channel = 0; channel < color_channels; channel++) { @@ -319,7 +327,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) if ((*dp | *(dp+1)) == 0) zero_samples++; - dp+=2; + dp += 2; } } if (row_info->color_type > 3) @@ -346,9 +354,6 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) #ifdef PNG_IO_STATE_SUPPORTED void pngtest_check_io_state(png_structp png_ptr, size_t data_length, - png_uint_32 io_op); -void -pngtest_check_io_state(png_structp png_ptr, size_t data_length, png_uint_32 io_op) { png_uint_32 io_state = png_get_io_state(png_ptr); @@ -361,7 +366,7 @@ pngtest_check_io_state(png_structp png_ptr, size_t data_length, /* Check if the buffer size specific to the current location * (file signature / header / data / crc) is as expected. */ - switch (io_state & PNG_IO_MASK_LOC) + switch ((io_state & PNG_IO_MASK_LOC) != 0) { case PNG_IO_SIGNATURE: if (data_length > 8) @@ -391,19 +396,18 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, size_t length) size_t check = 0; png_voidp io_ptr; + if (png_ptr == NULL) + png_error(png_ptr, "pngtest_read_data: bad png_ptr"); + /* fread() returns 0 on error, so it is OK to store this in a size_t * instead of an int, which is what fread() actually returns. */ io_ptr = png_get_io_ptr(png_ptr); if (io_ptr != NULL) - { check = fread(data, 1, length, (png_FILE_p)io_ptr); - } if (check != length) - { png_error(png_ptr, "Read Error"); - } #ifdef PNG_IO_STATE_SUPPORTED pngtest_check_io_state(png_ptr, length, PNG_IO_READING); @@ -414,8 +418,10 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, size_t length) static void PNGCBAPI pngtest_flush(png_structp png_ptr) { + if (png_ptr == NULL) + png_error(png_ptr, "pngtest_flush: bad png_ptr"); + /* Do nothing; fflush() is said to be just a waste of energy. */ - PNG_UNUSED(png_ptr) /* Stifle compiler warning */ } #endif @@ -429,12 +435,13 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, size_t length) { size_t check; + if (png_ptr == NULL) + png_error(png_ptr, "pngtest_write_data: bad png_ptr"); + check = fwrite(data, 1, length, (png_FILE_p)png_get_io_ptr(png_ptr)); if (check != length) - { png_error(png_ptr, "Write Error"); - } #ifdef PNG_IO_STATE_SUPPORTED pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING); @@ -537,7 +544,7 @@ PNGCBAPI png_debug_malloc(png_structp png_ptr, png_alloc_size_t size) pinfo->size = size; current_allocation += size; total_allocation += size; - num_allocations ++; + ++num_allocations; if (current_allocation > maximum_allocation) maximum_allocation = current_allocation; @@ -635,15 +642,14 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) /* (sTER is a public chunk not yet known by libpng. vpAg is a private chunk used in ImageMagick to store "virtual page" size). */ -static struct user_chunk_data +typedef struct user_chunk_info_def { png_const_infop info_ptr; png_uint_32 vpAg_width, vpAg_height; png_byte vpAg_units; png_byte sTER_mode; int location[2]; -} -user_chunk_data; +} user_chunk_info; /* Used for location and order; zero means nothing. */ #define have_sTER 0x01 @@ -653,37 +659,38 @@ user_chunk_data; #define after_IDAT 0x40 static void -init_callback_info(png_const_infop info_ptr) +init_user_chunk_info(png_const_infop info_ptr, user_chunk_info *chunk_data) { - MEMZERO(user_chunk_data); - user_chunk_data.info_ptr = info_ptr; + memset(chunk_data, 0, sizeof(*chunk_data)); + chunk_data->info_ptr = info_ptr; } static int -set_location(png_structp png_ptr, struct user_chunk_data *data, int what) +set_chunk_location(png_structp png_ptr, user_chunk_info *chunk_data, int what) { int location; - if ((data->location[0] & what) != 0 || (data->location[1] & what) != 0) - return 0; /* already have one of these */ + if ((chunk_data->location[0] & what) != 0 || + (chunk_data->location[1] & what) != 0) + return 0; /* we already have one of these */ /* Find where we are (the code below zeroes info_ptr to indicate that the * chunks before the first IDAT have been read.) */ - if (data->info_ptr == NULL) /* after IDAT */ + if (chunk_data->info_ptr == NULL) /* after IDAT */ location = what | after_IDAT; - else if (png_get_valid(png_ptr, data->info_ptr, PNG_INFO_PLTE) != 0) + else if (png_get_valid(png_ptr, chunk_data->info_ptr, PNG_INFO_PLTE) != 0) location = what | before_IDAT; else location = what | before_PLTE; - if (data->location[0] == 0) - data->location[0] = location; + if (chunk_data->location[0] == 0) + chunk_data->location[0] = location; else - data->location[1] = location; + chunk_data->location[1] = location; return 1; /* handled */ } @@ -691,11 +698,11 @@ set_location(png_structp png_ptr, struct user_chunk_data *data, int what) static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk) { - struct user_chunk_data *my_user_chunk_data = - (struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr); + user_chunk_info *my_user_chunk_data = + (user_chunk_info*)png_get_user_chunk_ptr(png_ptr); if (my_user_chunk_data == NULL) - png_error(png_ptr, "lost user chunk pointer"); + png_error(png_ptr, "lost pointer to user chunk data"); /* Return one of the following: * return -n; chunk had an error @@ -720,9 +727,9 @@ read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk) if (chunk->data[0] != 0 && chunk->data[0] != 1) return -1; /* Invalid mode */ - if (set_location(png_ptr, my_user_chunk_data, have_sTER) != 0) + if (set_chunk_location(png_ptr, my_user_chunk_data, have_sTER) != 0) { - my_user_chunk_data->sTER_mode=chunk->data[0]; + my_user_chunk_data->sTER_mode = chunk->data[0]; return 1; } @@ -739,7 +746,7 @@ read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk) if (chunk->size != 9) return -1; /* Error return */ - if (set_location(png_ptr, my_user_chunk_data, have_vpAg) == 0) + if (set_chunk_location(png_ptr, my_user_chunk_data, have_vpAg) == 0) return 0; /* duplicate vpAg */ my_user_chunk_data->vpAg_width = png_get_uint_31(png_ptr, chunk->data); @@ -751,18 +758,18 @@ read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk) #ifdef PNG_WRITE_SUPPORTED static void -write_sTER_chunk(png_structp write_ptr) +write_sTER_chunk(png_structp write_ptr, user_chunk_info *data) { png_byte sTER[5] = {115, 84, 69, 82, '\0'}; if (verbose != 0) - fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode); + fprintf(STDERR, "\n stereo mode = %d\n", data->sTER_mode); - png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1); + png_write_chunk(write_ptr, sTER, &data->sTER_mode, 1); } static void -write_vpAg_chunk(png_structp write_ptr) +write_vpAg_chunk(png_structp write_ptr, user_chunk_info *data) { png_byte vpAg[5] = {118, 112, 65, 103, '\0'}; @@ -770,18 +777,18 @@ write_vpAg_chunk(png_structp write_ptr) if (verbose != 0) fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n", - (unsigned long)user_chunk_data.vpAg_width, - (unsigned long)user_chunk_data.vpAg_height, - user_chunk_data.vpAg_units); + (unsigned long)data->vpAg_width, + (unsigned long)data->vpAg_height, + data->vpAg_units); - png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width); - png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height); - vpag_chunk_data[8] = user_chunk_data.vpAg_units; + png_save_uint_32(vpag_chunk_data, data->vpAg_width); + png_save_uint_32(vpag_chunk_data + 4, data->vpAg_height); + vpag_chunk_data[8] = data->vpAg_units; png_write_chunk(write_ptr, vpAg, vpag_chunk_data, 9); } static void -write_chunks(png_structp write_ptr, int location) +write_chunks(png_structp write_ptr, user_chunk_info *data, int location) { int i; @@ -791,13 +798,13 @@ write_chunks(png_structp write_ptr, int location) * vpAg chunks, resulting in an error later. This is not worth worrying * about - the chunks should not be duplicated! */ - for (i=0; i<2; ++i) + for (i = 0; i < 2; ++i) { - if (user_chunk_data.location[i] == (location | have_sTER)) - write_sTER_chunk(write_ptr); + if (data->location[i] == (location | have_sTER)) + write_sTER_chunk(write_ptr, data); - else if (user_chunk_data.location[i] == (location | have_vpAg)) - write_vpAg_chunk(write_ptr); + else if (data->location[i] == (location | have_vpAg)) + write_vpAg_chunk(write_ptr, data); } } #endif /* WRITE */ @@ -872,9 +879,9 @@ test_one_file(const char *inname, const char *outname) png_bytep row_buf; png_uint_32 y; png_uint_32 width, height; - volatile int num_passes; - int pass; int bit_depth, color_type; + user_chunk_info my_user_chunk_data; + int pass, num_passes; row_buf = NULL; error_parameters.file_name = inname; @@ -888,7 +895,7 @@ test_one_file(const char *inname, const char *outname) if ((fpout = fopen(outname, "wb")) == NULL) { fprintf(STDERR, "Could not open output file %s\n", outname); - FCLOSE(fpin); + fclose(fpin); return 1; } @@ -925,8 +932,8 @@ test_one_file(const char *inname, const char *outname) #endif #ifdef PNG_READ_USER_CHUNKS_SUPPORTED - init_callback_info(read_info_ptr); - png_set_read_user_chunk_fn(read_ptr, &user_chunk_data, + init_user_chunk_info(read_info_ptr, &my_user_chunk_data); + png_set_read_user_chunk_fn(read_ptr, &my_user_chunk_data, read_user_chunk_callback); #endif @@ -946,8 +953,8 @@ test_one_file(const char *inname, const char *outname) png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr); #endif - FCLOSE(fpin); - FCLOSE(fpout); + fclose(fpin); + fclose(fpout); return 1; } @@ -966,8 +973,8 @@ test_one_file(const char *inname, const char *outname) fprintf(STDERR, " destroying write structs\n"); png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr); - FCLOSE(fpin); - FCLOSE(fpout); + fclose(fpin); + fclose(fpout); return 1; } #endif @@ -1053,13 +1060,13 @@ test_one_file(const char *inname, const char *outname) #endif #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED - /* Preserve all the unknown chunks, if possible. If this is disabled then, + /* Preserve all the unknown chunks, if possible. If this is disabled, then * even if the png_{get,set}_unknown_chunks stuff is enabled, we can't use * libpng to *save* the unknown chunks on read (because we can't switch the * save option on!) * - * Notice that if SET_UNKNOWN_CHUNKS is *not* supported read will discard all - * unknown chunks and write will write them all. + * Notice that if SET_UNKNOWN_CHUNKS is *not* supported, the reader will + * discard all unknown chunks, and the writer will write them all. */ #ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS, @@ -1080,7 +1087,7 @@ test_one_file(const char *inname, const char *outname) * remove the info_ptr (which is only used to determine position relative to * PLTE) here to indicate that we are after the IDAT. */ - user_chunk_data.info_ptr = NULL; + my_user_chunk_data.info_ptr = NULL; #endif pngtest_debug("Transferring info struct"); @@ -1196,14 +1203,12 @@ test_one_file(const char *inname, const char *outname) png_color_16p background; if (png_get_bKGD(read_ptr, read_info_ptr, &background) != 0) - { png_set_bKGD(write_ptr, write_info_ptr, background); - } } #endif #ifdef PNG_READ_eXIf_SUPPORTED { - png_bytep exif=NULL; + png_bytep exif = NULL; png_uint_32 exif_length; if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0) @@ -1232,9 +1237,7 @@ test_one_file(const char *inname, const char *outname) if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y, &unit_type) != 0) - { png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type); - } } #endif #ifdef PNG_pCAL_SUPPORTED @@ -1246,10 +1249,8 @@ test_one_file(const char *inname, const char *outname) if (png_get_pCAL(read_ptr, read_info_ptr, &purpose, &X0, &X1, &type, &nparams, &units, ¶ms) != 0) - { png_set_pCAL(write_ptr, write_info_ptr, purpose, X0, X1, type, nparams, units, params); - } } #endif #ifdef PNG_pHYs_SUPPORTED @@ -1279,9 +1280,7 @@ test_one_file(const char *inname, const char *outname) if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width, &scal_height) != 0) - { png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height); - } } #else #ifdef PNG_FIXED_POINT_SUPPORTED @@ -1304,11 +1303,9 @@ test_one_file(const char *inname, const char *outname) { png_sPLT_tp entries; - int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries); - if (num_entries) - { + int num_entries = png_get_sPLT(read_ptr, read_info_ptr, &entries); + if (num_entries != 0) png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries); - } } #endif @@ -1328,7 +1325,7 @@ test_one_file(const char *inname, const char *outname) int i; fprintf(STDERR,"\n"); - for (i=0; i<num_text; i++) + for (i = 0; i < num_text; i++) { fprintf(STDERR," Text compression[%d]=%d\n", i, text_ptr[i].compression); @@ -1390,22 +1387,8 @@ test_one_file(const char *inname, const char *outname) &unknowns); if (num_unknowns != 0) - { png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns, num_unknowns); -#if PNG_LIBPNG_VER < 10600 - /* Copy the locations from the read_info_ptr. The automatically - * generated locations in write_end_info_ptr are wrong prior to 1.6.0 - * because they are reset from the write pointer (removed in 1.6.0). - */ - { - int i; - for (i = 0; i < num_unknowns; i++) - png_set_unknown_chunk_location(write_ptr, write_info_ptr, i, - unknowns[i].location); - } -#endif - } } #endif @@ -1417,15 +1400,15 @@ test_one_file(const char *inname, const char *outname) */ png_write_info_before_PLTE(write_ptr, write_info_ptr); - write_chunks(write_ptr, before_PLTE); /* before PLTE */ + write_chunks(write_ptr, &my_user_chunk_data, before_PLTE); /* before PLTE */ png_write_info(write_ptr, write_info_ptr); - write_chunks(write_ptr, before_IDAT); /* after PLTE */ + write_chunks(write_ptr, &my_user_chunk_data, before_IDAT); /* after PLTE */ png_write_info(write_ptr, write_end_info_ptr); - write_chunks(write_ptr, after_IDAT); /* after IDAT */ + write_chunks(write_ptr, &my_user_chunk_data, after_IDAT); /* after IDAT */ #ifdef PNG_COMPRESSION_COMPAT /* Test the 'compatibility' setting here, if it is available. */ @@ -1433,13 +1416,6 @@ test_one_file(const char *inname, const char *outname) #endif #endif -#ifdef SINGLE_ROWBUF_ALLOC - pngtest_debug("Allocating row buffer..."); - row_buf = (png_bytep)png_malloc(read_ptr, - png_get_rowbytes(read_ptr, read_info_ptr)); - - pngtest_debug1("\t%p", row_buf); -#endif /* SINGLE_ROWBUF_ALLOC */ pngtest_debug("Writing row data"); #if defined(PNG_READ_INTERLACING_SUPPORTED) &&\ @@ -1486,7 +1462,6 @@ test_one_file(const char *inname, const char *outname) pngtest_debug1("Writing row data for pass %d", pass); for (y = 0; y < pass_height; y++) { -#ifndef SINGLE_ROWBUF_ALLOC pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y); row_buf = (png_bytep)png_malloc(read_ptr, @@ -1495,7 +1470,6 @@ test_one_file(const char *inname, const char *outname) pngtest_debug2("\t%p (%lu bytes)", row_buf, (unsigned long)png_get_rowbytes(read_ptr, read_info_ptr)); -#endif /* !SINGLE_ROWBUF_ALLOC */ png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1); #ifdef PNG_WRITE_SUPPORTED @@ -1512,11 +1486,9 @@ test_one_file(const char *inname, const char *outname) #endif #endif /* WRITE */ -#ifndef SINGLE_ROWBUF_ALLOC pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y); png_free(read_ptr, row_buf); row_buf = NULL; -#endif /* !SINGLE_ROWBUF_ALLOC */ } } @@ -1548,7 +1520,7 @@ test_one_file(const char *inname, const char *outname) int i; fprintf(STDERR,"\n"); - for (i=0; i<num_text; i++) + for (i = 0; i < num_text; i++) { fprintf(STDERR," Text compression[%d]=%d\n", i, text_ptr[i].compression); @@ -1561,7 +1533,7 @@ test_one_file(const char *inname, const char *outname) #endif #ifdef PNG_READ_eXIf_SUPPORTED { - png_bytep exif=NULL; + png_bytep exif = NULL; png_uint_32 exif_length; if (png_get_eXIf_1(read_ptr, end_info_ptr, &exif_length, &exif) != 0) @@ -1604,22 +1576,8 @@ test_one_file(const char *inname, const char *outname) &unknowns); if (num_unknowns != 0) - { png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns, num_unknowns); -#if PNG_LIBPNG_VER < 10600 - /* Copy the locations from the read_info_ptr. The automatically - * generated locations in write_end_info_ptr are wrong prior to 1.6.0 - * because they are reset from the write pointer (removed in 1.6.0). - */ - { - int i; - for (i = 0; i < num_unknowns; i++) - png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i, - unknowns[i].location); - } -#endif - } } #endif @@ -1638,7 +1596,7 @@ test_one_file(const char *inname, const char *outname) * There seems to be no way round this, however vpAg/sTER are not expected * after IDAT. */ - write_chunks(write_ptr, after_IDAT); + write_chunks(write_ptr, &my_user_chunk_data, after_IDAT); png_write_end(write_ptr, write_end_info_ptr); #endif @@ -1655,11 +1613,6 @@ test_one_file(const char *inname, const char *outname) #endif pngtest_debug("Destroying data structs"); -#ifdef SINGLE_ROWBUF_ALLOC - pngtest_debug("Destroying row_buf for read_ptr"); - png_free(read_ptr, row_buf); - row_buf = NULL; -#endif /* SINGLE_ROWBUF_ALLOC */ pngtest_debug("Destroying read_ptr, read_info_ptr, end_info_ptr"); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); #ifdef PNG_WRITE_SUPPORTED @@ -1670,8 +1623,8 @@ test_one_file(const char *inname, const char *outname) #endif pngtest_debug("Destruction complete."); - FCLOSE(fpin); - FCLOSE(fpout); + fclose(fpin); + fclose(fpout); /* Summarize any warnings or errors and in 'strict' mode fail the test. * Unsupported chunks can result in warnings, in that case ignore the strict @@ -1717,7 +1670,7 @@ test_one_file(const char *inname, const char *outname) if ((fpout = fopen(outname, "rb")) == NULL) { fprintf(STDERR, "Could not find file %s\n", outname); - FCLOSE(fpin); + fclose(fpin); return 1; } @@ -1753,8 +1706,8 @@ test_one_file(const char *inname, const char *outname) wrote_question = 1; } - FCLOSE(fpin); - FCLOSE(fpout); + fclose(fpin); + fclose(fpout); if (strict != 0 && unsupported_chunks == 0) return 1; @@ -1785,8 +1738,8 @@ test_one_file(const char *inname, const char *outname) wrote_question = 1; } - FCLOSE(fpin); - FCLOSE(fpout); + fclose(fpin); + fclose(fpout); /* NOTE: the unsupported_chunks escape is permitted here because * unsupported text chunk compression will result in the compression @@ -1803,8 +1756,8 @@ test_one_file(const char *inname, const char *outname) } #endif /* WRITE && WRITE_FILTER */ - FCLOSE(fpin); - FCLOSE(fpout); + fclose(fpin); + fclose(fpout); return 0; } @@ -1851,12 +1804,11 @@ main(int argc, char *argv[]) fprintf(STDERR, " NOTE: libpng compiled for max 64k, zlib not\n"); #endif - if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING)) + if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING) != 0) { - fprintf(STDERR, - "Warning: versions are different between png.h and png.c\n"); - fprintf(STDERR, " png.h version: %s\n", PNG_LIBPNG_VER_STRING); - fprintf(STDERR, " png.c version: %s\n\n", png_libpng_ver); + fprintf(STDERR, "Warning: mismatching versions of png.h and png.c\n"); + fprintf(STDERR, " png.h version string: %s\n", PNG_LIBPNG_VER_STRING); + fprintf(STDERR, " png.c version string: %s\n\n", png_libpng_ver); ++ierror; } @@ -1890,7 +1842,7 @@ main(int argc, char *argv[]) inname = argv[2]; strict++; relaxed = 0; - multiple=1; + multiple = 1; } else if (strcmp(argv[1], "--relaxed") == 0) @@ -1900,7 +1852,7 @@ main(int argc, char *argv[]) inname = argv[2]; strict = 0; relaxed++; - multiple=1; + multiple = 1; } else if (strcmp(argv[1], "--xfail") == 0) { @@ -1910,7 +1862,7 @@ main(int argc, char *argv[]) strict = 0; xfail++; relaxed++; - multiple=1; + multiple = 1; } else @@ -1942,7 +1894,7 @@ main(int argc, char *argv[]) #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG int allocation_now = current_allocation; #endif - for (i=2; i<argc; ++i) + for (i = 2; i < argc; ++i) { int kerror; fprintf(STDERR, "\n Testing %s:", argv[i]); @@ -2013,7 +1965,7 @@ main(int argc, char *argv[]) else { int i; - for (i = 0; i<3; ++i) + for (i = 0; i < 3; ++i) { int kerror; #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG @@ -2141,7 +2093,7 @@ main(int argc, char *argv[]) (unsigned long) png_get_chunk_malloc_max(dummy_ptr)); png_destroy_read_struct(&dummy_ptr, NULL, NULL); - return (int)(ierror != 0); + return (ierror != 0); } #else int @@ -2150,9 +2102,6 @@ main(void) fprintf(STDERR, " test ignored because libpng was not built with read support\n"); /* And skip this test */ - return PNG_LIBPNG_VER < 10600 ? 0 : 77; + return SKIP; } #endif - -/* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_42 Your_png_h_is_not_version_1_6_42; diff --git a/Build/source/libs/libpng/libpng-src/powerpc/.editorconfig b/Build/source/libs/libpng/libpng-src/powerpc/.editorconfig new file mode 100644 index 00000000000..de2e98ab42c --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/powerpc/.editorconfig @@ -0,0 +1,8 @@ +# https://editorconfig.org + +root = false + +# FIXME +[*.[ch]] +max_doc_length = unset +max_line_length = unset diff --git a/Build/source/libs/libpng/libpng-src/projects/.editorconfig b/Build/source/libs/libpng/libpng-src/projects/.editorconfig new file mode 100644 index 00000000000..dc99bd001ce --- /dev/null +++ b/Build/source/libs/libpng/libpng-src/projects/.editorconfig @@ -0,0 +1,3 @@ +# https://editorconfig.org + +root = true diff --git a/Build/source/libs/libpng/libpng-src/scripts/checksym.awk b/Build/source/libs/libpng/libpng-src/scripts/checksym.awk index 48e55e60e12..2ab52ecb3a9 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/checksym.awk +++ b/Build/source/libs/libpng/libpng-src/scripts/checksym.awk @@ -106,11 +106,13 @@ NF==2 && $2 ~ /^@[1-9][0-9]*$/ { # exported symbol # At the end check for symbols marked as both duplicated and removed END{ if (symbolo > lasto) { - print "highest symbol ordinal in png.h,", symbolo ", exceeds last ordinal from png.h", lasto + print "highest symbol ordinal in png.h,", + symbolo ", exceeds last ordinal from png.h", lasto err = 1 } if (mastero > lasto) { - print "highest symbol ordinal in", master ",", mastero ", exceeds last ordinal from png.h", lasto + print "highest symbol ordinal in", master ",", + mastero ", exceeds last ordinal from png.h", lasto err = 1 } unexported=0 @@ -149,17 +151,21 @@ END{ unexported = 0 } if (symbol[o] != "" && removed[o] != "") { - print "png.h: symbol", o, "both exported as '" symbol[o] "' and removed as '" removed[o] "'" + print "png.h: symbol", o, + "both exported as '" symbol[o] "' and removed as '" removed[o] "'" err = 1 } else if (symbol[o] != official[o]) { # either the symbol is missing somewhere or it changed err = 1 if (symbol[o] == "") - print "png.h: symbol", o, "is exported as '" official[o] "' in", master + print "png.h: symbol", o, + "is exported as '" official[o] "' in", master else if (official[o] == "") - print "png.h: exported symbol", o, "'" symbol[o] "' not present in", master + print "png.h: exported symbol", o, + "'" symbol[o] "' not present in", master else - print "png.h: exported symbol", o, "'" symbol[o] "' exists as '" official[o] "' in", master + print "png.h: exported symbol", o, + "'" symbol[o] "' exists as '" official[o] "' in", master } # Finally generate symbols.new diff --git a/Build/source/libs/libpng/libpng-src/scripts/cmake/AUTHORS.md b/Build/source/libs/libpng/libpng-src/scripts/cmake/AUTHORS.md index 1c1173ab3fa..641dde265f3 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/cmake/AUTHORS.md +++ b/Build/source/libs/libpng/libpng-src/scripts/cmake/AUTHORS.md @@ -5,8 +5,12 @@ Author List ----------- * Alex Gaynor + * Alexey Petruchik * Andreas Franek + * Andrew Hundt * B. Scott Michel + * Benjamin Buch + * Bernd Kuhls * Cameron Cawley * Christian Ehrlicher * Christopher Sean Morrison @@ -14,7 +18,9 @@ Author List * Clifford Yapp * Clinton Ingram * Cosmin Truta + * Dan Rosser * David Callu + * Gianfranco Costamagna * Gleb Mazovetskiy * Glenn Randers-Pehrson * Gunther Nikl @@ -24,6 +30,7 @@ Author List * Kyle Bentley * Martin Storsjö * Owen Rudge + * Philip Lowman * Roger Leigh * Roger Lowman * Sam Serrels diff --git a/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in b/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in index 5fde8aeaf23..37577f4134f 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in +++ b/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in @@ -11,7 +11,7 @@ # Modeled after libxml-config. -version=1.6.42 +version=1.6.43 prefix="" libdir="" libs="" diff --git a/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in b/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in index 2d578b68cc6..6a581d1a481 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in +++ b/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in @@ -5,6 +5,6 @@ includedir=@includedir@/libpng16 Name: libpng Description: Loads and saves PNG files -Version: 1.6.42 +Version: 1.6.43 Libs: -L${libdir} -lpng16 Cflags: -I${includedir} diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.32sunu b/Build/source/libs/libpng/libpng-src/scripts/makefile.32sunu index ea4894e7417..822e8a9235b 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.32sunu +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.32sunu @@ -1,6 +1,6 @@ # makefile for libpng on Solaris 2.x with cc # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -19,9 +19,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir -p LN_SF=ln -f -s RM_F=/bin/rm -f @@ -42,6 +41,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wstrict-prototypes -Wmissing-prototypes # -Wconversion CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g +ARFLAGS=rc LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ @@ -65,7 +65,7 @@ DELETE = $(RM_F) DFNFLAGS = $(DEFS) $(CPPFLAGS) libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.64sunu b/Build/source/libs/libpng/libpng-src/scripts/makefile.64sunu index 3f603d3f1d2..65414b6b577 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.64sunu +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.64sunu @@ -1,6 +1,6 @@ # makefile for libpng on Solaris 2.x with cc # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -19,9 +19,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir -p LN_SF=ln -f -s RM_F=/bin/rm -f @@ -41,7 +40,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes # -Wconversion CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS= $(SUN_CC_FLAGS) # $(WARNMORE) -g +CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g +ARFLAGS=rc LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ @@ -65,7 +65,7 @@ DELETE = $(RM_F) DFNFLAGS = $(DEFS) $(CPPFLAGS) libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.aix b/Build/source/libs/libpng/libpng-src/scripts/makefile.aix index f00734e9072..5b24f54fc79 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.aix +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.aix @@ -1,5 +1,5 @@ # makefile for libpng using gcc (generic, static library) -# Copyright (C) 2000, 2022 Cosmin Truta +# Copyright (C) 2000, 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. @@ -15,9 +15,8 @@ ZLIBLIB = ../zlib # Compiler, linker, lib and other tools CC = gcc LD = $(CC) -AR_RC = ar rcs +AR = ar RANLIB = ranlib -MKDIR_P = mkdir -p RM_F = rm -f LIBNAME = libpng16 @@ -26,6 +25,7 @@ PNGMAJ = 16 WARNMORE = CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS = rc LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g # File lists @@ -44,7 +44,7 @@ REMOVE = $(RM_F) DFNFLAGS = $(DEFS) $(CPPFLAGS) $(LIBNAME).a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ test: pngtest diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.amiga b/Build/source/libs/libpng/libpng-src/scripts/makefile.amiga index 2dae9af99ce..321c7112aa5 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.amiga +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.amiga @@ -26,8 +26,6 @@ LN= slink RM= delete quiet # library (.lib) file creation command AR= oml -# make directory command -MKDIR= makedir # Pre-built configuration # See scripts/pnglibconf.mak for more options diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.beos b/Build/source/libs/libpng/libpng-src/scripts/makefile.beos index e02bdc3f48a..fcc7f9caca8 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.beos +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.beos @@ -1,6 +1,6 @@ # makefile for libpng on BeOS x86 ELF with gcc # modified from makefile.linux by Sander Stoks -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -19,9 +19,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=gcc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p LN_SF=ln -sf CP=cp RM_F=/bin/rm -f @@ -42,6 +41,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # still here in R4.5 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=-O1 -funroll-loops $(ALIGN) -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS=rc # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz # -g @@ -66,7 +66,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.clang b/Build/source/libs/libpng/libpng-src/scripts/makefile.clang index 2e154236f6e..08aaccf8583 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.clang +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.clang @@ -1,5 +1,5 @@ # makefile for libpng using clang (generic, static library) -# Copyright (C) 2000, 2014, 2019-2022 Cosmin Truta +# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta # Copyright (C) 2008, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -14,7 +14,7 @@ ZLIBLIB = ../zlib # Compiler, linker, lib and other tools CC = clang LD = $(CC) -AR_RC = ar rcs +AR = ar RANLIB = ranlib CP = cp RM_F = rm -f @@ -28,6 +28,7 @@ WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \ DEFS = $(NOHWOPT) CPPFLAGS = -I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5 CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS = rc LDFLAGS = -L$(ZLIBLIB) # -g LIBS = -lz -lm @@ -60,7 +61,7 @@ shared: @false libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ test: pngtest$(EXEEXT) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.darwin b/Build/source/libs/libpng/libpng-src/scripts/makefile.darwin index 0c50b57e6f5..e68797e5e1f 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.darwin +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.darwin @@ -1,5 +1,5 @@ # makefile for libpng on Darwin / macOS -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2004, 2006, 2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 2001 Christoph Pfisterer # derived from makefile.linux: @@ -24,9 +24,8 @@ LIBSOMAJ=$(LIBNAME).$(PNGMAJ).dylib # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p LN_SF=ln -sf CP=cp RM_F=rm -f @@ -36,6 +35,7 @@ NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ DEFS=$(NOHWOPT) CPPFLAGS=-I$(ZLIBINC) $(DEFS) CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef +ARFLAGS=rc LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz # Pre-built configuration @@ -63,7 +63,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.dec b/Build/source/libs/libpng/libpng-src/scripts/makefile.dec index b788b5aa39d..2cca020df6a 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.dec +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.dec @@ -1,5 +1,5 @@ # makefile for libpng on DEC Alpha Unix -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2000-2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -17,9 +17,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir LN_SF=ln -f -s CP=cp RM_F=/bin/rm -f @@ -32,6 +31,7 @@ ZLIBINC=../zlib CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=-std -w1 -O # -g +ARFLAGS=rc LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm # Pre-built configuration @@ -51,7 +51,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.dj2 b/Build/source/libs/libpng/libpng-src/scripts/makefile.dj2 index ff0d33286ff..3767150978a 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.dj2 +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.dj2 @@ -1,5 +1,5 @@ # DJGPP (DOS gcc) makefile for libpng -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2009-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -8,8 +8,11 @@ # and license in png.h CC=gcc +AR=ar +RANLIB=ranlib CPPFLAGS=-I../zlib -DPNG_NO_SNPRINTF CFLAGS=-O +ARFLAGS=rc LDFLAGS=-L. -L../zlib/ -lpng -lz -lm CP=cp @@ -32,8 +35,8 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - ar rc $@ $(OBJS) - ranlib $@ + $(AR) $(ARFLAGS) $@ $(OBJS) + $(RANLIB) $@ pngtest: pngtest.o libpng.a $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.emcc b/Build/source/libs/libpng/libpng-src/scripts/makefile.emcc index 5d27621c070..1ab01b8db75 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.emcc +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.emcc @@ -1,5 +1,5 @@ # makefile for libpng using emscripten -# Copyright (C) 2000, 2014, 2019-2022 Cosmin Truta +# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta # Copyright (C) 2021 Kirk Roerig # Copyright (C) 2008, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. @@ -15,13 +15,14 @@ ZLIBLIB = ../zlib # Compiler, linker, lib and other tools CC = emcc LD = $(CC) -AR_RC = emar rcs +AR = emar RANLIB = emranlib CP = cp RM_F = rm -f CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS = -O2 -Wall -Wextra -Wundef +ARFLAGS = rc LDFLAGS = -L$(ZLIBLIB) PNGTEST_LDFLAGS = --preload-file=pngtest.png LIBS = -lz -lm @@ -51,7 +52,7 @@ shared: @false libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ test: pngtest diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.gcc b/Build/source/libs/libpng/libpng-src/scripts/makefile.gcc index b215a70fbe7..fc0a1a09076 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.gcc +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.gcc @@ -1,5 +1,5 @@ # makefile for libpng using gcc (generic, static library) -# Copyright (C) 2000, 2014, 2019-2022 Cosmin Truta +# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta # Copyright (C) 2008, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -14,7 +14,7 @@ ZLIBLIB = ../zlib # Compiler, linker, lib and other tools CC = gcc LD = $(CC) -AR_RC = ar rcs +AR = ar RANLIB = ranlib CP = cp RM_F = rm -f @@ -28,6 +28,7 @@ WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \ DEFS = $(NOHWOPT) CPPFLAGS = -I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5 CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS = rc LDFLAGS = -L$(ZLIBLIB) # -g LIBS = -lz -lm @@ -60,7 +61,7 @@ shared: @false libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ test: pngtest$(EXEEXT) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.hp64 b/Build/source/libs/libpng/libpng-src/scripts/makefile.hp64 index e9c0a6938fc..c974d2f3345 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.hp64 +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.hp64 @@ -1,5 +1,5 @@ # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 1999-2002, 2006, 2009, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard @@ -29,9 +29,8 @@ LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p LN_SF=ln -sf CP=cp RM_F=/bin/rm -f @@ -41,7 +40,7 @@ CPPFLAGS=-I$(ZLIBINC) \ CFLAGS=-O -Ae -Wl,+vnocompatwarnings +DD64 +Z # Caution: be sure you have built zlib with the same CFLAGS. CCFLAGS=-O -Ae -Wl,+vnocompatwarnings +DD64 +Z - +ARFLAGS=rc LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm # Pre-built configuration @@ -68,7 +67,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.hpgcc b/Build/source/libs/libpng/libpng-src/scripts/makefile.hpgcc index 3686bd0ae0a..a24fb933986 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.hpgcc +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.hpgcc @@ -1,5 +1,5 @@ # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker. -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 2001, Laurent faillie # Copyright (C) 1998, 1999 Greg Roelofs @@ -19,10 +19,9 @@ LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ) # Utilities: CC=gcc -LD=ld -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p +LD=ld LN_SF=ln -sf CP=cp RM_F=/bin/rm -f @@ -44,6 +43,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS=rc #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g @@ -64,7 +64,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) all: libpng.a $(LIBSO) pngtest libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.hpux b/Build/source/libs/libpng/libpng-src/scripts/makefile.hpux index 59041f02a69..c3950ae3f5b 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.hpux +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.hpux @@ -1,5 +1,5 @@ # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard @@ -30,9 +30,8 @@ LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p LN_SF=ln -sf RM_F=/bin/rm -f @@ -40,6 +39,7 @@ CPPFLAGS=-I$(ZLIBINC) CFLAGS=-O -Ae +DA1.1 +DS2.0 # Caution: be sure you have built zlib with the same CFLAGS. CCFLAGS=-O -Ae +DA1.1 +DS2.0 +ARFLAGS=rc LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm # Pre-built configuration @@ -66,7 +66,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.linux b/Build/source/libs/libpng/libpng-src/scripts/makefile.linux index 3fece3d6c93..c49cdde9d21 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.linux +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.linux @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng16.so on Linux ELF with gcc -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and # Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger @@ -18,9 +18,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=gcc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p LN_SF=ln -sf CP=cp RM_F=rm -f @@ -40,6 +39,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ DEFS=$(NOHWOPT) CPPFLAGS=-I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5 CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS=rc LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm # -g @@ -68,7 +68,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.mips b/Build/source/libs/libpng/libpng-src/scripts/makefile.mips index ca50f6077c2..45de36d46f3 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.mips +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.mips @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 1998-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -8,15 +8,15 @@ # and license in png.h CC=cc +AR=ar +#RANLIB=ranlib +RANLIB=echo CPPFLAGS=-I../zlib -DSYSV -Dmips CFLAGS=-O -systype sysv -w #CFLAGS=-O +ARFLAGS=rc LDFLAGS=-L. -L../zlib/ -lpng -lz -lm -AR_RC=ar rc -#RANLIB=ranlib -RANLIB=echo - # Pre-built configuration # See scripts/pnglibconf.mak for more options PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt @@ -34,7 +34,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) cp $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ pngtest: pngtest.o libpng.a diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.msys b/Build/source/libs/libpng/libpng-src/scripts/makefile.msys index e2878233c2e..8ebcaab9920 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.msys +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.msys @@ -1,5 +1,5 @@ # makefile for libpng using MSYS/gcc (shared, static library) -# Copyright (C) 2019-2022 Cosmin Truta +# Copyright (C) 2000, 2019-2024 Cosmin Truta # Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler # # Portions taken from makefile.linux and makefile.gcc: @@ -30,20 +30,20 @@ ZLIBINC=/usr/local/include # Compiler, linker, lib and other tools CC = gcc LD = $(CC) -AR_RC = ar rcs +AR = ar RANLIB = ranlib CP = cp RM_F = rm -rf -MKDIR_P=mkdir -p -LN_SF=ln -sf +LN_SF = ln -sf CPPFLAGS = # -DPNG_DEBUG=5 CFLAGS = -O2 -Wall -Wextra -Wundef # -g +ARFLAGS = rc LDFLAGS = # -g LIBS = -lz -lm # File extensions -EXEEXT=.exe +EXEEXT = .exe # Pre-built configuration # See scripts/pnglibconf.mak for more options @@ -75,7 +75,7 @@ $(LIBSOMAJ): $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ) libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ install: diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.acorn b/Build/source/libs/libpng/libpng-src/scripts/makefile.riscos index 00b8fb5b35c..7baa1484366 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.acorn +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.riscos @@ -1,14 +1,12 @@ # Project: libpng +# Copyright (C) 2020 Cameron Cawley +# Copyright (C) 1997 Tom Tanner # Toolflags: -CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback -DRISCOS -fnah -C++flags = -c -depend !Depend -IC: -throwback -Linkflags = -aif -c++ -o $@ -ObjAsmflags = -throwback -NoCache -depend !Depend -CMHGflags = +CCflags = -c -depend !Depend -IC:,C:zlib -g -throwback -DRISCOS -fnah -wz +Linkflags = -aif -o $@ LibFileflags = -c -l -o $@ -Squeezeflags = -o $@ # Final targets: @.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \ @@ -27,14 +25,13 @@ Squeezeflags = -o $@ # User-editable dependencies: -# (C) Copyright 1997 Tom Tanner Test: @.pngtest - <Prefix$Dir>.pngtest - @remove <Prefix$Dir>.pngtest + Run @.pngtest + @Remove @.pngtest #It would be nice if you could stop "make" listing from here on! -@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib - Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib +@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs C:zlib.o.zlib + Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs C:zlib.o.zlib .SUFFIXES: .o .mm .c @@ -43,15 +40,15 @@ Test: @.pngtest .c.o: cc $(ccflags) -o $@ $< -# See scripts.mak.libpngconf for how to generate this: -@.h.libpngconf: @.scripts.h.libpngconf - copy @.scripts.h.libpngconf $@ +# See scripts.pnglibconf/mak for how to generate this: +@.h.pnglibconf: @.scripts.pnglibconf/h/prebuilt + Copy @.scripts.pnglibconf/h/prebuilt $@ ~CF~V # Static dependencies: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \ @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \ @.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil \ -@.o.pngtest: @.h.libpngconf +@.o.pngtest: @.h.pnglibconf # Dynamic dependencies: diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.sco b/Build/source/libs/libpng/libpng-src/scripts/makefile.sco index 002cd3f9b3b..8a8e50ffc7e 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.sco +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.sco @@ -1,7 +1,7 @@ # makefile for SCO OSr5 ELF and Unixware 7 with Native cc # Contributed by Mike Hopkirk (hops at sco.com) modified from Makefile.lnx # force ELF build dynamic linking, SONAME setting in lib and RPATH in app -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -20,9 +20,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir LN_SF=ln -f -s CP=cp RM_F=/bin/rm -f @@ -34,7 +33,8 @@ ZLIBLIB=../zlib ZLIBINC=../zlib CPPFLAGS=-I$(ZLIBINC) -CFLAGS= -dy -belf -O3 +CFLAGS=-dy -belf -O3 +ARFLAGS=rc LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm # Pre-built configuration @@ -61,7 +61,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.sggcc b/Build/source/libs/libpng/libpng-src/scripts/makefile.sggcc index e017916ef32..f694f6eedb8 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.sggcc +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.sggcc @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc' -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2001-2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -17,9 +17,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=gcc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir -p LN_SF=ln -sf CP=cp RM_F=/bin/rm -f @@ -39,6 +38,7 @@ ABI= WARNMORE= CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g +ARFLAGS=rc LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm # -g LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ -set_version sgi$(PNGMAJ).0 @@ -61,7 +61,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ shared: $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.sgi b/Build/source/libs/libpng/libpng-src/scripts/makefile.sgi index c7f8720e53d..a60650c251a 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.sgi +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.sgi @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc' -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2001-2002, 2006, 2007, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -17,9 +17,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=cc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir -p LN_SF=ln -sf CP=cp RM_F=/bin/rm -f @@ -41,6 +40,7 @@ WARNMORE=-fullwarn CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 #CFLAGS= $(ABI) -O $(WARNMORE) -KPIC # -g CFLAGS=$(ABI) -O $(WARNMORE) # -g +ARFLAGS=rc LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm # -g LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ @@ -64,7 +64,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.so9 b/Build/source/libs/libpng/libpng-src/scripts/makefile.so9 index 2fd8e7017fb..5af3ad9956b 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.so9 +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.so9 @@ -1,7 +1,7 @@ # makefile for libpng on Solaris 9 (beta) with Forte cc # Updated by Chad Schrock for Solaris 9 # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998-2001 Greg Roelofs # Copyright (C) 1996-1997 Andreas Dilger @@ -21,9 +21,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: # gcc 2.95 doesn't work. CC=cc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir -p LN_SF=ln -f -s CP=cp RM_F=/bin/rm -f @@ -41,6 +40,7 @@ ZLIBINC=/usr/include CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=-O3 +ARFLAGS=rc LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # Pre-built configuration @@ -67,7 +67,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.solaris b/Build/source/libs/libpng/libpng-src/scripts/makefile.solaris index 4aa672deb5a..c4d7709785d 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.solaris +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.solaris @@ -1,5 +1,5 @@ # makefile for libpng on Solaris 2.x with gcc -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2004, 2006-2008, 2010-2014 Glenn Randers-Pehrson # Contributed by William L. Sebok, based on makefile.linux # Copyright (C) 1998 Greg Roelofs @@ -19,9 +19,8 @@ LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: CC=gcc -AR_RC=ar rc +AR=ar RANLIB=echo -MKDIR_P=mkdir -p LN_SF=ln -f -s CP=cp RM_F=/bin/rm -f @@ -40,6 +39,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wstrict-prototypes -Wmissing-prototypes # -Wconversion CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=-O -Wall -Wextra -Wundef # $(WARNMORE) -g +ARFLAGS=rc LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # -g # Pre-built configuration @@ -66,7 +66,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ $(LIBSO): $(LIBSOMAJ) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.std b/Build/source/libs/libpng/libpng-src/scripts/makefile.std index 6ce0a498ad6..6d69bf586b4 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.std +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.std @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -16,9 +16,8 @@ ZLIBINC=../zlib CC = cc CPP = $(CC) -E LD = $(CC) -AR_RC = ar rc +AR = ar RANLIB = ranlib -MKDIR_P = mkdir MV_F = mv -f RM_F = rm -f AWK = awk @@ -29,6 +28,7 @@ DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build DFA_EXTRA = # extra files that can be used to control configuration CPPFLAGS = -I$(ZLIBINC) $(NOHWOPT) # -DPNG_DEBUG=5 CFLAGS = -O # -g +ARFLAGS = rc LDFLAGS = -L$(ZLIBLIB) # -g LIBS = -lz -lm @@ -66,7 +66,7 @@ pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(MV_F) pnglibconf.tmp $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ pngtest: pngtest.o libpng.a diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.sunos b/Build/source/libs/libpng/libpng-src/scripts/makefile.sunos index 675e8760f1b..e8c046bb00a 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.sunos +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.sunos @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2020-2024 Cosmin Truta # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -14,14 +14,14 @@ ZLIBLIB=../zlib ZLIBINC=../zlib CC=gcc -AR_RC=ar rc +AR=ar RANLIB=ranlib -MKDIR_P=mkdir -p CP=cp RM_F=/bin/rm -f CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CFLAGS=-O +ARFLAGS=rc LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm # Pre-built configuration @@ -41,7 +41,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ libpng.a: $(OBJS) - $(AR_RC) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ pngtest: pngtest.o libpng.a diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin-arm64 b/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin-arm64 index 9795ba6b0e3..1e98d1667f1 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin-arm64 +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin-arm64 @@ -31,7 +31,7 @@ RM = del PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt # File extensions -O=.obj +O = .obj # File lists OBJS1 = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin32 b/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin32 index ebc053da295..762032216fe 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin32 +++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.vcwin32 @@ -30,7 +30,7 @@ RM = del PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt # File extensions -O=.obj +O = .obj # File lists OBJS1 = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) diff --git a/Build/source/libs/libpng/libpng-src/scripts/options.awk b/Build/source/libs/libpng/libpng-src/scripts/options.awk index 284811967f5..b74223ab7c6 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/options.awk +++ b/Build/source/libs/libpng/libpng-src/scripts/options.awk @@ -401,8 +401,10 @@ pre != 0 && $1 == "chunk" && NF >= 2{ if (i > NF) { # Output new 'option' lines to the intermediate file (out) - print "option READ_" opt, "requires READ_ANCILLARY_CHUNKS" reqread, "enables", opt enables , onoff >out - print "option WRITE_" opt, "requires WRITE_ANCILLARY_CHUNKS" reqwrite, "enables", opt enables, onoff >out + print "option READ_" opt, "requires READ_ANCILLARY_CHUNKS" reqread, + "enables", opt enables , onoff >out + print "option WRITE_" opt, "requires WRITE_ANCILLARY_CHUNKS" reqwrite, + "enables", opt enables, onoff >out next } # Else hit the error handler below - bad line format! @@ -731,7 +733,9 @@ END{ # 'have_ifs' here means that everything = "off" still allows an 'if' on # an otherwise enabled option to turn it on; otherwise the 'if' # handling is effectively disabled by 'everything = off' - if (option[i] == "off" || option[i] == "disabled" && everything != "on" || option[i] == "enabled" && everything == "off" && !have_ifs) { + if ((option[i] == "off") || + (option[i] == "disabled" && everything != "on") || + (option[i] == "enabled" && everything == "off" && !have_ifs)) { print "# undef PNG_on /*default off*/" >out } else { print "# ifdef PNG_NO_" i >out @@ -752,7 +756,8 @@ END{ # pnglibconf.h print "# ifdef PNG_on" >out if (i ~ /^fail_/) { - print error, i, "is on: enabled by:" iffs[i] enabledby[i] ", requires" requires[i] end >out + print error, i, "is on:", + "enabled by:" iffs[i] enabledby[i] ", requires" requires[i] end >out } else if (i !~ /^ok_/) { print def i sup >out # Supported option, set required settings @@ -779,7 +784,8 @@ END{ print und i une >out } if (i ~ /^ok_/) { - print error, i, "not enabled: requires:" requires[i] ", enabled by:" iffs[i] enabledby[i] end >out + print error, i, "not enabled: ", + "requires:" requires[i] ", enabled by:" iffs[i] enabledby[i] end >out } print "#endif" >out } diff --git a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa index 739805d2d99..fe8e4812385 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa +++ b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa @@ -204,26 +204,33 @@ option SET_OPTION disabled # These options are specific to the ARM NEON hardware optimizations. At present # these optimizations depend on GCC specific pre-processing of an assembler (.S) -# file so they probably won't work with other compilers. -# -# ARM_NEON_OPT: unset: check at compile time (__ARM_NEON__ must be defined by -# the compiler, typically as a result of specifying -# CC="gcc -mfpu=neon".) -# 0: disable (even if the CPU has a NEON FPU.) -# 1: check at run time (via ARM_NEON_{API,CHECK}) -# 2: switch on unconditionally (inadvisable - instead pass -# -mfpu=neon to GCC in CC) -# When building libpng avoid using any setting other than '0'; '1' is -# set automatically when either 'API' or 'CHECK' are configured in, -# '2' should not be necessary as -mfpu=neon will achieve the same -# effect as well as applying NEON optimizations to the rest of the -# libpng code. -# NOTE: any setting other than '0' requires ALIGNED_MEMORY -# ARM_NEON_API: (PNG_ARM_NEON == 1) allow the optimization to be switched on -# with png_set_option -# ARM_NEON_CHECK: (PNG_ARM_NEON == 1) compile a run-time check to see if Neon -# extensions are supported. This is poorly supported and -# deprecated - use the png_set_option API. +# file, so they probably won't work with other compilers. +# +# ARM_NEON_OPT: +# unset: check at compile time +# (__ARM_NEON__ must be predefined by the compiler, as a result of +# passing "-mfpu=neon" to the compiler options) +# 0: disable (even if the CPU has a NEON FPU) +# 1: check at run time (via ARM_NEON_{API,CHECK}) +# 2: switch on unconditionally +# (inadvisable - instead, pass "-mfpu=neon" to the compiler) +# NOTE: +# When building libpng, avoid using any setting other than '0'; +# '1' is set automatically when either 'API' or 'CHECK' are configured in; +# '2' should not be necessary, as "-mfpu=neon" will achieve the same effect +# as well as applying the NEON optimizations to the rest of libpng. +# NOTE: +# Any setting other than '0' requires ALIGNED_MEMORY. +# +# ARM_NEON_API: +# (PNG_ARM_NEON == 1) +# Allow the optimization to be switched on with png_set_option. +# +# ARM_NEON_CHECK: +# (PNG_ARM_NEON == 1) +# Compile a run-time check to see if Neon extensions are supported. +# This is poorly supported and deprecated - use the png_set_option API. +# setting ARM_NEON_OPT option ARM_NEON_API disabled requires ALIGNED_MEMORY enables SET_OPTION, sets ARM_NEON_OPT 1 @@ -232,24 +239,29 @@ option ARM_NEON_CHECK disabled requires ALIGNED_MEMORY, # These options are specific to the PowerPC VSX hardware optimizations. # -# POWERPC_VSX_OPT: unset: check at compile time (__PPC64__,__ALTIVEC__,__VSX__ -# must be defined by the compiler, typically as a result -# of specifying -# "-mvsx -maltivec" compiler flags) -# 0: disable (even if the CPU supports VSX.) -# 1: check at run time (via POWERPC_VSX_{API,CHECK}) -# 2: switch on unconditionally (inadvisable - instead pass -# -mvsx -maltivec to compiler options) -# When building libpng avoid using any setting other than '0'; '1' is -# set automatically when either 'API' or 'CHECK' are configured in, -# '2' should not be necessary as "-mvsx -maltivec" will achieve the same -# effect as well as applying VSX optimizations to the rest of the -# libpng code. -# POWERPC_VSX_API: (PNG_POWERPC_VSX == 1) allow the optimization to be switched on -# with png_set_option -# POWERPC_VSX_CHECK: (PNG_POWERPC_VSX == 1) compile a run-time check to see if VSX -# extensions are supported. This is supported not for all OSes -# (see contrib/powerpc/README) +# POWERPC_VSX_OPT: +# unset: check at compile time +# (__PPC64__,__ALTIVEC__,__VSX__ must be predefined by the compiler, +# as a result of passing "-mvsx -maltivec" to the compiler options) +# 0: disable (even if the CPU supports VSX) +# 1: check at run time (via POWERPC_VSX_{API,CHECK}) +# 2: switch on unconditionally +# (inadvisable - instead, pass "-mvsx -maltivec" to the compiler) +# NOTE: +# When building libpng, avoid using any setting other than '0'; +# '1' is set automatically when either 'API' or 'CHECK' are configured in; +# '2' should not be necessary, as "-mvsx -maltivec" will achieve the same +# effect as well as applying the VSX optimizations to the rest of libpng. +# +# POWERPC_VSX_API: +# (PNG_POWERPC_VSX == 1) +# Allow the optimization to be switched on with png_set_option. +# +# POWERPC_VSX_CHECK: +# (PNG_POWERPC_VSX == 1) +# Compile a run-time check to see if VSX extensions are supported. +# This is not supported on all systems. See contrib/powerpc-vsx/README. +# setting POWERPC_VSX_OPT option POWERPC_VSX_API disabled enables SET_OPTION, sets POWERPC_VSX_OPT 1 @@ -258,23 +270,30 @@ option POWERPC_VSX_CHECK disabled, # These options are specific to the MIPS MSA hardware optimizations. # -# MIPS_MSA_OPT: unset: check at compile time (__mips_msa must be defined by -# the compiler, typically as a result of specifying -# "-mmsa -mfp64" compiler flags) -# 0: disable (even if the CPU supports MSA.) -# 1: check at run time (via MIPS_MSA_{API,CHECK}) -# 2: switch on unconditionally (inadvisable - instead pass -# -mmsa -mfp64 to compiler options) -# When building libpng avoid using any setting other than '0'; '1' is -# set automatically when either 'API' or 'CHECK' are configured in, -# '2' should not be necessary as "-mmsa -mfp64" will achieve the same -# effect as well as applying MSA optimizations to the rest of the -# libpng code. -# NOTE: any setting other than '0' requires ALIGNED_MEMORY -# MIPS_MSA_API: (PNG_MIPS_MSA == 1) allow the optimization to be switched on -# with png_set_option. -# MIPS_MSA_CHECK: (PNG_MIPS_MSA == 1) compile a run-time check to see if MSA -# extensions are supported. +# MIPS_MSA_OPT: +# unset: check at compile time +# (__mips_msa must be predefined by the compiler, as a result of +# passing "-mmsa -mfp64" to the compiler options) +# 0: disable (even if the CPU supports MSA) +# 1: check at run time (via MIPS_MSA_{API,CHECK}) +# 2: switch on unconditionally +# (inadvisable - instead, pass "-mmsa -mfp64" to the compiler) +# NOTE: +# When building libpng, avoid using any setting other than '0'; +# '1' is set automatically when either 'API' or 'CHECK' are configured in; +# '2' should not be necessary, as "-mmsa -mfp64" will achieve the same +# effect as well as applying the MSA optimizations to the rest of libpng. +# NOTE: +# Any setting other than '0' requires ALIGNED_MEMORY. +# +# MIPS_MSA_API: +# (PNG_MIPS_MSA == 1) +# Allow the optimization to be switched on with png_set_option. +# +# MIPS_MSA_CHECK: +# (PNG_MIPS_MSA == 1) +# Compile a run-time check to see if MSA extensions are supported. +# setting MIPS_MSA_OPT option MIPS_MSA_API disabled requires ALIGNED_MEMORY enables SET_OPTION, sets MIPS_MSA_OPT 1 @@ -283,22 +302,30 @@ option MIPS_MSA_CHECK disabled requires ALIGNED_MEMORY, # These options are specific to the MIPS MMI hardware optimizations. # -# MIPS_MMI_OPT: unset: check at compile time (__mips_loongson_mmi must be defined by -# the compiler, typically as a result of specifying -# "-mloongson-mmi -march=loongson3a" compiler flags) -# 0: disable (even if the CPU supports MMI.) -# 1: check at run time (via MIPS_MMI_{API,CHECK}) -# 2: switch on unconditionally (inadvisable - instead pass -# -mloongson-mmi -march=loongson3a to compiler options) -# When building libpng avoid using any setting other than '0'; '1' is -# set automatically when either 'API' or 'CHECK' are configured in, -# '2' should not be necessary as "-mloongson-mmi -march=loongson3a" will achieve the same -# effect as well as applying MMI optimizations to the rest of the -# libpng code. -# MIPS_MMI_API: (PNG_MIPS_MMI == 1) allow the optimization to be switched on -# with png_set_option -# MIPS_MMI_CHECK: (PNG_MIPS_MMI == 1) compile a run-time check to see if MMI -# extensions are supported. +# MIPS_MMI_OPT: +# unset: check at compile time +# (__mips_loongson_mmi must be defined by the compiler, as a result of +# passing "-mloongson-mmi -march=loongson3a" to the compiler options) +# 0: disable (even if the CPU supports MMI) +# 1: check at run time (via MIPS_MMI_{API,CHECK}) +# 2: switch on unconditionally +# (inadvisable - instead, pass "-mloongson-mmi -march=loongson3a" to the +# compiler) +# NOTE: +# When building libpng, avoid using any setting other than '0'; +# '1' is set automatically when either 'API' or 'CHECK' are configured in; +# '2' should not be necessary, as "-mloongson-mmi -march=loongson3a" will +# achieve the same effect as well as applying the MMI optimizations to the +# rest of libpng. +# +# MIPS_MMI_API: +# (PNG_MIPS_MMI == 1) +# Allow the optimization to be switched on with png_set_option. +# +# MIPS_MMI_CHECK: +# (PNG_MIPS_MMI == 1) +# Compile a run-time check to see if MMI extensions are supported. +# setting MIPS_MMI_OPT option MIPS_MMI_API disabled requires ALIGNED_MEMORY enables SET_OPTION, sets MIPS_MMI_OPT 1 diff --git a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt index 330453c1391..83f09fbe773 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt +++ b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt @@ -1,6 +1,6 @@ /* pnglibconf.h - library build configuration */ -/* libpng version 1.6.42 */ +/* libpng version 1.6.43 */ /* Copyright (c) 2018-2024 Cosmin Truta */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ diff --git a/Build/source/libs/libpng/libpng-src/scripts/pngwin.rc b/Build/source/libs/libpng/libpng-src/scripts/pngwin.rc index 9335cbbe03b..87702a4fbfd 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/pngwin.rc +++ b/Build/source/libs/libpng/libpng-src/scripts/pngwin.rc @@ -89,12 +89,12 @@ BEGIN #endif /* PNG_USER_VERSIONINFO_COMPANYNAME */ VALUE "FileDescription", "PNG image compression library\000" VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000" - VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_DLLNUM) PNG_LIBPNG_DLLFNAME_POSTFIX " (Windows 32 bit)\000" - VALUE "LegalCopyright", "\251 1998-2009 Glenn Randers-Pehrson et al.\000" + VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_SHAREDLIB) PNG_LIBPNG_DLLFNAME_POSTFIX " (Windows)\000" + VALUE "LegalCopyright", "\251 1998-2024 PNG Reference Library Authors\000" #ifdef PNG_USER_VERSIONINFO_LEGALTRADEMARKS VALUE "LegalTrademarks", PNG_USER_VERSIONINFO_LEGALTRADEMARKS "\000" #endif /* PNG_USER_VERSIONINFO_LEGALTRADEMARKS */ - VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_DLLNUM) PNG_LIBPNG_DLLFNAME_POSTFIX ".DLL\000" + VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_SHAREDLIB) PNG_LIBPNG_DLLFNAME_POSTFIX ".DLL\000" #ifdef PNG_USER_PRIVATEBUILD VALUE "PrivateBuild", PNG_USER_PRIVATEBUILD "\000" #endif /* PNG_USER_PRIVATEBUILD */ diff --git a/Build/source/libs/libpng/libpng-src/scripts/smakefile.ppc b/Build/source/libs/libpng/libpng-src/scripts/smakefile.ppc index 2fa5b651087..9212d2f0629 100644 --- a/Build/source/libs/libpng/libpng-src/scripts/smakefile.ppc +++ b/Build/source/libs/libpng/libpng-src/scripts/smakefile.ppc @@ -11,13 +11,12 @@ CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL IDIR /zlib \ OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 LIBNAME = libpng.a AR = ppc-amigaos-ar -AR_FLAGS = cr +ARFLAGS = cr RANLIB = ppc-amigaos-ranlib LDFLAGS = -r -o LDLIBS = ../zlib/libzip.a LIB:scppc.a LN = ppc-amigaos-ld RM = delete quiet -MKDIR = makedir OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ @@ -26,7 +25,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ all: $(LIBNAME) pngtest $(LIBNAME): $(OBJS) - $(AR) $(AR_FLAGS) $@ $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ pngtest: pngtest.o $(LIBNAME) diff --git a/Build/source/libs/libpng/libpng-src/tests/pngtest-all b/Build/source/libs/libpng/libpng-src/tests/pngtest-all index 7a9b64ae672..668d92e9c37 100644 --- a/Build/source/libs/libpng/libpng-src/tests/pngtest-all +++ b/Build/source/libs/libpng/libpng-src/tests/pngtest-all @@ -1,17 +1,24 @@ #!/bin/sh -st=0 # exit status (set to 1 if a test fails) +st=0 # exit status (set to 1 if a test fails) +skipped= fail="**FAIL**" +skip="**SKIP**" success=" SUCCESS" TEST(){ # Try to make the log file easier to read: - test_status="$success" - echo "=============== PNGTEST $* ====================" - ./pngtest "$@" || { - st=$? - test_status="$fail" - } + echo "=============== pngtest $* ====================" + ./pngtest "$@" + status=$? + case "$status" in + 0) test_status="$success";; + 77) test_status="$skip" + skipped=1;; + *) test_status="$fail" + st="$status";; + esac echo "===============$test_status $* ====================" + return "$status" } # The "standard" test @@ -48,15 +55,17 @@ check_stdout(){ # variable 'line' below. The pattern matching ignores this because of the # '*' at the end of the pattern match. found= + skipped= while read line do case "$line" in *"$2"*) found=1;; + *"TEST SKIPPED"*) skipped=1;; esac echo "$line" # preserve the original output verbatim done # output the missing warning on descriptor 3: - test -z "$found" && echo "$1: $2" >&3 + test -z "$found" -a -z "$skipped" && echo "$1: $2" >&3 } # NOTE: traditionally the Bourne shell executed the last element in a pipe # sequence in the original shell so it could set variables in the original @@ -74,7 +83,10 @@ exec 4>&1 # original stdout - the log file # The exit code is ignored here, the test is that the particular errors # (warnings) are produced. The original output still ends up in the log # file. - TEST "$file" | + { + TEST "$file" + test "$?" -eq 77 && echo "TEST SKIPPED" + } | check_stdout "$file" 'IDAT: Read palette index exceeding num_palette' | check_stdout "$file" 'Wrote palette index exceeding num_palette' >&4 done @@ -90,4 +102,6 @@ exec 4>&1 # original stdout - the log file exit $st } || st=$? -exit $st +test "$st" -gt 0 && exit "$st" +test -n "$skipped" && exit 77 +exit 0 |