AUTOMATION: cmake
ARCH: arm64
CI_NO_TEST: 1
+ - TOOLCHAIN: llvm
+ AUTOMATION: cmake
+ ARCH: x64
- TOOLCHAIN: msys2
AUTOMATION: cmake
ARCH: i686
AUTOMATION: cmake
ARCH: x86_64
- TOOLCHAIN: msys2
- AUTOMATION: autotools
+ AUTOMATION: configure
ARCH: i686
- TOOLCHAIN: msys2
- AUTOMATION: autotools
+ AUTOMATION: configure
ARCH: x86_64
- TOOLCHAIN: msys2
- AUTOMATION: legacy
+ AUTOMATION: makefiles
ARCH: i686
- TOOLCHAIN: msys2
- AUTOMATION: legacy
+ AUTOMATION: makefiles
ARCH: x86_64
install:
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe integrate install'
+ - 'if "%TOOLCHAIN%"=="llvm" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
+ - 'if "%TOOLCHAIN%"=="llvm" C:\tools\vcpkg\vcpkg.exe integrate install'
before_build:
- - 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_VARS=-DCMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_GENERATOR=Visual Studio 17 2022'
+ - 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x86" set CI_CMAKE_GENERATOR_PLATFORM=Win32'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x64" set CI_CMAKE_GENERATOR_PLATFORM=x64'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_GENERATOR_PLATFORM=ARM64'
+ - 'if "%TOOLCHAIN%"=="llvm" set CI_CMAKE_GENERATOR=Ninja'
+ - 'if "%TOOLCHAIN%"=="llvm" set CI_CMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
+ - 'if "%TOOLCHAIN%"=="llvm" set CI_CC=clang.exe'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" set CI_CMAKE_GENERATOR=Unix Makefiles'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set PATH=C:\msys64\mingw32\bin;%PATH%'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set PATH=C:\msys64\mingw64\bin;%PATH%'
- - 'if "%TOOLCHAIN%"=="msys2" set CI_CC=%ARCH%-w64-mingw32-gcc'
+ - 'if "%TOOLCHAIN%"=="msys2" set CI_CC=%ARCH%-w64-mingw32-gcc.exe'
- 'set CI_CMAKE_BUILD_FLAGS=--parallel 2'
- 'set CI_CTEST_FLAGS=--parallel 2'
- 'set CI_MAKE_FLAGS=-j2'
- - 'set CI_LEGACY_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std'
+ - 'set CI_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std'
build_script:
- - 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"'
- - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"'
- - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="autotools" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_autotools.sh"'
- - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="legacy" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_legacy.sh"'
+ - 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
+ - 'if "%TOOLCHAIN%"=="llvm" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
+ - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
+ - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="configure" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_configure.sh"'
+ - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="makefiles" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_makefiles.sh"'
cache:
- C:\tools\vcpkg\installed
- linux
- osx
-compiler:
- - clang
- - gcc
-
env:
- AUTOMATION=cmake CI_NO_TEST=1
- AUTOMATION=cmake CI_CMAKE_VARS="-DPNG_HARDWARE_OPTIMIZATIONS=ON" CI_SANITIZERS="address,undefined"
- AUTOMATION=cmake CI_CMAKE_VARS="-DPNG_HARDWARE_OPTIMIZATIONS=OFF" CI_SANITIZERS="address,undefined"
- - AUTOMATION=autotools CI_NO_TEST=1
- - AUTOMATION=autotools CI_CONFIGURE_FLAGS="--enable-hardware-optimizations"
- - AUTOMATION=autotools CI_CONFIGURE_FLAGS="--disable-hardware-optimizations"
- - AUTOMATION=legacy CI_NO_TEST=1
- - AUTOMATION=legacy CI_SANITIZERS="address,undefined"
+ - AUTOMATION=configure CI_NO_TEST=1
+ - AUTOMATION=configure CI_CONFIGURE_FLAGS="--enable-hardware-optimizations"
+ - AUTOMATION=configure CI_CONFIGURE_FLAGS="--disable-hardware-optimizations"
+ - AUTOMATION=makefiles CI_NO_TEST=1
+ - AUTOMATION=makefiles CI_SANITIZERS="address,undefined"
matrix:
include:
- os: osx
- compiler: cc
env: AUTOMATION=cmake CI_CMAKE_GENERATOR=Xcode
- exclude:
- - os: freebsd
- compiler: gcc
- - os: osx
- compiler: gcc
before_script:
+ - 'if test "$TRAVIS_OS_NAME" = "linux"; then COMPILER="gcc"; else COMPILER="clang"; fi'
+ - 'export CI_MAKEFILES="scripts/makefile.std scripts/makefile.$COMPILER"'
+ - 'export CI_MAKE_FLAGS="-j2"'
- 'export CI_CMAKE_BUILD_FLAGS="--parallel 2"'
- 'export CI_CTEST_FLAGS="--parallel 2"'
- - 'export CI_MAKE_FLAGS=-j2'
- - 'export CI_CC=$TRAVIS_COMPILER'
- - 'export CI_LEGACY_MAKEFILES="scripts/makefile.$TRAVIS_COMPILER scripts/makefile.std"'
script:
- - './ci/ci_$AUTOMATION.sh'
+ - './ci/ci_verify_$AUTOMATION.sh'
-libpng 1.6.39 - November 20, 2022
-=================================
+libpng 1.6.40 - June 21, 2023
+=============================
This is a public release of libpng, intended for use in production code.
Source files with LF line endings (for Unix/Linux):
- * libpng-1.6.39.tar.xz (LZMA-compressed, recommended)
- * libpng-1.6.39.tar.gz
+ * libpng-1.6.40.tar.xz (LZMA-compressed, recommended)
+ * libpng-1.6.40.tar.gz
Source files with CRLF line endings (for Windows):
- * lpng1639.7z (LZMA-compressed, recommended)
- * lpng1639.zip
+ * lpng1640.7z (LZMA-compressed, recommended)
+ * lpng1640.zip
Other information:
* TRADEMARK.md
-Changes from version 1.6.38 to version 1.6.39
+Changes from version 1.6.39 to version 1.6.40
---------------------------------------------
- * Changed the error handler of oversized chunks (i.e. larger than
- PNG_USER_CHUNK_MALLOC_MAX) from png_chunk_error to png_benign_error.
- * Fixed a buffer overflow error in contrib/tools/pngfix.
- * Fixed a memory leak (CVE-2019-6129) in contrib/tools/pngcp.
- * Disabled the ARM Neon optimizations by default in the CMake file,
- following the default behavior of the configure script.
- * Allowed configure.ac to work with the trunk version of autoconf.
- * Removed the support for "install" targets from the legacy makefiles;
- removed the obsolete makefile.cegcc.
- * Cleaned up the code and updated the internal documentation.
+ * Fixed the eXIf chunk multiplicity checks.
+ * Fixed a memory leak in pCAL processing.
+ * Corrected the validity report about tRNS inside png_get_valid().
+ * Fixed various build issues on *BSD, Mac and Windows.
+ * Updated the configurations and the scripts for continuous integration.
+ * Cleaned up the code, the build scripts, and the documentation.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
* Mike Klein
* Pascal Massimino
* Paul Schmidt
+ * Philippe Antoine
* Qiang Zhou
* Sam Bushell
* Samuel Williams
- Matt Sarett
- Mike Klein
- Sami Boukortt
+ - Wan-Teh Chang
The build projects, the build scripts, the test scripts, and other
files in the "ci", "projects", "scripts" and "tests" directories, have
Added simple sRGB support (Glenn R-P)
Easier conditional compiling, e.g.,
define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
- all configurable options can be selected from command-line instead
+ all configurable options can be selected from command line instead
of having to edit pngconf.h (Glenn R-P)
Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
Added more conditions for png_do_background, to avoid changing
Version 1.0.9beta1 [November 10, 2000]
Fixed typo in scripts/makefile.hpux
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
- Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
+ Fixed sequence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
Changed "cdrom.com" in documentation to "libpng.org"
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
Changed type of "params" from voidp to png_voidp in png_read|write_png().
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
Version 1.4.0beta59 [May 15, 2009]
- Reformated sources in libpng style (3-space indentation, comment format)
+ Reformatted sources in libpng style (3-space indentation, comment format)
Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG)
Added sections about the git repository and our coding style to the
documentation
Version 1.4.1beta07 [February 6, 2010]
Folded some long lines in the source files.
- Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
+ Added definable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
and a PNG_USER_LIMITS_SUPPORTED flag.
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
png_ptr->png_user_chunk_malloc_max.
version checking to configure.ac
Improved pngstest speed by not doing redundant tests and add const to
the background parameter of png_image_finish_read. The --background
- option is now done automagically only when required, so that commandline
+ option is now done automagically only when required, so that command-line
option no longer exists.
Cleaned up pngpriv.h to consistently declare all functions and data.
Also eliminated PNG_CONST_DATA, which is apparently not needed but we
(Bug report from the OSS-fuzz project).
Version 1.6.32beta04 [August 2, 2017]
- Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
+ Replaced local eXIf_buf with info_ptr->eXIf_buf in png_handle_eXIf().
Update libpng.3 and libpng-manual.txt about eXIf functions.
Version 1.6.32beta05 [August 2, 2017]
removed the obsolete makefile.cegcc.
Cleaned up the code and updated the internal documentation.
+Version 1.6.40 [June 21, 2023]
+ Fixed the eXIf chunk multiplicity checks.
+ Fixed a memory leak in pCAL processing.
+ Corrected the validity report about tRNS inside png_get_valid().
+ Fixed various build issues on *BSD, Mac and Windows.
+ Updated the configurations and the scripts for continuous integration.
+ Cleaned up the code, the build scripts, and the documentation.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
# CMakeLists.txt
-# Copyright (c) 2018-2022 Cosmin Truta
+# Copyright (c) 2018-2023 Cosmin Truta
# Copyright (c) 2007,2009-2018 Glenn Randers-Pehrson
# Written by Christian Ehrlicher, 2007
# Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012,2017
+# Revised by Claudio Bley, 2013
# Revised by Roger Leigh, 2016
# Revised by Andreas Franek, 2016
# Revised by Sam Serrels, 2017
# Revised by Owen Rudge, 2020
# Revised by Gleb Mazovetskiy, 2021
# Revised by Christopher Sean Morrison, 2022
+# Revised by B. Scott Michel, 2022
+# Revised by Jeremy Maitin-Shepard, 2022
# Revised by Martin Storsjo, 2022
+# Revised by Jon Creighton, 2023
+# Revised by Gunther Nikl, 2023
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
project(libpng C ASM)
enable_testing()
+include(CMakeParseArguments)
+include(CheckCSourceCompiles)
+include(GNUInstallDirs)
+
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
-set(PNGLIB_REVISION 39)
+set(PNGLIB_REVISION 40)
set(PNGLIB_SUBREVISION 0)
#set(PNGLIB_SUBREVISION "git")
-set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_REVISION})
-set(PNGLIB_SHARED_SOVERSION ${PNGLIB_MAJOR}${PNGLIB_MINOR})
-set(PNGLIB_SHARED_VERSION ${PNGLIB_SHARED_SOVERSION}.${PNGLIB_REVISION}.${PNGLIB_SUBREVISION})
-
-include(GNUInstallDirs)
+set(PNGLIB_ABI_VERSION ${PNGLIB_MAJOR}${PNGLIB_MINOR})
+set(PNGLIB_SHARED_VERSION ${PNGLIB_ABI_VERSION}.${PNGLIB_REVISION}.${PNGLIB_SUBREVISION})
+
+# Allow the users to specify an application-specific API prefix for libpng
+# vendoring purposes. A standard libpng build should have no such prefix.
+set(PNG_PREFIX ""
+ CACHE STRING "Prefix to prepend to the API function names")
+
+# Allow the users to override the postfix appended to debug library file names.
+# Previously, we used to set CMAKE_DEBUG_POSTFIX globally. That variable should
+# not be cached, however, because doing so would affect all projects processed
+# after libpng, in unexpected and undesirable ways.
+set(PNG_DEBUG_POSTFIX "d"
+ CACHE STRING "Postfix to append to library file names under the Debug configuration")
+
+# Allow the users to import their own extra configuration settings.
+set(DFA_XTRA ""
+ CACHE FILEPATH "File containing extra configuration settings")
+
+# Allow the users to configure the following build options.
+option(PNG_SHARED "Build libpng as a shared lib" ON)
+option(PNG_STATIC "Build libpng as a static lib" ON)
+option(PNG_FRAMEWORK "Build libpng as a Mac OS X framework" OFF)
+option(PNG_EXECUTABLES "Build libpng executables" ON)
+option(PNG_TESTS "Build libpng tests" ON)
+option(PNG_DEBUG "Enable debug output" OFF)
+option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
-# Allow users to specify location of zlib.
+# Allow the users to specify a location of zlib.
# Useful if zlib is being built alongside this as a sub-project.
-option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
-
+option(PNG_BUILD_ZLIB "Custom zlib location, else find_package is used" OFF)
if(NOT PNG_BUILD_ZLIB)
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})
set(M_LIBRARY "")
endif()
-# Public CMake configuration variables.
-option(PNG_SHARED "Build shared lib" ON)
-option(PNG_STATIC "Build static lib" ON)
-option(PNG_EXECUTABLES "Build libpng executables" ON)
-option(PNG_TESTS "Build libpng tests" ON)
-
-# Many more configuration options could be added here.
-option(PNG_FRAMEWORK "Build OS X framework" OFF)
-option(PNG_DEBUG "Build with debug output" OFF)
-option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
-
-set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
-set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
-
# CMake currently sets CMAKE_SYSTEM_PROCESSOR to one of x86_64 or arm64 on macOS,
# based upon the OS architecture, not the target architecture. As such, we need
# to check CMAKE_OSX_ARCHITECTURES to identify which hardware-specific flags to
endif(PNG_HARDWARE_OPTIMIZATIONS)
-# Set PNG_LIB_NAME.
-set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
-
-# Distinguish between debug and release builds.
-set(CMAKE_DEBUG_POSTFIX "d")
-
-include(CheckCSourceCompiles)
option(ld-version-script "Enable linker version script" ON)
if(ld-version-script AND NOT ANDROID AND NOT APPLE)
# Check if LD supports linker scripts.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "
-VERS_1 {
- global: sym;
- local: *;
-};
-
-VERS_2 {
- global: sym2;
- main;
-} VERS_1;
+VERS_1 { global: sym1; local: *; };
+VERS_2 { global: sym2; main; } VERS_1;
")
- set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
- check_c_source_compiles("void sym(void) {}
+ set(_SAVED_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "^SunOS")
+ # Avoid using CMAKE_SHARED_LIBRARY_C_FLAGS in version script checks on
+ # Solaris, because of an incompatibility with the Solaris link editor.
+ list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+ endif()
+ list(APPEND CMAKE_REQUIRED_FLAGS "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
+ check_c_source_compiles("
+void sym1(void) {}
void sym2(void) {}
-int main(void) {return 0;}
+int main(void) { return 0; }
" HAVE_LD_VERSION_SCRIPT)
if(NOT HAVE_LD_VERSION_SCRIPT)
- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
- check_c_source_compiles("void sym(void) {}
+ set(CMAKE_REQUIRED_FLAGS ${_SAVED_CMAKE_REQUIRED_FLAGS})
+ if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "^SunOS")
+ # Again, avoid using CMAKE_SHARED_LIBRARY_C_FLAGS in version script
+ # checks on Solaris.
+ list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+ endif()
+ list(APPEND CMAKE_REQUIRED_FLAGS "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
+ check_c_source_compiles("
+void sym1(void) {}
void sym2(void) {}
-int main(void) {return 0;}
+int main(void) { return 0; }
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
endif()
- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+ set(CMAKE_REQUIRED_FLAGS ${_SAVED_CMAKE_REQUIRED_FLAGS})
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
endif()
# Find symbol prefix. Likely obsolete and unnecessary with recent
# toolchains (it's not done in many other projects).
-function(symbol_prefix)
+function(find_symbol_prefix)
set(SYMBOL_PREFIX)
- execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
+ execute_process(COMMAND "${CMAKE_C_COMPILER}" -E -
INPUT_FILE /dev/null
OUTPUT_VARIABLE OUT
RESULT_VARIABLE STATUS)
endfunction()
if(UNIX)
- symbol_prefix()
+ find_symbol_prefix()
endif()
find_program(AWK NAMES gawk awk)
# No awk available to generate sources; use pre-built pnglibconf.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
- add_custom_target(genfiles) # Dummy
+ add_custom_target(png_genfiles)
else()
# Copy the awk scripts, converting their line endings to Unix (LF)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk
# Generate .chk from .out with awk:
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
- include(CMakeParseArguments)
function(generate_chk)
set(options)
set(oneValueArgs INPUT OUTPUT)
set(oneValueArgs INPUT OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GCO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if(NOT _GCO_INPUT)
+ message(FATAL_ERROR "generate_copy: Missing INPUT argument")
+ endif()
+ if(NOT _GCO_OUTPUT)
+ message(FATAL_ERROR "generate_copy: Missing OUTPUT argument")
+ endif()
+
add_custom_command(OUTPUT "${_GCO_OUTPUT}"
COMMAND "${CMAKE_COMMAND}"
-E remove "${_GCO_OUTPUT}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/options.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
- add_custom_target(scripts_pnglibconf_c DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c")
+ add_custom_target(png_scripts_pnglibconf_c
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c")
# Generate pnglibconf.c
generate_source(OUTPUT "pnglibconf.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/options.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
- add_custom_target(pnglibconf_c DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c")
+ add_custom_target(pnglibconf_c
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c")
if(PNG_PREFIX)
set(PNGLIBCONF_H_EXTRA_DEPENDS
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
DEPENDS pnglibconf_c)
- add_custom_target(pnglibconf_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
+ add_custom_target(pnglibconf_out
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
# Generate pnglibconf.h
generate_source(OUTPUT "pnglibconf.h"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" pnglibconf_out
${PNGLIBCONF_H_EXTRA_DEPENDS})
- add_custom_target(pnglibconf_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
+ add_custom_target(pnglibconf_h
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h)
- add_custom_target(scripts_intprefix_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
+ add_custom_target(png_scripts_intprefix_out
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" pnglibconf_out)
- add_custom_target(scripts_prefix_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out")
+ add_custom_target(png_scripts_prefix_out
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out")
# Generate pngprefix.h
generate_source(OUTPUT "pngprefix.h"
DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
- add_custom_target(pngprefix_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
+ add_custom_target(pngprefix_h
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h)
- add_custom_target(scripts_sym_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out")
+ add_custom_target(png_scripts_sym_out
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
- add_custom_target(scripts_symbols_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out")
+ add_custom_target(png_scripts_symbols_out
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h)
- add_custom_target(scripts_vers_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
+ add_custom_target(png_scripts_vers_out
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
- DEPENDS scripts_symbols_out
+ DEPENDS png_scripts_symbols_out
"${CMAKE_CURRENT_BINARY_DIR}/scripts/checksym.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
- add_custom_target(scripts_symbols_chk
+ add_custom_target(png_scripts_symbols_chk
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
generate_copy(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
- DEPENDS scripts_sym_out)
+ DEPENDS png_scripts_sym_out)
generate_copy(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
- DEPENDS scripts_vers_out)
+ DEPENDS png_scripts_vers_out)
- add_custom_target(genvers
+ add_custom_target(png_genvers
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
- add_custom_target(gensym
+ add_custom_target(png_gensym
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
- add_custom_target("genprebuilt"
+ add_custom_target(png_genprebuilt
COMMAND "${CMAKE_COMMAND}"
"-DOUTPUT=scripts/pnglibconf.h.prebuilt"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
# A single target handles generation of all generated files.
- add_custom_target(genfiles
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym" gensym
- "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers" genvers
+ add_custom_target(png_genfiles
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym" png_gensym
+ "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers" png_genvers
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" pnglibconf_c
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" pnglibconf_out
"${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h" pngprefix_h
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" scripts_intprefix_out
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c" scripts_pnglibconf_c
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" scripts_prefix_out
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" scripts_sym_out
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" scripts_symbols_chk
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" scripts_symbols_out
- "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" scripts_vers_out)
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" png_scripts_intprefix_out
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c" png_scripts_pnglibconf_c
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" png_scripts_prefix_out
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" png_scripts_sym_out
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" png_scripts_symbols_chk
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" png_scripts_symbols_out
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" png_scripts_vers_out)
endif(NOT AWK OR ANDROID OR IOS)
# List the source code files.
contrib/tools/png-fix-itxt.c
)
-if(MSVC)
+if(MSVC OR (WIN32 AND (CMAKE_C_COMPILER_ID MATCHES ".*Clang")))
+ add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif()
add_definitions(-DPNG_DEBUG)
endif()
-# Now build our target.
+# Now build our targets.
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS})
-unset(PNG_LIB_TARGETS)
+# Initialize the list of libpng library targets.
+set(PNG_LIBRARY_TARGETS "")
+
+# Initialize the libpng library file names.
+if(UNIX
+ OR (WIN32 AND NOT "${CMAKE_SHARED_LIBRARY_PREFIX}" STREQUAL "")
+ OR (WIN32 AND NOT "${CMAKE_STATIC_LIBRARY_PREFIX}" STREQUAL ""))
+ # We are on a Unix or Unix-like toolchain like the GNU toolchain on Windows.
+ # Library file names are expected to have an implicit prefix such as "lib".
+ # Let CMake prepend and append its usual prefixes and suffixes by default.
+ set(PNG_SHARED_OUTPUT_NAME "png${PNGLIB_ABI_VERSION}")
+ set(PNG_STATIC_OUTPUT_NAME "png${PNGLIB_ABI_VERSION}")
+else()
+ # We are, most likely, on a Windows toolchain like MSVC, Clang on Windows,
+ # Borland/Embarcadero, etc. We need to specify the "libpng" name explicitly.
+ # We also need to use a custom suffix, in order to distinguish between the
+ # shared import library name and the static library name.
+ set(PNG_SHARED_OUTPUT_NAME "libpng${PNGLIB_ABI_VERSION}")
+ set(PNG_STATIC_OUTPUT_NAME "libpng${PNGLIB_ABI_VERSION}_static")
+endif()
if(PNG_SHARED)
- add_library(png SHARED ${libpng_sources})
- set(PNG_LIB_TARGETS png)
- set_target_properties(png PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
- add_dependencies(png genfiles)
- if(MSVC)
- # MVC does not append 'lib'. Do it here, to have consistent name.
- set_target_properties(png PROPERTIES PREFIX "lib")
- set_target_properties(png PROPERTIES IMPORT_PREFIX "lib")
- endif()
- target_link_libraries(png ${ZLIB_LIBRARIES} ${M_LIBRARY})
-
+ add_library(png_shared SHARED ${libpng_sources})
+ add_dependencies(png_shared png_genfiles)
+ list(APPEND PNG_LIBRARY_TARGETS png_shared)
+ set_target_properties(png_shared PROPERTIES
+ OUTPUT_NAME "${PNG_SHARED_OUTPUT_NAME}"
+ DEBUG_POSTFIX "${PNG_DEBUG_POSTFIX}"
+ VERSION "${PNGLIB_SHARED_VERSION}"
+ SOVERSION "${PNGLIB_ABI_VERSION}")
if(UNIX AND AWK)
if(HAVE_LD_VERSION_SCRIPT)
- set_target_properties(png PROPERTIES
+ set_target_properties(png_shared PROPERTIES
LINK_FLAGS "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
elseif(HAVE_SOLARIS_LD_VERSION_SCRIPT)
- set_target_properties(png PROPERTIES
+ set_target_properties(png_shared PROPERTIES
LINK_FLAGS "-Wl,-M -Wl,'${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
endif()
endif()
+ if(WIN32)
+ set_target_properties(png_shared PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
+ endif()
+ target_link_libraries(png_shared ${ZLIB_LIBRARIES} ${M_LIBRARY})
endif()
if(PNG_STATIC)
- # does not work without changing name
- set(PNG_LIB_NAME_STATIC png_static)
add_library(png_static STATIC ${libpng_sources})
- add_dependencies(png_static genfiles)
- # MSVC doesn't use a different file extension for shared vs. static
- # libs. We are able to change OUTPUT_NAME to remove the _static
- # for all other platforms.
- if(NOT MSVC)
- set_target_properties(png_static PROPERTIES
- OUTPUT_NAME "${PNG_LIB_NAME}"
- CLEAN_DIRECT_OUTPUT 1)
- else()
- set_target_properties(png_static PROPERTIES
- OUTPUT_NAME "${PNG_LIB_NAME}_static"
- CLEAN_DIRECT_OUTPUT 1)
- endif()
- list(APPEND PNG_LIB_TARGETS png_static)
- if(MSVC)
- # MSVC does not append 'lib'. Do it here, to have consistent name.
- set_target_properties(png_static PROPERTIES PREFIX "lib")
- endif()
+ add_dependencies(png_static png_genfiles)
+ list(APPEND PNG_LIBRARY_TARGETS png_static)
+ set_target_properties(png_static PROPERTIES
+ OUTPUT_NAME "${PNG_STATIC_OUTPUT_NAME}"
+ DEBUG_POSTFIX "${PNG_DEBUG_POSTFIX}")
target_link_libraries(png_static ${ZLIB_LIBRARIES} ${M_LIBRARY})
endif()
if(PNG_FRAMEWORK)
- set(PNG_LIB_NAME_FRAMEWORK png_framework)
add_library(png_framework SHARED ${libpng_sources})
- add_dependencies(png_framework genfiles)
- list(APPEND PNG_LIB_TARGETS png_framework)
+ add_dependencies(png_framework png_genfiles)
+ list(APPEND PNG_LIBRARY_TARGETS png_framework)
set_target_properties(png_framework PROPERTIES
FRAMEWORK TRUE
- FRAMEWORK_VERSION ${PNGLIB_VERSION}
- MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
- MACOSX_FRAMEWORK_BUNDLE_VERSION ${PNGLIB_VERSION}
- MACOSX_FRAMEWORK_IDENTIFIER org.libpng.libpng
+ FRAMEWORK_VERSION "${PNGLIB_VERSION}"
+ MACOSX_FRAMEWORK_SHORT_VERSION_STRING "${PNGLIB_MAJOR}.${PNGLIB_MINOR}"
+ MACOSX_FRAMEWORK_BUNDLE_VERSION "${PNGLIB_VERSION}"
+ MACOSX_FRAMEWORK_IDENTIFIER "org.libpng.libpng"
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
PUBLIC_HEADER "${libpng_public_hdrs}"
- OUTPUT_NAME png)
+ OUTPUT_NAME "png")
target_link_libraries(png_framework ${ZLIB_LIBRARIES} ${M_LIBRARY})
endif()
-if(NOT PNG_LIB_TARGETS)
+if(NOT PNG_LIBRARY_TARGETS)
message(SEND_ERROR "No library variant selected to build. "
"Please enable at least one of the following options: "
- "PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
-endif()
-
-if(PNG_SHARED AND WIN32)
- set_target_properties(png PROPERTIES
- DEFINE_SYMBOL PNG_BUILD_DLL)
+ "PNG_SHARED, PNG_STATIC, PNG_FRAMEWORK")
endif()
function(png_add_test)
set(oneValueArgs NAME COMMAND)
set(multiValueArgs OPTIONS FILES)
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
if(NOT _PAT_NAME)
message(FATAL_ERROR "png_add_test: Missing NAME argument")
endif()
@ONLY)
add_test(NAME "${_PAT_NAME}"
COMMAND "${CMAKE_COMMAND}"
- "-DLIBPNG=$<TARGET_FILE:png>"
+ "-DLIBPNG=$<TARGET_FILE:png_shared>"
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
endfunction()
set(PNGTEST_PNG "${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png")
add_executable(pngtest ${pngtest_sources})
- target_link_libraries(pngtest png)
+ target_link_libraries(pngtest png_shared)
png_add_test(NAME pngtest
COMMAND pngtest
FILES "${PNGTEST_PNG}")
add_executable(pngvalid ${pngvalid_sources})
- target_link_libraries(pngvalid png)
+ target_link_libraries(pngvalid png_shared)
png_add_test(NAME pngvalid-gamma-16-to-8
COMMAND pngvalid
OPTIONS --transform)
add_executable(pngstest ${pngstest_sources})
- target_link_libraries(pngstest png)
+ target_link_libraries(pngstest png_shared)
foreach(gamma_type 1.8 linear none sRGB)
foreach(alpha_type none alpha)
endforeach()
add_executable(pngunknown ${pngunknown_sources})
- target_link_libraries(pngunknown png)
+ target_link_libraries(pngunknown png_shared)
png_add_test(NAME pngunknown-discard
COMMAND pngunknown
FILES "${PNGTEST_PNG}")
add_executable(pngimage ${pngimage_sources})
- target_link_libraries(pngimage png)
+ target_link_libraries(pngimage png_shared)
png_add_test(NAME pngimage-quick
COMMAND pngimage
if(PNG_SHARED AND PNG_EXECUTABLES)
add_executable(pngfix ${pngfix_sources})
- target_link_libraries(pngfix png)
+ target_link_libraries(pngfix png_shared)
set(PNG_BIN_TARGETS pngfix)
add_executable(png-fix-itxt ${png_fix_itxt_sources})
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
endif()
-# Creates a symlink from src to dest (if possible), or, alternatively,
-# copies src to dest if different.
-include(CMakeParseArguments)
+# Create a symlink from src to dest (if possible), or, alternatively,
+# copy src to dest if different.
function(create_symlink DEST_FILE)
- cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
-
- if(NOT S_TARGET AND NOT S_FILE)
- message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
+ cmake_parse_arguments(_SYM "" "FILE;TARGET" "" ${ARGN})
+ if(NOT _SYM_FILE AND NOT _SYM_TARGET)
+ message(FATAL_ERROR "create_symlink: Missing FILE or TARGET argument")
endif()
-
- if(S_TARGET AND S_FILE)
+ if(_SYM_FILE AND _SYM_TARGET)
message(FATAL_ERROR "create_symlink: "
- "Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; "
- "can only have one")
+ "The arguments FILE (${_SYM_FILE}) and TARGET (${_SYM_TARGET}) "
+ "are mutually-exclusive")
endif()
- if(S_FILE)
+ if(_SYM_FILE)
# If we don't need to symlink something that's coming from a build target,
# we can go ahead and symlink/copy at configure time.
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
execute_process(COMMAND "${CMAKE_COMMAND}"
-E copy_if_different
- ${S_FILE} ${DEST_FILE}
+ ${_SYM_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
else()
execute_process(COMMAND "${CMAKE_COMMAND}"
-E create_symlink
- ${S_FILE} ${DEST_FILE}
+ ${_SYM_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
endif()
- if(S_TARGET)
+ if(_SYM_TARGET)
# We need to use generator expressions, which can be a bit tricky.
# For simplicity, make the symlink a POST_BUILD step, and use the TARGET
# signature of add_custom_command.
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
- add_custom_command(TARGET ${S_TARGET}
+ add_custom_command(TARGET ${_SYM_TARGET}
POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-E copy_if_different
- $<TARGET_LINKER_FILE_NAME:${S_TARGET}>
- $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
+ $<TARGET_LINKER_FILE_NAME:${_SYM_TARGET}>
+ $<TARGET_LINKER_FILE_DIR:${_SYM_TARGET}>/${DEST_FILE})
else()
- add_custom_command(TARGET ${S_TARGET}
+ add_custom_command(TARGET ${_SYM_TARGET}
POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-E create_symlink
- $<TARGET_LINKER_FILE_NAME:${S_TARGET}>
- $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
+ $<TARGET_LINKER_FILE_NAME:${_SYM_TARGET}>
+ $<TARGET_LINKER_FILE_DIR:${_SYM_TARGET}>/${DEST_FILE})
endif()
endif()
endfunction()
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
- ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
+ ${CMAKE_CURRENT_BINARY_DIR}/libpng${PNGLIB_ABI_VERSION}.pc
@ONLY)
- create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
+ create_symlink(libpng.pc FILE libpng${PNGLIB_ABI_VERSION}.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
- ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
+ ${CMAKE_CURRENT_BINARY_DIR}/libpng${PNGLIB_ABI_VERSION}-config
@ONLY)
- create_symlink(libpng-config FILE ${PNGLIB_NAME}-config)
-endif()
-
-# Set up links.
-if(PNG_SHARED)
- set_target_properties(png PROPERTIES
- VERSION ${PNGLIB_SHARED_VERSION}
- SOVERSION ${PNGLIB_SHARED_SOVERSION}
- CLEAN_DIRECT_OUTPUT 1)
+ create_symlink(libpng-config FILE libpng${PNGLIB_ABI_VERSION}-config)
endif()
# Install.
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
- install(TARGETS ${PNG_LIB_TARGETS}
+ install(TARGETS ${PNG_LIBRARY_TARGETS}
EXPORT libpng
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
if(PNG_SHARED)
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
if(CYGWIN OR MINGW)
- create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
- install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
+ create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png_shared)
+ install(FILES $<TARGET_LINKER_FILE_DIR:png_shared>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT WIN32)
- create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
- install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
+ create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared)
+ install(FILES $<TARGET_LINKER_FILE_DIR:png_shared>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
install(FILES ${libpng_public_hdrs}
DESTINATION include)
install(FILES ${libpng_public_hdrs}
- DESTINATION include/${PNGLIB_NAME})
+ DESTINATION include/libpng${PNGLIB_ABI_VERSION})
endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
if(NOT WIN32 OR CYGWIN OR MINGW)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng${PNGLIB_ABI_VERSION}-config
DESTINATION bin)
endif()
endif()
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION ${CMAKE_INSTALL_BINDIR})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${PNGLIB_ABI_VERSION}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng${PNGLIB_ABI_VERSION}-config
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
install(EXPORT libpng
DESTINATION lib/libpng
- FILE lib${PNG_LIB_NAME}.cmake)
+ FILE libpng${PNGLIB_ABI_VERSION}.cmake)
endif()
# TODO: Create MSVC import lib for MinGW-compiled shared lib.
PNG Reference Library License version 2
---------------------------------------
- * Copyright (c) 1995-2022 The PNG Reference Library Authors.
- * Copyright (c) 2018-2022 Cosmin Truta.
+ * Copyright (c) 1995-2023 The PNG Reference Library Authors.
+ * Copyright (c) 2018-2023 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-README for libpng version 1.6.39
+README for libpng version 1.6.40
================================
-See the note about version numbers near the top of png.h.
-See INSTALL for instructions on how to install libpng.
+See the note about version numbers near the top of `png.h`.
+See `INSTALL` for instructions on how to install libpng.
-Libpng comes in several distribution formats. Get libpng-*.tar.gz or
-libpng-*.tar.xz if you want UNIX-style line endings in the text files,
-or lpng*.7z or lpng*.zip if you want DOS-style line endings.
+Libpng comes in several distribution formats. Get `libpng-*.tar.gz`
+or `libpng-*.tar.xz` if you want UNIX-style line endings in the text
+files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings.
-Version 0.89 was the first official release of libpng. Don't let the
-fact that it's the first release fool you. The libpng library has been
-in extensive use and testing since mid-1995. By late 1997 it had
-finally gotten to the stage where there hadn't been significant
-changes to the API in some time, and people have a bad feeling about
-libraries with versions < 1.0. Version 1.0.0 was released in
-March 1998.
+For a detailed description on using libpng, read `libpng-manual.txt`.
+For examples of libpng in a program, see `example.c` and `pngtest.c`.
+For usage information and restrictions (what little they are) on libpng,
+see `png.h`. For a description on using zlib (the compression library
+used by libpng) and zlib's restrictions, see `zlib.h`.
-****
-Note that some of the changes to the png_info structure render this
-version of the library binary incompatible with libpng-0.89 or
-earlier versions if you are using a shared library. The type of the
-"filler" parameter for png_set_filler() has changed from png_byte to
-png_uint_32, which will affect shared-library applications that use
-this function.
-
-To avoid problems with changes to the internals of the png info_struct,
-new APIs have been made available in 0.95 to avoid direct application
-access to info_ptr. These functions are the png_set_<chunk> and
-png_get_<chunk> functions. These functions should be used when
-accessing/storing the info_struct data, rather than manipulating it
-directly, to avoid such problems in the future.
-
-It is important to note that the APIs did not make current programs
-that access the info struct directly incompatible with the new
-library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
-be a transitional release, members of the png_struct and the
-info_struct can still be accessed, but the compiler will issue a
-warning about deprecated usage. Since libpng-1.5.0, direct access
-to these structs is not allowed, and the definitions of the structs
-reside in private pngstruct.h and pnginfo.h header files that are not
-accessible to applications. It is strongly suggested that new
-programs use the new APIs (as shown in example.c and pngtest.c), and
-older programs be converted to the new format, to facilitate upgrades
-in the future.
-****
-
-Additions since 0.90 include the ability to compile libpng as a
-Windows DLL, and new APIs for accessing data in the info struct.
-Experimental functions include the ability to set weighting and cost
-factors for row filter selection, direct reads of integers from buffers
-on big-endian processors that support misaligned data access, faster
-methods of doing alpha composition, and more accurate 16->8 bit color
-conversion.
-
-The additions since 0.89 include the ability to read from a PNG stream
-which has had some (or all) of the signature bytes read by the calling
-application. This also allows the reading of embedded PNG streams that
-do not have the PNG file signature. As well, it is now possible to set
-the library action on the detection of chunk CRC errors. It is possible
-to set different actions based on whether the CRC error occurred in a
-critical or an ancillary chunk.
-
-For a detailed description on using libpng, read libpng-manual.txt.
-For examples of libpng in a program, see example.c and pngtest.c. For
-usage information and restrictions (what little they are) on libpng,
-see png.h. For a description on using zlib (the compression library
-used by libpng) and zlib's restrictions, see zlib.h
-
-I have included a general makefile, as well as several machine and
-compiler specific ones, but you may have to modify one for your own
-needs.
-
-You should use zlib 1.0.4 or later to run this, but it MAY work with
+You should use zlib 1.0.4 or later to run this, but it _may_ work with
versions as old as zlib 0.95. Even so, there are bugs in older zlib
versions which can cause the output of invalid compression streams for
some images.
You should also note that zlib is a compression library that is useful
for more things than just PNG files. You can use zlib as a drop-in
-replacement for fread() and fwrite(), if you are so inclined.
+replacement for `fread()` and `fwrite()`, if you are so inclined.
zlib should be available at the same place that libpng is, or at
-https://zlib.net.
+https://zlib.net .
You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/pngdocs.html .
-This code is currently being archived at libpng.sourceforge.io in the
-[DOWNLOAD] area, and at http://libpng.download/src .
+This code is currently being archived at https://libpng.sourceforge.io
+in the download area, and at http://libpng.download/src .
This release, based in a large way on Glenn's, Guy's and Andreas'
earlier work, was created and will be supported by myself and the PNG
development group.
-Send comments/corrections/commendations to png-mng-implement at
-lists.sourceforge.net (subscription required; visit
+Send comments, corrections and commendations to `png-mng-implement`
+at `lists.sourceforge.net`. (Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
-to subscribe).
+to subscribe.)
+
+Send general questions about the PNG specification to `png-mng-misc`
+at `lists.sourceforge.net`. (Subscription is required; visit
+https://lists.sourceforge.net/lists/listinfo/png-mng-misc
+to subscribe.)
-Send general questions about the PNG specification to png-mng-misc
-at lists.sourceforge.net (subscription required; visit
-https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
-subscribe).
+Historical notes
+----------------
+
+The libpng library has been in extensive use and testing since mid-1995.
+Version 0.89, published a year later, was the first official release.
+By late 1997, it had finally gotten to the stage where there hadn't
+been significant changes to the API in some time, and people have a bad
+feeling about libraries with versions below 1.0. Version 1.0.0 was
+released in March 1998.
+
+Note that some of the changes to the `png_info` structure render this
+version of the library binary incompatible with libpng-0.89 or
+earlier versions if you are using a shared library. The type of the
+`filler` parameter for `png_set_filler()` has changed from `png_byte`
+to `png_uint_32`, which will affect shared-library applications that
+use this function.
+
+To avoid problems with changes to the internals of the `info_struct`,
+new APIs have been made available in 0.95 to avoid direct application
+access to `info_ptr`. These functions are the `png_set_<chunk>` and
+`png_get_<chunk>` functions. These functions should be used when
+accessing/storing the `info_struct` data, rather than manipulating it
+directly, to avoid such problems in the future.
+
+It is important to note that the APIs did not make current programs
+that access the info struct directly incompatible with the new
+library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
+be a transitional release, members of the `png_struct` and the
+`info_struct` can still be accessed, but the compiler will issue a
+warning about deprecated usage. Since libpng-1.5.0, direct access
+to these structs is not allowed, and the definitions of the structs
+reside in private `pngstruct.h` and `pnginfo.h` header files that are
+not accessible to applications. It is strongly suggested that new
+programs use the new APIs (as shown in `example.c` and `pngtest.c`),
+and older programs be converted to the new format, to facilitate
+upgrades in the future.
+
+The additions since 0.89 include the ability to read from a PNG stream
+which has had some (or all) of the signature bytes read by the calling
+application. This also allows the reading of embedded PNG streams that
+do not have the PNG file signature. As well, it is now possible to set
+the library action on the detection of chunk CRC errors. It is possible
+to set different actions based on whether the CRC error occurred in a
+critical or an ancillary chunk.
+
+The additions since 0.90 include the ability to compile libpng as a
+Windows DLL, and new APIs for accessing data in the `info_struct`.
+Experimental functions included the ability to set weighting and cost
+factors for row filter selection, direct reads of integers from buffers
+on big-endian processors that support misaligned data access, faster
+methods of doing alpha composition, and more accurate 16-to-8 bit color
+conversion. Some of these experimental functions, such as the weighted
+filter heuristics, have since been removed.
-Files in this distribution:
+Files included in this distribution
+-----------------------------------
ANNOUNCE => Announcement of this version, with recent changes
AUTHORS => List of contributing authors
arm-neon/ => Optimized code for the ARM-NEON platform
mips-msa/ => Optimized code for the MIPS-MSA platform
powerpc-vsx/ => Optimized code for the POWERPC-VSX platform
- examples/ => Example programs
+ examples/ => Examples of libpng usage
gregbook/ => Source code for PNG reading and writing, from
"PNG: The Definitive Guide" by Greg Roelofs,
O'Reilly, 1999
config.sub configure depcomp install-sh ltmain.sh missing\
test-driver"
#
-# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
+# Files generated by versions of autoconf >2.68 or automake >1.13 (i.e. later
# versions than those required by configure.ac):
libpng_autotools_extra="compile config.h.in~"
#
#!/usr/bin/env bash
set -e
-# ci_cmake.sh
+# ci_verify_cmake.sh
# Continuously integrate libpng using CMake.
#
-# Copyright (c) 2019-2022 Cosmin Truta.
+# Copyright (c) 2019-2023 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
-CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"
-CI_INSTALLDIR="$CI_SRCDIR/out/cmake.install"
+CI_BUILDDIR="$CI_SRCDIR/out/ci_verify_cmake.build"
+CI_INSTALLDIR="$CI_SRCDIR/out/ci_verify_cmake.install"
+
+# Keep the following relative paths in sync with the absolute paths.
+# We use them for the benefit of native Windows tools that might be
+# otherwise confused by the path encoding used by Bash-on-Windows.
+CI_SRCDIR_FROM_BUILDDIR="../.."
+CI_INSTALLDIR_FROM_BUILDDIR="../ci_verify_cmake.install"
function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
"$@"
}
-function ci_init_cmake {
+function ci_init_cmake_build {
CI_SYSTEM_NAME="$(uname -s)"
CI_MACHINE_NAME="$(uname -m)"
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}"
+ [[ -x $(command -v ninja) ]] &&
+ CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
then
- # Initialize the CI_...DIR_NATIVE variables, for the benefit of
- # the native Windows build tools. The regular CI_...DIR variables
- # can only be used inside Bash-on-Windows.
- mkdir -p "$CI_BUILDDIR"
- mkdir -p "$CI_INSTALLDIR"
- if [[ -x $CYGPATH ]]
- then
- CI_SRCDIR_NATIVE="$("$CYGPATH" -w "$CI_SRCDIR")"
- CI_BUILDDIR_NATIVE="$("$CYGPATH" -w "$CI_BUILDDIR")"
- CI_INSTALLDIR_NATIVE="$("$CYGPATH" -w "$CI_INSTALLDIR")"
- else
- CI_SRCDIR_NATIVE="$(cd "$CI_SRCDIR" ; pwd -W || pwd -P)"
- CI_BUILDDIR_NATIVE="$(cd "$CI_BUILDDIR" ; pwd -W || pwd -P)"
- CI_INSTALLDIR_NATIVE="$(cd "$CI_INSTALLDIR" ; pwd -W || pwd -P)"
- fi
# Clean up incidental mixtures of Windows and Bash-on-Windows
# environment variables, to avoid confusing MSBuild.
[[ $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_err "missing: \$CI_CMAKE_GENERATOR_PLATFORM"
+ [[ $CI_CMAKE_GENERATOR_PLATFORM ]] ||
+ ci_err "missing: \$CI_CMAKE_GENERATOR_PLATFORM"
fi
}
-function ci_trace_cmake {
+function ci_trace_cmake_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "system name: $CI_SYSTEM_NAME"
ci_info "machine hardware name: $CI_MACHINE_NAME"
ci_info "source directory: $CI_SRCDIR"
- [[ $CI_SRCDIR_NATIVE ]] &&
- ci_info "source directory (native): $CI_SRCDIR_NATIVE"
ci_info "build directory: $CI_BUILDDIR"
- [[ $CI_BUILDDIR_NATIVE ]] &&
- ci_info "build directory (native): $CI_BUILDDIR_NATIVE"
ci_info "install directory: $CI_INSTALLDIR"
- [[ $CI_INSTALLDIR_NATIVE ]] &&
- ci_info "install directory (native): $CI_INSTALLDIR_NATIVE"
ci_info "environment option: \$CI_CMAKE: '$CI_CMAKE'"
ci_info "environment option: \$CI_CMAKE_GENERATOR: '$CI_CMAKE_GENERATOR'"
ci_info "environment option: \$CI_CMAKE_GENERATOR_PLATFORM: '$CI_CMAKE_GENERATOR_PLATFORM'"
ci_info "environment option: \$CI_CMAKE_BUILD_TYPE: '$CI_CMAKE_BUILD_TYPE'"
ci_info "environment option: \$CI_CMAKE_BUILD_FLAGS: '$CI_CMAKE_BUILD_FLAGS'"
+ ci_info "environment option: \$CI_CMAKE_TOOLCHAIN_FILE: '$CI_CMAKE_TOOLCHAIN_FILE'"
ci_info "environment option: \$CI_CMAKE_VARS: '$CI_CMAKE_VARS'"
ci_info "environment option: \$CI_CTEST: '$CI_CTEST'"
ci_info "environment option: \$CI_CTEST_FLAGS: '$CI_CTEST_FLAGS'"
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_CMAKE_GENERATOR == *"Ninja"* ]] &&
- ci_info "executable: $(command -V ninja)"
[[ $CI_CC ]] &&
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
[[ $CI_AR ]] &&
ci_info "## END OF CONFIGURATION ##"
}
+function ci_cleanup_old_cmake_build {
+ [[ ! -e $CI_BUILDDIR ]] ||
+ ci_spawn rm -fr "$CI_BUILDDIR"
+ [[ ! -e $CI_INSTALLDIR ]] ||
+ ci_spawn rm -fr "$CI_INSTALLDIR"
+}
+
function ci_build_cmake {
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"
+ [[ $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 -a ALL_CMAKE_VARS=()
- [[ $CI_CC ]] && ALL_CMAKE_VARS+=(-DCMAKE_C_COMPILER="$CI_CC")
- [[ $ALL_CC_FLAGS ]] && ALL_CMAKE_VARS+=(-DCMAKE_C_FLAGS="$ALL_CC_FLAGS")
- [[ $CI_AR ]] && ALL_CMAKE_VARS+=(-DCMAKE_AR="$CI_AR")
- [[ $CI_RANLIB ]] && ALL_CMAKE_VARS+=(-DCMAKE_RANLIB="$CI_RANLIB")
+ 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")
+ [[ $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)
- [[ $CI_NO_TEST ]] && ALL_CMAKE_VARS+=(-DPNG_TESTS=OFF)
+ [[ $CI_NO_TEST ]] &&
+ ALL_CMAKE_VARS+=(-DPNG_TESTS=OFF)
ALL_CMAKE_VARS+=($CI_CMAKE_VARS)
- local -a ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS)
- local -a ALL_CTEST_FLAGS=($CI_CTEST_FLAGS)
- # Initialize SRCDIR_NATIVE and INSTALLDIR_NATIVE.
- local SRCDIR_NATIVE="${CI_SRCDIR_NATIVE:-"$CI_SRCDIR"}"
- local INSTALLDIR_NATIVE="${CI_INSTALLDIR_NATIVE:-"$CI_INSTALLDIR"}"
+ local ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS)
+ local ALL_CTEST_FLAGS=($CI_CTEST_FLAGS)
# Export the CMake environment variables.
[[ $CI_CMAKE_GENERATOR ]] &&
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
# Build and install.
- ci_spawn rm -fr "$CI_BUILDDIR" "$CI_INSTALLDIR"
+ # Use $CI_SRCDIR_FROM_BUILDDIR and $CI_INSTALLDIR_FROM_BUILDDIR
+ # instead of $CI_SRCDIR and $CI_INSTALLDIR from this point onwards.
ci_spawn mkdir -p "$CI_BUILDDIR"
ci_spawn cd "$CI_BUILDDIR"
- ci_spawn "$CI_CMAKE" "${ALL_CMAKE_VARS[@]}" \
- -DCMAKE_INSTALL_PREFIX="$INSTALLDIR_NATIVE" \
- "$SRCDIR_NATIVE"
+ [[ $CI_SRCDIR -ef $CI_SRCDIR_FROM_BUILDDIR ]] ||
+ ci_err "assertion failed: testing: '$CI_SRCDIR' -ef '$CI_SRCDIR_FROM_BUILDDIR'"
+ ci_spawn mkdir -p "$CI_INSTALLDIR"
+ [[ $CI_INSTALLDIR -ef $CI_INSTALLDIR_FROM_BUILDDIR ]] ||
+ ci_err "assertion failed: testing: '$CI_INSTALLDIR' -ef '$CI_INSTALLDIR_FROM_BUILDDIR'"
+ ci_spawn "$CI_CMAKE" -DCMAKE_INSTALL_PREFIX="$CI_INSTALLDIR_FROM_BUILDDIR" \
+ "${ALL_CMAKE_VARS[@]}" \
+ "$CI_SRCDIR_FROM_BUILDDIR"
ci_spawn "$CI_CMAKE" --build . \
--config "$CI_CMAKE_BUILD_TYPE" \
"${ALL_CMAKE_BUILD_FLAGS[@]}"
ci_info "## END OF BUILD ##"
}
-ci_init_cmake
-ci_trace_cmake
-[[ $# -eq 0 ]] || {
- ci_info "note: this program accepts environment options only"
- ci_err "unexpected command arguments: '$*'"
+function main {
+ [[ $# -eq 0 ]] || {
+ ci_info "note: this program accepts environment options only"
+ ci_err "unexpected command arguments: '$*'"
+ }
+ ci_init_cmake_build
+ ci_trace_cmake_build
+ ci_cleanup_old_cmake_build
+ ci_build_cmake
}
-ci_build_cmake
+
+main "$@"
#!/usr/bin/env bash
set -e
-# ci_autotools.sh
-# Continuously integrate libpng using the GNU Autotools.
+# ci_verify_configure.sh
+# Continuously integrate libpng using the configure script.
#
-# Copyright (c) 2019-2022 Cosmin Truta.
+# Copyright (c) 2019-2023 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
-CI_BUILDDIR="$CI_SRCDIR/out/autotools.build"
-CI_INSTALLDIR="$CI_SRCDIR/out/autotools.install"
+CI_BUILDDIR="$CI_SRCDIR/out/ci_verify_configure.build"
+CI_INSTALLDIR="$CI_SRCDIR/out/ci_verify_configure.install"
function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
"$@"
}
-function ci_init_autotools {
+function ci_init_configure_build {
CI_SYSTEM_NAME="$(uname -s)"
CI_MACHINE_NAME="$(uname -m)"
CI_MAKE="${CI_MAKE:-make}"
[[ ! $CI_MAKE_VARS ]] || ci_err "unexpected: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
}
-function ci_trace_autotools {
+function ci_trace_configure_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "system name: $CI_SYSTEM_NAME"
ci_info "machine hardware name: $CI_MACHINE_NAME"
ci_info "## END OF CONFIGURATION ##"
}
-function ci_build_autotools {
+function ci_cleanup_old_configure_build {
+ [[ ! -e $CI_BUILDDIR ]] ||
+ ci_spawn rm -fr "$CI_BUILDDIR"
+ [[ ! -e $CI_INSTALLDIR ]] ||
+ ci_spawn rm -fr "$CI_INSTALLDIR"
+}
+
+function ci_build_configure {
ci_info "## START OF BUILD ##"
# Export the configure build environment.
[[ $CI_CC ]] && ci_spawn export CC="$CI_CC"
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
}
# Build and install.
- ci_spawn rm -fr "$CI_BUILDDIR" "$CI_INSTALLDIR"
ci_spawn mkdir -p "$CI_BUILDDIR"
ci_spawn cd "$CI_BUILDDIR"
ci_spawn "$CI_SRCDIR/configure" --prefix="$CI_INSTALLDIR" $CI_CONFIGURE_FLAGS
ci_info "## END OF BUILD ##"
}
-ci_init_autotools
-ci_trace_autotools
-[[ $# -eq 0 ]] || {
- ci_info "note: this program accepts environment options only"
- ci_err "unexpected command arguments: '$*'"
+function main {
+ [[ $# -eq 0 ]] || {
+ ci_info "note: this program accepts environment options only"
+ ci_err "unexpected command arguments: '$*'"
+ }
+ ci_init_configure_build
+ ci_trace_configure_build
+ ci_cleanup_old_configure_build
+ ci_build_configure
}
-ci_build_autotools
+
+main "$@"
#!/usr/bin/env bash
set -e
-# ci_legacy.sh
+# ci_verify_makefiles.sh
# Continuously integrate libpng using the legacy makefiles.
#
-# Copyright (c) 2019-2022 Cosmin Truta.
+# Copyright (c) 2019-2023 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
-CI_BUILDDIR="$CI_SRCDIR"
function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
"$@"
}
-function ci_init_legacy {
+function ci_init_makefiles_build {
CI_SYSTEM_NAME="$(uname -s)"
CI_MACHINE_NAME="$(uname -m)"
CI_MAKE="${CI_MAKE:-make}"
- case "$CI_SYSTEM_NAME" in
- ( Darwin | *BSD | DragonFly )
- [[ -x $(command -v clang) ]] && CI_CC="${CI_CC:-clang}" ;;
- ( * )
- [[ -x $(command -v gcc) ]] && CI_CC="${CI_CC:-gcc}" ;;
- esac
- CI_CC="${CI_CC:-cc}"
case "$CI_CC" in
( *clang* )
- CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.clang"}" ;;
+ CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.clang"}" ;;
( *gcc* )
- CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.gcc"}" ;;
- ( cc | c89 | c99 )
- CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.std"}" ;;
+ CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.gcc"}" ;;
+ ( * )
+ CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.std"}" ;;
esac
- CI_LD="${CI_LD:-"$CI_CC"}"
- CI_LIBS="${CI_LIBS:-"-lz -lm"}"
}
-function ci_trace_legacy {
+function ci_trace_makefiles_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "system name: $CI_SYSTEM_NAME"
ci_info "machine hardware name: $CI_MACHINE_NAME"
ci_info "source directory: $CI_SRCDIR"
- ci_info "build directory: $CI_BUILDDIR"
- ci_info "environment option: \$CI_LEGACY_MAKEFILES: '$CI_LEGACY_MAKEFILES'"
+ ci_info "environment option: \$CI_MAKEFILES: '$CI_MAKEFILES'"
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
ci_info "environment option: \$CI_MAKE_FLAGS: '$CI_MAKE_FLAGS'"
ci_info "environment option: \$CI_MAKE_VARS: '$CI_MAKE_VARS'"
ci_info "## END OF CONFIGURATION ##"
}
-function ci_build_legacy {
+function ci_cleanup_old_makefiles_build {
+ # Any old makefile-based build will most likely leave a mess
+ # of object files behind if interrupted, e.g., via Ctrl+C.
+ # There may be other files behind, depending on what makefile
+ # had been used. We cannot easily enumerate all of those.
+ # Fortunately, for a clean makefiles-based build, it should be
+ # sufficient to remove the old object files only.
+ [[ -z $(find "$CI_SRCDIR" -maxdepth 1 -name "*.o") ]] ||
+ ci_spawn rm -f "$CI_SRCDIR"/*.o
+ [[ -z $(find "$CI_SRCDIR" -maxdepth 1 -name "*.obj") ]] ||
+ ci_spawn rm -f "$CI_SRCDIR"/*.obj
+}
+
+function ci_build_makefiles {
ci_info "## START OF BUILD ##"
# Initialize ALL_CC_FLAGS and ALL_LD_FLAGS as strings.
local ALL_CC_FLAGS="$CI_CC_FLAGS"
ALL_LD_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_LD_FLAGS"
}
# Initialize ALL_MAKE_FLAGS and ALL_MAKE_VARS as arrays.
- local -a ALL_MAKE_FLAGS=($CI_MAKE_FLAGS)
- local -a ALL_MAKE_VARS=()
+ 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_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")
- ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
+ [[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
ALL_MAKE_VARS+=($CI_MAKE_VARS)
# Build!
- ci_spawn cd "$CI_SRCDIR"
+ cd "$CI_SRCDIR"
local MY_MAKEFILE
- for MY_MAKEFILE in $CI_LEGACY_MAKEFILES
+ for MY_MAKEFILE in $CI_MAKEFILES
do
ci_info "using makefile: $MY_MAKEFILE"
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
ci_info "## END OF BUILD ##"
}
-ci_init_legacy
-ci_trace_legacy
-[[ $# -eq 0 ]] || {
- ci_info "note: this program accepts environment options only"
- ci_err "unexpected command arguments: '$*'"
+function main {
+ [[ $# -eq 0 ]] || {
+ ci_info "note: this program accepts environment options only"
+ ci_err "unexpected command arguments: '$*'"
+ }
+ ci_init_makefiles_build
+ ci_trace_makefiles_build
+ ci_cleanup_old_makefiles_build
+ ci_build_makefiles
}
-ci_build_legacy
+
+main "$@"
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for libpng 1.6.39.
+# Generated by GNU Autoconf 2.71 for libpng 1.6.40.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
-PACKAGE_VERSION='1.6.39'
-PACKAGE_STRING='libpng 1.6.39'
+PACKAGE_VERSION='1.6.40'
+PACKAGE_STRING='libpng 1.6.40'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libpng 1.6.39 to adapt to many kinds of systems.
+\`configure' configures libpng 1.6.40 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libpng 1.6.39:";;
+ short | recursive ) echo "Configuration of libpng 1.6.40:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libpng configure 1.6.39
+libpng configure 1.6.40
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libpng $as_me 1.6.39, which was
+It was created by libpng $as_me 1.6.40, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
# Define the identity of the package.
PACKAGE='libpng'
- VERSION='1.6.39'
+ VERSION='1.6.40'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
-PNGLIB_VERSION=1.6.39
+PNGLIB_VERSION=1.6.40
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
-PNGLIB_RELEASE=39
+PNGLIB_RELEASE=40
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libpng $as_me 1.6.39, which was
+This file was extended by libpng $as_me 1.6.40, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-libpng config.status 1.6.39
+libpng config.status 1.6.40
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
dnl Version number stuff here:
-AC_INIT([libpng],[1.6.39],[png-mng-implement@lists.sourceforge.net])
+AC_INIT([libpng],[1.6.40],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign')
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
-PNGLIB_VERSION=1.6.39
+PNGLIB_VERSION=1.6.40
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
-PNGLIB_RELEASE=39
+PNGLIB_RELEASE=40
dnl End of version number stuff
case 32:
case 48:
case 64:
- /* The rows are filled by an alogorithm similar to the above, in the
+ /* The rows are filled by an algorithm similar to the above, in the
* first row pixel bytes are all equal, increasing from 0 by 1 for
* each pixel. In the second row the bytes within a pixel are
* incremented 1,3,5,7,... from the previous row byte. Using an odd
*
* 2) Remove color by mapping to grayscale. (Grayscale to color is a no-op.)
*
- * 3) Convert between 8-bit and 16-bit components. (Both directtions are
+ * 3) Convert between 8-bit and 16-bit components. (Both directions are
* relevant.)
*
* This gives the following base format conversion matrix:
unsigned int out, png_byte sample_depth, double err, double limit,
const char *name, double digitization_error)
{
- /* Compare the scaled, digitzed, values of our local calculation (in+-err)
+ /* Compare the scaled, digitized, values of our local calculation (in+-err)
* with the digitized values libpng produced; 'sample_depth' is the actual
* digitization depth of the libpng output colors (the bit depth except for
* palette images where it is always 8.) The check on 'err' is to detect
static int
image_transform_test_counter(png_uint_32 counter, unsigned int max)
{
- /* Test the list to see if there is any point contining, given a current
+ /* Test the list to see if there is any point continuing, given a current
* counter and a 'max' value.
*/
image_transform *next = image_transform_first;
/**************************** VALIDATION TESTS ********************************/
/* Various validation routines are included herein, they require some
- * definition for png_warning and png_error, seetings of VALIDATION:
+ * definition for png_warning and png_error, settings of VALIDATION:
*
* 1: validates the ASCII to floating point conversions
* 2: validates png_muldiv
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 copyight holders be liable for any claim, damages or other
+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.
* signature (in length,type).
*
* When a chunk control structure is instantiated these values are copied
- * into the structure and can then be overritten with the data for the next
+ * into the structure and can then be overwritten with the data for the next
* chunk.
*/
fpos_t data_pos; /* Position of first byte of chunk data */
return 0;
}
- /* if filename given on commandline, store it */
+ /* if filename given on command line, store it */
if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
if (szCmdLine[0] == '"')
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
libpng-manual.txt - A description on how to use and modify libpng
- Copyright (c) 2018-2022 Cosmin Truta
+ Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 1998-2018 Glenn Randers-Pehrson
This document is released under the libpng license.
Based on:
- libpng version 1.6.36, December 2018, through 1.6.39 - November 2022
+ libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
Updated and distributed by Cosmin Truta
- Copyright (c) 2018-2022 Cosmin Truta
+ Copyright (c) 2018-2023 Cosmin Truta
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
Updated and distributed by Glenn Randers-Pehrson
-.TH LIBPNG 3 "November 20, 2022"
+.TH LIBPNG 3 "June 21, 2023"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.39
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.40
.SH SYNOPSIS
\fB#include <png.h>\fP
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
- Copyright (c) 2018-2022 Cosmin Truta
+ Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 1998-2018 Glenn Randers-Pehrson
This document is released under the libpng license.
Based on:
- libpng version 1.6.36, December 2018, through 1.6.39 - November 2022
+ libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
Updated and distributed by Cosmin Truta
- Copyright (c) 2018-2022 Cosmin Truta
+ Copyright (c) 2018-2023 Cosmin Truta
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
Updated and distributed by Glenn Randers-Pehrson
public release number plus "betaNN" or "rcNN".
.SH "SEE ALSO"
-.IR libpngpf(3) ", " png(5)
-.LP
-.IR libpng :
+.BR "png"(5)
.IP
-https://libpng.sourceforge.io/ (follow the [DOWNLOAD] link)
-http://www.libpng.org/pub/png
-
+The PNG (Portable Network Graphics) format specification.
.LP
-.IR zlib :
+.B libpng
.IP
-(generally) at the same location as
-.I libpng
-or at
+http://www.libpng.org/pub/png/libpng.html (canonical home page)
.br
-https://zlib.net/
-
+https://github.com/pnggroup/libpng (canonical Git repository)
+.br
+https://libpng.sourceforge.io (downloadable archives)
.LP
-.IR PNG specification: RFC 2083
+.B zlib
.IP
-(generally) at the same location as
-.I libpng
-or at
+https://zlib.net (canonical home page)
.br
-https://www.ietf.org/rfc/rfc2083.txt
+https://github.com/madler/zlib (canonical Git repository)
.br
-or (as a W3C Recommendation) at
-.br
-https://www.w3.org/TR/REC-png.html
-
+A copy of zlib may also be found at the same location as libpng.
.LP
In the case of any inconsistency between the PNG specification
and this library, the specification takes precedence.
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Maintained by Cosmin Truta.
-Supported by the PNG development group
+Supported by the PNG development group.
.br
-png-mng-implement at lists.sourceforge.net (subscription required; visit
-https://lists.sourceforge.net/lists/listinfo/png-mng-implement
-to subscribe).
+png-mng-implement at lists.sourceforge.net. (Subscription is required;
+visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+to subscribe.)
.\" end of man page
-.TH LIBPNGPF 3 "November 20, 2022"
+.TH LIBPNGPF 3 "June 21, 2023"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.39
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.40
(private functions)
.SH SYNOPSIS
-.TH PNG 5 "September 14, 2022"
+.TH PNG 5 "June 21, 2023"
.SH NAME
png \- Portable Network Graphics (PNG) format
matching on heterogeneous platforms.
.SH "SEE ALSO"
-.BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
+.BR "libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.LP
PNG Specification (Second Edition), November 2003:
.IP
ISO/IEC 15948:2003 (E) (November 10, 2003): David Duce and others.
.LP
Portable Network Graphics (PNG) Specification Version 1.2 (July 8, 1999):
-Glenn Randers-Pehrson and others (png-list).
+Glenn Randers-Pehrson and others.
.LP
Portable Network Graphics (PNG) Specification Version 1.0 (October 1, 1996):
-Thomas Boutell and others (png-list).
+Thomas Boutell and others.
-.SH COPYRIGHT
-.LP
-This man page is
-.br
-Copyright (c) 2018 Cosmin Truta.
-.br
-Copyright (c) 1998-2006 Glenn Randers-Pehrson.
-.br
-See png.h for conditions of use and distribution.
-.LP
-The PNG Specification (Second Edition) is
-.br
-Copyright (c) 2003 W3C. (MIT, ERCIM, Keio), All Rights Reserved.
-.LP
-The PNG-1.2 Specification is
-.br
-Copyright (c) 1999 Glenn Randers-Pehrson.
-.br
-See the specification for conditions of use and distribution.
-.LP
-The PNG-1.0 Specification is
-.br
-Copyright (c) 1996 Massachusetts Institute of Technology.
-.br
-See the specification for conditions of use and distribution.
.\" end of man page
/* png.c - location for general purpose libpng functions
*
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_39 Your_png_h_is_not_version_1_6_39;
+typedef png_libpng_version_1_6_40 Your_png_h_is_not_version_1_6_40;
#ifdef __GNUC__
/* The version tests may need to be added to, but the problem warning has
return PNG_STRING_COPYRIGHT
#else
return PNG_STRING_NEWLINE \
- "libpng version 1.6.39" PNG_STRING_NEWLINE \
- "Copyright (c) 2018-2022 Cosmin Truta" PNG_STRING_NEWLINE \
+ "libpng version 1.6.40" PNG_STRING_NEWLINE \
+ "Copyright (c) 2018-2023 Cosmin Truta" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
/* png.h - header file for PNG reference library
*
- * libpng version 1.6.39 - November 20, 2022
+ * libpng version 1.6.40
*
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* 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.39, November 2022:
+ * libpng versions 1.6.36, December 2018, through 1.6.40, June 2023:
* Cosmin Truta
* See also "Contributing Authors", below.
*/
* PNG Reference Library License version 2
* ---------------------------------------
*
- * * Copyright (c) 1995-2022 The PNG Reference Library Authors.
- * * Copyright (c) 2018-2022 Cosmin Truta.
+ * * Copyright (c) 1995-2023 The PNG Reference Library Authors.
+ * * Copyright (c) 2018-2023 Cosmin Truta.
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* * Copyright (c) 1996-1997 Andreas Dilger.
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* ...
* 1.5.30 15 10530 15.so.15.30[.0]
* ...
- * 1.6.39 16 10639 16.so.16.39[.0]
+ * 1.6.40 16 10640 16.so.16.40[.0]
*
* Henceforth the source version will match the shared-library major and
* minor numbers; the shared-library major version number will be used for
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.39"
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.39 - November 20, 2022\n"
+#define PNG_LIBPNG_VER_STRING "1.6.40"
+#define PNG_HEADER_VERSION_STRING " libpng version 1.6.40 - June 21, 2023\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
/* 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 39
+#define PNG_LIBPNG_VER_RELEASE 40
/* This should be zero for a public release, or non-zero for a
* development version. [Deprecated]
* From version 1.0.1 it is:
* XXYYZZ, where XX=major, YY=minor, ZZ=release
*/
-#define PNG_LIBPNG_VER 10639 /* 1.6.39 */
+#define PNG_LIBPNG_VER 10640 /* 1.6.40 */
/* Library configuration: these options cannot be changed after
* the library has been built.
/* 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_39;
+typedef char* png_libpng_version_1_6_40;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
/* pngconf.h - machine-configurable file for libpng
*
- * libpng version 1.6.39
+ * libpng version 1.6.40
*
* Copyright (c) 2018-2022 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
/* pngget.c - retrieval of values from info struct
*
- * Copyright (c) 2018 Cosmin Truta
+ * Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
png_uint_32 flag)
{
if (png_ptr != NULL && info_ptr != NULL)
+ {
+#ifdef PNG_READ_tRNS_SUPPORTED
+ /* png_handle_PLTE() may have canceled a valid tRNS chunk but left the
+ * 'valid' flag for the detection of duplicate chunks. Do not report a
+ * valid tRNS chunk in this case.
+ */
+ if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
+ return(0);
+#endif
+
return(info_ptr->valid & flag);
+ }
return(0);
}
/* pngpriv.h - private declarations for use inside libpng
*
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
#define PNG_BACKGROUND_IS_GRAY 0x800U
#define PNG_HAVE_PNG_SIGNATURE 0x1000U
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
- /* 0x4000U (unused) */
+#define PNG_WROTE_eXIf 0x4000U
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
/* Flags for the transformations the PNG library does on the image data */
*/
#define PNG_FP_INVALID 512 /* Available for callers as a distinct value */
-/* Result codes for the parser (boolean - true meants ok, false means
+/* Result codes for the parser (boolean - true means ok, false means
* not ok yet.)
*/
#define PNG_FP_MAYBE 0 /* The number may be valid in the future */
/* pngset.c - storage of image information into info struct
*
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
#ifdef PNG_eXIf_SUPPORTED
void PNGAPI
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
- png_bytep eXIf_buf)
+ png_bytep exif)
{
png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
PNG_UNUSED(info_ptr)
- PNG_UNUSED(eXIf_buf)
+ PNG_UNUSED(exif)
}
void PNGAPI
png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
- png_uint_32 num_exif, png_bytep eXIf_buf)
+ png_uint_32 num_exif, png_bytep exif)
{
- int i;
+ png_bytep new_exif;
png_debug1(1, "in %s storage function", "eXIf");
- if (png_ptr == NULL || info_ptr == NULL)
+ if (png_ptr == NULL || info_ptr == NULL ||
+ (png_ptr->mode & PNG_WROTE_eXIf) != 0)
return;
- if (info_ptr->exif)
- {
- png_free(png_ptr, info_ptr->exif);
- info_ptr->exif = NULL;
- }
+ new_exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, num_exif));
- info_ptr->num_exif = num_exif;
-
- info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
- info_ptr->num_exif));
-
- if (info_ptr->exif == NULL)
+ if (new_exif == NULL)
{
png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
return;
}
- info_ptr->free_me |= PNG_FREE_EXIF;
+ memcpy(new_exif, exif, (size_t)num_exif);
- for (i = 0; i < (int) info_ptr->num_exif; i++)
- info_ptr->exif[i] = eXIf_buf[i];
+ png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
+ info_ptr->num_exif = num_exif;
+ info_ptr->exif = new_exif;
+ info_ptr->free_me |= PNG_FREE_EXIF;
info_ptr->valid |= PNG_INFO_eXIf;
}
#endif /* eXIf */
if (info_ptr->hist == NULL)
{
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
-
return;
}
- info_ptr->free_me |= PNG_FREE_HIST;
-
for (i = 0; i < info_ptr->num_palette; i++)
info_ptr->hist[i] = hist[i];
+ info_ptr->free_me |= PNG_FREE_HIST;
info_ptr->valid |= PNG_INFO_hIST;
}
#endif
memcpy(info_ptr->pcal_purpose, purpose, length);
+ info_ptr->free_me |= PNG_FREE_PCAL;
+
png_debug(3, "storing X0, X1, type, and nparams in info");
info_ptr->pcal_X0 = X0;
info_ptr->pcal_X1 = X1;
if (info_ptr->pcal_units == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL units");
-
return;
}
if (info_ptr->pcal_params == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL params");
-
return;
}
if (info_ptr->pcal_params[i] == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL parameter");
-
return;
}
}
info_ptr->valid |= PNG_INFO_pCAL;
- info_ptr->free_me |= PNG_FREE_PCAL;
}
#endif
if (info_ptr->scal_s_height == NULL)
{
- png_free (png_ptr, info_ptr->scal_s_width);
+ png_free(png_ptr, info_ptr->scal_s_width);
info_ptr->scal_s_width = NULL;
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
-
return;
}
memcpy(info_ptr->scal_s_height, sheight, lengthh);
- info_ptr->valid |= PNG_INFO_sCAL;
info_ptr->free_me |= PNG_FREE_SCAL;
+ info_ptr->valid |= PNG_INFO_sCAL;
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
if (num_palette > 0)
memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
(sizeof (png_color)));
+
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
-
info_ptr->free_me |= PNG_FREE_PLTE;
-
info_ptr->valid |= PNG_INFO_PLTE;
}
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
- info_ptr->valid |= PNG_INFO_tRNS;
info_ptr->free_me |= PNG_FREE_TRNS;
+ info_ptr->valid |= PNG_INFO_tRNS;
}
png_ptr->trans_alpha = info_ptr->trans_alpha;
}
if (num_trans != 0)
{
- info_ptr->valid |= PNG_INFO_tRNS;
info_ptr->free_me |= PNG_FREE_TRNS;
+ info_ptr->valid |= PNG_INFO_tRNS;
}
}
#endif
{
/* Out of memory or too many chunks */
png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
-
return;
}
png_free(png_ptr, info_ptr->splt_palettes);
+
info_ptr->splt_palettes = np;
info_ptr->free_me |= PNG_FREE_SPLT;
{
png_chunk_report(png_ptr, "too many unknown chunks",
PNG_CHUNK_WRITE_ERROR);
-
return;
}
png_free(png_ptr, info_ptr->unknown_chunks);
+
info_ptr->unknown_chunks = np; /* safe because it is initialized */
info_ptr->free_me |= PNG_FREE_UNKN;
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_39 Your_png_h_is_not_version_1_6_39;
+typedef png_libpng_version_1_6_40 Your_png_h_is_not_version_1_6_40;
/* pngwrite.c - general routines to write a PNG file
*
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
#ifdef PNG_WRITE_eXIf_SUPPORTED
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
+ {
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
+ png_ptr->mode |= PNG_WROTE_eXIf;
+ }
#endif
#ifdef PNG_WRITE_hIST_SUPPORTED
#endif
#ifdef PNG_WRITE_eXIf_SUPPORTED
- if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
- png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
+ if ((info_ptr->valid & PNG_INFO_eXIf) != 0 &&
+ (png_ptr->mode & PNG_WROTE_eXIf) == 0)
+ png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
#endif
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
set(PLATFORM_C_FLAGS)
if(APPLE)
- set(CMAKE_OSX_ARCHITECTURES "@CMAKE_OSX_ARCHITECTURES@")
+ set(CMAKE_OSX_INTERNAL_ARCHITECTURES "@CMAKE_OSX_INTERNAL_ARCHITECTURES@")
set(CMAKE_OSX_SYSROOT "@CMAKE_OSX_SYSROOT@")
- if(CMAKE_OSX_ARCHITECTURES)
- set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -arch ${CMAKE_OSX_ARCHITECTURES})
+ if(CMAKE_OSX_INTERNAL_ARCHITECTURES)
+ set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -arch ${CMAKE_OSX_INTERNAL_ARCHITECTURES})
endif()
if(CMAKE_OSX_SYSROOT)
set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT})
message(STATUS "Attempting to build scripts/pnglibconf.h.prebuilt")
message(STATUS "This is a machine generated file, but if you want to make")
- message(STATUS "a new one simply build the 'genfiles' target, and copy")
+ message(STATUS "a new one simply build the 'png_genfiles' target, and copy")
message(STATUS "scripts/pnglibconf.out to scripts/pnglibconf.h.prebuilt")
message(STATUS "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)")
message(FATAL_ERROR "Stopping build")
# Modeled after libxml-config.
-version=1.6.39
+version=1.6.40
prefix=""
libdir=""
libs=""
Name: libpng
Description: Loads and saves PNG files
-Version: 1.6.39
+Version: 1.6.40
Libs: -L${libdir} -lpng16
Cflags: -I${includedir}
com
version
com
-com Copyright (c) 2018-2022 Cosmin Truta
+com Copyright (c) 2018-2023 Cosmin Truta
com Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
com
com This code is released under the libpng license.
#
# 1) Create 'pngusr.h', enter the required private build information
# detailed below and #define PNG_NO_<option> for each option you
-# don't want in that file in that file. You can also turn on options
-# using PNG_<option>_SUPPORTED. When you have finished rerun
-# configure and rebuild pnglibconf.h file with -DPNG_USER_CONFIG:
+# don't want in that file. You can also turn on options using
+# PNG_<option>_SUPPORTED. When you have finished, rerun configure
+# and rebuild pnglibconf.h file with -DPNG_USER_CONFIG:
#
# make clean
# CPPFLAGS='-DPNG_USER_CONFIG' ./configure
/* pnglibconf.h - library build configuration */
-/* libpng version 1.6.39 */
+/* libpng version 1.6.40 */
-/* Copyright (c) 2018-2022 Cosmin Truta */
+/* Copyright (c) 2018-2023 Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */