Compare commits

..

No commits in common. "master" and "v1.6.37" have entirely different histories.

305 changed files with 17176 additions and 26476 deletions

View File

@ -1,81 +0,0 @@
version: 1.6.x-{build}
branches:
except:
- /libpng[0-1][0-8]/
- /v[0-1][.][0-8][.][0-9]+/
image:
- Visual Studio 2022
shallow_clone: true
environment:
matrix:
- TOOLCHAIN: vstudio
AUTOMATION: cmake
ARCH: x86
- TOOLCHAIN: vstudio
AUTOMATION: cmake
ARCH: x64
- TOOLCHAIN: vstudio
AUTOMATION: cmake
ARCH: arm64
- TOOLCHAIN: llvm
AUTOMATION: cmake
ARCH: x64
- TOOLCHAIN: msys2
AUTOMATION: cmake
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: cmake
ARCH: x86_64
- TOOLCHAIN: msys2
AUTOMATION: configure
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: configure
ARCH: x86_64
- TOOLCHAIN: msys2
AUTOMATION: makefiles
ARCH: i686
- TOOLCHAIN: msys2
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'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-ninja'
before_build:
- '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%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_VARS=-DPNG_TESTS=0'
- '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'
- 'if "%TOOLCHAIN%"=="msys2" set CI_CMAKE_GENERATOR=Ninja'
- 'if "%TOOLCHAIN%"=="msys2" set CI_CC=gcc'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set MSYSTEM=MINGW32'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set MSYSTEM=MINGW64'
- 'set CI_CMAKE_BUILD_FLAGS=-j2'
- 'set CI_CTEST_FLAGS=-j2'
- 'set CI_MAKE_FLAGS=-j2'
- '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_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'
- 'C:\msys64\var\cache\pacman'

View File

@ -1,94 +0,0 @@
# https://pypi.org/project/cmakelang
# https://github.com/cheshirekow/cmake_format
# ----------------------
# Options for formatting
# ----------------------
# How wide to allow formatted cmake files
# TODO: Reflow the CMake files to allow setting the maximum line width to 100.
line_width: 255
# How many spaces to tab for indent
tab_size: 2
# If true, lines are indented using tab characters (utf-8 0x09) instead of
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
# require a fractional tab character, the behavior of the fractional
# indentation is governed by <fractional_tab_policy>
use_tabchars: false
# If <use_tabchars> is True, then the value of this variable indicates how
# fractional indentions are handled during whitespace replacement. If set to
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
# to `round-up` fractional indentation is replaced with a single tab character
# (utf-8 0x09) effectively shifting the column to the next tabstop
fractional_tab_policy: "use-space"
# Enable comment markup parsing and reflow
enable_markup: false
# -------------------
# Options for linting
# -------------------
# Lint codes to disable
disabled_codes: [
# TODO:
# Reconcile the CMake variable names with the patterns below, then
# re-enable the "invalid variable name XXX" messages.
"C0103",
# TODO:
# Add brief COMMENT arguments to the `add_custom_target` commands.
"C0113",
]
# Regular expression pattern describing valid function names
function_pattern: "[0-9a-z_]+"
# Regular expression pattern describing valid macro names
macro_pattern: "[0-9A-Z_]+"
# Regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern: "[A-Z][0-9A-Z_]+"
# Regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern: "_[A-Z][0-9A-Z_]+"
# Regular expression pattern describing valid names for variables with local
# scope
local_var_pattern: "[a-z][a-z0-9_]+"
# Regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern: "_[0-9a-z_]+"
# Regular expression pattern describing valid names for public directory
# variables
public_var_pattern: "[A-Z][0-9A-Z_]+"
# Regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern: "[a-z][a-z0-9_]+"
# Regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern: "[A-Z][0-9A-Z_]+"
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser
max_conditionals_custom_parser: 2
# Require at least this many newlines between statements;
# require no more than this many newlines between statements;
# etc.
min_statement_spacing: 1
max_statement_spacing: 2
max_returns: 6
max_branches: 12
max_arguments: 5
max_localvars: 15
max_statements: 50

View File

@ -1,55 +0,0 @@
# https://editorconfig.org
root = true
[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[*.txt]
indent_size = unset
indent_style = space
[*.[chS]]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 80
[*.dfa]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 80
[*.awk]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 100
[*.cmake]
indent_size = 2
indent_style = space
max_doc_length = 80
max_line_length = 100
[*.sh]
indent_size = 4
indent_style = space
max_doc_length = 100
max_line_length = 100
[{Makefile.in,aclocal.m4,ltmain.sh}]
indent_size = unset
indent_style = unset
insert_final_newline = unset
max_doc_length = unset
max_line_length = unset
trim_trailing_whitespace = unset
[COMMIT_EDITMSG]
indent_style = space
max_doc_length = unset
max_line_length = 72

View File

@ -1,9 +0,0 @@
{
"Disable": {
"IndentSize": true
},
"Exclude": [
".git/",
"out/"
]
}

View File

@ -1,31 +0,0 @@
name: Linting libpng
on:
push:
branches:
- libpng16
- libpng18
pull_request:
branches:
- libpng16
- libpng18
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up the cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pip.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install yamllint
run: pip install yamllint
- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main
- name: Check out the code
uses: actions/checkout@v4
- name: Run the linting script
run: bash ./ci/ci_lint.sh

159
.gitignore vendored
View File

@ -1,159 +0,0 @@
# Prerequisites
*.d
# Precompiled headers
*.gch
*.pch
# Object files
*.slo
*.lo
*.o
*.obj
# Linker output files
*.exp
*.ilk
*.map
# Compiled dynamic libraries
*.dll
*.dylib
*.so
*.so.*
# Compiled static libraries
*.a
*.la
*.lai
*.lib
# Compiled executables
*.app/
*.exe
a.out
# Debug files
*.dSYM/
*.idb
*.pdb
*.su
# Tag files
TAGS
.TAGS
!TAGS/
tags
.tags
!tags/
gtags.files
GTAGS
GRTAGS
GPATH
GSYMS
cscope.files
cscope.out
cscope.*.out
# Text editing and text processing artifacts
\#*\#
.\#*
[._]*.sw[a-p]
[._]sw[a-p]
*.bak
*.orig
*.rej
*.tmp
*~
# IDE files and directories
## Eclipse
.cproject/
.project/
.settings/
## Embarcadero RAD Studio
*.cbproj.*
__recovery/
## JetBrains
.idea/
## NetBeans
nbbuild/
nbdist/
nbproject/
## Visual Studio
.vs/
### Visual Studio user files
*.rsuser
*.sln.docstates
*.suo
*.user
*.userprefs
### Visual Studio cache files (for older versions)
*.aps
*.ncb
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
ipch/
## Visual Studio Code
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/settings.json
!.vscode/tasks.json
## (Various)
*.*cache
*.cache*
[._]*_history
.history/
[Bb]ackup*/
# Build, test and CI output directories
*[Dd]ebug/
[Dd]ebug*/
*[Rr]elease/
[Rr]elease*/
[._]build*/
/[Bb]uild*/
/[Oo]ut/
# Libpng configuration and auxiliary build artifacts
*.out
*out.png
[._]deps/
[._]libs/
.dirstamp
/Makefile
/autom4te.cache/
/config*~
/config.h
/config.log
/config.status
/install*~
/libpng*-config
/libpng*.pc
/libpng.vers
/libtool
/stamp-h1
CMake*.json
!CMakePresets.json
CMakeLists.txt.*
pnglibconf.[ch]
pnglibconf.dfn
pnglibconf.pre
pngprefix.h
# Libpng test programs, scripts and artifacts
/test-suite.log
/tests/*.log
/tests/*.trs
/png-fix-itxt
/pngcp
/pngfix
/pngimage
/pngstest
/pngtest
/pngunknown
/pngvalid
/timepng

View File

@ -1,7 +0,0 @@
extends: default
rules:
document-start: disable
document-end: disable
line-length: disable
truthy:
check-keys: false

View File

@ -1,13 +1,5 @@
libpng 1.6.51.git libpng 1.6.37 - April 14, 2019
================= ==============================
This is a development version, not intended to be a public release.
It will be replaced by a public release, or by another development
version, at a later time.
libpng 1.6.50 - July 1, 2025
============================
This is a public release of libpng, intended for use in production code. This is a public release of libpng, intended for use in production code.
@ -17,13 +9,13 @@ Files available for download
Source files with LF line endings (for Unix/Linux): Source files with LF line endings (for Unix/Linux):
* libpng-1.6.50.tar.xz (LZMA-compressed, recommended) * libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.50.tar.gz (deflate-compressed) * libpng-1.6.37.tar.gz
Source files with CRLF line endings (for Windows): Source files with CRLF line endings (for Windows):
* lpng1650.7z (LZMA-compressed, recommended) * lp1637.7z (LZMA-compressed, recommended)
* lpng1650.zip (deflate-compressed) * lp1637.zip
Other information: Other information:
@ -33,18 +25,20 @@ Other information:
* TRADEMARK.md * TRADEMARK.md
Changes from version 1.6.49 to version 1.6.50 Changes since the previous public release (version 1.6.36)
--------------------------------------------- ----------------------------------------------------------
* Improved the detection of the RVV Extension on the RISC-V platform. * Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
(Contributed by Filip Wasil) * Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
* Replaced inline ASM with C intrinsics in the RVV code. * Fixed a memory leak in pngtest.c.
(Contributed by Filip Wasil) * Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
* Fixed a decoder defect in which unknown chunks trailing IDAT, set contrib/pngminus; refactor.
to go through the unknown chunk handler, incorrectly triggered * Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
out-of-place IEND errors. (Contributed by Willem van Schaik)
(Contributed by John Bowler) * Fixed a typo in the libpng license v2.
* Fixed the CMake file for cross-platform builds that require `libm`. (Contributed by Miguel Ojeda)
* Added makefiles for AddressSanitizer-enabled builds.
* Cleaned up various makefiles.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Send comments/corrections/commendations to png-mng-implement at lists.sf.net.

39
AUTHORS
View File

@ -4,9 +4,7 @@ PNG REFERENCE LIBRARY AUTHORS
This is the list of PNG Reference Library ("libpng") Contributing This is the list of PNG Reference Library ("libpng") Contributing
Authors, for copyright and licensing purposes. Authors, for copyright and licensing purposes.
* Adam Richter
* Andreas Dilger * Andreas Dilger
* Chris Blume
* Cosmin Truta * Cosmin Truta
* Dave Martindale * Dave Martindale
* Eric S. Raymond * Eric S. Raymond
@ -17,17 +15,12 @@ Authors, for copyright and licensing purposes.
* James Yu * James Yu
* John Bowler * John Bowler
* Kevin Bracey * Kevin Bracey
* Lucas Chollet
* Magnus Holmgren * Magnus Holmgren
* Mandar Sahastrabuddhe * Mandar Sahastrabuddhe
* Manfred Schlaegl
* Mans Rullgard * Mans Rullgard
* Matt Sarett * Matt Sarett
* Mike Klein * Mike Klein
* Pascal Massimino
* Paul Schmidt * Paul Schmidt
* Philippe Antoine
* Qiang Zhou
* Sam Bushell * Sam Bushell
* Samuel Williams * Samuel Williams
* Simon-Pierre Cadieux * Simon-Pierre Cadieux
@ -37,30 +30,16 @@ Authors, for copyright and licensing purposes.
* Vadim Barkov * Vadim Barkov
* Willem van Schaik * Willem van Schaik
* Zhijie Liang * Zhijie Liang
* Apple Inc.
- Zixu Wang (王子旭)
* Arm Holdings * Arm Holdings
- Richard Townsend - Richard Townsend
* Google LLC * Google Inc.
- Dan Field - Matt Sarett
- Dragoș Tiselice - Mike Klein
- Leon Scroggins III
- Matt Sarett
- Mike Klein
- Sami Boukortt
- Wan-Teh Chang
* Loongson Technology Corporation Ltd.
- GuXiWei (顾希伟)
- JinBo (金波)
- ZhangLixia (张利霞)
* Samsung Group
- Filip Wasil
The build projects, the build scripts, the test scripts, and other The build projects, the build scripts, the test scripts, and other
files in the "projects", "scripts" and "tests" directories, have files in the "projects", "scripts" and "tests" directories, have other
other copyright owners, but are released under the libpng license. copyright owners, but are released under the libpng license.
Some files in the "ci" and "contrib" directories, as well as some Some files in the "contrib" directory, and some tools-generated files
of the tools-generated files that are distributed with libpng, have that are distributed with libpng, have other copyright owners, and are
other copyright owners, and are released under other open source released under other open source licenses.
licenses.

201
CHANGES
View File

@ -204,7 +204,7 @@ Version 0.97 [January, 1998]
Added simple sRGB support (Glenn R-P) Added simple sRGB support (Glenn R-P)
Easier conditional compiling, e.g., Easier conditional compiling, e.g.,
define PNG_READ/WRITE_NOT_FULLY_SUPPORTED; 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) of having to edit pngconf.h (Glenn R-P)
Fixed memory leak in pngwrite.c (free info_ptr->text) (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 Added more conditions for png_do_background, to avoid changing
@ -942,7 +942,7 @@ Version 1.0.8 [July 24, 2000]
Version 1.0.9beta1 [November 10, 2000] Version 1.0.9beta1 [November 10, 2000]
Fixed typo in scripts/makefile.hpux Fixed typo in scripts/makefile.hpux
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser) Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
Fixed sequence-point bug in contrib/pngminus/png2pnm (Martin Zinser) Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
Changed "cdrom.com" in documentation to "libpng.org" Changed "cdrom.com" in documentation to "libpng.org"
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg). 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(). Changed type of "params" from voidp to png_voidp in png_read|write_png().
@ -2295,7 +2295,7 @@ Version 1.4.0beta58 [May 14, 2009]
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri) Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
Version 1.4.0beta59 [May 15, 2009] Version 1.4.0beta59 [May 15, 2009]
Reformatted sources in libpng style (3-space indentation, comment format) Reformated sources in libpng style (3-space intentation, comment format)
Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG) 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 Added sections about the git repository and our coding style to the
documentation documentation
@ -2661,7 +2661,7 @@ Version 1.4.1beta06 [January 28, 2010]
Version 1.4.1beta07 [February 6, 2010] Version 1.4.1beta07 [February 6, 2010]
Folded some long lines in the source files. Folded some long lines in the source files.
Added definable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX, Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
and a PNG_USER_LIMITS_SUPPORTED flag. and a PNG_USER_LIMITS_SUPPORTED flag.
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
png_ptr->png_user_chunk_malloc_max. png_ptr->png_user_chunk_malloc_max.
@ -3886,7 +3886,7 @@ Version 1.6.0beta06 [January 24, 2012]
Version 1.6.0beta07 [January 28, 2012] Version 1.6.0beta07 [January 28, 2012]
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived) Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
compiler issues slightly different warnings from those issued by the compiler issues slightly different warnings from those issued by the
current versions of GCC. This eliminates those warnings by current vesions of GCC. This eliminates those warnings by
adding/removing casts and small code rewrites. adding/removing casts and small code rewrites.
Updated configure.ac from autoupdate: added --enable-werror option. Updated configure.ac from autoupdate: added --enable-werror option.
Also some layout regularization and removal of introduced tab characters Also some layout regularization and removal of introduced tab characters
@ -3919,7 +3919,7 @@ Version 1.6.0beta08 [February 1, 2012]
version checking to configure.ac version checking to configure.ac
Improved pngstest speed by not doing redundant tests and add const to Improved pngstest speed by not doing redundant tests and add const to
the background parameter of png_image_finish_read. The --background the background parameter of png_image_finish_read. The --background
option is now done automagically only when required, so that command-line option is now done automagically only when required, so that commandline
option no longer exists. option no longer exists.
Cleaned up pngpriv.h to consistently declare all functions and data. Cleaned up pngpriv.h to consistently declare all functions and data.
Also eliminated PNG_CONST_DATA, which is apparently not needed but we Also eliminated PNG_CONST_DATA, which is apparently not needed but we
@ -4052,7 +4052,7 @@ Version 1.6.0beta16 [March 6, 2012]
(in fact this is harmless, but the PNG data produced may be sub-optimal). (in fact this is harmless, but the PNG data produced may be sub-optimal).
Version 1.6.0beta17 [March 10, 2012] Version 1.6.0beta17 [March 10, 2012]
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition. Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
Reject all iCCP chunks after the first, even if the first one is invalid. Reject all iCCP chunks after the first, even if the first one is invalid.
Deflate/inflate was reworked to move common zlib calls into single Deflate/inflate was reworked to move common zlib calls into single
functions [rw]util.c. A new shared keyword check routine was also added functions [rw]util.c. A new shared keyword check routine was also added
@ -4962,7 +4962,7 @@ Version 1.6.13beta01 [July 4, 2014]
Changed "if defined(__ARM_NEON__)" to Changed "if defined(__ARM_NEON__)" to
"if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu). "if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
Fixed clang no-warning builds: png_digit was defined but never used. Fixed clang no-warning builds: png_digit was defined but never used.
Version 1.6.13beta02 [July 21, 2014] Version 1.6.13beta02 [July 21, 2014]
Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32 Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
(bug report from Wolfgang S. Kechel). Bug was introduced in libpng-1.6.11. (bug report from Wolfgang S. Kechel). Bug was introduced in libpng-1.6.11.
@ -5453,7 +5453,7 @@ Version 1.6.21beta01 [December 11, 2015]
Version 1.6.21beta02 [December 14, 2015] Version 1.6.21beta02 [December 14, 2015]
Moved png_check_keyword() from pngwutil.c to pngset.c Moved png_check_keyword() from pngwutil.c to pngset.c
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
in the BigEndian tests by not testing it, making the BE code the same in the BigEndian tests by not testing it, making the BE code the same
as the LE version. as the LE version.
Fixes to pngvalid for various reduced build configurations (eliminate unused Fixes to pngvalid for various reduced build configurations (eliminate unused
statics) and a fix for the case in rgb_to_gray when the digitize option statics) and a fix for the case in rgb_to_gray when the digitize option
@ -5517,7 +5517,7 @@ Version 1.6.22beta03 [March 9, 2016]
Added a common-law trademark notice and export control information Added a common-law trademark notice and export control information
to the LICENSE file, png.h, and the man page. to the LICENSE file, png.h, and the man page.
Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
were accidentally removed from libpng-1.6.17. were accidentally removed from libpng-1.6.17.
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
(Robert C. Seacord). (Robert C. Seacord).
Removed dubious "#if INT_MAX" test from png.h that was added to Removed dubious "#if INT_MAX" test from png.h that was added to
@ -5927,7 +5927,7 @@ Version 1.6.32beta03 [August 2, 2017]
(Bug report from the OSS-fuzz project). (Bug report from the OSS-fuzz project).
Version 1.6.32beta04 [August 2, 2017] 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. Update libpng.3 and libpng-manual.txt about eXIf functions.
Version 1.6.32beta05 [August 2, 2017] Version 1.6.32beta05 [August 2, 2017]
@ -5950,7 +5950,7 @@ Version 1.6.32beta09 [August 3, 2017]
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
no longer using deprecated cmake LOCATION feature (Clifford Yapp). no longer using deprecated cmake LOCATION feature (Clifford Yapp).
Fixed five-byte error in the calculation of IDAT maximum possible size. Fixed five-byte error in the calculation of IDAT maximum possible size.
Version 1.6.32beta10 [August 5, 2017] Version 1.6.32beta10 [August 5, 2017]
Moved chunk-length check into a png_check_chunk_length() private Moved chunk-length check into a png_check_chunk_length() private
function (Suggested by Max Stepin). function (Suggested by Max Stepin).
@ -6103,183 +6103,6 @@ Version 1.6.37 [April 14, 2019]
Added makefiles for AddressSanitizer-enabled builds. Added makefiles for AddressSanitizer-enabled builds.
Cleaned up various makefiles. Cleaned up various makefiles.
Version 1.6.38 [September 14, 2022]
Added configurations and scripts for continuous integration.
Fixed various errors in the handling of tRNS, hIST and eXIf.
Implemented many stability improvements across all platforms.
Updated the internal documentation.
Version 1.6.39 [November 20, 2022]
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.
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.
Version 1.6.41 [January 24, 2024]
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.
(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.
(Contributed by John Bowler)
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.
Version 1.6.44 [September 12, 2024]
Hardened calculations in chroma handling to prevent overflows, and
relaxed a constraint in cHRM validation to accomodate the standard
ACES AP1 set of color primaries.
(Contributed by John Bowler)
Removed the ASM implementation of ARM Neon optimizations and updated
the build accordingly. Only the remaining C implementation shall be
used from now on, thus ensuring the support of the PAC/BTI security
features on ARM64.
(Contributed by Ross Burton and John Bowler)
Fixed the pickup of the PNG_HARDWARE_OPTIMIZATIONS option in the
CMake build on FreeBSD/amd64. This is an important performance fix
on this platform.
Applied various fixes and improvements to the CMake build.
(Contributed by Eric Riff, Benjamin Buch and Erik Scholz)
Added fuzzing targets for the simplified read API.
(Contributed by Mikhail Khachayants)
Fixed a build error involving pngtest.c under a custom config.
This was a regression introduced in a code cleanup in libpng-1.6.43.
(Contributed by Ben Wagner)
Fixed and improved the config files for AppVeyor CI and Travis CI.
Version 1.6.45 [January 7, 2025]
Added support for the cICP chunk.
(Contributed by Lucas Chollet and John Bowler)
Adjusted and improved various checks in colorspace calculations.
(Contributed by John Bowler)
Rearranged the write order of colorspace chunks for better conformance
with the PNG v3 draft specification.
(Contributed by John Bowler)
Raised the minimum required CMake version from 3.6 to 3.14.
Forked off a development branch for libpng version 1.8.
Version 1.6.46 [January 23, 2025]
Added support for the mDCV and cLLI chunks.
(Contributed by John Bowler)
Fixed a build issue affecting C89 compilers.
This was a regression introduced in libpng-1.6.45.
(Contributed by John Bowler)
Added makefile.c89, specifically for testing C89 compilers.
Cleaned up contrib/pngminus: corrected an old typo, removed an old
workaround, and updated the CMake file.
Version 1.6.47 [February 18, 2025]
Modified the behaviour of colorspace chunks in order to adhere
to the new precedence rules formulated in the latest draft of
the PNG Specification.
(Contributed by John Bowler)
Fixed a latent bug in `png_write_iCCP`.
This would have been a read-beyond-end-of-malloc vulnerability,
introduced early in the libpng-1.6.0 development, yet (fortunately!)
it was inaccessible before the above-mentioned modification of the
colorspace precedence rules, due to pre-existing colorspace checks.
(Reported by Bob Friesenhahn; fixed by John Bowler)
Version 1.6.48 [April 30, 2025]
Fixed the floating-point version of the mDCv setter `png_set_mDCv`.
(Reported by Mohit Bakshi; fixed by John Bowler)
Added #error directives to discourage the inclusion of private
libpng implementation header files in PNG-supporting applications.
Added the CMake build option `PNG_LIBCONF_HEADER`, to be used as an
alternative to `DFA_XTRA`.
Removed the Travis CI configuration files, with heartfelt thanks for
their generous support of our project over the past five years!
Version 1.6.49 [June 12, 2025]
Added SIMD-optimized code for the RISC-V Vector Extension (RVV).
(Contributed by Manfred Schlaegl, Dragos Tiselice and Filip Wasil)
Added various fixes and improvements to the build scripts and to
the sample code.
Version 1.6.50 [July 1, 2025]
Improved the detection of the RVV Extension on the RISC-V platform.
(Contributed by Filip Wasil)
Replaced inline ASM with C intrinsics in the RVV code.
(Contributed by Filip Wasil)
Fixed a decoder defect in which unknown chunks trailing IDAT, set
to go through the unknown chunk handler, incorrectly triggered
out-of-place IEND errors.
(Contributed by John Bowler)
Fixed the CMake file for cross-platform builds that require `libm`.
Version 1.6.51 [TODO]
Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement

File diff suppressed because it is too large Load Diff

98
INSTALL
View File

@ -1,3 +1,4 @@
Installing libpng Installing libpng
Contents Contents
@ -127,18 +128,16 @@ Your directory structure should look like this:
README README
*.h, *.c => libpng source files *.h, *.c => libpng source files
CMakeLists.txt => "cmake" script CMakeLists.txt => "cmake" script
ci
ci_*.sh
configuration files: configuration files:
configure.ac, configure, Makefile.am, Makefile.in, configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in, autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
libpng-config.in, aclocal.m4, config.h.in, config.sub, libpng-config.in, aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, mkinstalldirs, test-pngtest.sh, etc. depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib contrib
arm-neon, conftest, examples, gregbook, libtests, pngminim, arm-neon, conftest, examples, gregbook, libtests, pngminim,
pngminus, pngsuite, tools, visupng, riscv-rvv pngminus, pngsuite, tools, visupng
projects projects
owatcom, visualc71, vstudio cbuilder5, owatcom, visualc71, vstudio, xcode
scripts scripts
makefile.* makefile.*
*.def (module definition files) *.def (module definition files)
@ -146,7 +145,7 @@ Your directory structure should look like this:
pngtest.png pngtest.png
etc. etc.
zlib zlib
README, *.h, *.c, contrib, etc. README, *.h, *.c contrib, etc.
If the line endings in the files look funny, you may wish to get the other If the line endings in the files look funny, you may wish to get the other
distribution of libpng. It is available in both tar.gz (UNIX style line distribution of libpng. It is available in both tar.gz (UNIX style line
@ -154,27 +153,28 @@ endings) and zip (DOS style line endings) formats.
VI. Building with project files VI. Building with project files
If you are building libpng with Microsoft Visual Studio, you can enter If you are building libpng with MSVC, you can enter the
the directory projects\visualc71 or projects\vstudio and follow the libpng projects\visualc71 or vstudio directory and follow the instructions
instructions in README.txt. in README.txt.
Otherwise, enter the zlib directory and follow the instructions in Otherwise enter the zlib directory and follow the instructions in zlib/README,
zlib/README, then come back here and run "configure" or choose the then come back here and run "configure" or choose the appropriate
appropriate makefile in the scripts directory. makefile.sys in the scripts directory.
VII. Building with makefiles VII. Building with makefiles
Copy the file (or files) that you need from the Copy the file (or files) that you need from the
scripts directory into this directory, for example scripts directory into this directory, for example
MSDOS example:
copy scripts\makefile.msc makefile
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
UNIX example: UNIX example:
cp scripts/makefile.std Makefile cp scripts/makefile.std makefile
make cp scripts/pnglibconf.h.prebuilt pnglibconf.h
Windows example:
nmake -f scripts\makefile.vcwin32
Read the makefile to see if you need to change any source or Read the makefile to see if you need to change any source or
target directories to match your preferences. target directories to match your preferences.
@ -191,33 +191,36 @@ test. For more confidence, you can run another test by typing
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
your output with the result shown in contrib/pngsuite/README. your output with the result shown in contrib/pngsuite/README.
Most of the makefiles used to allow you to run "make install" to put Most of the makefiles will allow you to run "make install" to
the library in its final resting place, but that feature is no longer put the library in its final resting place (if you want to
supported. The only tested and supported manners to install libpng are do that, run "make install" in the zlib directory first if necessary).
the conventional build and install procedures driven by the configure Some also allow you to run "make test-installed" after you have
script or by the CMake file. run "make install".
VIII. Configuring for DOS and other 16-bit platforms VIII. Configuring libpng for 16-bit platforms
Officially, the support for 16-bit platforms has been removed. You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more than 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
IX. Configuring for DOS
For DOS users who only have access to the lower 640K, you will For DOS users who only have access to the lower 640K, you will
have to limit zlib's memory usage via a png_set_compression_mem_level() have to limit zlib's memory usage via a png_set_compression_mem_level()
call. See zlib.h or zconf.h in the zlib library for more information. call. See zlib.h or zconf.h in the zlib library for more information.
You may be or may not be in luck if you target the "large" memory model, X. Configuring for Medium Model
but all the smaller models ("small", "compact" and "medium") are known
to be unworkable. For DOS users who have access beyond the lower 640K,
a "flat" 32-bit DOS model (such as DJGPP) is strongly recommended.
For DOS users who only have access to the lower 640K, you will have to Libpng's support for medium model has been tested on most of the popular
limit zlib's memory usage via a png_set_compression_mem_level() call. compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
You will also have to look into zconf.h to tell zlib (and thus libpng) defined, and FAR gets defined to far in pngconf.h, and you should be
that it cannot allocate more than 64K at a time. Even if you can, the all set. Everything in the library (except for zlib's structure) is
memory won't be accessible. Therefore, you should limit zlib and libpng expecting far data. You must use the typedefs with the p or pp on
to 64K by defining MAXSEG_64K. the end for pointers (or at least look at them and be careful). Make
note that the rows of data are defined as png_bytepp, which is
an "unsigned char far * far *".
IX. Prepending a prefix to exported symbols XI. Prepending a prefix to exported symbols
Starting with libpng-1.6.0, you can configure libpng (when using the Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the "configure" script) to prefix all exported symbols by means of the
@ -228,7 +231,7 @@ identifier). This creates a set of macros in pnglibconf.h, so this is
transparent to applications; their function calls get transformed by transparent to applications; their function calls get transformed by
the macros to use the modified names. the macros to use the modified names.
X. Configuring for compiler xxx: XII. Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add, change All includes for libpng are in pngconf.h. If you need to add, change
or delete an include, this is the place to do it. or delete an include, this is the place to do it.
@ -240,7 +243,7 @@ As of libpng-1.5.0, pngpriv.h also includes three other private header
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
that previously appeared in the public headers. that previously appeared in the public headers.
XI. Removing unwanted object code XIII. Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are libpng are compiled. All the defines end in _SUPPORTED. If you are
@ -279,7 +282,7 @@ library to fail if they call functions not available in your library.
The size of the library itself should not be an issue, because only The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory. those sections that are actually used will be loaded into memory.
XII. Enabling or disabling hardware optimizations XIV. Enabling or disabling hardware optimizations
Certain hardware capabilities, such as the Intel SSE instructions, Certain hardware capabilities, such as the Intel SSE instructions,
are normally detected at run time. Enable them with configure options are normally detected at run time. Enable them with configure options
@ -289,7 +292,6 @@ such as one of
--enable-mips-msa=yes --enable-mips-msa=yes
--enable-intel-sse=yes --enable-intel-sse=yes
--enable-powerpc-vsx=yes --enable-powerpc-vsx=yes
--enable-riscv-rvv=yes
or enable them all at once with or enable them all at once with
@ -302,7 +304,6 @@ or more of
CPPFLAGS += "-DPNG_MIPS_MSA" CPPFLAGS += "-DPNG_MIPS_MSA"
CPPFLAGS += "-DPNG_INTEL_SSE" CPPFLAGS += "-DPNG_INTEL_SSE"
CPPFLAGS += "-DPNG_POWERPC_VSX" CPPFLAGS += "-DPNG_POWERPC_VSX"
CPPFLAGS += "-DPNG_RISCV_RVV"
See for example scripts/makefile.linux-opt See for example scripts/makefile.linux-opt
@ -319,21 +320,19 @@ to disable a particular one,
or via compiler-command options such as or via compiler-command options such as
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0, CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0,
-DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0, -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0"
-DPNG_RISCV_RVV_OPT=0"
If you are using cmake, hardware optimizations are "on" If you are using cmake, hardware optimizations are "on"
by default. To disable them, use by default. To disable them, use
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \ cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no \ -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no
-DPNG_RISCV_RVV=no
or disable them all at once with or disable them all at once with
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
XIII. Changes to the build and configuration of libpng in libpng-1.5.x XV. Changes to the build and configuration of libpng in libpng-1.5.x
Details of internal changes to the library code can be found in the CHANGES Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast file and in the GIT repository logs. These will be of no concern to the vast
@ -424,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
libpng, because than the settings would not accurately reflect the settings libpng, because than the settings would not accurately reflect the settings
that were used to build libpng. that were used to build libpng.
XIV. Setjmp/longjmp issues XVI. Setjmp/longjmp issues
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
is known to be not thread-safe on some platforms and we don't know of is known to be not thread-safe on some platforms and we don't know of
@ -442,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
XV. Common linking failures XVII. Common linking failures
If your application fails to find libpng or zlib entries while linking: If your application fails to find libpng or zlib entries while linking:
@ -454,13 +453,12 @@ If your application fails to find libpng or zlib entries while linking:
If you are using the vstudio project, observe the WARNING in If you are using the vstudio project, observe the WARNING in
project/vstudio/README.txt. project/vstudio/README.txt.
XVI. Other sources of information about libpng: XVIII. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.
Copyright (c) 2022 Cosmin Truta
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
This document is released under the libpng license. This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer For conditions of distribution and use, see the disclaimer

View File

@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
PNG Reference Library License version 2 PNG Reference Library License version 2
--------------------------------------- ---------------------------------------
* Copyright (c) 1995-2025 The PNG Reference Library Authors. * Copyright (c) 1995-2019 The PNG Reference Library Authors.
* Copyright (c) 2018-2025 Cosmin Truta. * Copyright (c) 2018-2019 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger. * Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.

View File

@ -1,6 +1,6 @@
# Makefile.am, the source file for Makefile.in (and hence Makefile), is # Makefile.am, the source file for Makefile.in (and hence Makefile), is
# #
# Copyright (c) 2018-2025 Cosmin Truta # Copyright (c) 2018 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson # Copyright (c) 2004-2016 Glenn Randers-Pehrson
# #
# This code is released under the libpng license. # This code is released under the libpng license.
@ -9,24 +9,16 @@
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
ACLOCAL_AMFLAGS = -I scripts/autoconf ACLOCAL_AMFLAGS = -I scripts
# test programs - run on make check, make distcheck # test programs - run on make check, make distcheck
if ENABLE_TESTS
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
if HAVE_CLOCK_GETTIME if HAVE_CLOCK_GETTIME
check_PROGRAMS += timepng check_PROGRAMS += timepng
endif endif
else
check_PROGRAMS=
endif
# Utilities - installed # Utilities - installed
if ENABLE_TOOLS
bin_PROGRAMS= pngfix png-fix-itxt bin_PROGRAMS= pngfix png-fix-itxt
else
bin_PROGRAMS=
endif
# This ensures that pnglibconf.h gets built at the start of 'make all' or # This ensures that pnglibconf.h gets built at the start of 'make all' or
# 'make check', but it does not add dependencies to the individual programs, # 'make check', but it does not add dependencies to the individual programs,
@ -38,7 +30,6 @@ endif
# always wrong and always very confusing. # always wrong and always very confusing.
BUILT_SOURCES = pnglibconf.h BUILT_SOURCES = pnglibconf.h
if ENABLE_TESTS
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
@ -57,22 +48,19 @@ pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
timepng_SOURCES = contrib/libtests/timepng.c timepng_SOURCES = contrib/libtests/timepng.c
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngcp_SOURCES = contrib/tools/pngcp.c
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
endif
if ENABLE_TOOLS
pngfix_SOURCES = contrib/tools/pngfix.c pngfix_SOURCES = contrib/tools/pngfix.c
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
endif
pngcp_SOURCES = contrib/tools/pngcp.c
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# Generally these are single line shell scripts to run a test with a particular # Generally these are single line shell scripts to run a test with a particular
# set of parameters: # set of parameters:
if ENABLE_TESTS
TESTS =\ TESTS =\
tests/pngtest-all\ tests/pngtest\
tests/pngtest-badpngs\
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\ tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\ tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
tests/pngvalid-gamma-expand16-background\ tests/pngvalid-gamma-expand16-background\
@ -88,7 +76,6 @@ TESTS =\
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\ tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\ tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
tests/pngimage-quick tests/pngimage-full tests/pngimage-quick tests/pngimage-full
endif
# man pages # man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5 dist_man_MANS= libpng.3 libpngpf.3 png.5
@ -108,7 +95,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
if PNG_ARM_NEON if PNG_ARM_NEON
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
arm/filter_neon_intrinsics.c \ arm/filter_neon.S arm/filter_neon_intrinsics.c \
arm/palette_neon_intrinsics.c arm/palette_neon_intrinsics.c
endif endif
@ -117,13 +104,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
mips/filter_msa_intrinsics.c mips/filter_msa_intrinsics.c
endif endif
if PNG_MIPS_MMI
if !PNG_MIPS_MSA
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c
endif
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/filter_mmi_inline_assembly.c
endif
if PNG_INTEL_SSE if PNG_INTEL_SSE
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
intel/filter_sse2_intrinsics.c intel/filter_sse2_intrinsics.c
@ -134,22 +114,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
powerpc/filter_vsx_intrinsics.c powerpc/filter_vsx_intrinsics.c
endif endif
if PNG_RISCV_RVV
noinst_LTLIBRARIES= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv_la_SOURCES = riscv/riscv_init.c\
riscv/filter_rvv_intrinsics.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv_la_CFLAGS = -march=rv64gv
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv.la
endif
if PNG_LOONGARCH_LSX
noinst_LTLIBRARIES= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES = loongarch/loongarch_lsx_init.c\
loongarch/filter_lsx_intrinsics.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS = -mlsx
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
endif
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
@ -170,14 +134,6 @@ else
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif endif
if PNG_RISCV_RVV
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES += libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv.la
endif
if PNG_LOONGARCH_LSX
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES += libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
endif
#distribute headers in /usr/include/libpng/* #distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME) pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h pkginclude_HEADERS= png.h pngconf.h
@ -194,7 +150,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
EXTRA_DIST= \ EXTRA_DIST= \
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \ ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \ ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) $(XFAIL_TESTS) tests/pngstest \ $(TESTS) $(XFAIL_TESTS) tests/pngstest \
CMakeLists.txt example.c libpng-manual.txt CMakeLists.txt example.c libpng-manual.txt
@ -210,7 +166,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing config.sub configure depcomp install-sh ltmain.sh missing
# PNG_COPTS give extra options for the C compiler to be used on all compilation # PNG_COPTS give extra options for the C compiler to be used on all compilation
# steps (unless target_CFLAGS is specified; that will take precedence over # steps (unless targe_CFLAGS is specified; that will take precedence over
# AM_CFLAGS) # AM_CFLAGS)
PNG_COPTS = @PNG_COPTS@ PNG_COPTS = @PNG_COPTS@
AM_CFLAGS = ${PNG_COPTS} AM_CFLAGS = ${PNG_COPTS}

File diff suppressed because it is too large Load Diff

299
README
View File

@ -1,88 +1,57 @@
README for libpng version 1.6.51.git README for libpng version 1.6.37 - April 14, 2019
==================================== =================================================
See the note about version numbers near the top of `png.h`. See the note about version numbers near the top of png.h.
See `INSTALL` for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get `libpng-*.tar.gz` Libpng comes in several distribution formats. Get libpng-*.tar.gz or
or `libpng-*.tar.xz` if you want UNIX-style line endings in the text libpng-*.tar.xz or if you want UNIX-style line endings in the text
files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings. files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
For a detailed description on using libpng, read `libpng-manual.txt`. Version 0.89 was the first official release of libpng. Don't let the
For examples of libpng in a program, see `example.c` and `pngtest.c`. fact that it's the first release fool you. The libpng library has been
For usage information and restrictions (what little they are) on libpng, in extensive use and testing since mid-1995. By late 1997 it had
see `png.h`. For a description on using zlib (the compression library finally gotten to the stage where there hadn't been significant
used by libpng) and zlib's restrictions, see `zlib.h`. 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.
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 Note that some of the changes to the png_info structure render this
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.
zlib should be available at the same place that libpng is, or at
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 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 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.)
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.)
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 version of the library binary incompatible with libpng-0.89 or
earlier versions if you are using a shared library. The type of the earlier versions if you are using a shared library. The type of the
`filler` parameter for `png_set_filler()` has changed from `png_byte` "filler" parameter for png_set_filler() has changed from png_byte to
to `png_uint_32`, which will affect shared-library applications that png_uint_32, which will affect shared-library applications that use
use this function. this function.
To avoid problems with changes to the internals of the `info_struct`, 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 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 access to info_ptr. These functions are the png_set_<chunk> and
`png_get_<chunk>` functions. These functions should be used when png_get_<chunk> functions. These functions should be used when
accessing/storing the `info_struct` data, rather than manipulating it accessing/storing the info_struct data, rather than manipulating it
directly, to avoid such problems in the future. directly, to avoid such problems in the future.
It is important to note that the APIs did not make current programs It is important to note that the APIs did not make current programs
that access the info struct directly incompatible with the new 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 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 be a transitional release, members of the png_struct and the
`info_struct` can still be accessed, but the compiler will issue a info_struct can still be accessed, but the compiler will issue a
warning about deprecated usage. Since libpng-1.5.0, direct access warning about deprecated usage. Since libpng-1.5.0, direct access
to these structs is not allowed, and the definitions of the structs to these structs is not allowed, and the definitions of the structs
reside in private `pngstruct.h` and `pnginfo.h` header files that are reside in private pngstruct.h and pnginfo.h header files that are not
not accessible to applications. It is strongly suggested that new accessible to applications. It is strongly suggested that new
programs use the new APIs (as shown in `example.c` and `pngtest.c`), programs use the new APIs (as shown in example.c and pngtest.c), and
and older programs be converted to the new format, to facilitate older programs be converted to the new format, to facilitate upgrades
upgrades in the future. 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 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 which has had some (or all) of the signature bytes read by the calling
@ -92,88 +61,118 @@ 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 to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The additions since 0.90 include the ability to compile libpng as a For a detailed description on using libpng, read libpng-manual.txt.
Windows DLL, and new APIs for accessing data in the `info_struct`. For examples of libpng in a program, see example.c and pngtest.c. For
Experimental functions included the ability to set weighting and cost usage information and restrictions (what little they are) on libpng,
factors for row filter selection, direct reads of integers from buffers see png.h. For a description on using zlib (the compression library
on big-endian processors that support misaligned data access, faster used by libpng) and zlib's restrictions, see zlib.h
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 included in this distribution 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.
ANNOUNCE => Announcement of this version, with recent changes You should use zlib 1.0.4 or later to run this, but it MAY work with
AUTHORS => List of contributing authors versions as old as zlib 0.95. Even so, there are bugs in older zlib
CHANGES => Description of changes between libpng versions versions which can cause the output of invalid compression streams for
INSTALL => Instructions to install libpng some images.
LICENSE => License to use and redistribute libpng
README => This file You should also note that zlib is a compression library that is useful
TODO => Things not implemented in the current library for more things than just PNG files. You can use zlib as a drop-in
TRADEMARK => Trademark information replacement for fread() and fwrite(), if you are so inclined.
example.c => Example code for using libpng functions
libpng.3 => Manual page for libpng (includes libpng-manual.txt) zlib should be available at the same place that libpng is, or at
libpng-manual.txt => Description of libpng and its functions https://zlib.net.
libpngpf.3 => Manual page for libpng's private functions (deprecated)
png.5 => Manual page for the PNG format You may also want a copy of the PNG specification. It is available
png.c => Basic interface functions common to library as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
png.h => Library function and interface declarations (public) these at http://www.libpng.org/pub/png/pngdocs.html .
pngpriv.h => Library function and interface declarations (private)
pngconf.h => System specific library configuration (public) This code is currently being archived at libpng.sourceforge.io in the
pngstruct.h => png_struct declaration (private) [DOWNLOAD] area, and at http://libpng.download/src .
pnginfo.h => png_info struct declaration (private)
pngdebug.h => debugging macros (private) This release, based in a large way on Glenn's, Guy's and Andreas'
pngerror.c => Error/warning message I/O functions earlier work, was created and will be supported by myself and the PNG
pngget.c => Functions for retrieving info from struct development group.
pngmem.c => Memory handling functions
pngbar.png => PNG logo, 88x31 Send comments/corrections/commendations to png-mng-implement at
pngnow.png => PNG logo, 98x31 lists.sourceforge.net (subscription required; visit
pngpread.c => Progressive reading functions https://lists.sourceforge.net/lists/listinfo/png-mng-implement
pngread.c => Read data/helper high-level functions to subscribe).
pngrio.c => Lowest-level data read I/O functions
pngrtran.c => Read data transformation functions Send general questions about the PNG specification to png-mng-misc
pngrutil.c => Read data utility functions at lists.sourceforge.net (subscription required; visit
pngset.c => Functions for storing data into the info_struct https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
pngtest.c => Library test program subscribe).
pngtest.png => Library test sample image
pngtrans.c => Common data transformation functions Files in this distribution:
pngwio.c => Lowest-level write I/O functions
pngwrite.c => High-level write functions ANNOUNCE => Announcement of this version, with recent changes
pngwtran.c => Write data transformations AUTHORS => List of contributing authors
pngwutil.c => Write utility functions CHANGES => Description of changes between libpng versions
arm/ => Optimized code for ARM Neon KNOWNBUG => List of known bugs and deficiencies
intel/ => Optimized code for INTEL SSE2 LICENSE => License to use and redistribute libpng
loongarch/ => Optimized code for LoongArch LSX README => This file
mips/ => Optimized code for MIPS MSA and MIPS MMI TODO => Things not implemented in the current library
powerpc/ => Optimized code for PowerPC VSX TRADEMARK => Trademark information
riscv/ => Optimized code for the RISC-V platform example.c => Example code for using libpng functions
ci/ => Scripts for continuous integration libpng.3 => manual page for libpng (includes libpng-manual.txt)
contrib/ => External contributions libpng-manual.txt => Description of libpng and its functions
arm-neon/ => Optimized code for the ARM-NEON platform libpngpf.3 => manual page for libpng's private functions
mips-msa/ => Optimized code for the MIPS-MSA platform png.5 => manual page for the PNG format
powerpc-vsx/ => Optimized code for the POWERPC-VSX platform png.c => Basic interface functions common to library
examples/ => Examples of libpng usage png.h => Library function and interface declarations (public)
gregbook/ => Source code for PNG reading and writing, from pngpriv.h => Library function and interface declarations (private)
"PNG: The Definitive Guide" by Greg Roelofs, pngconf.h => System specific library configuration (public)
O'Reilly, 1999 pngstruct.h => png_struct declaration (private)
libtests/ => Test programs pnginfo.h => png_info struct declaration (private)
pngexif/ => Program to inspect the EXIF information in PNG files pngdebug.h => debugging macros (private)
pngminim/ => Minimal decoder, encoder, and progressive decoder pngerror.c => Error/warning message I/O functions
programs demonstrating the use of pngusr.dfa pngget.c => Functions for retrieving info from struct
pngminus/ => Simple pnm2png and png2pnm programs pngmem.c => Memory handling functions
pngsuite/ => Test images pngbar.png => PNG logo, 88x31
riscv-rvv/ => Optimized code for the RISC-V Vector platform pngnow.png => PNG logo, 98x31
testpngs/ => Test images pngpread.c => Progressive reading functions
tools/ => Various tools pngread.c => Read data/helper high-level functions
visupng/ => VisualPng, a Windows viewer for PNG images pngrio.c => Lowest-level data read I/O functions
projects/ => Project files and workspaces for various IDEs pngrtran.c => Read data transformation functions
owatcom/ => OpenWatcom project pngrutil.c => Read data utility functions
visualc71/ => Microsoft Visual C++ 7.1 workspace pngset.c => Functions for storing data into the info_struct
vstudio/ => Microsoft Visual Studio workspace pngtest.c => Library test program
scripts/ => Scripts and makefiles for building libpng pngtest.png => Library test sample image
(see scripts/README.txt for the complete list) pngtrans.c => Common data transformation functions
tests/ => Test scripts pngwio.c => Lowest-level write I/O functions
pngwrite.c => High-level write functions
pngwtran.c => Write data transformations
pngwutil.c => Write utility functions
arm => Contains optimized code for the ARM platform
powerpc => Contains optimized code for the PowerPC platform
contrib => Contributions
arm-neon => Optimized code for ARM-NEON platform
powerpc-vsx => Optimized code for POWERPC-VSX platform
examples => Example programs
gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
libtests => Test programs
mips-msa => Optimized code for MIPS-MSA platform
pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
testpngs
tools => Various tools
visupng => Contains a MSVC workspace for VisualPng
intel => Optimized code for INTEL-SSE2 platform
mips => Optimized code for MIPS platform
projects => Contains project files and workspaces for
building a DLL
owatcom => Contains a WATCOM project for building libpng
visualc71 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
vstudio => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
scripts => Directory containing scripts for building libpng:
(see scripts/README.txt for the list of scripts)
Good luck, and happy coding! Good luck, and happy coding!

43
TODO
View File

@ -1,22 +1,23 @@
TODO list for libpng TODO - list of things to do for libpng:
--------------------
* Fix all defects (duh!) * Fix all defects (duh!)
* cHRM transformation. * Better C++ wrapper / full C++ implementation (?)
* Palette creation. * Fix the problems with C++ and 'extern "C"'.
* "grayscale->palette" transformation and "palette->grayscale" detection. * cHRM transformation.
* Improved dithering. * Palette creation.
* Multi-lingual error and warning message support. * "grayscale->palette" transformation and "palette->grayscale" detection.
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.) * Improved dithering.
* Man pages for function calls. * Multi-lingual error and warning message support.
* Better documentation. * Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
* Better filter selection * Man pages for function calls.
(e.g., counting huffman bits/precompression; filter inertia; filter costs). * Better documentation.
* Histogram creation. * Better filter selection
* Text conversion between different code pages (e.g., Latin-1 to Mac). (e.g., counting huffman bits/precompression; filter inertia; filter costs).
* Avoid building gamma tables whenever possible. * Histogram creation.
* Greater precision in changing to linear gamma for compositing against * Text conversion between different code pages (e.g., Latin-1 -> Mac).
background, and in doing rgb-to-gray transformations. * Avoid building gamma tables whenever possible.
* Investigate pre-incremented loop counters and other loop constructions. * Greater precision in changing to linear gamma for compositing against
* Interpolated method of handling interlacing. background, and in doing rgb-to-gray transformations.
* More validations for libpng transformations. * Investigate pre-incremented loop counters and other loop constructions.
* Interpolated method of handling interlacing.
* More validations for libpng transformations.

476
aclocal.m4 vendored
View File

@ -1,6 +1,6 @@
# generated automatically by aclocal 1.18.1 -*- Autoconf -*- # generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# Copyright (C) 1996-2025 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -14,13 +14,13 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],, m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.72. [m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to. You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2025 Free Software Foundation, Inc. # Copyright (C) 2002-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# generated from the m4 files accompanying Automake X.Y. # generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.) # (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION], AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.18' [am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.18.1], [], m4_if([$1], [1.16.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
]) ])
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.18.1])dnl [AM_AUTOMAKE_VERSION([1.16.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Figure out how to run the assembler. -*- Autoconf -*- # Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001-2025 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -78,7 +78,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2025 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -130,7 +130,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*- # AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2025 Free Software Foundation, Inc. # Copyright (C) 1997-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -161,7 +161,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]]) Usually this means the macro was only invoked conditionally.]])
fi])]) fi])])
# Copyright (C) 1999-2025 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -293,7 +293,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
# icc doesn't choke on unknown options, it will just issue warnings # icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message # or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported. # that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thus: # When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required # icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0: # The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported # icc: Command line remark: option '-MP' not supported
@ -352,7 +352,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*- # Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2025 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -391,9 +391,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
done done
if test $am_rc -ne 0; then if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. If GNU make was not used, consider for automatic dependency tracking. Try re-running configure with the
re-running the configure script with MAKE="gmake" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build '--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).]) the package (albeit without support for automatic dependency tracking).])
fi fi
@ -420,7 +418,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*- # Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2025 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -448,10 +446,6 @@ m4_defn([AC_PROG_CC])
# release and drop the old call support. # release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE], AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl [AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
[m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about. dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@ -488,7 +482,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
[_AM_SET_OPTIONS([$1])dnl [_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if( m4_if(
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
[ok:ok],, [ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
@ -520,9 +514,8 @@ AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_IF_OPTION([tar-v7], [_AM_PROG_TAR([v7])], [_AM_PROG_TAR([v7])])])
[_AM_PROG_TAR([ustar])])])])
_AM_IF_OPTION([no-dependencies],, _AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC], [AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES([CC])], [_AM_DEPENDENCIES([CC])],
@ -541,21 +534,7 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[m4_define([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
]) ])
# Variables for tags utilities; see am/tags.am AC_REQUIRE([AM_SILENT_RULES])dnl
if test -z "$CTAGS"; then
CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
AC_SUBST([CSCOPE])
AC_REQUIRE([_AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
@ -563,9 +542,47 @@ AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT], [m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
AC_REQUIRE([_AM_PROG_RM_F]) # POSIX will say in a future version that running "rm -f" with no argument
AC_REQUIRE([_AM_PROG_XARGS_N]) # is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi
dnl The trailing newline in this macro's definition is deliberate, for dnl The trailing newline in this macro's definition is deliberate, for
dnl backward compatibility and to allow trailing 'dnl'-style comments dnl backward compatibility and to allow trailing 'dnl'-style comments
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
@ -598,7 +615,7 @@ for _am_header in $config_headers :; do
done done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2025 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -619,7 +636,7 @@ if test x"${install_sh+set}" != xset; then
fi fi
AC_SUBST([install_sh])]) AC_SUBST([install_sh])])
# Copyright (C) 2003-2025 Free Software Foundation, Inc. # Copyright (C) 2003-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -641,7 +658,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering # From Jim Meyering
# Copyright (C) 1996-2025 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -676,7 +693,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*- # Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2025 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -719,7 +736,7 @@ AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2025 Free Software Foundation, Inc. # Copyright (C) 1997-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -740,7 +757,12 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then if test x"${MISSING+set}" != xset; then
MISSING="\${SHELL} '$am_aux_dir/missing'" case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi fi
# Use eval to expand $SHELL # Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then if eval "$MISSING --is-lightweight"; then
@ -753,7 +775,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*- # Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2025 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -782,7 +804,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION], AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2025 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -814,10 +836,7 @@ AC_CACHE_CHECK(
break break
fi fi
done done
# aligned with autoconf, so not including core; see bug#72225. rm -f core conftest*
rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.$ac_objext \
conftest.dSYM conftest1.$ac_ext conftest1.$ac_objext conftest1.dSYM \
conftest2.$ac_ext conftest2.$ac_objext conftest2.dSYM
unset am_i]) unset am_i])
if test "$am_cv_prog_cc_c_o" != yes; then if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script. # Losing compiler, so override with the script.
@ -832,23 +851,7 @@ AC_LANG_POP([C])])
# For backward compatibility. # For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2022-2025 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_RM_F
# ---------------
# Check whether 'rm -f' without any arguments works.
# https://bugs.gnu.org/10828
AC_DEFUN([_AM_PROG_RM_F],
[am__rm_f_notfound=
AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
AC_SUBST(am__rm_f_notfound)
])
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -867,181 +870,26 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*- # Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2025 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# _AM_SLEEP_FRACTIONAL_SECONDS
# ----------------------------
AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
AC_CACHE_CHECK([whether sleep supports fractional seconds],
am_cv_sleep_fractional_seconds, [dnl
AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
[am_cv_sleep_fractional_seconds=no])
])])
# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
# -----------------------------------
# Determine the filesystem's resolution for file modification
# timestamps. The coarsest we know of is FAT, with a resolution
# of only two seconds, even with the most recent "exFAT" extensions.
# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
# nanosecond, matching clock_gettime. However, it is probably not
# possible to delay execution of a shell script for less than one
# millisecond, due to process creation overhead and scheduling
# granularity, so we don't check for anything finer than that. (See below.)
AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
AC_CACHE_CHECK([filesystem timestamp resolution],
am_cv_filesystem_timestamp_resolution, [dnl
# Default to the worst case.
am_cv_filesystem_timestamp_resolution=2
# Only try to go finer than 1 sec if sleep can do it.
# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
# - 1 sec is not much of a win compared to 2 sec, and
# - it takes 2 seconds to perform the test whether 1 sec works.
#
# Instead, just use the default 2s on platforms that have 1s resolution,
# accept the extra 1s delay when using $sleep in the Automake tests, in
# exchange for not incurring the 2s delay for running the test for all
# packages.
#
am_try_resolutions=
if test "$am_cv_sleep_fractional_seconds" = yes; then
# Even a millisecond often causes a bunch of false positives,
# so just try a hundredth of a second. The time saved between .001 and
# .01 is not terribly consequential.
am_try_resolutions="0.01 0.1 $am_try_resolutions"
fi
# In order to catch current-generation FAT out, we must *modify* files
# that already exist; the *creation* timestamp is finer. Use names
# that make ls -t sort them differently when they have equal
# timestamps than when they have distinct timestamps, keeping
# in mind that ls -t prints the *newest* file first.
rm -f conftest.ts?
: > conftest.ts1
: > conftest.ts2
: > conftest.ts3
# Make sure ls -t actually works. Do 'set' in a subshell so we don't
# clobber the current shell's arguments. (Outer-level square brackets
# are removed by m4; they're present so that m4 does not expand
# <dollar><star>; be careful, easy to get confused.)
if (
set X `[ls -t conftest.ts[12]]` &&
{
test "$[]*" != "X conftest.ts1 conftest.ts2" ||
test "$[]*" != "X conftest.ts2 conftest.ts1";
}
); then :; else
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
_AS_ECHO_UNQUOTED(
["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
[AS_MESSAGE_LOG_FD])
AC_MSG_FAILURE([ls -t produces unexpected output.
Make sure there is not a broken ls alias in your environment.])
fi
for am_try_res in $am_try_resolutions; do
# Any one fine-grained sleep might happen to cross the boundary
# between two values of a coarser actual resolution, but if we do
# two fine-grained sleeps in a row, at least one of them will fall
# entirely within a coarse interval.
echo alpha > conftest.ts1
sleep $am_try_res
echo beta > conftest.ts2
sleep $am_try_res
echo gamma > conftest.ts3
# We assume that 'ls -t' will make use of high-resolution
# timestamps if the operating system supports them at all.
if (set X `ls -t conftest.ts?` &&
test "$[]2" = conftest.ts3 &&
test "$[]3" = conftest.ts2 &&
test "$[]4" = conftest.ts1); then
#
# Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
# because we don't need to test make.
make_ok=true
if test $am_try_res != 1; then
# But if we've succeeded so far with a subsecond resolution, we
# have one more thing to check: make. It can happen that
# everything else supports the subsecond mtimes, but make doesn't;
# notably on macOS, which ships make 3.81 from 2006 (the last one
# released under GPLv2). https://bugs.gnu.org/68808
#
# We test $MAKE if it is defined in the environment, else "make".
# It might get overridden later, but our hope is that in practice
# it does not matter: it is the system "make" which is (by far)
# the most likely to be broken, whereas if the user overrides it,
# probably they did so with a better, or at least not worse, make.
# https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
#
# Create a Makefile (real tab character here):
rm -f conftest.mk
echo 'conftest.ts1: conftest.ts2' >conftest.mk
echo ' touch conftest.ts2' >>conftest.mk
#
# Now, running
# touch conftest.ts1; touch conftest.ts2; make
# should touch ts1 because ts2 is newer. This could happen by luck,
# but most often, it will fail if make's support is insufficient. So
# test for several consecutive successes.
#
# (We reuse conftest.ts[12] because we still want to modify existing
# files, not create new ones, per above.)
n=0
make=${MAKE-make}
until test $n -eq 3; do
echo one > conftest.ts1
sleep $am_try_res
echo two > conftest.ts2 # ts2 should now be newer than ts1
if $make -f conftest.mk | grep 'up to date' >/dev/null; then
make_ok=false
break # out of $n loop
fi
n=`expr $n + 1`
done
fi
#
if $make_ok; then
# Everything we know to check worked out, so call this resolution good.
am_cv_filesystem_timestamp_resolution=$am_try_res
break # out of $am_try_res loop
fi
# Otherwise, we'll go on to check the next resolution.
fi
done
rm -f conftest.ts?
# (end _am_filesystem_timestamp_resolution)
])])
# AM_SANITY_CHECK # AM_SANITY_CHECK
# --------------- # ---------------
AC_DEFUN([AM_SANITY_CHECK], AC_DEFUN([AM_SANITY_CHECK],
[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) [AC_MSG_CHECKING([whether build environment is sane])
# This check should not be cached, as it may vary across builds of
# different projects.
AC_MSG_CHECKING([whether build environment is sane])
# Reject unsafe characters in $srcdir or the absolute working directory # Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter. # name. Accept space and tab only in the latter.
am_lf=' am_lf='
' '
case `pwd` in case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*) *[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_RESULT([no])
AC_MSG_ERROR([unsafe absolute working directory name]);; AC_MSG_ERROR([unsafe absolute working directory name]);;
esac esac
case $srcdir in case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_RESULT([no])
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac esac
@ -1050,40 +898,49 @@ esac
# symlink; some systems play weird games with the mod time of symlinks # symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing # (eg FreeBSD returns the mod time of the symlink's containing
# directory). # directory).
am_build_env_is_sane=no if (
am_has_slept=no am_has_slept=no
rm -f conftest.file for am_try in 1 2; do
for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file
echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if ( if test "$[*]" = "X"; then
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` # -L didn't work.
if test "$[]*" = "X"; then set X `ls -t "$srcdir/configure" conftest.file`
# -L didn't work. fi
set X `ls -t "$srcdir/configure" conftest.file` if test "$[*]" != "X $srcdir/configure conftest.file" \
fi && test "$[*]" != "X conftest.file $srcdir/configure"; then
test "$[]2" = conftest.file
); then
am_build_env_is_sane=yes
break
fi
# Just in case.
sleep "$am_cv_filesystem_timestamp_resolution"
am_has_slept=yes
done
AC_MSG_RESULT([$am_build_env_is_sane]) # If neither matched, then we have a broken ls. This can happen
if test "$am_build_env_is_sane" = no; then # if, for instance, CONFIG_SHELL is bash and it inherits a
AC_MSG_ERROR([newly created file is older than distributed files! # broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock]) Check your system clock])
fi fi
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and # If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer. # generated files are strictly newer.
am_sleep_pid= am_sleep_pid=
AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep "$am_cv_filesystem_timestamp_resolution" ) & ( sleep 1 ) &
am_sleep_pid=$! am_sleep_pid=$!
]) fi
AC_CONFIG_COMMANDS_PRE( AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure]) [AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then if test -n "$am_sleep_pid"; then
@ -1094,18 +951,18 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file rm -f conftest.file
]) ])
# Copyright (C) 2009-2025 Free Software Foundation, Inc. # Copyright (C) 2009-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# _AM_SILENT_RULES # AM_SILENT_RULES([DEFAULT])
# ---------------- # --------------------------
# Enable less verbose build rules support. # Enable less verbose build rules; with the default set to DEFAULT
AC_DEFUN([_AM_SILENT_RULES], # ("yes" being less verbose, "no" or empty being verbose).
[AM_DEFAULT_VERBOSITY=1 AC_DEFUN([AM_SILENT_RULES],
AC_ARG_ENABLE([silent-rules], [dnl [AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING( AS_HELP_STRING(
[--enable-silent-rules], [--enable-silent-rules],
[less verbose build output (undo: "make V=1")]) [less verbose build output (undo: "make V=1")])
@ -1113,6 +970,11 @@ AS_HELP_STRING(
[--disable-silent-rules], [--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl [verbose build output (undo: "make V=0")])dnl
]) ])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions. dnl do not support nested variable expansions.
@ -1131,21 +993,6 @@ am__doit:
else else
am_cv_make_support_nested_variables=no am_cv_make_support_nested_variables=no
fi]) fi])
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
dnl to AM_SILENT_RULES to change the default value.
AC_CONFIG_COMMANDS_PRE([dnl
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
esac
if test $am_cv_make_support_nested_variables = yes; then if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make. dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)' AM_V='$(V)'
@ -1154,22 +1001,17 @@ else
AM_V=$AM_DEFAULT_VERBOSITY AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi fi
])dnl AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
]) ])
# AM_SILENT_RULES([DEFAULT]) # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# --------------------------
# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
# empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_REQUIRE([_AM_SILENT_RULES])
AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])m4_newline
dnl We intentionally force a newline after the assignment, since a) nothing
dnl good can come of more text following, and b) that was the behavior
dnl before 1.17. See https://bugs.gnu.org/72267.
])
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1197,7 +1039,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])]) AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2025 Free Software Foundation, Inc. # Copyright (C) 2006-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1216,7 +1058,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*- # Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2025 Free Software Foundation, Inc. # Copyright (C) 2004-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1262,19 +1104,15 @@ m4_if([$1], [v7],
am_uid=`id -u || echo unknown` am_uid=`id -u || echo unknown`
am_gid=`id -g || echo unknown` am_gid=`id -g || echo unknown`
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
if test x$am_uid = xunknown; then if test $am_uid -le $am_max_uid; then
AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) AC_MSG_RESULT([yes])
elif test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
_am_tools=none _am_tools=none
fi fi
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
if test x$gm_gid = xunknown; then if test $am_gid -le $am_max_gid; then
AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) AC_MSG_RESULT([yes])
elif test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
_am_tools=none _am_tools=none
@ -1351,28 +1189,8 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar]) AC_SUBST([am__untar])
]) # _AM_PROG_TAR ]) # _AM_PROG_TAR
# Copyright (C) 2022-2025 Free Software Foundation, Inc. m4_include([scripts/libtool.m4])
# m4_include([scripts/ltoptions.m4])
# This file is free software; the Free Software Foundation m4_include([scripts/ltsugar.m4])
# gives unlimited permission to copy and/or distribute it, m4_include([scripts/ltversion.m4])
# with or without modifications, as long as this notice is preserved. m4_include([scripts/lt~obsolete.m4])
# _AM_PROG_XARGS_N
# ----------------
# Check whether 'xargs -n' works. It should work everywhere, so the fallback
# is not optimized at all as we never expect to use it.
AC_DEFUN([_AM_PROG_XARGS_N],
[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
])dnl
AC_SUBST(am__xargs_n)
])
m4_include([scripts/autoconf/libtool.m4])
m4_include([scripts/autoconf/ltoptions.m4])
m4_include([scripts/autoconf/ltsugar.m4])
m4_include([scripts/autoconf/ltversion.m4])
m4_include([scripts/autoconf/lt~obsolete.m4])

View File

@ -1,6 +1,7 @@
/* arm_init.c - NEON optimised filter functions /* arm_init.c - NEON optimised filter functions
* *
* Copyright (c) 2018-2022 Cosmin Truta * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2014,2016 Glenn Randers-Pehrson * Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011. * Written by Mans Rullgard, 2011.
* *
@ -9,7 +10,9 @@
* and license in png.h * and license in png.h
*/ */
/* This module requires POSIX 1003.1 functions. */ /* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
* called.
*/
#define _POSIX_SOURCE 1 #define _POSIX_SOURCE 1
#include "../pngpriv.h" #include "../pngpriv.h"
@ -30,30 +33,25 @@
* has partial support is contrib/arm-neon/linux.c - a generic Linux * has partial support is contrib/arm-neon/linux.c - a generic Linux
* implementation which reads /proc/cpufino. * implementation which reads /proc/cpufino.
*/ */
#include <signal.h> /* for sig_atomic_t */
#ifndef PNG_ARM_NEON_FILE #ifndef PNG_ARM_NEON_FILE
# if defined(__aarch64__) || defined(_M_ARM64) # ifdef __linux__
/* ARM Neon is expected to be unconditionally available on ARM64. */ # define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
# error PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on ARM64
# elif defined(__ARM_NEON__) || defined(__ARM_NEON)
/* ARM Neon is expected to be available on the target CPU architecture. */
# error PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on this CPU arch
# elif defined(__linux__)
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
# else
# error No support for run-time ARM Neon checking; use compile-time options
# endif # endif
#endif #endif
static int png_have_neon(png_structp png_ptr);
#ifdef PNG_ARM_NEON_FILE #ifdef PNG_ARM_NEON_FILE
# include PNG_ARM_NEON_FILE
#endif #include <signal.h> /* for sig_atomic_t */
static int png_have_neon(png_structp png_ptr);
#include PNG_ARM_NEON_FILE
#else /* PNG_ARM_NEON_FILE */
# error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
#endif /* PNG_ARM_NEON_FILE */
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */ #endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED #ifndef PNG_ALIGNED_MEMORY_SUPPORTED
# error ALIGNED_MEMORY is required; please define PNG_ALIGNED_MEMORY_SUPPORTED # error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
#endif #endif
void void

View File

@ -1,60 +1,253 @@
/* filter_neon.S - placeholder file
/* filter_neon.S - NEON optimised filter functions
* *
* Copyright (c) 2024 Cosmin Truta * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
*/ */
/* IMPORTANT NOTE:
*
* Historically, the hand-coded assembler implementation of Neon optimizations
* in this module had not been in sync with the intrinsics-based implementation
* in filter_neon_intrinsics.c and palette_neon_intrinsics.c, at least since
* the introduction of riffled palette optimizations. Moreover, the assembler
* code used to work on 32-bit ARM only, and it caused problems, even if empty,
* on 64-bit ARM.
*
* All references to this module from our internal build scripts and projects
* have been removed.
*
* For the external projects that might still expect this module to be present,
* we leave this stub in place, for the remaining lifetime of libpng-1.6.x.
* Everything should continue to function normally, as long as there are no
* deliberate attempts to use the old hand-made assembler code. A build error
* will be raised otherwise.
*/
/* This is required to get the symbol renames, which are #defines, and the /* This is required to get the symbol renames, which are #defines, and the
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION. * definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
*/ */
#define PNG_VERSION_INFO_ONLY #define PNG_VERSION_INFO_ONLY
#include "../pngpriv.h" #include "../pngpriv.h"
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
#endif
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
* for the logic which sets PNG_USE_ARM_NEON_ASM:
*/
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */ #if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
#if PNG_ARM_NEON_OPT > 0 #if PNG_ARM_NEON_OPT > 0
#if defined(__clang__) #ifdef __ELF__
#define GNUC_VERSION 0 /* not gcc, although it might pretend to be */ # define ELF
#elif defined(__GNUC__)
#define GNUC_MAJOR (__GNUC__ + 0)
#define GNUC_MINOR (__GNUC_MINOR__ + 0)
#define GNUC_PATCHLEVEL (__GNUC_PATCHLEVEL__ + 0)
#define GNUC_VERSION (GNUC_MAJOR * 10000 + GNUC_MINOR * 100 + GNUC_PATCHLEVEL)
#else #else
#define GNUC_VERSION 0 /* not gcc */ # define ELF @
#endif #endif
#if (GNUC_VERSION > 0) && (GNUC_VERSION < 40300) .arch armv7-a
#error "PNG_ARM_NEON is not supported with gcc versions earlier than 4.3.0" .fpu neon
#elif GNUC_VERSION == 40504
#error "PNG_ARM_NEON is not supported with gcc version 4.5.4"
#else
#error "Please use 'arm/*_neon_intrinsics.c' for PNG_ARM_NEON support"
#endif
.macro func name, export=0
.macro endfunc
ELF .size \name, . - \name
.endfunc
.purgem endfunc
.endm
.text
/* Explicitly specifying alignment here because some versions of
* GAS don't align code correctly. This is harmless in correctly
* written versions of GAS.
*/
.align 2
.if \export
.global \name
.endif
ELF .type \name, STT_FUNC
.func \name
\name:
.endm
func png_read_filter_row_sub4_neon, export=1
ldr r3, [r0, #4] @ rowbytes
vmov.i8 d3, #0
1:
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
vadd.u8 d0, d3, d4
vadd.u8 d1, d0, d5
vadd.u8 d2, d1, d6
vadd.u8 d3, d2, d7
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
subs r3, r3, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_sub3_neon, export=1
ldr r3, [r0, #4] @ rowbytes
vmov.i8 d3, #0
mov r0, r1
mov r2, #3
mov r12, #12
vld1.8 {q11}, [r0], r12
1:
vext.8 d5, d22, d23, #3
vadd.u8 d0, d3, d22
vext.8 d6, d22, d23, #6
vadd.u8 d1, d0, d5
vext.8 d7, d23, d23, #1
vld1.8 {q11}, [r0], r12
vst1.32 {d0[0]}, [r1,:32], r2
vadd.u8 d2, d1, d6
vst1.32 {d1[0]}, [r1], r2
vadd.u8 d3, d2, d7
vst1.32 {d2[0]}, [r1], r2
vst1.32 {d3[0]}, [r1], r2
subs r3, r3, #12
bgt 1b
bx lr
endfunc
func png_read_filter_row_up_neon, export=1
ldr r3, [r0, #4] @ rowbytes
1:
vld1.8 {q0}, [r1,:128]
vld1.8 {q1}, [r2,:128]!
vadd.u8 q0, q0, q1
vst1.8 {q0}, [r1,:128]!
subs r3, r3, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_avg4_neon, export=1
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
1:
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
vhadd.u8 d0, d3, d16
vadd.u8 d0, d0, d4
vhadd.u8 d1, d0, d17
vadd.u8 d1, d1, d5
vhadd.u8 d2, d1, d18
vadd.u8 d2, d2, d6
vhadd.u8 d3, d2, d19
vadd.u8 d3, d3, d7
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
subs r12, r12, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_avg3_neon, export=1
push {r4,lr}
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
mov r0, r1
mov r4, #3
mov lr, #12
vld1.8 {q11}, [r0], lr
1:
vld1.8 {q10}, [r2], lr
vext.8 d5, d22, d23, #3
vhadd.u8 d0, d3, d20
vext.8 d17, d20, d21, #3
vadd.u8 d0, d0, d22
vext.8 d6, d22, d23, #6
vhadd.u8 d1, d0, d17
vext.8 d18, d20, d21, #6
vadd.u8 d1, d1, d5
vext.8 d7, d23, d23, #1
vld1.8 {q11}, [r0], lr
vst1.32 {d0[0]}, [r1,:32], r4
vhadd.u8 d2, d1, d18
vst1.32 {d1[0]}, [r1], r4
vext.8 d19, d21, d21, #1
vadd.u8 d2, d2, d6
vhadd.u8 d3, d2, d19
vst1.32 {d2[0]}, [r1], r4
vadd.u8 d3, d3, d7
vst1.32 {d3[0]}, [r1], r4
subs r12, r12, #12
bgt 1b
pop {r4,pc}
endfunc
.macro paeth rx, ra, rb, rc
vaddl.u8 q12, \ra, \rb @ a + b
vaddl.u8 q15, \rc, \rc @ 2*c
vabdl.u8 q13, \rb, \rc @ pa
vabdl.u8 q14, \ra, \rc @ pb
vabd.u16 q15, q12, q15 @ pc
vcle.u16 q12, q13, q14 @ pa <= pb
vcle.u16 q13, q13, q15 @ pa <= pc
vcle.u16 q14, q14, q15 @ pb <= pc
vand q12, q12, q13 @ pa <= pb && pa <= pc
vmovn.u16 d28, q14
vmovn.u16 \rx, q12
vbsl d28, \rb, \rc
vbsl \rx, \ra, d28
.endm
func png_read_filter_row_paeth4_neon, export=1
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
vmov.i8 d20, #0
1:
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
paeth d0, d3, d16, d20
vadd.u8 d0, d0, d4
paeth d1, d0, d17, d16
vadd.u8 d1, d1, d5
paeth d2, d1, d18, d17
vadd.u8 d2, d2, d6
paeth d3, d2, d19, d18
vmov d20, d19
vadd.u8 d3, d3, d7
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
subs r12, r12, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_paeth3_neon, export=1
push {r4,lr}
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
vmov.i8 d4, #0
mov r0, r1
mov r4, #3
mov lr, #12
vld1.8 {q11}, [r0], lr
1:
vld1.8 {q10}, [r2], lr
paeth d0, d3, d20, d4
vext.8 d5, d22, d23, #3
vadd.u8 d0, d0, d22
vext.8 d17, d20, d21, #3
paeth d1, d0, d17, d20
vst1.32 {d0[0]}, [r1,:32], r4
vext.8 d6, d22, d23, #6
vadd.u8 d1, d1, d5
vext.8 d18, d20, d21, #6
paeth d2, d1, d18, d17
vext.8 d7, d23, d23, #1
vld1.8 {q11}, [r0], lr
vst1.32 {d1[0]}, [r1], r4
vadd.u8 d2, d2, d6
vext.8 d19, d21, d21, #1
paeth d3, d2, d19, d18
vst1.32 {d2[0]}, [r1], r4
vmov d4, d19
vadd.u8 d3, d3, d7
vst1.32 {d3[0]}, [r1], r4
subs r12, r12, #12
bgt 1b
pop {r4,pc}
endfunc
#endif /* PNG_ARM_NEON_OPT > 0 */ #endif /* PNG_ARM_NEON_OPT > 0 */
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 */ #endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
#endif /* READ */ #endif /* READ */

View File

@ -1,3 +1,4 @@
/* filter_neon_intrinsics.c - NEON optimised filter functions /* filter_neon_intrinsics.c - NEON optimised filter functions
* *
* Copyright (c) 2018 Cosmin Truta * Copyright (c) 2018 Cosmin Truta
@ -17,7 +18,7 @@
/* This code requires -mfpu=neon on the command line: */ /* This code requires -mfpu=neon on the command line: */
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */ #if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64) #if defined(_MSC_VER) && defined(_M_ARM64)
# include <arm64_neon.h> # include <arm64_neon.h>
#else #else
# include <arm_neon.h> # include <arm_neon.h>

View File

@ -1,3 +1,4 @@
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions /* palette_neon_intrinsics.c - NEON optimised palette expansion functions
* *
* Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 2018-2019 Cosmin Truta
@ -13,7 +14,7 @@
#if PNG_ARM_NEON_IMPLEMENTATION == 1 #if PNG_ARM_NEON_IMPLEMENTATION == 1
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64) #if defined(_MSC_VER) && defined(_M_ARM64)
# include <arm64_neon.h> # include <arm64_neon.h>
#else #else
# include <arm_neon.h> # include <arm_neon.h>
@ -29,6 +30,8 @@ png_riffle_palette_neon(png_structrp png_ptr)
int num_trans = png_ptr->num_trans; int num_trans = png_ptr->num_trans;
int i; int i;
png_debug(1, "in png_riffle_palette_neon");
/* Initially black, opaque. */ /* Initially black, opaque. */
uint8x16x4_t w = {{ uint8x16x4_t w = {{
vdupq_n_u8(0x00), vdupq_n_u8(0x00),
@ -37,8 +40,6 @@ png_riffle_palette_neon(png_structrp png_ptr)
vdupq_n_u8(0xff), vdupq_n_u8(0xff),
}}; }};
png_debug(1, "in png_riffle_palette_neon");
/* First, riffle the RGB colours into an RGBA8 palette. /* First, riffle the RGB colours into an RGBA8 palette.
* The alpha component is set to opaque for now. * The alpha component is set to opaque for now.
*/ */
@ -63,13 +64,12 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
{ {
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
const png_uint_32 *riffled_palette = const png_uint_32 *riffled_palette =
png_aligncastconst(png_const_uint_32p, png_ptr->riffled_palette); (const png_uint_32 *)png_ptr->riffled_palette;
const png_uint_32 pixels_per_chunk = 4; const png_int_32 pixels_per_chunk = 4;
png_uint_32 i; int i;
png_debug(1, "in png_do_expand_palette_rgba8_neon"); png_debug(1, "in png_do_expand_palette_rgba8_neon");
PNG_UNUSED(row)
if (row_width < pixels_per_chunk) if (row_width < pixels_per_chunk)
return 0; return 0;
@ -109,11 +109,10 @@ png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
png_const_bytep palette = (png_const_bytep)png_ptr->palette; png_const_bytep palette = (png_const_bytep)png_ptr->palette;
const png_uint_32 pixels_per_chunk = 8; const png_uint_32 pixels_per_chunk = 8;
png_uint_32 i; int i;
png_debug(1, "in png_do_expand_palette_rgb8_neon"); png_debug(1, "in png_do_expand_palette_rgb8_neon");
PNG_UNUSED(row)
if (row_width <= pixels_per_chunk) if (row_width <= pixels_per_chunk)
return 0; return 0;

View File

@ -77,14 +77,13 @@ libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
config.sub configure depcomp install-sh ltmain.sh missing\ config.sub configure depcomp install-sh ltmain.sh missing\
test-driver" test-driver"
# #
# Files generated by versions of autoconf >2.68 or automake >1.13 (i.e. later # Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
# versions than those required by configure.ac): # versions than those required by configure.ac):
libpng_autotools_extra="compile config.h.in~" libpng_autotools_extra="compile config.h.in~"
# #
# These are separate because 'maintainer-clean' does not remove them. # These are separate because 'maintainer-clean' does not remove them.
libpng_libtool_files="scripts/autoconf/libtool.m4 scripts/autoconf/ltoptions.m4\ libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
scripts/autoconf/ltsugar.m4 scripts/autoconf/ltversion.m4\ scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
scripts/autoconf/lt~obsolete.m4"
libpng_autotools_dirs="autom4te.cache" # not required libpng_autotools_dirs="autom4te.cache" # not required
# #

View File

@ -1,11 +0,0 @@
# 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
# 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

View File

@ -1,19 +0,0 @@
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.

View File

@ -1,25 +0,0 @@
Scripts for the Continuous Integration of the PNG Reference Library
===================================================================
Copyright Notice
----------------
Copyright (c) 2019-2025 Cosmin Truta.
Use, modification and distribution are subject to the MIT License.
Please see the accompanying file `LICENSE_MIT.txt` or visit
https://opensource.org/license/mit
File List
---------
LICENSE_MIT.txt ==> The License file
README.md ==> This file
ci_lint.sh ==> Lint the source code
ci_shellify.sh ==> Convert select definitions to shell syntax
ci_verify_cmake.sh ==> Verify the build driven by CMakeLists.txt
ci_verify_configure.sh ==> Verify the build driven by configure
ci_verify_makefiles.sh ==> Verify the build driven by scripts/makefile.*
ci_verify_version.sh ==> Verify the consistency of version definitions
lib/ci.lib.sh ==> Shell utilities for the main ci_*.sh scripts
targets/*/ci_env.*.sh ==> Shell environments for cross-platform testing

View File

@ -1,142 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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 -name "ci_*.sh" -not -name "ci_env.*.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" --config .editorconfig-checker.json || {
# 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
# Considering that the YAML format is an extension of the JSON format,
# we can lint both the YAML files and the plain JSON files here.
find . \( -iname "*.yml" -o -iname "*.yaml" -o -iname "*.json" \) -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 "$@"

View File

@ -1,209 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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_SRC_DIR="$CI_TOPLEVEL_DIR"
CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
function ci_init_build {
# Ensure that the mandatory variables are initialized.
CI_CMAKE="${CI_CMAKE:-cmake}"
CI_CTEST="${CI_CTEST:-ctest}"
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
then
# 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_internal "missing \$CI_CMAKE_GENERATOR_PLATFORM"
}
elif [[ -x $(command -v ninja) ]]
then
CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
fi
}
function ci_trace_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "build arch: $CI_BUILD_ARCH"
ci_info "build system: $CI_BUILD_SYSTEM"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
ci_info "target arch: $CI_TARGET_ARCH"
ci_info "target system: $CI_TARGET_SYSTEM"
}
ci_info "source directory: $CI_SRC_DIR"
ci_info "build directory: $CI_BUILD_DIR"
ci_info "install directory: $CI_INSTALL_DIR"
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_CC: '$CI_CC'"
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
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_BUILD: '$CI_NO_BUILD'"
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_info "executable: \$CI_CC: $(command -V "$CI_CC")"
}
[[ $CI_AR ]] && {
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
}
[[ $CI_RANLIB ]] && {
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
}
ci_info "## END OF CONFIGURATION ##"
}
function ci_cleanup_old_build {
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 ##"
}
function ci_build {
ci_info "## START OF BUILD ##"
# 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 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 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_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
}
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] && {
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
}
# 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!
ci_spawn mkdir -p "$CI_BUILD_DIR"
# Spawn "cmake ...".
ci_spawn "$CI_CMAKE" -B "$CI_BUILD_DIR" \
-S . \
-DCMAKE_INSTALL_PREFIX="$CI_INSTALL_DIR" \
"${all_cmake_vars[@]}"
ci_expr $((CI_NO_BUILD)) || {
# Spawn "cmake --build ...".
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
"${all_cmake_build_flags[@]}"
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "ctest" if testing is not disabled.
ci_spawn pushd "$CI_BUILD_DIR"
ci_spawn "$CI_CTEST" --build-config "$CI_CMAKE_BUILD_TYPE" \
"${all_ctest_flags[@]}"
ci_spawn popd
}
ci_expr $((CI_NO_INSTALL)) || {
# Spawn "cmake --build ... --target install" if installation is not disabled.
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
--target install \
"${all_cmake_build_flags[@]}"
}
ci_expr $((CI_NO_CLEAN)) || {
# Spawn "make --build ... --target clean" if cleaning is not disabled.
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
--target clean \
"${all_cmake_build_flags[@]}"
}
ci_info "## END OF BUILD ##"
}
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))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
echo >&2 "note: this program accepts environment options only"
usage 2
}
ci_cleanup_old_build
ci_build
}
main "$@"

View File

@ -1,182 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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_SRC_DIR="$CI_TOPLEVEL_DIR"
CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_configure.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_configure.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
function ci_init_build {
# Ensure that the mandatory variables are initialized.
CI_MAKE="${CI_MAKE:-make}"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] || {
# For native builds, set CI_CC to "cc" by default if the cc command is available.
# The configure script defaults CC to "gcc", which is not always a good idea.
[[ -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_err "unsupported: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'"
}
[[ ! $CI_MAKE_VARS ]] || {
ci_err "unsupported: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
}
}
function ci_trace_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "build arch: $CI_BUILD_ARCH"
ci_info "build system: $CI_BUILD_SYSTEM"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
ci_info "target arch: $CI_TARGET_ARCH"
ci_info "target system: $CI_TARGET_SYSTEM"
}
ci_info "source directory: $CI_SRC_DIR"
ci_info "build directory: $CI_BUILD_DIR"
ci_info "install directory: $CI_INSTALL_DIR"
ci_info "environment option: \$CI_CONFIGURE_FLAGS: '$CI_CONFIGURE_FLAGS'"
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
ci_info "environment option: \$CI_MAKE_FLAGS: '$CI_MAKE_FLAGS'"
ci_info "environment option: \$CI_CC: '$CI_CC'"
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
ci_info "environment option: \$CI_CPP: '$CI_CPP'"
ci_info "environment option: \$CI_CPP_FLAGS: '$CI_CPP_FLAGS'"
ci_info "environment option: \$CI_AR: '$CI_AR'"
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
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_BUILD: '$CI_NO_BUILD'"
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_info "executable: \$CI_CC: $(command -V "$CI_CC")"
}
[[ $CI_CPP ]] && {
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
}
[[ $CI_AR ]] && {
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
}
[[ $CI_RANLIB ]] && {
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
}
[[ $CI_LD ]] && {
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
}
ci_info "## END OF CONFIGURATION ##"
}
function ci_cleanup_old_build {
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"
}
[[ ! -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 {
ci_info "## START OF BUILD ##"
# Export the configure build environment.
[[ $CI_CC ]] && ci_spawn export CC="$CI_CC"
[[ $CI_CC_FLAGS ]] && ci_spawn export CFLAGS="$CI_CC_FLAGS"
[[ $CI_CPP ]] && ci_spawn export CPP="$CI_CPP"
[[ $CI_CPP_FLAGS ]] && ci_spawn export CPPFLAGS="$CI_CPP_FLAGS"
[[ $CI_AR ]] && ci_spawn export AR="$CI_AR"
[[ $CI_RANLIB ]] && ci_spawn export RANLIB="$CI_RANLIB"
[[ $CI_LD ]] && ci_spawn export LD="$CI_LD"
[[ $CI_LD_FLAGS ]] && ci_spawn export LDFLAGS="$CI_LD_FLAGS"
[[ $CI_SANITIZERS ]] && {
ci_spawn export CFLAGS="${CFLAGS:-"-O2"} -fsanitize=$CI_SANITIZERS"
ci_spawn export LDFLAGS="${LDFLAGS}${LDFLAGS:+" "}-fsanitize=$CI_SANITIZERS"
}
# Spawn "autogen.sh" if the configure script is not available.
[[ -x "$CI_SRC_DIR/configure" ]] || {
ci_spawn "$CI_SRC_DIR/autogen.sh" --maintainer
}
# And... build!
ci_spawn mkdir -p "$CI_BUILD_DIR"
ci_spawn cd "$CI_BUILD_DIR"
# Spawn "configure".
ci_spawn "$CI_SRC_DIR/configure" --prefix="$CI_INSTALL_DIR" $CI_CONFIGURE_FLAGS
ci_expr $((CI_NO_BUILD)) || {
# Spawn "make".
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "make test" if testing is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS test
}
ci_expr $((CI_NO_INSTALL)) || {
# Spawn "make install" if installation is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS install
}
ci_expr $((CI_NO_CLEAN)) || {
# Spawn "make clean" and "make distclean" if cleaning is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS clean
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS distclean
}
ci_info "## END OF BUILD ##"
}
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))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
echo >&2 "note: this program accepts environment options only"
usage 2
}
ci_cleanup_old_build
ci_build
}
main "$@"

View File

@ -1,200 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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_SRC_DIR="$CI_TOPLEVEL_DIR"
function ci_init_build {
# Ensure that the mandatory variables are initialized.
CI_MAKE="${CI_MAKE:-make}"
case "$CI_CC" in
( *clang* )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.clang"}" ;;
( *gcc* )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.gcc"}" ;;
( * )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.std"}" ;;
esac
}
function ci_trace_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "build arch: $CI_BUILD_ARCH"
ci_info "build system: $CI_BUILD_SYSTEM"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
ci_info "target arch: $CI_TARGET_ARCH"
ci_info "target system: $CI_TARGET_SYSTEM"
}
ci_info "source directory: $CI_SRC_DIR"
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 "environment option: \$CI_CC: '$CI_CC'"
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
ci_info "environment option: \$CI_CPP: '$CI_CPP'"
ci_info "environment option: \$CI_CPP_FLAGS: '$CI_CPP_FLAGS'"
ci_info "environment option: \$CI_AR: '$CI_AR'"
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
ci_info "environment option: \$CI_LD: '$CI_LD'"
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_BUILD: '$CI_NO_BUILD'"
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_info "executable: \$CI_CC: $(command -V "$CI_CC")"
}
[[ $CI_CPP ]] && {
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
}
[[ $CI_AR ]] && {
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
}
[[ $CI_RANLIB ]] && {
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
}
[[ $CI_LD ]] && {
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
}
ci_info "## END OF CONFIGURATION ##"
}
function ci_cleanup_old_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.
ci_info "## START 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 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_expr $((CI_NO_BUILD)) || {
# Spawn "make".
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[@]}" \
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[@]}" \
clean
}
done
ci_info "## END OF BUILD ##"
}
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))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
echo >&2 "note: this program accepts environment options only"
usage 2
}
ci_cleanup_old_build
ci_build
}
main "$@"

View File

@ -1,191 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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"
# Declare the global environments collected from various sources.
declare CI_ENV_LIBPNG_VER # collected from png.h
declare CI_ENV_AUTOCONF_VER # collected from configure.ac
declare CI_ENV_CMAKE_VER # collected from CMakeLists.txt
declare CI_ENV_LIBPNGCONFIG_VER # collected from scripts/libpng-config-head.in
function ci_run_shellify {
local my_script my_result
my_script="$CI_SCRIPT_DIR/libexec/ci_shellify_${1#--}.sh"
shift 1
[[ -f $my_script ]] || {
ci_err_internal "missing script: '$my_script'"
}
ci_info "shellifying:" "$@"
"$BASH" "$my_script" "$@"
echo "$my_result" | "$BASH" --posix || ci_err "bad shellify output"
echo "$my_result"
}
function ci_init_version_verification {
ci_info "## START OF VERIFICATION ##"
CI_ENV_LIBPNG_VER="$(ci_run_shellify --c png.h)"
echo "$CI_ENV_LIBPNG_VER"
CI_ENV_AUTOCONF_VER="$(ci_run_shellify --autoconf configure.ac)"
echo "$CI_ENV_AUTOCONF_VER"
CI_ENV_CMAKE_VER="$(ci_run_shellify --cmake CMakeLists.txt)"
echo "$CI_ENV_CMAKE_VER"
CI_ENV_LIBPNGCONFIG_VER="$(ci_run_shellify --shell scripts/libpng-config-head.in)"
echo "$CI_ENV_LIBPNGCONFIG_VER"
}
# shellcheck disable=SC2154
function ci_do_version_verification {
local my_expect
ci_info "## VERIFYING: version definitions in 'png.h' ##"
eval "$CI_ENV_LIBPNG_VER"
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: build definitions in 'png.h' ##"
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_STABLE"
else
ci_err "mismatched: \$PNG_LIBPNG_BUILD_BASE_TYPE -ne \$PNG_LIBPNG_BUILD_STABLE"
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 -ne $PNG_LIBPNG_BUILD_STABLE ]]
then
ci_info "matched: \$PNG_LIBPNG_BUILD_BASE_TYPE -ne \$PNG_LIBPNG_BUILD_STABLE"
else
ci_err "mismatched: \$PNG_LIBPNG_BUILD_BASE_TYPE -eq \$PNG_LIBPNG_BUILD_STABLE"
fi
else
ci_err "unexpected: \$PNG_LIBPNG_VER_STRING == '$PNG_LIBPNG_VER_STRING'"
fi
ci_info "## VERIFYING: type definitions in 'png.h' ##"
my_expect="$(echo "png_libpng_version_${PNG_LIBPNG_VER_STRING}" | tr . _)"
ci_spawn grep -w -e "$my_expect" png.h
ci_info "## VERIFYING: version definitions in 'configure.ac' ##"
eval "$CI_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: version definitions in 'CMakeLists.txt' ##"
eval "$CI_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 "## VERIFYING: version definitions in 'scripts/libpng-config-head.in' ##"
eval "$CI_ENV_LIBPNGCONFIG_VER"
if [[ "$version" == "$PNG_LIBPNG_VER_STRING" ]]
then
ci_info "matched: \$version == \$PNG_LIBPNG_VER_STRING"
else
ci_err "mismatched: \$version != \$PNG_LIBPNG_VER_STRING"
fi
}
function ci_finish_version_verification {
ci_info "## END OF VERIFICATION ##"
# Relying on "set -o errexit" to not reach here in case of error.
ci_info "## SUCCESS ##"
}
function ci_verify_version {
ci_init_version_verification
ci_do_version_verification
ci_finish_version_verification
}
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 "$@"

View File

@ -1,111 +0,0 @@
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
test -f "$BASH_SOURCE" || {
echo >&2 "warning: this module requires Bash version 3 or newer"
}
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
export LANG=C
export LANGUAGE=C
# Reset CDPATH to avoid surprises from the "cd" command.
export CDPATH=""
# Initialize the global constants CI_SCRIPT_{NAME,DIR} and CI_TOPLEVEL_DIR.
CI_SCRIPT_NAME="$(basename -- "$0")"
CI_SCRIPT_DIR="$(cd "$(dirname -- "$0")" && pwd)"
CI_TOPLEVEL_DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
# Initialize the global constants CI_BUILD_{...} for the host build platform.
CI_BUILD_ARCH="${CI_BUILD_ARCH:-"$(uname -m | tr 'A-Z/\.-' 'a-z____')"}"
CI_BUILD_SYSTEM="${CI_BUILD_SYSTEM:-"$(uname -s | tr 'A-Z/\.-' 'a-z____')"}"
# Initialize the global constants CI_TARGET_{...} for the target platform.
CI_TARGET_ARCH="${CI_TARGET_ARCH:-"$CI_BUILD_ARCH"}"
CI_TARGET_SYSTEM="${CI_TARGET_SYSTEM:-"$CI_BUILD_SYSTEM"}"
function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPT_NAME" "$*"
}
function ci_warn {
printf >&2 "%s: warning: %s\\n" "$CI_SCRIPT_NAME" "$*"
}
function ci_err {
printf >&2 "%s: error: %s\\n" "$CI_SCRIPT_NAME" "$*"
exit 2
}
function ci_err_internal {
printf >&2 "%s: internal error: %s\\n" "$CI_SCRIPT_NAME" "$*"
printf >&2 "ABORTED\\n"
# Exit with the conventional SIGABRT code.
exit 134
}
function ci_expr {
if [[ ${*:-0} == [0-9] ]]
then
# This is the same as in the else-branch below, albeit much faster
# for our intended use cases.
return $((!$1))
else
# The funny-looking compound command "... && return $? || return $?"
# allows the execution to continue uninterrupted under "set -e".
expr >/dev/null "$@" && return $? || return $?
fi
}
function ci_spawn {
printf >&2 "%s: executing:" "$CI_SCRIPT_NAME"
printf >&2 " %q" "$@"
printf >&2 "\\n"
"$@"
}
# Ensure that the internal initialization is correct.
[[ $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_err_internal "bad or missing \$CI_SCRIPT_DIR/\$CI_SCRIPT_NAME"
}
[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] || {
ci_err_internal "missing \$CI_BUILD_ARCH or \$CI_BUILD_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_FORCE:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_FORCE: '$CI_FORCE'"
}
[[ ${CI_NO_BUILD:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
}
[[ ${CI_NO_TEST:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_TEST: '$CI_NO_TEST'"
}
[[ ${CI_NO_INSTALL:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
}
[[ ${CI_NO_CLEAN:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
}
if ci_expr $((CI_NO_BUILD))
then
ci_expr $((CI_NO_TEST && CI_NO_INSTALL)) || {
ci_err "\$CI_NO_BUILD requires \$CI_NO_TEST and \$CI_NO_INSTALL"
}
fi

View File

@ -1,48 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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"
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 usage {
echo "usage: $CI_SCRIPT_NAME [<options>] configure.ac"
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 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
[[ $(basename -- "$1") == configure.ac ]] || {
ci_err "incorrect operand: '$1' (expecting: 'configure.ac')"
}
ci_shellify_autoconf <"$1"
}
main "$@"

View File

@ -1,49 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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"
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 usage {
echo "usage: $CI_SCRIPT_NAME [<options>] png.h"
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 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
[[ $(basename -- "$1") == png.h ]] || {
ci_err "incorrect operand: '$1' (expecting: 'png.h')"
}
ci_shellify_c <"$1"
}
main "$@"

View File

@ -1,49 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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"
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 usage {
echo "usage: $CI_SCRIPT_NAME [<options>] CMakeLists.txt"
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 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
filename="$(basename -- "$1")"
[[ $filename == [Cc][Mm]ake[Ll]ists.txt ]] || {
ci_err "incorrect operand: '$1' (expecting: 'CMakeLists.txt')"
}
ci_shellify_cmake <"$1"
}
main "$@"

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 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"
function ci_shellify_shell {
# Convert shell scripting text to shell scripting text.
# Select only the easy-to-parse version definitions.
sed -n -e '/^ *[A-Za-z_][0-9A-Za-z_]*=[0-9][^ #]* *$/ p' |
sed -e 's/^ *\([^ ]*=[^ ]*\) *$/export \1;/'
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>] libpng-config-head.in"
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 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
[[ $(basename -- "$1") == libpng-config-head.in ]] || {
ci_err "incorrect operand: '$1' (expecting: 'libpng-config-head.in')"
}
ci_shellify_shell <"$1"
}
main "$@"

View File

@ -1,16 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=aarch64
export CI_TARGET_ARCHVER=aarch64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=android
export CI_TARGET_ABIVER=android29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -1,16 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=arm
export CI_TARGET_ARCHVER=armv7a
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=androideabi
export CI_TARGET_ABIVER=androideabi29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -1,16 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i686
export CI_TARGET_ARCHVER=i686
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=android
export CI_TARGET_ABIVER=android29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -1,16 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_ARCHVER=x86_64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=android
export CI_TARGET_ABIVER=android29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=cygwin
export CI_CC="$CI_TARGET_ARCH-pc-$CI_TARGET_SYSTEM-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=CYGWIN
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=cygwin
export CI_CC="$CI_TARGET_ARCH-pc-$CI_TARGET_SYSTEM-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=CYGWIN
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,15 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=arm64
export CI_TARGET_SYSTEM=darwin
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
-DCMAKE_OSX_ARCHITECTURES=$CI_TARGET_ARCH
"

View File

@ -1,15 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=darwin
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
-DCMAKE_OSX_ARCHITECTURES=$CI_TARGET_ARCH
"

View File

@ -1,14 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=aarch64
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,14 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,14 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=riscv64
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,14 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=aarch64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=arm
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnueabi
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=arm
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnueabihf
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mips
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mips64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mips64el
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mipsel
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mipsisa32r6
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mipsisa32r6el
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mipsisa64r6
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=mipsisa64r6el
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=powerpc
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=powerpc64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=powerpc64le
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=riscv64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i386
export CI_TARGET_SYSTEM=msdoswatcom
export CI_CC="wcl386"
# Open Watcom V2 CMake build
# https://github.com/open-watcom/open-watcom-v2/discussions/716
export CI_CMAKE_GENERATOR="Watcom WMake"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=DOS
"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i586
export CI_TARGET_SYSTEM=msdosdjgpp
export CI_CC="$CI_TARGET_ARCH-pc-$CI_TARGET_SYSTEM-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,19 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i86
export CI_TARGET_SYSTEM=msdoswatcom
export CI_CC="wcl"
# Open Watcom V2 CMake build
# https://github.com/open-watcom/open-watcom-v2/discussions/716
export CI_CMAKE_GENERATOR="Watcom WMake"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=DOS
-DCMAKE_SYSTEM_PROCESSOR=I86
"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=aarch64
export CI_TARGET_SYSTEM=windows
export CI_CC="clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=mingw32
# The output of `uname -s` on MSYS2 is understandable, and so is
# CI_TARGET_SYSTEM above, in simplified form. (See also Cygwin.)
# But aside from that, the Mingw-w64 nomenclature is rather messy.
export CI_CC="$CI_TARGET_ARCH-w64-mingw32-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=windows
export CI_CC="clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,21 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=mingw64
# The output of `uname -s` on MSYS2 is understandable, and so is
# CI_TARGET_SYSTEM above, in simplified form. (See also Cygwin.)
# But aside from that, the Mingw-w64 nomenclature is rather messy.
export CI_CC="$CI_TARGET_ARCH-w64-mingw32-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023-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
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=windows
export CI_CC="clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

38
compile
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Wrapper for compilers which do not understand '-c -o'. # Wrapper for compilers which do not understand '-c -o'.
scriptversion=2025-06-18.21; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2025 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -37,11 +37,11 @@ IFS=" "" $nl"
file_conv= file_conv=
# func_file_conv build_file unneeded_conversions # func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file # Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion # Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no # type is listed in (the comma separated) LAZY, no conversion will
# conversion will take place. # take place.
func_file_conv () func_file_conv ()
{ {
file=$1 file=$1
@ -51,20 +51,9 @@ func_file_conv ()
# lazily determine how to convert abs files # lazily determine how to convert abs files
case `uname -s` in case `uname -s` in
MINGW*) MINGW*)
if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then file_conv=mingw
# MSYS2 environment.
file_conv=cygwin
else
# Original MinGW environment.
file_conv=mingw
fi
;;
MSYS*)
# Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
file_conv=cygwin
;; ;;
CYGWIN*) CYGWIN*)
# Cygwin environment.
file_conv=cygwin file_conv=cygwin
;; ;;
*) *)
@ -74,14 +63,12 @@ func_file_conv ()
fi fi
case $file_conv/,$2, in case $file_conv/,$2, in
*,$file_conv,*) *,$file_conv,*)
# This is the optimization mentioned above:
# If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
;; ;;
mingw/*) mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;; ;;
cygwin/*) cygwin/*)
file=`cygpath -w "$file" || echo "$file"` file=`cygpath -m "$file" || echo "$file"`
;; ;;
wine/*) wine/*)
file=`winepath -w "$file" || echo "$file"` file=`winepath -w "$file" || echo "$file"`
@ -156,7 +143,7 @@ func_cl_wrapper ()
# configure might choose to run compile as 'compile cc -o foo foo.c'. # configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1 eat=1
case $2 in case $2 in
*.o | *.lo | *.[oO][bB][jJ]) *.o | *.[oO][bB][jJ])
func_file_conv "$2" func_file_conv "$2"
set x "$@" -Fo"$file" set x "$@" -Fo"$file"
shift shift
@ -261,17 +248,14 @@ If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'. right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>. Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
EOF EOF
exit $? exit $?
;; ;;
-v | --v*) -v | --v*)
echo "compile (GNU Automake) $scriptversion" echo "compile $scriptversion"
exit $? exit $?
;; ;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return... func_cl_wrapper "$@" # Doesn't return...
;; ;;
@ -356,9 +340,9 @@ exit $ret
# Local Variables: # Local Variables:
# mode: shell-script # mode: shell-script
# sh-indentation: 2 # sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp nil t) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%Y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:

1579
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@ -3,27 +3,27 @@
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
/* Define to 1 if you have the 'feenableexcept' function. */ /* Define to 1 if you have the `feenableexcept' function. */
#undef HAVE_FEENABLEEXCEPT #undef HAVE_FEENABLEEXCEPT
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the 'm' library (-lm). */ /* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM #undef HAVE_LIBM
/* Define to 1 if you have the 'z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ #undef HAVE_LIBZ
/* Define to 1 if you have the 'pow' function. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW #undef HAVE_POW
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H #undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H #undef HAVE_STDLIB_H
@ -78,18 +78,6 @@
/* Enable Intel SSE optimizations */ /* Enable Intel SSE optimizations */
#undef PNG_INTEL_SSE_OPT #undef PNG_INTEL_SSE_OPT
/* Enable LOONGARCH LSX optimizations */
#undef PNG_LOONGARCH_LSX_OPT
/* Turn on MIPS MMI optimizations at run-time */
#undef PNG_MIPS_MMI_API_SUPPORTED
/* Check for MIPS MMI support at run-time */
#undef PNG_MIPS_MMI_CHECK_SUPPORTED
/* Enable MIPS MMI optimizations */
#undef PNG_MIPS_MMI_OPT
/* Turn on MIPS MSA optimizations at run-time */ /* Turn on MIPS MSA optimizations at run-time */
#undef PNG_MIPS_MSA_API_SUPPORTED #undef PNG_MIPS_MSA_API_SUPPORTED
@ -108,31 +96,31 @@
/* Enable POWERPC VSX optimizations */ /* Enable POWERPC VSX optimizations */
#undef PNG_POWERPC_VSX_OPT #undef PNG_POWERPC_VSX_OPT
/* Enable RISCV RVV optimizations */ /* Define to 1 if you have the ANSI C header files. */
#undef PNG_RISCV_RVV_OPT
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares 'struct tm'. */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME #undef TM_IN_SYS_TIME
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to the equivalent of the C99 'restrict' keyword, or to /* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is nothing if this is not supported. Do not define if restrict is
supported only directly. */ supported directly. */
#undef restrict #undef restrict
/* Work around a bug in older versions of Sun C++, which did not /* Work around a bug in Sun C++: it does not support _Restrict or
#define __restrict__ or support _Restrict or __restrict__ __restrict__, even though the corresponding Sun C compiler ends up with
even though the corresponding Sun C compiler ended up with "#define restrict _Restrict" or "#define restrict __restrict__" in the
"#define restrict _Restrict" or "#define restrict __restrict__" previous line. Perhaps some future version of Sun C++ will work with
in the previous line. This workaround can be removed once restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
we assume Oracle Developer Studio 12.5 (2016) or later. */ #if defined __SUNPRO_CC && !defined __RESTRICT
#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
# define _Restrict # define _Restrict
# define __restrict__ # define __restrict__
#endif #endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

3347
config.sub vendored

File diff suppressed because it is too large Load Diff

8829
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# configure.ac # configure.ac
# Copyright (c) 2018-2024 Cosmin Truta # Copyright (c) 2018 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson # Copyright (c) 2004-2016 Glenn Randers-Pehrson
# This code is released under the libpng license. # This code is released under the libpng license.
@ -25,8 +25,8 @@ AC_PREREQ([2.68])
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng],[1.6.51.git],[png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng],[1.6.37],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts/autoconf]) AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign') # libpng does not follow GNU file name conventions (hence 'foreign')
# color-tests requires automake 1.11 or later # color-tests requires automake 1.11 or later
@ -46,17 +46,17 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2]) dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.51.git PNGLIB_VERSION=1.6.37
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=6 PNGLIB_MINOR=6
PNGLIB_RELEASE=51 PNGLIB_RELEASE=37
dnl End of version number stuff dnl End of version number stuff
AC_CONFIG_SRCDIR([pngget.c]) AC_CONFIG_SRCDIR([pngget.c])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
# Check the basic programs. # Checks for programs.
AC_LANG([C]) AC_LANG([C])
AC_PROG_CC AC_PROG_CC
AM_PROG_AS AM_PROG_AS
@ -72,19 +72,16 @@ dnl compatible later version may be used
LT_INIT([win32-dll]) LT_INIT([win32-dll])
LT_PREREQ([2.4.2]) LT_PREREQ([2.4.2])
dnl Declare the AWK variable. # Some awks crash when confronted with pnglibconf.dfa, do a test run now
AC_ARG_VAR(AWK, [AWK language processor]) # to make sure this doesn't happen
AC_MSG_CHECKING([that AWK works])
# 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\ if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
${srcdir}/pngusr.dfa 1>&2 ${srcdir}/pngusr.dfa 1>&2
then then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([ok])
else else
AC_MSG_FAILURE([no], 1) AC_MSG_FAILURE([failed], 1)
fi fi
# This is a remnant of the old cc -E validation, where it may have been # This is a remnant of the old cc -E validation, where it may have been
@ -92,29 +89,11 @@ fi
DFNCPP="$CPP" DFNCPP="$CPP"
AC_SUBST(DFNCPP) AC_SUBST(DFNCPP)
AC_ARG_ENABLE([tests], # -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
AS_HELP_STRING([--disable-tests], # checks the compiler with a program that generates a warning), add the
[do not build the test programs (default is to build)]), # following option to deal with this
[enable_tests="$enableval"],
[enable_tests=yes])
AM_CONDITIONAL([ENABLE_TESTS],
[test "$enable_tests" != "no"])
AC_ARG_ENABLE([tools],
AS_HELP_STRING([--disable-tools],
[do not build the auxiliary tools (default is to build)]),
[enable_tools="$enableval"],
[enable_tools=yes])
AM_CONDITIONAL([ENABLE_TOOLS],
[test "$enable_tools" != "no"])
# -Werror cannot be passed to GCC in CFLAGS because configure will fail
# (it checks the compiler with a program that generates a warning).
# Add the following option to deal with this:
AC_ARG_VAR(PNG_COPTS, AC_ARG_VAR(PNG_COPTS,
[additional flags for the C compiler, to be used for options that would] [additional flags for the C compiler, use this for options that would]
[cause configure itself to fail]) [cause configure itself to fail])
AC_ARG_ENABLE(werror, AC_ARG_ENABLE(werror,
AS_HELP_STRING([[[--enable-werror[=OPT]]]], AS_HELP_STRING([[[--enable-werror[=OPT]]]],
@ -135,10 +114,10 @@ AC_ARG_ENABLE(werror,
CFLAGS="$sav_CFLAGS" CFLAGS="$sav_CFLAGS"
fi],) fi],)
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89. # For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining # In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
# _POSIX_SOURCE to 1. This is incompatible with the new default mode, so # This is incompatible with the new default mode, so we test for that and force the
# we test for that and force the "-std=c89" compiler option: # "-std=c89" compiler option:
AC_MSG_CHECKING([if we need to force back C standard to C89]) AC_MSG_CHECKING([if we need to force back C standard to C89])
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([ [AC_LANG_PROGRAM([
@ -154,17 +133,22 @@ AC_COMPILE_IFELSE(
CFLAGS="$CFLAGS -std=c89" CFLAGS="$CFLAGS -std=c89"
]) ])
# Checks for structures and compiler characteristics. # Checks for header files.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM AC_STRUCT_TM
AC_C_RESTRICT AC_C_RESTRICT
# Checks for library functions. # Checks for library functions.
AC_CHECK_FUNCS([pow], , AC_FUNC_STRTOD
[AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])]) AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
# Some later POSIX 1003.1 functions are required for test programs, failure # Some later POSIX 1003.1 functions are required for test programs, failure here
# here is soft (the corresponding test program is not built). # is soft (the corresponding test program is not built).
AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])]) AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"]) AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
AC_ARG_WITH(zlib-prefix, AC_ARG_WITH(zlib-prefix,
@ -172,9 +156,8 @@ AC_ARG_WITH(zlib-prefix,
[prefix that may have been used in installed zlib]), [prefix that may have been used in installed zlib]),
[ZPREFIX=${withval}], [ZPREFIX=${withval}],
[ZPREFIX='z_']) [ZPREFIX='z_'])
AC_CHECK_LIB([z], [zlibVersion], , AC_CHECK_LIB(z, zlibVersion, ,
[AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], , AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
[AC_MSG_ERROR([zlib not installed])])])
# The following is for pngvalid, to ensure it catches FP errors even on # The following is for pngvalid, to ensure it catches FP errors even on
# platforms that don't enable FP exceptions, the function appears in the math # platforms that don't enable FP exceptions, the function appears in the math
@ -226,9 +209,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then if test "$have_ld_version_script" = "yes"; then
AC_MSG_CHECKING([for symbol prefix]) AC_MSG_CHECKING([for symbol prefix])
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP:-${CC:-gcc} -E} - 2>&1 \ | ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP:-grep} "^PREFIX=" \ | ${EGREP-grep} "^PREFIX=" \
| ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
AC_SUBST(SYMBOL_PREFIX) AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX) AC_MSG_RESULT($SYMBOL_PREFIX)
fi fi
@ -313,7 +296,7 @@ AC_ARG_ENABLE([unversioned-libpng-config],
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
[test "$enable_unversioned_libpng_config" != "no"]) [test "$enable_unversioned_libpng_config" != "no"])
# HOST-SPECIFIC OPTIONS # HOST SPECIFIC OPTIONS
# ===================== # =====================
# #
# DEFAULT # DEFAULT
@ -321,7 +304,7 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
# #
AC_ARG_ENABLE([hardware-optimizations], AC_ARG_ENABLE([hardware-optimizations],
AS_HELP_STRING([[[--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 [case "$enableval" in
no|off) no|off)
# disable hardware optimization on all systems: # disable hardware optimization on all systems:
@ -331,36 +314,24 @@ AC_ARG_ENABLE([hardware-optimizations],
enable_mips_msa=no enable_mips_msa=no
AC_DEFINE([PNG_MIPS_MSA_OPT], [0], AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Disable MIPS_MSA optimizations]) [Disable MIPS_MSA optimizations])
enable_mips_mmi=no
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
[Disable MIPS_MMI optimizations])
enable_powerpc_vsx=no enable_powerpc_vsx=no
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
[Disable POWERPC VSX optimizations]) [Disable POWERPC VSX optimizations])
enable_intel_sse=no enable_intel_sse=no
AC_DEFINE([PNG_INTEL_SSE_OPT], [0], AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
[Disable INTEL_SSE optimizations]) [Disable INTEL_SSE optimizations])
enable_loongarch_lsx=no
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
[Disable LOONGARCH_LSX optimizations])
enable_riscv_rvv=no
AC_DEFINE([PNG_RISCV_RVV_OPT], [0],
[Disable RISC-V Vector optimizations])
;; ;;
*) *)
# allow enabling hardware optimization on any system: # allow enabling hardware optimization on any system:
case "$host_cpu" in case "$host_cpu" in
arm*|aarch64*) arm*|aarch64*)
enable_arm_neon=yes enable_arm_neon=yes
AC_DEFINE([PNG_ARM_NEON_OPT], [2], AC_DEFINE([PNG_ARM_NEON_OPT], [0],
[Enable ARM_NEON optimizations]) [Enable ARM_NEON optimizations])
;; ;;
mipsel*|mips64el*) mipsel*|mips64el*)
enable_mips_mmi=yes
enable_mips_msa=yes enable_mips_msa=yes
AC_DEFINE([PNG_MIPS_MMI_OPT], [1], AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Enable MIPS_MMI optimizations])
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS_MSA optimizations]) [Enable MIPS_MSA optimizations])
;; ;;
i?86|x86_64) i?86|x86_64)
@ -373,30 +344,21 @@ AC_ARG_ENABLE([hardware-optimizations],
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[Enable POWERPC VSX optimizations]) [Enable POWERPC VSX optimizations])
;; ;;
loongarch*)
enable_loongarch_lsx=yes
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
[Enable LOONGARCH_LSX optimizations])
;;
riscv64)
enable_riscv_rvv=yes
AC_DEFINE([PNG_RISCV_RVV_OPT], [2],
[Enable RISC-V Vector optimizations])
;;
esac esac
;; ;;
esac]) esac])
# ARM NEON # ARM
# ======== # ===
#
# ARM NEON (SIMD) support.
AC_ARG_ENABLE([arm-neon], AC_ARG_ENABLE([arm-neon],
AS_HELP_STRING([[[--enable-arm-neon]]], AS_HELP_STRING([[[--enable-arm-neon]]],
[Enable ARM NEON optimizations: =no/off, check, api, yes/on.] [Enable ARM NEON optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations;] [no/off: disable the optimizations; check: use internal checking code]
[check: use internal checking code (deprecated and poorly supported);] [(deprecated and poorly supported); api: disable by default, enable by]
[api: disable by default, enable by a call to png_set_option;] [a call to png_set_option; yes/on: turn on unconditionally.]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
[case "$enableval" in [case "$enableval" in
no|off) no|off)
@ -404,7 +366,7 @@ AC_ARG_ENABLE([arm-neon],
AC_DEFINE([PNG_ARM_NEON_OPT], [0], AC_DEFINE([PNG_ARM_NEON_OPT], [0],
[Disable ARM Neon optimizations]) [Disable ARM Neon optimizations])
# Prevent inclusion of the assembler files below: # Prevent inclusion of the assembler files below:
enable_arm_neon=no ;; enable_arm_neon=no;;
check) check)
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [], AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
[Check for ARM Neon support at run-time]);; [Check for ARM Neon support at run-time]);;
@ -414,35 +376,35 @@ AC_ARG_ENABLE([arm-neon],
yes|on) yes|on)
AC_DEFINE([PNG_ARM_NEON_OPT], [2], AC_DEFINE([PNG_ARM_NEON_OPT], [2],
[Enable ARM Neon optimizations]) [Enable ARM Neon optimizations])
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';] AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if]
[if you want the optimizations unconditionally,] [you want the optimizations unconditionally pass -mfpu=neon]
[pass '-mfpu=neon' to the compiler.]);; [to the compiler.]);;
*) *)
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:] AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
[invalid argument])
esac]) esac])
# Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or # Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
# where ARM optimizations were explicitly requested. (This allows a fallback # where ARM optimizations were explicitly requested (this allows a fallback if a
# if a future host CPU does not match 'arm*'.) # future host CPU does not match 'arm*')
AM_CONDITIONAL([PNG_ARM_NEON], AM_CONDITIONAL([PNG_ARM_NEON],
[test "$enable_arm_neon" != 'no' && [test "$enable_arm_neon" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
arm*|aarch64*) : ;; arm*|aarch64*) :;;
*) test "$enable_arm_neon" != '' ;; *) test "$enable_arm_neon" != '';;
esac]) esac])
# MIPS MSA # MIPS
# ======== # ===
#
# MIPS MSA (SIMD) support.
AC_ARG_ENABLE([mips-msa], AC_ARG_ENABLE([mips-msa],
AS_HELP_STRING([[[--enable-mips-msa]]], AS_HELP_STRING([[[--enable-mips-msa]]],
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on.] [Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations;] [no/off: disable the optimizations; check: use internal checking code]
[check: use internal checking code (deprecated and poorly supported);] [(deprecated and poorly supported); api: disable by default, enable by]
[api: disable by default, enable by a call to png_set_option;] [a call to png_set_option; yes/on: turn on unconditionally.]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
[case "$enableval" in [case "$enableval" in
no|off) no|off)
@ -450,7 +412,7 @@ AC_ARG_ENABLE([mips-msa],
AC_DEFINE([PNG_MIPS_MSA_OPT], [0], AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Disable MIPS MSA optimizations]) [Disable MIPS MSA optimizations])
# Prevent inclusion of the assembler files below: # Prevent inclusion of the assembler files below:
enable_mips_msa=no ;; enable_mips_msa=no;;
check) check)
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [], AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
[Check for MIPS MSA support at run-time]);; [Check for MIPS MSA support at run-time]);;
@ -460,75 +422,31 @@ AC_ARG_ENABLE([mips-msa],
yes|on) yes|on)
AC_DEFINE([PNG_MIPS_MSA_OPT], [2], AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS MSA optimizations]) [Enable MIPS MSA optimizations])
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';] AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
[if you want the optimizations unconditionally,] [you want the optimizations unconditionally pass '-mmsa -mfp64']
[pass '-mmsa -mfp64' to the compiler.]);; [to the compiler.]);;
*) *)
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:] AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
[invalid argument])
esac]) esac])
# Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or # 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 # where MIPS optimizations were explicitly requested (this allows a fallback if a
# if a future host CPU does not match 'mips*'.) # future host CPU does not match 'mips*')
AM_CONDITIONAL([PNG_MIPS_MSA], AM_CONDITIONAL([PNG_MIPS_MSA],
[test "$enable_mips_msa" != 'no' && [test "$enable_mips_msa" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
mipsel*|mips64el*) : ;; mipsel*|mips64el*) :;;
esac]) esac])
# MIPS MMI # INTEL
# ======== # =====
#
AC_ARG_ENABLE([mips-mmi], # INTEL SSE (SIMD) support.
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.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __mips_mmi systems:
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
[Disable MIPS MMI optimizations])
# Prevent inclusion of the assembler files below:
enable_mips_mmi=no;;
check)
AC_DEFINE([PNG_MIPS_MMI_CHECK_SUPPORTED], [],
[Check for MIPS MMI support at run-time]);;
api)
AC_DEFINE([PNG_MIPS_MMI_API_SUPPORTED], [],
[Turn on MIPS MMI optimizations at run-time]);;
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_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*'.)
AM_CONDITIONAL([PNG_MIPS_MMI],
[test "$enable_mips_mmi" != 'no' &&
case "$host_cpu" in
mipsel*|mips64el*) : ;;
esac])
# INTEL SSE
# =========
AC_ARG_ENABLE([intel-sse], AC_ARG_ENABLE([intel-sse],
AS_HELP_STRING([[[--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;] [no/off: disable the optimizations;]
[yes/on: enable the optimizations.] [yes/on: enable the optimizations.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
@ -538,34 +456,34 @@ AC_ARG_ENABLE([intel-sse],
AC_DEFINE([PNG_INTEL_SSE_OPT], [0], AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
[Disable Intel SSE optimizations]) [Disable Intel SSE optimizations])
# Prevent inclusion of the assembler files below: # Prevent inclusion of the assembler files below:
enable_intel_sse=no ;; enable_intel_sse=no;;
yes|on) yes|on)
AC_DEFINE([PNG_INTEL_SSE_OPT], [1], AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
[Enable Intel SSE optimizations]);; [Enable Intel SSE optimizations]);;
*) *)
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:] AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
[invalid argument])
esac]) esac])
# Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or # Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
# where Intel optimizations were explicitly requested. (This allows a fallback # or where Intel optimizations were explicitly requested (this allows a
# if a future host CPU does not match 'x86*'.) # fallback if a future host CPU does not match 'x86*')
AM_CONDITIONAL([PNG_INTEL_SSE], AM_CONDITIONAL([PNG_INTEL_SSE],
[test "$enable_intel_sse" != 'no' && [test "$enable_intel_sse" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
i?86|x86_64) : ;; i?86|x86_64) :;;
*) test "$enable_intel_sse" != '' ;; *) test "$enable_intel_sse" != '';;
esac]) esac])
# POWERPC VSX # PowerPC
# =========== # ===
#
# PowerPC VSX (SIMD) support.
AC_ARG_ENABLE([powerpc-vsx], AC_ARG_ENABLE([powerpc-vsx],
AS_HELP_STRING([[[--enable-powerpc-vsx]]], AS_HELP_STRING([[[--enable-powerpc-vsx]]],
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.] [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations;] [no/off: disable the optimizations; check: use internal checking code]
[check: use internal checking code;] [api: disable by default, enable by a call to png_set_option]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.] [yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
[case "$enableval" in [case "$enableval" in
@ -573,171 +491,36 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]],
# disable the default enabling on __ppc64__ systems: # disable the default enabling on __ppc64__ systems:
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
[Disable POWERPC VSX optimizations]) [Disable POWERPC VSX optimizations])
# Prevent inclusion of the platform-specific files below: # Prevent inclusion of the platform specific files below:
enable_powerpc_vsx=no ;; enable_powerpc_vsx=no;;
check) check)
AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [], AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
[Check for POWERPC VSX support at run-time]) [Check for POWERPC VSX support at run-time])
AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README] AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file]
[for the list of supported systems.]);; [for the list of supported OSes.]);;
api) api)
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [], AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
[Turn on POWERPC VSX optimizations at run-time]);; [Turn on POWERPC VSX optimizations at run-time]);;
yes|on) yes|on)
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[Enable POWERPC VSX optimizations]) [Enable POWERPC VSX optimizations])
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';] AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if]
[if you want the optimizations unconditionally,] [you want the optimizations unconditionally pass '-maltivec -mvsx']
[pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);; [or '-mcpu=power8'to the compiler.]);;
*) *)
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:] AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value])
[invalid argument])
esac]) esac])
# Add PowerPC-specific files to all builds where $host_cpu is powerpc # Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or
# ('powerpc*') or where PowerPC optimizations were explicitly requested. # where POWERPC optimizations were explicitly requested (this allows a fallback if a
# (This allows a fallback if a future host CPU does not match 'powerpc*'.) # future host CPU does not match 'powerpc*')
AM_CONDITIONAL([PNG_POWERPC_VSX], AM_CONDITIONAL([PNG_POWERPC_VSX],
[test "$enable_powerpc_vsx" != 'no' && [test "$enable_powerpc_vsx" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
powerpc*|ppc64*) : ;; powerpc*|ppc64*) :;;
esac]) esac])
# LOONGARCH LSX
# =============
AC_ARG_ENABLE([loongarch-lsx],
AS_HELP_STRING([[[--enable-loongarch-lsx]]],
[Enable LOONGARCH LSX optimizations: =no/off, yes/on:]
[no/off: disable the optimizations;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __loongarch_simd systems:
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
[Disable LOONGARCH LSX optimizations])
# Prevent inclusion of the assembler files below:
enable_loongarch_lsx=no;;
yes|on)
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
[Enable LOONGARCH LSX optimizations])
;;
*)
AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}:]
[invalid argument])
esac])
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*'.)
AM_CONDITIONAL([PNG_LOONGARCH_LSX],
[test "$enable_loongarch_lsx" != "no" &&
test "$compiler_support_loongarch_lsx" = "yes" &&
case "$host_cpu" in
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac])
# RISC-V
# ======
#
# RISC-V Vector support.
AC_ARG_ENABLE([riscv-rvv],
AS_HELP_STRING([[[--enable-riscv-rvv]]],
[Enable RISC-V Vector 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. If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __riscv systems:
AC_DEFINE([PNG_RISCV_RVV_OPT], [0],
[Disable RISC-V Vector optimizations])
# Prevent inclusion of the platform-specific files below:
enable_riscv_rvv=no ;;
yes|on)
AC_DEFINE([PNG_RISCV_RVV_OPT], [2],
[Enable RISC-V Vector optimizations])
AC_MSG_WARN([--enable-riscv-rvv:]
[if you want the optimizations pass e.g. '-march=rv64gv1p0' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-riscv-rvv=${enable_riscv_rvv}: invalid value])
esac])
if test "$enable_riscv_rvv" != "no" &&
case "$host_cpu" in
riscv64) : ;;
*) test "$enable_riscv_rvv" != '' ;;
esac
then
compiler_support_riscv_rvv=no
AC_MSG_CHECKING(whether to use RISC-V RVV intrinsics)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <riscv_vector.h>
#include <asm/hwcap.h>
#ifndef COMPAT_HWCAP_ISA_V /* added in linux-6.5 */
#error "COMPAT_HWCAP_ISA_V is not available"
#endif
int main() {
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
uint64_t ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
vuint8m1_t a = __riscv_vreinterpret_v_u64m1_u8m1(__riscv_vle64_v_u64m1(ptr, 2));
vfloat32m1_t val = __riscv_vle32_v_f32m1((const float*)(src), 4);
return (int)__riscv_vfmv_f_s_f32m1_f32(val);
}]])],compiler_support_riscv_rvv=yes)
AC_MSG_RESULT($compiler_support_riscv_rvv)
if test "$compiler_support_riscv_rvv" = "yes"; then
AC_DEFINE([PNG_RISCV_RVV_OPT], [1],
[Enable RISCV RVV optimizations])
else
AC_MSG_WARN([Compiler does not support riscv rvv.])
fi
fi
# Add RISC-V-specific files to all builds where $host_cpu is riscv ('riscv64')
# or where RISC-V optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'riscv64')
AM_CONDITIONAL([PNG_RISCV_RVV],
[test "$enable_riscv_rvv" != "no" &&
test "$compiler_support_riscv_rvv" = "yes" &&
case "$host_cpu" in
riscv64) : ;;
*) test "$compiler_support_riscv_rvv" != '' ;;
esac])
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])

View File

@ -1,9 +0,0 @@
# https://editorconfig.org
root = false
[*.[ch]]
indent_size = unset
indent_style = unset
max_doc_length = unset
max_line_length = unset

View File

@ -1,5 +1,3 @@
External contributions to libpng
--------------------------------
This "contrib" directory contains contributions which are not necessarily under This "contrib" directory contains contributions which are not necessarily under
the libpng license, although all are open source. They are not part of the libpng license, although all are open source. They are not part of

View File

@ -2,6 +2,7 @@
* *
* Copyright (c) 2014 Glenn Randers-Pehrson * Copyright (c) 2014 Glenn Randers-Pehrson
* Written by John Bowler, 2014. * Written by John Bowler, 2014.
* Last changed in libpng 1.6.10 [March 6, 2014]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -23,7 +24,6 @@
* has been compiled only, not linked: no version of the library has been found, * has been compiled only, not linked: no version of the library has been found,
* only the header files exist in the NDK. * only the header files exist in the NDK.
*/ */
#include <cpu-features.h> #include <cpu-features.h>
static int static int

View File

@ -2,6 +2,7 @@
* *
* Copyright (c) 2014 Glenn Randers-Pehrson * Copyright (c) 2014 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011. * Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.10 [March 6, 2014]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -21,7 +22,6 @@
* This generic __linux__ implementation requires reading /proc/self/auxv and * This generic __linux__ implementation requires reading /proc/self/auxv and
* looking at each element for one that records NEON capabilities. * looking at each element for one that records NEON capabilities.
*/ */
#include <unistd.h> /* for POSIX 1003.1 */ #include <unistd.h> /* for POSIX 1003.1 */
#include <errno.h> /* for EINTR */ #include <errno.h> /* for EINTR */

View File

@ -1,5 +1,6 @@
/* contrib/arm-neon/linux.c /* contrib/arm-neon/linux.c
* *
* Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson * Copyright (c) 2014, 2017 Glenn Randers-Pehrson
* Written by John Bowler, 2014, 2017. * Written by John Bowler, 2014, 2017.
* *
@ -18,7 +19,6 @@
* This code is strict ANSI-C and is probably moderately portable; it does * This code is strict ANSI-C and is probably moderately portable; it does
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized. * however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
*/ */
#include <stdio.h> #include <stdio.h>
static int static int

View File

@ -1,133 +0,0 @@
# 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

View File

@ -1,15 +0,0 @@
# fixed.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# 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.
#
# Test the standard libpng configuration without floating point (the internal
# fixed point implementations are used instead).
#
option FLOATING_ARITHMETIC off
option FLOATING_POINT off

View File

@ -1,14 +0,0 @@
# fixed-float.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# 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.
#
# Test the standard libpng configuration with the fixed point internal
# implementation in place of the default floating point
#
option FLOATING_ARITHMETIC off

View File

@ -1,21 +0,0 @@
# nolimits.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
#
# 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 without any limits and without run-time settable limits. Turning
# USER_LIMITS off reduces libpng code size by allowing compile-time elimination
# of some checking code.
#
option USER_LIMITS off
@# define PNG_USER_WIDTH_MAX PNG_UINT_31_MAX
@# define PNG_USER_HEIGHT_MAX PNG_UINT_31_MAX
@# define PNG_USER_CHUNK_CACHE_MAX 0
@# define PNG_USER_CHUNK_MALLOC_MAX 0

View File

@ -1,19 +0,0 @@
# nolimits.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
#
# 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 without any limits. With these settigs run-time limits are still
# possible.
#
@# define PNG_USER_WIDTH_MAX PNG_UINT_31_MAX
@# define PNG_USER_HEIGHT_MAX PNG_UINT_31_MAX
@# define PNG_USER_CHUNK_CACHE_MAX 0
@# define PNG_USER_CHUNK_MALLOC_MAX 0

View File

@ -1,13 +0,0 @@
# read-full.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# 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 no write support and full read support.
#
option WRITE off

View File

@ -1,13 +0,0 @@
# write-full.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# 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 no read support and full write support.
#
option READ off

View File

@ -1,143 +0,0 @@
---
Language: Cpp
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AlignConsecutiveBitFields:
Enabled: false
AlignConsecutiveDeclarations:
Enabled: false
AlignConsecutiveMacros:
Enabled: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AlignEscapedNewlines: DontAlign
AlignOperands: false
AlignTrailingComments:
Kind: Never
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: BinPack
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: TopLevel
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakStringLiterals: false
BreakTemplateDeclarations: MultiLine
ColumnLimit: 79
ContinuationIndentWidth: 3
DerivePointerAlignment: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExportBlock: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 3
IndentWrappedFunctionNames: false
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: false
KeepFormFeed: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PackConstructorInitializers: Never
PointerAlignment: Left
QualifierAlignment: Custom
QualifierOrder: [static, inline, constexpr, const, volatile, restrict, type]
ReferenceAlignment: Pointer
ReflowComments: Never
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SortIncludes: false
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 8
UseTab: Never
WrapNamespaceBodyWithEmptyLines: Leave
...

View File

@ -1,3 +1,4 @@
This directory (contrib/examples) contains examples of libpng usage. This directory (contrib/examples) contains examples of libpng usage.
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY. NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.

View File

@ -26,9 +26,8 @@
#include <png.h> #include <png.h>
#if !defined(PNG_iCCP_SUPPORTED) || !defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) && \
#error This program requires libpng supporting the iCCP chunk and the read API defined (PNG_iCCP_SUPPORTED)
#endif
static int verbose = 1; static int verbose = 1;
@ -37,8 +36,7 @@ static png_byte no_profile[] = "no profile";
static png_bytep static png_bytep
extract(FILE *fp, png_uint_32 *proflen) extract(FILE *fp, png_uint_32 *proflen)
{ {
png_structp png_ptr = png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info_ptr = NULL; png_infop info_ptr = NULL;
png_bytep result = NULL; png_bytep result = NULL;
@ -71,7 +69,7 @@ extract(FILE *fp, png_uint_32 *proflen)
png_bytep profile; png_bytep profile;
if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile, if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile,
proflen) & PNG_INFO_iCCP) proflen) & PNG_INFO_iCCP)
{ {
result = malloc(*proflen); result = malloc(*proflen);
if (result != NULL) if (result != NULL)
@ -82,7 +80,7 @@ extract(FILE *fp, png_uint_32 *proflen)
} }
else else
result = no_profile; result = no_profile;
} }
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@ -109,7 +107,7 @@ extract_one_file(const char *filename)
const char *ep = strrchr(filename, '.'); const char *ep = strrchr(filename, '.');
if (ep != NULL) if (ep != NULL)
len = ep - filename; len = ep-filename;
else else
len = strlen(filename); len = strlen(filename);
@ -121,14 +119,14 @@ extract_one_file(const char *filename)
FILE *of; FILE *of;
memcpy(output, filename, len); memcpy(output, filename, len);
strcpy(output + len, ".icc"); strcpy(output+len, ".icc");
of = fopen(output, "wb"); of = fopen(output, "wb");
if (of != NULL) if (of != NULL)
{ {
if (fwrite(profile, proflen, 1, of) == 1 && if (fwrite(profile, proflen, 1, of) == 1 &&
fflush(of) == 0 && fflush(of) == 0 &&
fclose(of) == 0) fclose(of) == 0)
{ {
if (verbose) if (verbose)
printf("%s -> %s\n", filename, output); printf("%s -> %s\n", filename, output);
@ -157,15 +155,12 @@ extract_one_file(const char *filename)
} }
else if (verbose && profile == no_profile) else if (verbose && profile == no_profile)
printf("%s has no profile\n", filename); printf("%s has no profile\n", filename);
} }
else else
fprintf(stderr, "%s: could not open file\n", filename); fprintf(stderr, "%s: could not open file\n", filename);
if (fp != NULL)
fclose(fp);
return result; return result;
} }
@ -175,7 +170,7 @@ main(int argc, char **argv)
int i; int i;
int extracted = 0; int extracted = 0;
for (i = 1; i < argc; ++i) for (i=1; i<argc; ++i)
{ {
if (strcmp(argv[i], "-q") == 0) if (strcmp(argv[i], "-q") == 0)
verbose = 0; verbose = 0;
@ -187,3 +182,4 @@ main(int argc, char **argv)
/* Exit code is true if any extract succeeds */ /* Exit code is true if any extract succeeds */
return extracted == 0; return extracted == 0;
} }
#endif /* READ && STDIO && iCCP */

View File

@ -15,8 +15,8 @@
* images. Normally you would call png_set_interlace_handling() to have libpng * images. Normally you would call png_set_interlace_handling() to have libpng
* deal with the interlace for you, but that obliges you to buffer half of the * deal with the interlace for you, but that obliges you to buffer half of the
* image to assemble the interlaced rows. In this code * image to assemble the interlaced rows. In this code
* png_set_interlace_handling() is not called and, instead, the code handles * png_set_interlace_handling() is not called and, instead, the code handles the
* the interlace passes directly looking for the required pixel. * interlace passes directly looking for the required pixel.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -27,37 +27,34 @@
*/ */
#include "../../png.h" #include "../../png.h"
#if !defined(PNG_READ_SUPPORTED) || !defined(PNG_SEQUENTIAL_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)
#error This program requires libpng supporting the read and sequential read API
#endif
/* Return component 'c' of pixel 'x' from the given row. */ /* Return component 'c' of pixel 'x' from the given row. */
static unsigned int static unsigned int
component(png_const_bytep row, png_uint_32 x, unsigned int c, component(png_const_bytep row, png_uint_32 x, unsigned int c,
unsigned int bit_depth, unsigned int channels) unsigned int bit_depth, unsigned int channels)
{ {
/* PNG images can be up to 2^31 pixels wide, which means they can be up to /* PNG images can be up to 2^31 pixels wide, but this means they can be up to
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence * 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence 2^34
* 2^34 bytes wide. Since the row fitted into memory, the following must * bytes wide. Since the row fitted into memory, however, the following must
* work: * work:
*/ */
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels); png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c); png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
row = (png_const_bytep)(((const png_byte(*)[8])row) + bit_offset_hi); row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
row += bit_offset_lo >> 3; row += bit_offset_lo >> 3;
bit_offset_lo &= 0x07; bit_offset_lo &= 0x07;
/* PNG pixels are packed into bytes to put the first pixel in the highest /* PNG pixels are packed into bytes to put the first pixel in the highest
* bits of the byte, and into two bytes for 16-bit values with the high * bits of the byte and into two bytes for 16-bit values with the high 8 bits
* 8 bits first, so: * first, so:
*/ */
switch (bit_depth) switch (bit_depth)
{ {
case 1: return (row[0] >> (7 - bit_offset_lo)) & 0x01; case 1: return (row[0] >> (7-bit_offset_lo)) & 0x01;
case 2: return (row[0] >> (6 - bit_offset_lo)) & 0x03; case 2: return (row[0] >> (6-bit_offset_lo)) & 0x03;
case 4: return (row[0] >> (4 - bit_offset_lo)) & 0x0f; case 4: return (row[0] >> (4-bit_offset_lo)) & 0x0f;
case 8: return row[0]; case 8: return row[0];
case 16: return (row[0] << 8) + row[1]; case 16: return (row[0] << 8) + row[1];
default: default:
@ -74,7 +71,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
*/ */
static void static void
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row, print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
png_uint_32 x) png_uint_32 x)
{ {
unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr); unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
@ -95,24 +92,22 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
int num_palette = 0; int num_palette = 0;
if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) & if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) &
PNG_INFO_PLTE) && PNG_INFO_PLTE) && num_palette > 0 && palette != NULL)
(num_palette > 0) &&
(palette != NULL))
{ {
png_bytep trans_alpha = NULL; png_bytep trans_alpha = NULL;
int num_trans = 0; int num_trans = 0;
if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans,
NULL) & PNG_INFO_tRNS) && NULL) & PNG_INFO_tRNS) && num_trans > 0 &&
(num_trans > 0) && trans_alpha != NULL)
(trans_alpha != NULL))
printf("INDEXED %u = %d %d %d %d\n", index, printf("INDEXED %u = %d %d %d %d\n", index,
palette[index].red, palette[index].green, palette[index].red, palette[index].green,
palette[index].blue, palette[index].blue,
index < num_trans ? trans_alpha[index] : 255); index < num_trans ? trans_alpha[index] : 255);
else /* no transparency */ else /* no transparency */
printf("INDEXED %u = %d %d %d\n", index, palette[index].red, printf("INDEXED %u = %d %d %d\n", index,
palette[index].green, palette[index].blue); palette[index].red, palette[index].green,
palette[index].blue);
} }
else else
@ -122,20 +117,20 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_RGB:
printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3), printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3),
component(row, x, 1, bit_depth, 3), component(row, x, 1, bit_depth, 3),
component(row, x, 2, bit_depth, 3)); component(row, x, 2, bit_depth, 3));
return; return;
case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_GRAY_ALPHA:
printf("GRAY+ALPHA %u %u\n", component(row, x, 0, bit_depth, 2), printf("GRAY+ALPHA %u %u\n", component(row, x, 0, bit_depth, 2),
component(row, x, 1, bit_depth, 2)); component(row, x, 1, bit_depth, 2));
return; return;
case PNG_COLOR_TYPE_RGB_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA:
printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4), printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4),
component(row, x, 1, bit_depth, 4), component(row, x, 1, bit_depth, 4),
component(row, x, 2, bit_depth, 4), component(row, x, 2, bit_depth, 4),
component(row, x, 3, bit_depth, 4)); component(row, x, 3, bit_depth, 4));
return; return;
default: default:
@ -143,8 +138,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
} }
} }
int int main(int argc, const char **argv)
main(int argc, const char **argv)
{ {
/* This program uses the default, <setjmp.h> based, libpng error handling /* This program uses the default, <setjmp.h> based, libpng error handling
* mechanism, therefore any local variable that exists before the call to * mechanism, therefore any local variable that exists before the call to
@ -152,7 +146,7 @@ main(int argc, const char **argv)
* be declared with 'volatile' to ensure that their values don't get * be declared with 'volatile' to ensure that their values don't get
* destroyed by longjmp: * destroyed by longjmp:
*/ */
volatile int result = 1 /*fail*/; volatile int result = 1/*fail*/;
if (argc == 4) if (argc == 4)
{ {
@ -169,8 +163,8 @@ main(int argc, const char **argv)
* writes error messages to stderr. Creating the png_struct is a * writes error messages to stderr. Creating the png_struct is a
* little tricky; just copy the following code. * little tricky; just copy the following code.
*/ */
png_structp png_ptr = png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); NULL, NULL, NULL);
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -190,11 +184,11 @@ main(int argc, const char **argv)
compression_method, filter_method; compression_method, filter_method;
png_bytep row_tmp; png_bytep row_tmp;
/* Now associate the recently opened FILE object with the /* Now associate the recently opened (FILE*) with the default
* default libpng initialization functions. Sometimes libpng * libpng initialization functions. Sometimes libpng is
* is compiled without stdio support (it can be difficult to * compiled without stdio support (it can be difficult to do
* do in some environments); in that case you will have to * in some environments); in that case you will have to write
* write your own read callback to read data from the stream. * your own read callback to read data from the (FILE*).
*/ */
png_init_io(png_ptr, f); png_init_io(png_ptr, f);
@ -208,21 +202,21 @@ main(int argc, const char **argv)
* space. In this case png_malloc is used - it will not * space. In this case png_malloc is used - it will not
* return if memory isn't available. * return if memory isn't available.
*/ */
row = row = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); info_ptr));
/* Avoid the overhead of using a volatile auto copy row_tmp /* To avoid the overhead of using a volatile auto copy row_tmp
* to a local here - just use row for the png_free below. * to a local here - just use row for the png_free below.
*/ */
row_tmp = row; row_tmp = row;
/* All the information we need is in the header returned by /* All the information we need is in the header is returned by
* png_get_IHDR. If this fails, we can use 'png_error' to * png_get_IHDR, if this fails we can now use 'png_error' to
* signal the error and return control to the setjmp above. * signal the error and return control to the setjmp above.
*/ */
if (png_get_IHDR(png_ptr, info_ptr, &width, &height, if (png_get_IHDR(png_ptr, info_ptr, &width, &height,
&bit_depth, &color_type, &interlace_method, &bit_depth, &color_type, &interlace_method,
&compression_method, &filter_method)) &compression_method, &filter_method))
{ {
int passes, pass; int passes, pass;
@ -248,7 +242,7 @@ main(int argc, const char **argv)
/* Now read the pixels, pass-by-pass, row-by-row: */ /* Now read the pixels, pass-by-pass, row-by-row: */
png_start_read_image(png_ptr); png_start_read_image(png_ptr);
for (pass = 0; pass < passes; ++pass) for (pass=0; pass<passes; ++pass)
{ {
png_uint_32 ystart, xstart, ystep, xstep; png_uint_32 ystart, xstart, ystep, xstep;
png_uint_32 py; png_uint_32 py;
@ -305,27 +299,19 @@ main(int argc, const char **argv)
* are, of course, much better ways of doing this * are, of course, much better ways of doing this
* than using a for loop: * than using a for loop:
*/ */
if (y == py) if (y == py) for (px = xstart, ppx = 0;
px < width; px += xstep, ++ppx) if (x == px)
{ {
for (px = xstart, ppx = 0; /* 'ppx' is the index of the pixel in the row
px < width; * buffer.
px += xstep, ++ppx) */
{ print_pixel(png_ptr, info_ptr, row_tmp, ppx);
if (x == px)
{
/* 'ppx' is the index of the pixel in the
* row buffer.
*/
print_pixel(png_ptr, info_ptr, row_tmp,
ppx);
/* Now terminate the loops early - we have /* Now terminate the loops early - we have
* found and handled the required data. * found and handled the required data.
*/ */
goto pass_loop_end; goto pass_loop_end;
} /* x loop */ } /* x loop */
}
}
} /* y loop */ } /* y loop */
} /* pass loop */ } /* pass loop */
@ -337,6 +323,7 @@ main(int argc, const char **argv)
else else
png_error(png_ptr, "pngpixel: png_get_IHDR failed"); png_error(png_ptr, "pngpixel: png_get_IHDR failed");
} }
else else
@ -362,8 +349,7 @@ main(int argc, const char **argv)
} }
else else
fprintf(stderr, fprintf(stderr, "pngpixel: out of memory allocating png_info\n");
"pngpixel: out of memory allocating png_info\n");
png_destroy_read_struct(&png_ptr, NULL, NULL); png_destroy_read_struct(&png_ptr, NULL, NULL);
} }
@ -382,3 +368,4 @@ main(int argc, const char **argv)
return result; return result;
} }
#endif /* READ && SEQUENTIAL_READ */

View File

@ -5,11 +5,13 @@
* related or neighboring rights to this work. This work is published from: * related or neighboring rights to this work. This work is published from:
* United States. * United States.
* *
* Last changed in libpng 1.6.29 [March 16, 2017]
*
* Read a PNG and write it out in a fixed format, using the 'simplified API' * Read a PNG and write it out in a fixed format, using the 'simplified API'
* that was introduced in libpng-1.6.0. * that was introduced in libpng-1.6.0.
* *
* This sample code is just the code from 'example.c' with some error handling * This sample code is just the code from the top of 'example.c' with some error
* added. See example.c in the top-level libpng directory for more comments. * handling added. See example.c for more comments.
*/ */
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
@ -20,15 +22,10 @@
* ensure the code picks up the local libpng implementation: * ensure the code picks up the local libpng implementation:
*/ */
#include "../../png.h" #include "../../png.h"
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) && \
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
#if !defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \ int main(int argc, const char **argv)
!defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
#error This program requires libpng supporting the simplified read/write API
#endif
int
main(int argc, const char **argv)
{ {
int result = 1; int result = 1;
@ -53,22 +50,22 @@ main(int argc, const char **argv)
if (buffer != NULL) if (buffer != NULL)
{ {
if (png_image_finish_read(&image, NULL /*background*/, buffer, if (png_image_finish_read(&image, NULL/*background*/, buffer,
0 /*row_stride*/, NULL /*colormap */)) 0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))
{ {
if (png_image_write_to_file( if (png_image_write_to_file(&image, argv[2],
&image, argv[2], 0 /*convert_to_8bit*/, buffer, 0/*convert_to_8bit*/, buffer, 0/*row_stride*/,
0 /*row_stride*/, NULL /*colormap*/)) NULL/*colormap*/))
result = 0; result = 0;
else else
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2], fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
image.message); image.message);
} }
else else
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1], fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
image.message); image.message);
free(buffer); free(buffer);
} }
@ -76,7 +73,7 @@ main(int argc, const char **argv)
else else
{ {
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n", fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image)); (unsigned long)PNG_IMAGE_SIZE(image));
/* This is the only place where a 'free' is required; libpng does /* This is the only place where a 'free' is required; libpng does
* the cleanup on error and success, but in this case we couldn't * the cleanup on error and success, but in this case we couldn't
@ -98,3 +95,4 @@ main(int argc, const char **argv)
return result; return result;
} }
#endif /* READ && WRITE */

View File

@ -6,9 +6,9 @@
* United States. * United States.
* *
* Read several PNG files, which should have an alpha channel or transparency * Read several PNG files, which should have an alpha channel or transparency
* information, and composite them together to produce one or more 16-bit * information, and composite them together to produce one or more 16-bit linear
* linear RGBA intermediates. This involves doing the 'over' compositing * RGBA intermediates. This involves doing the correct 'over' composition to
* operation to combine the alpha channels and corresponding data. * combine the alpha channels and corresponding data.
* *
* Finally read an output (background) PNG using the 24-bit RGB format (the * Finally read an output (background) PNG using the 24-bit RGB format (the
* PNG will be composited on green (#00ff00) by default if it has an alpha * PNG will be composited on green (#00ff00) by default if it has an alpha
@ -28,8 +28,8 @@
* correctly. Apart from the libpng Simplified API the only work done in here * correctly. Apart from the libpng Simplified API the only work done in here
* is to combine multiple input PNG images into a single sprite; this involves * is to combine multiple input PNG images into a single sprite; this involves
* a Porter-Duff 'over' operation and the input PNG images may, as a result, * a Porter-Duff 'over' operation and the input PNG images may, as a result,
* be regarded as being layered one on top of the other with the first * be regarded as being layered one on top of the other with the first (leftmost
* (leftmost on the command line) being at the bottom and the last on the top. * on the command line) being at the bottom and the last on the top.
*/ */
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
@ -44,61 +44,54 @@
*/ */
#include "../../png.h" #include "../../png.h"
#if !defined(PNG_SIMPLIFIED_READ_SUPPORTED) #ifdef PNG_SIMPLIFIED_READ_SUPPORTED
#error This program requires libpng supporting the simplified read API
#endif
#define sprite_name_chars 15 #define sprite_name_chars 15
struct sprite struct sprite {
{ FILE *file;
FILE *file; png_uint_16p buffer;
png_uint_16p buffer; unsigned int width;
unsigned int width; unsigned int height;
unsigned int height; char name[sprite_name_chars+1];
char name[sprite_name_chars + 1];
}; };
#if 0 /* div by 65535 test program */ #if 0 /* div by 65535 test program */
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
int int main(void) {
main(void)
{
double err = 0; double err = 0;
unsigned int xerr = 0; unsigned int xerr = 0;
unsigned int r = 32769; unsigned int r = 32769;
unsigned int x = 0;
do
{ {
unsigned int t = x + (x >> 16) /*+ (x >> 31)*/ + r; unsigned int x = 0;
double v = x, errtest;
if (t < x) do {
{ unsigned int t = x + (x >> 16) /*+ (x >> 31)*/ + r;
fprintf(stderr, "overflow: %u+%u -> %u\n", x, r, t); double v = x, errtest;
return 1;
}
v /= 65535; if (t < x) {
errtest = v; fprintf(stderr, "overflow: %u+%u -> %u\n", x, r, t);
t >>= 16; return 1;
errtest -= t;
if (errtest > err)
{
err = errtest;
xerr = x;
if (errtest >= .5)
{
fprintf(stderr, "error: %u/65535 = %f, not %u, error %f\n",
x, v, t, errtest);
return 0;
} }
}
} while (++x <= 65535U * 65535U); v /= 65535;
errtest = v;
t >>= 16;
errtest -= t;
if (errtest > err) {
err = errtest;
xerr = x;
if (errtest >= .5) {
fprintf(stderr, "error: %u/65535 = %f, not %u, error %f\n",
x, v, t, errtest);
return 0;
}
}
} while (++x <= 65535U*65535U);
}
printf("error %f @ %u\n", err, xerr); printf("error %f @ %u\n", err, xerr);
@ -108,7 +101,7 @@ main(void)
static void static void
sprite_op(const struct sprite *sprite, int x_offset, int y_offset, sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
png_imagep image, const png_uint_16 *buffer) png_imagep image, const png_uint_16 *buffer)
{ {
/* This is where the Porter-Duff 'Over' operator is evaluated; change this /* This is where the Porter-Duff 'Over' operator is evaluated; change this
* code to change the operator (this could be parameterized). Any other * code to change the operator (this could be parameterized). Any other
@ -119,8 +112,8 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
/* Check for an x or y offset that pushes any part of the image beyond the /* Check for an x or y offset that pushes any part of the image beyond the
* right or bottom of the sprite: * right or bottom of the sprite:
*/ */
if ((y_offset < 0 || /*SAFE*/ (unsigned)y_offset < sprite->height) && if ((y_offset < 0 || (unsigned)/*SAFE*/y_offset < sprite->height) &&
(x_offset < 0 || /*SAFE*/ (unsigned)x_offset < sprite->width)) (x_offset < 0 || (unsigned)/*SAFE*/x_offset < sprite->width))
{ {
unsigned int y = 0; unsigned int y = 0;
@ -137,7 +130,7 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
do do
{ {
/* In and out are RGBA values, so: */ /* In and out are RGBA values, so: */
const png_uint_16 *in_pixel = buffer + (y * image->width + x) * 4; const png_uint_16 *in_pixel = buffer + (y * image->width + x)*4;
png_uint_32 in_alpha = in_pixel[3]; png_uint_32 in_alpha = in_pixel[3];
/* This is the optimized Porter-Duff 'Over' operation, when the /* This is the optimized Porter-Duff 'Over' operation, when the
@ -146,10 +139,10 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
if (in_alpha > 0) if (in_alpha > 0)
{ {
png_uint_16 *out_pixel = sprite->buffer + png_uint_16 *out_pixel = sprite->buffer +
((y + y_offset) * sprite->width + (x + x_offset)) * 4; ((y+y_offset) * sprite->width + (x+x_offset))*4;
/* This is the weight to apply to the output: */ /* This is the weight to apply to the output: */
in_alpha = 65535 - in_alpha; in_alpha = 65535-in_alpha;
if (in_alpha > 0) if (in_alpha > 0)
{ {
@ -166,9 +159,9 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
*/ */
png_uint_32 tmp; png_uint_32 tmp;
# define compose(c) \ # define compose(c)\
tmp = out_pixel[c] * in_alpha; \ tmp = out_pixel[c] * in_alpha;\
tmp = (tmp + (tmp >> 16) + 32769) >> 16; \ tmp = (tmp + (tmp >> 16) + 32769) >> 16;\
out_pixel[c] = tmp + in_pixel[c] out_pixel[c] = tmp + in_pixel[c]
/* The following is very vectorizable... */ /* The following is very vectorizable... */
@ -179,15 +172,15 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
} }
else else
{ out_pixel[0] = in_pixel[0],
out_pixel[0] = in_pixel[0]; out_pixel[1] = in_pixel[1],
out_pixel[1] = in_pixel[1]; out_pixel[2] = in_pixel[2],
out_pixel[2] = in_pixel[2];
out_pixel[3] = in_pixel[3]; out_pixel[3] = in_pixel[3];
}
} }
} while (++x < image->width); }
} while (++y < image->height); while (++x < image->width);
}
while (++y < image->height);
} }
} }
@ -231,8 +224,9 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
if (buffer != NULL) if (buffer != NULL)
{ {
if (png_image_finish_read(&image, NULL /*background*/, buffer, if (png_image_finish_read(&image, NULL/*background*/, buffer,
0 /*row_stride*/, NULL /*colormap*/)) 0/*row_stride*/,
NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP*/))
{ {
/* This is the place where the Porter-Duff 'Over' operator /* This is the place where the Porter-Duff 'Over' operator
* needs to be done by this code. In fact, any image * needs to be done by this code. In fact, any image
@ -251,14 +245,14 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
{ {
free(buffer); free(buffer);
fprintf(stderr, "simpleover: read %s: %s\n", (*argv)[0], fprintf(stderr, "simpleover: read %s: %s\n", (*argv)[0],
image.message); image.message);
} }
} }
else else
{ {
fprintf(stderr, "simpleover: out of memory: %lu bytes\n", fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image)); (unsigned long)PNG_IMAGE_SIZE(image));
/* png_image_free must be called if we abort the Simplified API /* png_image_free must be called if we abort the Simplified API
* read because of a problem detected in this code. If problems * read because of a problem detected in this code. If problems
@ -296,9 +290,8 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
save.flags = PNG_IMAGE_FLAG_FAST; save.flags = PNG_IMAGE_FLAG_FAST;
save.colormap_entries = 0; save.colormap_entries = 0;
if (png_image_write_to_stdio(&save, sprite->file, 1 /*convert_to_8_bit*/, if (png_image_write_to_stdio(&save, sprite->file, 1/*convert_to_8_bit*/,
sprite->buffer, 0 /*row_stride*/, sprite->buffer, 0/*row_stride*/, NULL/*colormap*/))
NULL /*colormap*/))
{ {
/* Success; the buffer is no longer needed: */ /* Success; the buffer is no longer needed: */
free(sprite->buffer); free(sprite->buffer);
@ -308,20 +301,19 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
else else
fprintf(stderr, "simpleover: write sprite %s: %s\n", sprite->name, fprintf(stderr, "simpleover: write sprite %s: %s\n", sprite->name,
save.message); save.message);
} }
else else
fprintf(stderr, fprintf(stderr, "simpleover: sprite %s: could not allocate tmpfile: %s\n",
"simpleover: sprite %s: could not allocate tmpfile: %s\n", sprite->name, strerror(errno));
sprite->name, strerror(errno));
return 0; /* fail */ return 0; /* fail */
} }
static int static int
add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite, add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
int *argc, const char ***argv) int *argc, const char ***argv)
{ {
/* Given a --add argument naming this sprite, perform the operations listed /* Given a --add argument naming this sprite, perform the operations listed
* in the following arguments. The arguments are expected to have the form * in the following arguments. The arguments are expected to have the form
@ -342,13 +334,13 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
* will fit. * will fit.
*/ */
if (x < 0 || y < 0 || if (x < 0 || y < 0 ||
/*SAFE*/ (unsigned)x >= output->width || (unsigned)/*SAFE*/x >= output->width ||
/*SAFE*/ (unsigned)y >= output->height || (unsigned)/*SAFE*/y >= output->height ||
sprite->width > output->width - x || sprite->width > output->width-x ||
sprite->height > output->height - y) sprite->height > output->height-y)
{ {
fprintf(stderr, "simpleover: sprite %s @ (%d,%d) outside image\n", fprintf(stderr, "simpleover: sprite %s @ (%d,%d) outside image\n",
sprite->name, x, y); sprite->name, x, y);
/* Could just skip this, but for the moment it is an error */ /* Could just skip this, but for the moment it is an error */
return 0; /* error */ return 0; /* error */
} }
@ -367,10 +359,10 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
{ {
in.format = PNG_FORMAT_RGB; /* force compose */ in.format = PNG_FORMAT_RGB; /* force compose */
if (png_image_finish_read( if (png_image_finish_read(&in, NULL/*background*/,
&in, NULL /*background*/, out_buf + (y*output->width + x)*3/*RGB*/,
out_buf + (y * output->width + x) * 3 /*RGB*/, output->width*3/*row_stride*/,
output->width * 3 /*row_stride*/, NULL /*colormap*/)) NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP*/))
{ {
++*argv, --*argc; ++*argv, --*argc;
continue; continue;
@ -379,7 +371,7 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
/* The read failed: */ /* The read failed: */
fprintf(stderr, "simpleover: add sprite %s: %s\n", sprite->name, fprintf(stderr, "simpleover: add sprite %s: %s\n", sprite->name,
in.message); in.message);
return 0; /* error */ return 0; /* error */
} }
} }
@ -387,7 +379,7 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
else else
{ {
fprintf(stderr, "simpleover: --add='%s': invalid position %s\n", fprintf(stderr, "simpleover: --add='%s': invalid position %s\n",
sprite->name, (*argv)[0]); sprite->name, (*argv)[0]);
return 0; /* error */ return 0; /* error */
} }
} }
@ -397,10 +389,10 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
static int static int
simpleover_process(png_imagep output, png_bytep out_buf, int argc, simpleover_process(png_imagep output, png_bytep out_buf, int argc,
const char **argv) const char **argv)
{ {
int result = 1; /* success */ int result = 1; /* success */
# define csprites 10 /*limit*/ # define csprites 10/*limit*/
# define str(a) #a # define str(a) #a
int nsprites = 0; int nsprites = 0;
struct sprite sprites[csprites]; struct sprite sprites[csprites];
@ -420,25 +412,23 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
sprites[nsprites].width = sprites[nsprites].height = 0; sprites[nsprites].width = sprites[nsprites].height = 0;
sprites[nsprites].name[0] = 0; sprites[nsprites].name[0] = 0;
n = sscanf(argv[0], n = sscanf(argv[0], "--sprite=%u,%u,%" str(sprite_name_chars) "s%c",
"--sprite=%u,%u,%" str(sprite_name_chars) "s%c", &sprites[nsprites].width, &sprites[nsprites].height,
&sprites[nsprites].width, &sprites[nsprites].height, sprites[nsprites].name, &tombstone);
sprites[nsprites].name, &tombstone);
if ((n == 2 || n == 3) && if ((n == 2 || n == 3) &&
(sprites[nsprites].width > 0) && sprites[nsprites].width > 0 && sprites[nsprites].height > 0)
(sprites[nsprites].height > 0))
{ {
size_t buf_size, tmp; size_t buf_size, tmp;
/* Default a name if not given. */ /* Default a name if not given. */
if (sprites[nsprites].name[0] == 0) if (sprites[nsprites].name[0] == 0)
sprintf(sprites[nsprites].name, "sprite-%d", nsprites + 1); sprintf(sprites[nsprites].name, "sprite-%d", nsprites+1);
/* Allocate a buffer for the sprite and calculate the buffer /* Allocate a buffer for the sprite and calculate the buffer
* size: * size:
*/ */
buf_size = sizeof(png_uint_16[4]); buf_size = sizeof (png_uint_16 [4]);
buf_size *= sprites[nsprites].width; buf_size *= sprites[nsprites].width;
buf_size *= sprites[nsprites].height; buf_size *= sprites[nsprites].height;
@ -447,7 +437,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
tmp /= sprites[nsprites].width; tmp /= sprites[nsprites].width;
tmp /= sprites[nsprites].height; tmp /= sprites[nsprites].height;
if (tmp == sizeof(png_uint_16[4])) if (tmp == sizeof (png_uint_16 [4]))
{ {
sprites[nsprites].buffer = malloc(buf_size); sprites[nsprites].buffer = malloc(buf_size);
/* This buffer must be initialized to transparent: */ /* This buffer must be initialized to transparent: */
@ -458,7 +448,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
sprites[nsprites].file = NULL; sprites[nsprites].file = NULL;
++argv, --argc; ++argv, --argc;
if (create_sprite(sprites + nsprites++, &argc, &argv)) if (create_sprite(sprites+nsprites++, &argc, &argv))
{ {
result = 1; /* still ok */ result = 1; /* still ok */
continue; continue;
@ -476,8 +466,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
else else
{ {
fprintf(stderr, "simpleover: %s: invalid sprite (%u,%u)\n", fprintf(stderr, "simpleover: %s: invalid sprite (%u,%u)\n",
argv[0], argv[0], sprites[nsprites].width, sprites[nsprites].height);
sprites[nsprites].width, sprites[nsprites].height);
break; break;
} }
} }
@ -491,7 +480,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
else if (strncmp(argv[0], "--add=", 6) == 0) else if (strncmp(argv[0], "--add=", 6) == 0)
{ {
const char *name = argv[0] + 6; const char *name = argv[0]+6;
int isprite = nsprites; int isprite = nsprites;
++argv, --argc; ++argv, --argc;
@ -500,8 +489,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
{ {
if (strcmp(sprites[isprite].name, name) == 0) if (strcmp(sprites[isprite].name, name) == 0)
{ {
if (!add_sprite(output, out_buf, sprites + isprite, if (!add_sprite(output, out_buf, sprites+isprite, &argc, &argv))
&argc, &argv))
goto out; /* error in add_sprite */ goto out; /* error in add_sprite */
break; break;
@ -510,8 +498,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
if (isprite < 0) /* sprite not found */ if (isprite < 0) /* sprite not found */
{ {
fprintf(stderr, "simpleover: --add='%s': sprite not found\n", fprintf(stderr, "simpleover: --add='%s': sprite not found\n", name);
name);
break; break;
} }
} }
@ -539,8 +526,7 @@ out:
return result; return result;
} }
int int main(int argc, const char **argv)
main(int argc, const char **argv)
{ {
int result = 1; /* default to fail */ int result = 1; /* default to fail */
@ -550,7 +536,7 @@ main(int argc, const char **argv)
const char *output = NULL; const char *output = NULL;
png_image image; png_image image;
if (argc > 2 && argv[2][0] != '-' /*an operation*/) if (argc > 2 && argv[2][0] != '-'/*an operation*/)
{ {
output = argv[2]; output = argv[2];
argi = 3; argi = 3;
@ -572,7 +558,7 @@ main(int argc, const char **argv)
png_color background = {0, 0xff, 0}; /* fully saturated green */ png_color background = {0, 0xff, 0}; /* fully saturated green */
if (png_image_finish_read(&image, &background, buffer, if (png_image_finish_read(&image, &background, buffer,
0 /*row_stride*/, NULL /*colormap*/)) 0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))
{ {
/* At this point png_image_finish_read has cleaned up the /* At this point png_image_finish_read has cleaned up the
* allocated data in png_image, and only the buffer needs to be * allocated data in png_image, and only the buffer needs to be
@ -580,24 +566,22 @@ main(int argc, const char **argv)
* *
* Perform the remaining operations: * Perform the remaining operations:
*/ */
if (simpleover_process(&image, buffer, if (simpleover_process(&image, buffer, argc-argi, argv+argi))
argc - argi, argv + argi))
{ {
/* Write the output: */ /* Write the output: */
if ((output != NULL && if ((output != NULL &&
png_image_write_to_file( png_image_write_to_file(&image, output,
&image, output, 0 /*convert_to_8bit*/, buffer, 0/*convert_to_8bit*/, buffer, 0/*row_stride*/,
0 /*row_stride*/, NULL /*colormap*/)) || NULL/*colormap*/)) ||
(output == NULL && (output == NULL &&
png_image_write_to_stdio( png_image_write_to_stdio(&image, stdout,
&image, stdout, 0 /*convert_to_8bit*/, buffer, 0/*convert_to_8bit*/, buffer, 0/*row_stride*/,
0 /*row_stride*/, NULL /*colormap*/))) NULL/*colormap*/)))
result = 0; result = 0;
else else
fprintf(stderr, "simpleover: write %s: %s\n", fprintf(stderr, "simpleover: write %s: %s\n",
output == NULL ? "stdout" : output, output == NULL ? "stdout" : output, image.message);
image.message);
} }
/* else simpleover_process writes an error message */ /* else simpleover_process writes an error message */
@ -605,7 +589,7 @@ main(int argc, const char **argv)
else else
fprintf(stderr, "simpleover: read %s: %s\n", argv[1], fprintf(stderr, "simpleover: read %s: %s\n", argv[1],
image.message); image.message);
free(buffer); free(buffer);
} }
@ -613,7 +597,7 @@ main(int argc, const char **argv)
else else
{ {
fprintf(stderr, "simpleover: out of memory: %lu bytes\n", fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image)); (unsigned long)PNG_IMAGE_SIZE(image));
/* This is the only place where a 'free' is required; libpng does /* This is the only place where a 'free' is required; libpng does
* the cleanup on error and success, but in this case we couldn't * the cleanup on error and success, but in this case we couldn't
@ -633,8 +617,7 @@ main(int argc, const char **argv)
else else
{ {
/* Usage message */ /* Usage message */
fprintf( fprintf(stderr,
stderr,
"simpleover: usage: simpleover background.png [output.png]\n" "simpleover: usage: simpleover background.png [output.png]\n"
" Output 'background.png' as a 24-bit RGB PNG file in 'output.png'\n" " Output 'background.png' as a 24-bit RGB PNG file in 'output.png'\n"
" or, if not given, stdout. 'background.png' will be composited\n" " or, if not given, stdout. 'background.png' will be composited\n"
@ -645,13 +628,13 @@ main(int argc, const char **argv)
" --sprite=width,height,name {[--at=x,y] {sprite.png}}\n" " --sprite=width,height,name {[--at=x,y] {sprite.png}}\n"
" Produce a transparent sprite of size (width,height) and with\n" " Produce a transparent sprite of size (width,height) and with\n"
" name 'name'.\n" " name 'name'.\n"
" For each sprite.png composite it is using a Porter-Duff 'Over'\n" " For each sprite.png composite it using a Porter-Duff 'Over'\n"
" operation at offset (x,y) in the sprite, defaulting to (0,0).\n" " operation at offset (x,y) in the sprite (defaulting to (0,0)).\n"
" Input PNGs will be truncated to the area of the sprite.\n" " Input PNGs will be truncated to the area of the sprite.\n"
"\n" "\n"
" --add='name' {x,y}\n" " --add='name' {x,y}\n"
" Optionally, before output, composite a sprite, 'name', which\n" " Optionally, before output, composite a sprite, 'name', which\n"
" must have been previously produced using --sprite at each\n" " must have been previously produced using --sprite, at each\n"
" offset (x,y) in the output image. Each sprite must fit\n" " offset (x,y) in the output image. Each sprite must fit\n"
" completely within the output image.\n" " completely within the output image.\n"
"\n" "\n"
@ -662,3 +645,4 @@ main(int argc, const char **argv)
return result; return result;
} }
#endif /* SIMPLIFIED_READ */

View File

@ -21,7 +21,7 @@
- 1.10: added support for non-default visuals; fixed X pixel-conversion - 1.10: added support for non-default visuals; fixed X pixel-conversion
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed - 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug 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.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
- 1.14: added support for X resources (thanks to Gerhard Niklasch) - 1.14: added support for X resources (thanks to Gerhard Niklasch)
- 2.00: dual-licensed (added GNU GPL) - 2.00: dual-licensed (added GNU GPL)

View File

@ -27,7 +27,7 @@
- 1.11: added -usleep option for demos; fixed command-line parsing bug - 1.11: added -usleep option for demos; fixed command-line parsing bug
- 1.12: added -pause option for demos and testing - 1.12: added -pause option for demos and testing
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options - 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.22: fixed XFreeGC() crash bug (thanks to Patrick Welche)
- 1.23: added -bgpat 0 mode (std white/gray checkerboard, 8x8 squares) - 1.23: added -bgpat 0 mode (std white/gray checkerboard, 8x8 squares)
- 1.30: added -loop option for -bgpat (ifdef FEATURE_LOOP); fixed bpp = - 1.30: added -loop option for -bgpat (ifdef FEATURE_LOOP); fixed bpp =

View File

@ -2,6 +2,8 @@
# #
# Copyright (c) 2013 John Cunningham Bowler # Copyright (c) 2013 John Cunningham Bowler
# #
# Last changed in libpng 1.6.0 [February 14, 2013]
#
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
# and license in png.h # and license in png.h

Some files were not shown because too many files have changed in this diff Show More