mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
317 Commits
master
...
v1.7.0beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67b88b8ee0 | ||
|
|
7a4bfbdec1 | ||
|
|
859254054a | ||
|
|
515659d638 | ||
|
|
fd409c8019 | ||
|
|
9ee6678e1f | ||
|
|
9b36280e31 | ||
|
|
eaad9f9177 | ||
|
|
70cd1a10f2 | ||
|
|
7974d60f54 | ||
|
|
c7e743d385 | ||
|
|
b2e89f1af6 | ||
|
|
ad30a1262b | ||
|
|
35f88c1341 | ||
|
|
4f8050416f | ||
|
|
776d1768aa | ||
|
|
d7078c52e2 | ||
|
|
4a67ac3f1e | ||
|
|
2799bf9a4f | ||
|
|
34e49ae1bc | ||
|
|
cea01951da | ||
|
|
1a9c06b11a | ||
|
|
f3b1eb68a6 | ||
|
|
12845bc947 | ||
|
|
3ac960f128 | ||
|
|
eb2b0248e2 | ||
|
|
e529698d38 | ||
|
|
1a9e897289 | ||
|
|
3a81956ffe | ||
|
|
0acf4f9770 | ||
|
|
b407af6503 | ||
|
|
0fb41f05df | ||
|
|
8ebdaa0700 | ||
|
|
4e61b58980 | ||
|
|
88e7d62fbc | ||
|
|
43cd0a0bb5 | ||
|
|
1345c5bff8 | ||
|
|
39c420834f | ||
|
|
f898f69f46 | ||
|
|
352f43cdc6 | ||
|
|
f99393490d | ||
|
|
deb920b4a7 | ||
|
|
148cdac18f | ||
|
|
51ecc14a8a | ||
|
|
713a20c57d | ||
|
|
4526f546ba | ||
|
|
0c5acfa19e | ||
|
|
848eeacb41 | ||
|
|
2ced844b0e | ||
|
|
e2c5ed8d1d | ||
|
|
76004ce6ed | ||
|
|
258b986917 | ||
|
|
50a09830b8 | ||
|
|
9a3f244085 | ||
|
|
fb1305faeb | ||
|
|
3d7f3bbab7 | ||
|
|
2d032e966d | ||
|
|
8dd3784f7c | ||
|
|
98b9371115 | ||
|
|
d29413a2a9 | ||
|
|
dc63b03da1 | ||
|
|
cf354c2c82 | ||
|
|
484dad1a19 | ||
|
|
1695471118 | ||
|
|
ae14dcd404 | ||
|
|
302c58b8cf | ||
|
|
39fee3cee1 | ||
|
|
b7362c6738 | ||
|
|
f2d8561fdc | ||
|
|
1bd81ffa21 | ||
|
|
6d2b1a7dbc | ||
|
|
5daa97c2eb | ||
|
|
9e441e96b9 | ||
|
|
a0d314ce84 | ||
|
|
b871b25997 | ||
|
|
d38ebc9ded | ||
|
|
995402ca6e | ||
|
|
1982968dad | ||
|
|
32cd66d619 | ||
|
|
03a53fa429 | ||
|
|
441de8f4fd | ||
|
|
4e5c80034e | ||
|
|
879d63156a | ||
|
|
eb021245d0 | ||
|
|
6607a3b905 | ||
|
|
28711dff2a | ||
|
|
4413d5dcd2 | ||
|
|
206d1eed42 | ||
|
|
114fa16ab3 | ||
|
|
eb2af04bd3 | ||
|
|
200fc68f52 | ||
|
|
4cfd01a288 | ||
|
|
e98229ceb0 | ||
|
|
ad1a4c8cc3 | ||
|
|
8df7c46e5b | ||
|
|
99078ec8bd | ||
|
|
a2c5f56e77 | ||
|
|
9e168ea2c9 | ||
|
|
06be739941 | ||
|
|
448092b8eb | ||
|
|
1faa6ff32c | ||
|
|
3adf438f39 | ||
|
|
d45a632529 | ||
|
|
5a1b8d106d | ||
|
|
05f896004f | ||
|
|
a4f1de9109 | ||
|
|
7ebb353944 | ||
|
|
b1f0c7d0e5 | ||
|
|
55df049962 | ||
|
|
219ba1370e | ||
|
|
4dc4471bb5 | ||
|
|
a199a15b28 | ||
|
|
e9446f2f95 | ||
|
|
f70f2fcf48 | ||
|
|
158c947ce2 | ||
|
|
7e2707e2af | ||
|
|
81824079b5 | ||
|
|
e8e1add0a8 | ||
|
|
a549223f91 | ||
|
|
ebe7945b96 | ||
|
|
e3e35aa980 | ||
|
|
9f2fbcf5d8 | ||
|
|
264ba68afe | ||
|
|
3ef99c9316 | ||
|
|
4b29f97f9b | ||
|
|
fe6e6cf130 | ||
|
|
547df4b9ca | ||
|
|
a0d4a0b971 | ||
|
|
72c2577302 | ||
|
|
091fab713c | ||
|
|
32aeb2cd4e | ||
|
|
c1bcdc3a86 | ||
|
|
553b8f85d3 | ||
|
|
30666a6097 | ||
|
|
0bfa63cd0d | ||
|
|
b37a7c6674 | ||
|
|
7657ac14f2 | ||
|
|
d9f60caf72 | ||
|
|
88c20ada06 | ||
|
|
f3bfc4a142 | ||
|
|
3fdef04d55 | ||
|
|
eae431e514 | ||
|
|
003590c361 | ||
|
|
8e23262b2b | ||
|
|
157e0649e0 | ||
|
|
83f1287c02 | ||
|
|
a1124a574a | ||
|
|
6f27254a7e | ||
|
|
79fc8fa0d9 | ||
|
|
394bc6cdee | ||
|
|
bb06552075 | ||
|
|
a14071d814 | ||
|
|
23f3e46518 | ||
|
|
f97b2a6cde | ||
|
|
23f4320775 | ||
|
|
fb411867b0 | ||
|
|
5aa2ca454d | ||
|
|
7905286ffa | ||
|
|
2edcb6ad0f | ||
|
|
0f1599e6e5 | ||
|
|
cbf22f30b4 | ||
|
|
9bf3c70730 | ||
|
|
1bc5747713 | ||
|
|
4a7796faca | ||
|
|
34081a0e2f | ||
|
|
b88c94208a | ||
|
|
30662f5e92 | ||
|
|
46ad4c5bd4 | ||
|
|
5c32606ec0 | ||
|
|
a08ac031fc | ||
|
|
c233ec8743 | ||
|
|
d594be641a | ||
|
|
4c9168875b | ||
|
|
3c051ee282 | ||
|
|
e1ded944f0 | ||
|
|
c09dddc0cd | ||
|
|
bd56d76417 | ||
|
|
0cc23ac171 | ||
|
|
cb10e19725 | ||
|
|
9dba7219a0 | ||
|
|
17c6af8c40 | ||
|
|
6a02eb6d2c | ||
|
|
40d41fe6f8 | ||
|
|
7073d26e51 | ||
|
|
cf76fe8654 | ||
|
|
b780b64fbf | ||
|
|
b1876ab6e2 | ||
|
|
28a95d125f | ||
|
|
993f68c006 | ||
|
|
8d23524359 | ||
|
|
e0f4aaa668 | ||
|
|
3de174cd2f | ||
|
|
eaf2f1dcbe | ||
|
|
ea0b4c602e | ||
|
|
371c3d4dfd | ||
|
|
0bcf5fb451 | ||
|
|
57d6907d89 | ||
|
|
6cf97e37af | ||
|
|
8ef61c4693 | ||
|
|
25a116f97d | ||
|
|
d6d41c847a | ||
|
|
9e0297546f | ||
|
|
d529363d13 | ||
|
|
55e93d7090 | ||
|
|
23674b75be | ||
|
|
0ddf350360 | ||
|
|
066f9862f0 | ||
|
|
ae1a5c811c | ||
|
|
5a1ce92c0c | ||
|
|
7a498039c5 | ||
|
|
40a93652aa | ||
|
|
a1362f38de | ||
|
|
30bc0333fe | ||
|
|
55794013d4 | ||
|
|
2e92b4dfa0 | ||
|
|
f46106fa04 | ||
|
|
0dcd32f39c | ||
|
|
808ea281a4 | ||
|
|
ec89aefb44 | ||
|
|
6152dbd424 | ||
|
|
fe18c0d9ea | ||
|
|
1b0358302d | ||
|
|
d20f9d5030 | ||
|
|
fc447311aa | ||
|
|
8e30e43587 | ||
|
|
0403ccf1de | ||
|
|
1a321cc088 | ||
|
|
c9f99f487b | ||
|
|
8360e60abc | ||
|
|
2799f74489 | ||
|
|
7363babe4f | ||
|
|
e3a526f789 | ||
|
|
8f0935b8dc | ||
|
|
ae6503fe0e | ||
|
|
851a6265a8 | ||
|
|
ffa24d4108 | ||
|
|
206f4d2678 | ||
|
|
bb040784c2 | ||
|
|
70e1af50ed | ||
|
|
eb4a645eda | ||
|
|
9f7f03a3c4 | ||
|
|
395ddbd318 | ||
|
|
9f0d36c85f | ||
|
|
e9760e5e95 | ||
|
|
b96b2b7e90 | ||
|
|
9bb705e0a8 | ||
|
|
e860f77393 | ||
|
|
b5a7565908 | ||
|
|
e88e221d91 | ||
|
|
b10867cdc2 | ||
|
|
bf7084b80d | ||
|
|
6afcee826f | ||
|
|
f15a5006c8 | ||
|
|
cdbd5174bd | ||
|
|
7a9b6203ef | ||
|
|
803493e19c | ||
|
|
4245e6b1b2 | ||
|
|
81892f6b90 | ||
|
|
862993827d | ||
|
|
d304125332 | ||
|
|
9124f3e29a | ||
|
|
2969375aa6 | ||
|
|
5e8ba1cbbf | ||
|
|
8aee43d10a | ||
|
|
e355657bbe | ||
|
|
fb6ba9acf4 | ||
|
|
815173a0b5 | ||
|
|
7f489a77bb | ||
|
|
8ec8e8fcd5 | ||
|
|
a4e606dd5f | ||
|
|
646de7962b | ||
|
|
4accd423c2 | ||
|
|
f62caaf4dc | ||
|
|
b789bb84bb | ||
|
|
ce60ad642b | ||
|
|
ab097b1168 | ||
|
|
3a737d86c7 | ||
|
|
a1337e57a8 | ||
|
|
247b3fcf49 | ||
|
|
f01273b25c | ||
|
|
8cb1a2ac6d | ||
|
|
e6e5ac8cb7 | ||
|
|
a4798fb83e | ||
|
|
46369f35c5 | ||
|
|
e699993d70 | ||
|
|
5a0afcfa63 | ||
|
|
3fc9cbf126 | ||
|
|
36b628b19e | ||
|
|
2c31365fd4 | ||
|
|
e1e3c1a2a2 | ||
|
|
b940e5dc5d | ||
|
|
fbbbc620b8 | ||
|
|
9b99600c4d | ||
|
|
3129d7426e | ||
|
|
325ceea971 | ||
|
|
ac39fc3024 | ||
|
|
99343407e6 | ||
|
|
3e23f45ba9 | ||
|
|
72389dec42 | ||
|
|
1f0853f47e | ||
|
|
32a60a4885 | ||
|
|
5e07dc6970 | ||
|
|
4b90a8d416 | ||
|
|
d59c19b64c | ||
|
|
bbabd977d1 | ||
|
|
0cf9c7d63d | ||
|
|
b4e241559e | ||
|
|
1e15aee6be | ||
|
|
d59e60d0fb | ||
|
|
ec1d13a1d4 | ||
|
|
d9002f94cb | ||
|
|
1fa858db48 | ||
|
|
0f2a5bac64 | ||
|
|
eac85878bf | ||
|
|
240ac287eb | ||
|
|
3e42c81193 | ||
|
|
ac3b4d9b69 |
@@ -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'
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"Disable": {
|
|
||||||
"IndentSize": true
|
|
||||||
},
|
|
||||||
"Exclude": [
|
|
||||||
".git/",
|
|
||||||
"out/"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
31
.github/workflows/lint.yml
vendored
31
.github/workflows/lint.yml
vendored
@@ -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
159
.gitignore
vendored
@@ -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
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
extends: default
|
|
||||||
rules:
|
|
||||||
document-start: disable
|
|
||||||
document-end: disable
|
|
||||||
line-length: disable
|
|
||||||
truthy:
|
|
||||||
check-keys: false
|
|
||||||
650
ANNOUNCE
650
ANNOUNCE
@@ -1,53 +1,629 @@
|
|||||||
libpng 1.6.51.git
|
|
||||||
=================
|
|
||||||
|
|
||||||
This is a development version, not intended to be a public release.
|
Libpng 1.7.0beta39 - November 1, 2014
|
||||||
It will be replaced by a public release, or by another development
|
|
||||||
version, at a later time.
|
|
||||||
|
|
||||||
|
This is not intended to be a public release. It will be replaced
|
||||||
|
within a few weeks by a public version or by another test version.
|
||||||
|
|
||||||
libpng 1.6.50 - July 1, 2025
|
Files available for download:
|
||||||
============================
|
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production code.
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
|
"configure" script
|
||||||
|
|
||||||
|
1.7.0beta39.tar.xz (LZMA-compressed, recommended)
|
||||||
|
1.7.0beta39.tar.gz
|
||||||
|
|
||||||
Files available for download
|
Source files with CRLF line endings (for Windows), without the
|
||||||
----------------------------
|
"configure" script
|
||||||
|
|
||||||
Source files with LF line endings (for Unix/Linux):
|
lp170b39.7z (LZMA-compressed, recommended)
|
||||||
|
lp170b39.zip
|
||||||
* libpng-1.6.50.tar.xz (LZMA-compressed, recommended)
|
|
||||||
* libpng-1.6.50.tar.gz (deflate-compressed)
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows):
|
|
||||||
|
|
||||||
* lpng1650.7z (LZMA-compressed, recommended)
|
|
||||||
* lpng1650.zip (deflate-compressed)
|
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
* README.md
|
1.7.0beta39-README.txt
|
||||||
* LICENSE.md
|
1.7.0beta39-LICENSE.txt
|
||||||
* AUTHORS.md
|
libpng-1.7.0beta39-*.asc (armored detached GPG signatures)
|
||||||
* TRADEMARK.md
|
|
||||||
|
|
||||||
|
Changes since the last public release (1.6.0):
|
||||||
|
|
||||||
Changes from version 1.6.49 to version 1.6.50
|
Version 1.7.0alpha01 [December 15, 2012]
|
||||||
---------------------------------------------
|
Started 1.7.0 branch from libpng-1.6.0beta33.
|
||||||
|
Made 8-bit compose and rgb_to_grayscale accuracy improvements. These
|
||||||
|
changes cause 16-bit arithmetic to be used for 8-bit data in the gamma
|
||||||
|
corrected compose and grayscale operations. The arithmetic errors have
|
||||||
|
three sources all of which are fixed in this commit:
|
||||||
|
1) 8-bit linear calculations produce massive errors for lower intensity
|
||||||
|
values.
|
||||||
|
2) The old 16-bit "16 to 8" gamma table code erroneously wrote the lowest
|
||||||
|
output value into a table entry which corresponded to multiple output
|
||||||
|
values (so where the value written should have been the closest to the
|
||||||
|
transformed input value.)
|
||||||
|
3) In a number of cases the code to access the 16-bit table did not round;
|
||||||
|
it did a simple shift, which was wrong and made the side effects of (2)
|
||||||
|
even worse.
|
||||||
|
The new gamma code does not have the 16-to-8 problem at the cost of slightly
|
||||||
|
more calculations and the algorithm used to minimize the number of
|
||||||
|
calculations has been extended to all the 16-bit tables; it has advantages
|
||||||
|
for any significant gamma correction.
|
||||||
|
Rearranged png_struct, remove unused members, change png_set_filter handling
|
||||||
|
png_struct members rearranged - partly to reorder to avoid packing, partly
|
||||||
|
to put frequently accessed members at the start and partly to make
|
||||||
|
the grouping more clear. png_set_filter code has been rewritten and the
|
||||||
|
code shared with png_write_start_row moved to a common function. Comments
|
||||||
|
in png.h have been made more clear. Minor fixes to
|
||||||
|
contrib/libtests/timepng.c and some of the png_*_tRNS logic, including
|
||||||
|
more error detection in png_set_tRNS.
|
||||||
|
Cleaned up USER_LIMITS feature, removing members from png_struct when not
|
||||||
|
required.
|
||||||
|
Rearranged ARM-NEON optimizations to isolate the machine specific code to
|
||||||
|
the hardware subdirectory, and add comments to pngrutil.c so that
|
||||||
|
implementors of other optimizations will know what to do.
|
||||||
|
Fixed cases of unquoted DESTDIR in Makefile.am.
|
||||||
|
Rebuilt Makefile.in, configure, etc., with autoconf-2.69 and automake-1.12.5.
|
||||||
|
|
||||||
* Improved the detection of the RVV Extension on the RISC-V platform.
|
Version 1.7.0alpha02 [December 17, 2012]
|
||||||
(Contributed by Filip Wasil)
|
Removed functions that were deprecated in libpng-1.6.0:
|
||||||
* Replaced inline ASM with C intrinsics in the RVV code.
|
png_reset_zstream(), png_info_init_3(), and png_data_freer() and its
|
||||||
(Contributed by Filip Wasil)
|
associated flags.
|
||||||
* Fixed a decoder defect in which unknown chunks trailing IDAT, set
|
Removed some duplicated lines from contrib/tools/scale.c and png.c.
|
||||||
to go through the unknown chunk handler, incorrectly triggered
|
Changed some instances of png_warning() to png_app_error().
|
||||||
out-of-place IEND errors.
|
Updated some left over "1.6.0beta32" in code sources.
|
||||||
(Contributed by John Bowler)
|
Fixed a "png_structp" prototype (should be png_structrp) in arm_init.c
|
||||||
* Fixed the CMake file for cross-platform builds that require `libm`.
|
Updated the version-number hack in pngvalid.c
|
||||||
|
|
||||||
|
Version 1.7.0alpha03 [December 19, 2012]
|
||||||
|
Cleaned up and enhanced the configure option; libpng now correctly
|
||||||
|
links and tests against zlib with a prefix; tests have been clarified; and
|
||||||
|
irrelevant or obsolete things (as defined by the autotools man page) have
|
||||||
|
been removed.
|
||||||
|
Documented new PNG_ABORT behavior in the manual and commentary in pngerror.c
|
||||||
|
Cleaned up whitespace in the synopsis portion of the manpage "libpng.3"
|
||||||
|
Fixed previous support for Z_PREFIX in configure builds, corrected sCAL APIs;
|
||||||
|
some of these use floating point arithmetic so they need to be disabled if
|
||||||
|
floating point arithmetic is switched off. This is a quiet API change -
|
||||||
|
previously it appeared that the APIs were supported if fixed point
|
||||||
|
arithmetic was used internally, however they required certain APIs (floor,
|
||||||
|
modf, frexp, atof) that are part of C floating point support. Changed
|
||||||
|
png_fixed and the gamma code specific version of the same to avoid floor(),
|
||||||
|
which may be a library function (not an intrinsic). Removed unused #if 0
|
||||||
|
code.
|
||||||
|
Disassembled the version number in scripts/options.awk (necessary for
|
||||||
|
building on SunOs).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
Version 1.7.0alpha04 [December 23, 2012]
|
||||||
Subscription is required; visit
|
Added scripts/makefile.msys contributed by Christopher M. Wheeler
|
||||||
|
Made default Zlib compression settings be configurable. This adds #defines to
|
||||||
|
pnglibconf.h to control the defaults.
|
||||||
|
Fixed Windows build issues, enabled ARM compilation. Various warnings issued
|
||||||
|
by earlier versions of GCC fixed for Cygwin and Min/GW (which both use old
|
||||||
|
GCCs.) ARM support is enabled by default in zlib.props (unsupported by
|
||||||
|
Microsoft) and ARM compilation is made possible by deleting the check for
|
||||||
|
x86. The test programs cannot be run because they are not signed.
|
||||||
|
|
||||||
|
Version 1.7.0alpha05 [December 24, 2012]
|
||||||
|
Discontinued distributing libpng-1.x.x.tar.bz2.
|
||||||
|
Discontinued distributing libpng-1.7.0-1.6.0-diff.txt and similar.
|
||||||
|
|
||||||
|
Version 1.7.0alpha06 [January 1, 2013]
|
||||||
|
Fixed 'make distcheck' on SUN OS - libpng.so was not being removed
|
||||||
|
|
||||||
|
Version 1.7.0alpha07 [January 10, 2013]
|
||||||
|
Fixed conceivable but difficult to repro overflow. Also added two test
|
||||||
|
programs to generate and test a PNG which should have the problem.
|
||||||
|
|
||||||
|
Version 1.7.0alpha08 [January 17, 2013]
|
||||||
|
Corrected previous attempt at overflow detection in png_set_unknown_chunks()
|
||||||
|
(CVE-2013-7353). Added overflow detection in png_set_sPLT() and
|
||||||
|
png_set_text_2() (CVE-2013-7354).
|
||||||
|
|
||||||
|
Version 1.7.0alpha09 [January 21, 2013]
|
||||||
|
Pulled changes to multi-chunk handling from libpng-1.6.0beta40.
|
||||||
|
|
||||||
|
Version 1.7.0alpha10 [February 5, 2013]
|
||||||
|
Make symbol prefixing work with the ARM neon optimizations. Also
|
||||||
|
allow pngpriv.h to be included for preprocessor definitions only, so
|
||||||
|
it can be used in non-C/C++ files.
|
||||||
|
Added png_get_palette_max() function.
|
||||||
|
Changed png_size_t to size_t throughout headers, make sRGB check numbers
|
||||||
|
consistent.
|
||||||
|
Fixed ARM support (Mans Rullgard).
|
||||||
|
Removed stray out-of-order #endif and #ifdef (Mans Rullgard).
|
||||||
|
Ported libpng 1.5 options.awk/dfn file handling to 1.7, fixed one bug.
|
||||||
|
Rebuilt Makefile.in, configure, etc., with autoconf-2.69 and automake-1.13.
|
||||||
|
Minor fixes to assembler changes, verified with a dummy .S file
|
||||||
|
Removed cc -E workround, corrected png_get_palette_max API. Tested on
|
||||||
|
SUN OS cc 5.9, which demonstrates the tokenization problem previously
|
||||||
|
avoided by using /lib/cpp. Since all .dfn output is now protected
|
||||||
|
in double quotes unless it is to be macro substituted the fix should work
|
||||||
|
everywhere.
|
||||||
|
|
||||||
|
Version 1.7.0beta01 [February 15, 2013]
|
||||||
|
Enable parallel tests and rearrange TESTS order to take advantage of
|
||||||
|
the massive speed improvements use a make capable of parallel builds
|
||||||
|
on a multi-CPU machine and pass the right arguments to make (-j10000
|
||||||
|
for GNU make) to get the build to run in parallel.
|
||||||
|
Fixed previous support for Z_PREFIX in configure builds, corrected
|
||||||
|
sCAL APIs; some of these use floating point arithmetic so need to be
|
||||||
|
disabled if floating point arithmetic is switched off. This is a quiet API
|
||||||
|
change - previously it appeared that the APIs were supported if fixed point
|
||||||
|
arithmetic was used internally, however they required certain APIs (floor,
|
||||||
|
modf, frexp, atof) that are part of C floating point support. Changed
|
||||||
|
png_fixed and the gamma code specific version of the same to avoid floor(),
|
||||||
|
which may be a library function (not an intrinsic). Removed unused #if 0
|
||||||
|
code.
|
||||||
|
Fixed make distcheck to skip over the test result files. They were
|
||||||
|
being included because the whole of the 'tests' directory is included,
|
||||||
|
fixed to just include the actual test files and tests/pngstest. Also
|
||||||
|
reverted the previous erroneous change to remove the ${srcdir} from the
|
||||||
|
front of contrib, scripts, projects and added an explanation of what is
|
||||||
|
going on to Makefile.am
|
||||||
|
Fixed missing dependency in --prefix builds. The intermediate
|
||||||
|
internal 'prefix.h' file can only be generated correctly after pnglibconf.h,
|
||||||
|
however the dependency was not in Makefile.am. The symptoms are
|
||||||
|
unpredictable depending on the order make chooses to build pngprefix.h and
|
||||||
|
pnglibconf.h, often the error goes unnoticed because there is a system
|
||||||
|
pnglibconf.h to use instead.
|
||||||
|
Accept "," as a separator in pnglibconf.dfa and allow for
|
||||||
|
continuation lines. This adds to the syntax of "option" and "chunk" lines,
|
||||||
|
allowing the elements to be separated by a "," at the end of an element and
|
||||||
|
interpreting a "," at end of line as a continuation - so the following line
|
||||||
|
is read. The new syntax is optional and solely provided for readability.
|
||||||
|
Enclosed the new png_get_palette_max in #ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||||
|
block, and revised pnglibconf.h and pnglibconf.h.prebuilt accordingly.
|
||||||
|
|
||||||
|
Version 1.7.0beta02 [February 18, 2013]
|
||||||
|
Fixed a race condition in the creation of the build 'scripts' directory
|
||||||
|
while building with a parallel make.
|
||||||
|
Use approved/supported Android method to check for NEON, use Linux/POSIX
|
||||||
|
1003.1 API to check /proc/self/auxv avoiding buffer allocation and other
|
||||||
|
library calls (ported from libpng15).
|
||||||
|
Use parentheses more consistently in "#if defined(MACRO)" tests.
|
||||||
|
Folded long lines.
|
||||||
|
|
||||||
|
Version 1.7.0beta03 [February 22, 2013]
|
||||||
|
Reenabled code to allow zero length PLTE chunks for MNG.
|
||||||
|
Fixed ALIGNED_MEMORY support.
|
||||||
|
Allow run-time ARM NEON checking to be disabled. A new configure option:
|
||||||
|
--enable-arm-neon=always will stop the run-time checks. New checks
|
||||||
|
within arm/arm_init.c will cause the code not to be compiled unless
|
||||||
|
__ARM_NEON__ is set. This should make it fail safe (if someone asks
|
||||||
|
for it on then the build will fail if it can't be done.)
|
||||||
|
Updated the INSTALL document.
|
||||||
|
|
||||||
|
Version 1.7.0beta04 [February 27, 2013]
|
||||||
|
Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
|
||||||
|
Revised scripts/makefile.freebsd to respect ZLIBLIB and ZLIBINC.
|
||||||
|
Revised scripts/dfn.awk to work with the buggy MSYS awk that has trouble
|
||||||
|
with CRLF line endings.
|
||||||
|
|
||||||
|
Version 1.7.0beta05 [March 5, 2013]
|
||||||
|
Avoid a possible memory leak in contrib/gregbook/readpng.c
|
||||||
|
Changed user chunk callback API to respect global and per chunk defaults.
|
||||||
|
Previously a return of 0 from a user chunk callback would result in the
|
||||||
|
chunk being saved (if this was safe, even if the chunk was unsafe-to-copy);
|
||||||
|
this change respects the defaults set by the application, so unknown chunks
|
||||||
|
can be discarded by default and known-safe ones preserved.
|
||||||
|
Corrected Android builds and corrected libpng.vers with symbol
|
||||||
|
prefixing. This adds an API to set optimization options externally,
|
||||||
|
providing an alternative and general solution for the non-portable
|
||||||
|
run-time tests used by the ARM Neon code. It also makes those tests
|
||||||
|
compile and link on Android. The order of settings vs options in
|
||||||
|
pnglibconf.h is reversed to allow settings to depend on options and
|
||||||
|
options can now set (or override) the defaults for settings.
|
||||||
|
|
||||||
|
Version 1.7.0beta06 [March 13, 2013]
|
||||||
|
Corrected simplified API default gamma for color-mapped output, added
|
||||||
|
a flag to change default. In 1.6.0 when the simplified API was used
|
||||||
|
to produce color-mapped output from an input image with no gamma
|
||||||
|
information the gamma assumed for the input could be different from
|
||||||
|
that assumed for non-color-mapped output. In particular 16-bit depth
|
||||||
|
input files were assumed to be sRGB encoded, whereas in the 'direct'
|
||||||
|
case they were assumed to have linear data. This was an error. The
|
||||||
|
fix makes the simplified API treat all input files the same way and
|
||||||
|
adds a new flag to the png_image::flags member to allow the
|
||||||
|
application/user to specify that 16-bit files contain sRGB data
|
||||||
|
rather than the default linear.
|
||||||
|
Fixed bugs in the pngpixel and makepng test programs.
|
||||||
|
Fixed CMakelists.txt to allow building a single variant of the library
|
||||||
|
(Claudio Bley):
|
||||||
|
Introduced a PNG_LIB_TARGETS variable that lists all activated library
|
||||||
|
targets. It is an error if this variable ends up empty, ie. you have
|
||||||
|
to build at least one library variant.
|
||||||
|
Made the *_COPY targets only depend on library targets actually being build.
|
||||||
|
Use PNG_LIB_TARGETS to unify a code path.
|
||||||
|
Changed the CREATE_SYMLINK macro to expect the full path to a file as the
|
||||||
|
first argument. When symlinking the filename component of that path is
|
||||||
|
determined and used as the link target.
|
||||||
|
Use copy_if_different in the CREATE_SYMLINK macro.
|
||||||
|
Eliminated two warnings from the Intel C compiler. The warnings are
|
||||||
|
technically valid, although a reasonable treatment of division would
|
||||||
|
show it to be incorrect.
|
||||||
|
|
||||||
|
Version 1.7.0beta07 [April 14, 2013]
|
||||||
|
Updated documentation of 1.5.x to 1.6.x changes in iCCP chunk handling.
|
||||||
|
Fixed incorrect warning of excess deflate data. End condition - the
|
||||||
|
warning would be produced if the end of the deflate stream wasn't read
|
||||||
|
in the last row. The warning is harmless.
|
||||||
|
Corrected the test on user transform changes on read. It was in the
|
||||||
|
png_set of the transform function, but that doesn't matter unless the
|
||||||
|
transform function changes the rowbuf size, and that is only valid if
|
||||||
|
transform_info is called.
|
||||||
|
Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
|
||||||
|
(Flavio Medeiros).
|
||||||
|
Corrected length written to uncompressed iTXt chunks (Samuli Suominen).
|
||||||
|
|
||||||
|
Version 1.7.0beta08 [April 18, 2013]
|
||||||
|
Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
|
||||||
|
written by libpng-1.6.0 and 1.6.1.
|
||||||
|
Disallow storing sRGB information when the sRGB is not supported.
|
||||||
|
|
||||||
|
Version 1.7.0beta09 [April 24, 2013]
|
||||||
|
Exposed PNG chunk types in png.h
|
||||||
|
Modified png_uint_32 macros/code to make as few assumptions as possible
|
||||||
|
Revised stack marking in arm/filter_neon.S and configure.ac
|
||||||
|
Ensure that NEON filter stuff is completely disabled when switched 'off'.
|
||||||
|
Previously the ARM NEON specific files were still built if the option
|
||||||
|
was switched 'off' as opposed to being explicitly disabled.
|
||||||
|
|
||||||
|
Version 1.7.0beta10 [April 24, 2013]
|
||||||
|
Attempt to fix the PNG_ARM_NEON configuration mess.
|
||||||
|
|
||||||
|
Version 1.7.0beta11 [April 26, 2013]
|
||||||
|
Test for 'arm*', not just 'arm' in the host_cpu configure variable.
|
||||||
|
|
||||||
|
Version 1.7.0beta12 [April 30, 2013]
|
||||||
|
Added png_app_warning for out-of-range unknown chunk index in
|
||||||
|
png_set_unknown_chunk_location().
|
||||||
|
Expanded manual paragraph about writing private chunks.
|
||||||
|
Avoid dereferencing NULL pointer possibly returned from
|
||||||
|
png_create_write_struct() (Andrew Church).
|
||||||
|
|
||||||
|
Version 1.7.0beta13 [May 12, 2013]
|
||||||
|
Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
|
||||||
|
right zlib header files.
|
||||||
|
Separated CPPFLAGS and CFLAGS in contrib/pngminim/*/makefile
|
||||||
|
Updated contrib/pngminus/pnm2png.c (Paul Stewart):
|
||||||
|
Check for EOF
|
||||||
|
Ignore "#" delimited comments in input file to pnm2png.c.
|
||||||
|
Fixed whitespace handling
|
||||||
|
Added a call to png_set_packing()
|
||||||
|
Initialize dimension values so if sscanf fails at least we have known
|
||||||
|
invalid values.
|
||||||
|
Calculate our own zlib windowBits when decoding rather than trusting the
|
||||||
|
CMF bytes in the PNG datastream.
|
||||||
|
Added an option to force maximum window size for inflating, which was
|
||||||
|
the behavior of libpng15 and earlier.
|
||||||
|
Added png-fix-itxt and png-fix-too-far-back to the built programs and
|
||||||
|
removed warnings from the source code and timepng that are revealed as
|
||||||
|
a result.
|
||||||
|
Detect wrong libpng versions linked to png-fix-too-far-back, which currently
|
||||||
|
only works with libpng versions that can be made to reliably fail when
|
||||||
|
the deflate data contains an out-of-window reference. This means only
|
||||||
|
1.6 and later.
|
||||||
|
Attempt to detect configuration issues with png-fix-too-far-back, which
|
||||||
|
requires both the correct libpng and the correct zlib to function
|
||||||
|
correctly.
|
||||||
|
Check ZLIB_VERNUM for mismatches, enclose #error in quotes
|
||||||
|
Added information in the documentation about problems with and fixes for
|
||||||
|
the bad CRC and bad iTXt chunk situations.
|
||||||
|
|
||||||
|
Version 1.7.0beta14 [June 8, 2013]
|
||||||
|
Removed a redundant test in png_set_IHDR().
|
||||||
|
Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
|
||||||
|
Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
|
||||||
|
Enclose the prototypes for the simplified write API in #ifdef STDIO/#endif
|
||||||
|
Make ARM NEON support work at compile time (not just configure time).
|
||||||
|
This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
|
||||||
|
using a compiler that compiles for multiple architectures at one time.
|
||||||
|
Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
|
||||||
|
pnglibconf.h, allowing more of the decisions to be made internally
|
||||||
|
(pngpriv.h) during the compile. Without this, symbol prefixing is broken
|
||||||
|
under certain circumstances on ARM platforms. Now only the API parts of
|
||||||
|
the optimizations ('check' vs 'api') are exposed in the public header files
|
||||||
|
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||||
|
decision about whether or not to use the optimizations.
|
||||||
|
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
|
||||||
|
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||||
|
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||||
|
prefixing because the definition of the special png_init_filter_functions
|
||||||
|
call was hidden at configure time if the relevant compiler arguments are
|
||||||
|
passed in CFLAGS as opposed to CC. This change attempts to avoid all
|
||||||
|
the confusion that would result by declaring the init function even when
|
||||||
|
it is not used, so that it will always get prefixed.
|
||||||
|
|
||||||
|
Version 1.7.0beta15 [June 18, 2013]
|
||||||
|
Revised libpng.3 so that "doclifter" can process it.
|
||||||
|
|
||||||
|
Version 1.7.0beta16 [July 5, 2013]
|
||||||
|
Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
|
||||||
|
as parameters for png_set_gamma(). These have been available since
|
||||||
|
libpng-1.5.4.
|
||||||
|
Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised it
|
||||||
|
to check all compressed chunks known to libpng.
|
||||||
|
Updated documentation to show default behavior of benign errors correctly.
|
||||||
|
Added perfect hash code generation for lists of PNG chunks. This is
|
||||||
|
a work in progress; checked in for use in pngfix.c
|
||||||
|
Ported ARM no-read patch from libpng16.
|
||||||
|
Ported pngfix.c patches from libpng16.
|
||||||
|
|
||||||
|
Version 1.7.0beta17 [August 21, 2013]
|
||||||
|
Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
|
||||||
|
Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
|
||||||
|
may be erroneously issued by code-checking applications.
|
||||||
|
Added information about png_set_options() to the manual.
|
||||||
|
Delay calling png_init_filter_functions() until a row with nonzero filter
|
||||||
|
is found.
|
||||||
|
|
||||||
|
Version 1.7.0beta18 [September 16, 2013]
|
||||||
|
Fixed inconsistent conditional compilation of png_chunk_unknown_handling()
|
||||||
|
prototype, definition, and usage. Made it depend on
|
||||||
|
PNG_HANDLE_AS_UNKNOWN_SUPPORTED everywhere.
|
||||||
|
|
||||||
|
Version 1.7.0beta19 [September 30, 2013]
|
||||||
|
Reverted the change to unknown handling #defines; the change breaks 'NOREAD'
|
||||||
|
builds.
|
||||||
|
Fixed default behavior of ARM_NEON_API. If the ARM NEON API option is
|
||||||
|
compiled without the CHECK option it defaulted to on, not off.
|
||||||
|
Catch up with recent libpng16 changes; unknown handling and spelling
|
||||||
|
corrections
|
||||||
|
Avoid up-cast warnings in pngvalid.c. On ARM the alignment requirements of
|
||||||
|
png_modifier are greater than that of png_store and as a consequence
|
||||||
|
compilation of pngvalid.c results in a warning about increased alignment
|
||||||
|
requirements because of the bare cast to (png_modifier*). The code is
|
||||||
|
safe, because the pointer is known to point to a stack allocated
|
||||||
|
png_modifier, but this change avoids the warning.
|
||||||
|
Fixed some grammatical changes and updated the png chunks list.
|
||||||
|
|
||||||
|
Version 1.7.0beta20 [October 13, 2013]
|
||||||
|
Made changes for compatibility with automake 1.14:
|
||||||
|
1) Added the 'compile' program to the list of programs that must be cleaned
|
||||||
|
in autogen.sh
|
||||||
|
2) Added 'subdir-objects' which causes .c files in sub-directories to be
|
||||||
|
compiled such that the corresponding .o files are also in the
|
||||||
|
sub-directory. This is because automake 1.14 warns that the
|
||||||
|
current behavior of compiling to the top level directory may be removed
|
||||||
|
in the future.
|
||||||
|
3) Updated dependencies on pnglibconf.h to match the new .o locations and
|
||||||
|
added all the files in contrib/libtests and contrib/tools that depend
|
||||||
|
on pnglibconf.h
|
||||||
|
4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
|
||||||
|
way of handling the dependencies of sources that are machine generated;
|
||||||
|
unfortunately it only works if the user does 'make all' or 'make check',
|
||||||
|
so the dependencies (3) are still required.
|
||||||
|
Cleaned up (char*) casts of zlib messages. The latest version of the Intel C
|
||||||
|
compiler complains about casting a string literal as (char*), so copied the
|
||||||
|
treatment of z_const from the library code into pngfix.c
|
||||||
|
Simplified error message code in pngunknown. The simplification has the
|
||||||
|
useful side effect of avoiding a bogus warning generated by the latest
|
||||||
|
version of the Intel C compiler (it objects to
|
||||||
|
condition ? string-literal : string-literal).
|
||||||
|
Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always
|
||||||
|
removing the 1.14 'compile' script but never checking for it.
|
||||||
|
|
||||||
|
Version 1.7.0beta21 [November 2, 2013]
|
||||||
|
Added ARMv8 support (James Yu <james.yu at linaro.org>). Added file
|
||||||
|
arm/filter_neon_intrinsics.c; enable with -mfpu=neon.
|
||||||
|
Revised pngvalid to generate size images with as many filters as it can
|
||||||
|
manage, limited by the number of rows.
|
||||||
|
Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
|
||||||
|
and detect the broken GCC compilers.
|
||||||
|
Allow clang derived from older GCC versions to use ARM intrinsics. This
|
||||||
|
causes all clang builds that use -mfpu=neon to use the intrinsics code,
|
||||||
|
not the assembler code. This has only been tested on iOS 7. It may be
|
||||||
|
necessary to exclude some earlier clang versions but this seems unlikely.
|
||||||
|
Changed NEON implementation selection mechanism. This allows assembler
|
||||||
|
or intrinsics to be turned on at compile time during the build by defining
|
||||||
|
PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1). This macro
|
||||||
|
is undefined by default and the build type is selected in pngpriv.h.
|
||||||
|
|
||||||
|
Version 1.7.0beta22 [November 7, 2013]
|
||||||
|
Fixed #include in filter_neon_intrinsics.c and ctype macros. The ctype char
|
||||||
|
checking macros take an unsigned char argument, not a signed char.
|
||||||
|
|
||||||
|
Version 1.7.0beta23 [November 24, 2013]
|
||||||
|
Changed #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED in pngpread.c to
|
||||||
|
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED to be consistent with
|
||||||
|
what is in pngpriv.h.
|
||||||
|
Moved prototype for png_handle_unknown() in pngpriv.h outside of
|
||||||
|
the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
|
||||||
|
Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile
|
||||||
|
Conditionally compile some unused functions reported by -Wall in
|
||||||
|
pngminim.
|
||||||
|
Fixed 'minimal' builds. Various obviously useful minimal configurations
|
||||||
|
don't build because of missing contrib/libtests test programs and
|
||||||
|
overly complex dependencies in scripts/pnglibconf.dfa. This change
|
||||||
|
adds contrib/conftest/*.dfa files that can be used in automatic build
|
||||||
|
scripts to ensure that these configurations continue to build.
|
||||||
|
Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
|
||||||
|
Fixed pngvalid 'fail' function declaration on the Intel C Compiler.
|
||||||
|
This reverts to the previous 'static' implementation and works round
|
||||||
|
the 'unused static function' warning by using PNG_UNUSED().
|
||||||
|
|
||||||
|
Version 1.7.0beta24 [December 15, 2013]
|
||||||
|
Removed or marked PNG_UNUSED some harmless "dead assignments" reported
|
||||||
|
by clang scan-build.
|
||||||
|
Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
|
||||||
|
to '"%s" m' to improve portability among compilers.
|
||||||
|
Changed png_free_default() to free() in pngtest.c
|
||||||
|
Tidied up pngfix inits and fixed pngtest no-write builds.
|
||||||
|
Bookkeeping: Moved functions around (no changes). Moved transform
|
||||||
|
function definitions before the place where they are called so that
|
||||||
|
they can be made static. Move the intrapixel functions and the
|
||||||
|
grayscale palette builder out of the png?tran.c files. The latter
|
||||||
|
isn't a transform function and is no longer used internally, and the
|
||||||
|
former MNG specific functions are better placed in pngread/pngwrite.c
|
||||||
|
Made transform implementation functions static. This makes the internal
|
||||||
|
functions called by png_do_{read|write}_transformations static. On an
|
||||||
|
x86-64 DLL build (Gentoo Linux) this reduces the size of the text
|
||||||
|
segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
|
||||||
|
maintenance by removing the declarations from pngpriv.h and allowing
|
||||||
|
easier changes to the internal interfaces.
|
||||||
|
Handle zero-length PLTE chunk or NULL palette with png_error()
|
||||||
|
instead of png_chunk_report(), which by default issues a warning
|
||||||
|
rather than an error, leading to later reading from a NULL pointer
|
||||||
|
(png_ptr->palette) in png_do_expand_palette(). This is CVE-2013-6954
|
||||||
|
and VU#650142. Libpng-1.6.1 through 1.6.7 and libpng-1.7.0beta03
|
||||||
|
through 1.7.0beta23 are vulnerable. Libpng-1.6.0 and earlier do not
|
||||||
|
have the bug.
|
||||||
|
|
||||||
|
Version 1.7.0beta25 [December 26, 2013]
|
||||||
|
Merged files with version 1.6.8 that have not changed since then.
|
||||||
|
Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
|
||||||
|
|
||||||
|
Version 1.7.0beta26 [January 1, 2014]
|
||||||
|
Added libpng 1.5 checks to pngvalid.c
|
||||||
|
Merged with 1.5 and 1.6 changes to create a single pngvalid.c
|
||||||
|
Added dSIG to chunk list in png.h
|
||||||
|
Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
|
||||||
|
Merged pngrio.c, pngtrans.c, and pngwio.c with libpng-1.6.9
|
||||||
|
Fixed test programs for interlace options. Made pngvalid.c and
|
||||||
|
pngtest.c work correctly when READ_INTERLACING and/or WRITE_INTERLACING
|
||||||
|
are switched off.
|
||||||
|
Changed pngvalid.c to support libpng 1.5, which does not support
|
||||||
|
the PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when
|
||||||
|
appropriate in pngvalid.c
|
||||||
|
Allow unversioned links created on install to be disabled in configure.
|
||||||
|
In configure builds 'make install' changes/adds links like png.h
|
||||||
|
and libpng.a to point to the newly installed, versioned, files (e.g.
|
||||||
|
libpng17/png.h and libpng17.a). Three new configure options and some
|
||||||
|
rearrangement of Makefile.am allow creation of these links to be disabled.
|
||||||
|
|
||||||
|
Version 1.7.0beta27 [January 10, 2014]
|
||||||
|
Removed potentially misleading warning from png_check_IHDR().
|
||||||
|
|
||||||
|
Version 1.7.0beta28 [January 20, 2014]
|
||||||
|
Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
|
||||||
|
Added clang attribute support (Cosmin).
|
||||||
|
|
||||||
|
Version 1.7.0beta29 [January 30, 2014]
|
||||||
|
Quiet an uninitialized memory warning from VS2013 in png_get_png().
|
||||||
|
|
||||||
|
Version 1.7.0beta30 [February 2, 2014]
|
||||||
|
Fixed a large number of instances where PNGCBAPI was omitted from
|
||||||
|
function definitions.
|
||||||
|
Added pngimage test program for png_read_png and png_write_png. This
|
||||||
|
is a work-in-progress; no tests are run automatically at present and
|
||||||
|
the program by virtue of exhaustively testing all the transforms is
|
||||||
|
very slow.
|
||||||
|
|
||||||
|
Version 1.7.0beta31 [February 6, 2014]
|
||||||
|
Make png_read_png() and png_write_png() prototypes in png.h depend
|
||||||
|
upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
|
||||||
|
Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
|
||||||
|
png_set_packing() in png_read_png().
|
||||||
|
Completed full working pngimage test program and added two test scripts.
|
||||||
|
Fixed combination of ~alpha with shift. On read invert alpha, processing
|
||||||
|
occurred after shift processing, which causes the final values to be
|
||||||
|
outside the range that should be produced by the shift. Reversing the
|
||||||
|
order on read makes the two transforms work together correctly and mirrors
|
||||||
|
the order used on write.
|
||||||
|
Do not read invalid sBIT chunks. Previously libpng only checked sBIT
|
||||||
|
values on write, so a malicious PNG writer could therefore cause
|
||||||
|
the read code to return an invalid sBIT chunk, which might lead to
|
||||||
|
application errors or crashes. Such chunks are now skipped (with
|
||||||
|
chunk_benign_error).
|
||||||
|
Restored a line, "c = b;", that was inadvertently deleted from the
|
||||||
|
PAETH filtering code from libpng-1.7.0beta24/pngrutil.c. Deleted
|
||||||
|
the other instance of "c = b;" which is the one that triggered a
|
||||||
|
scan-build warning.
|
||||||
|
Support builds with unsupported PNG_TRANSFORM_* values. All of the
|
||||||
|
PNG_TRANSFORM_* values are always defined in png.h and, because they
|
||||||
|
are used for both read and write in some cases, it is not reliable
|
||||||
|
to #if out ones that are totally unsupported. This change adds error
|
||||||
|
detection in png_read_image() and png_write_image() to do a
|
||||||
|
png_app_error() if the app requests something that cannot be done
|
||||||
|
and it adds corresponding code to pngimage.c to handle such options
|
||||||
|
by not attempting to test them.
|
||||||
|
|
||||||
|
Version 1.7.0beta32 [February 26, 2014]
|
||||||
|
Moved redefines of png_error(), png_warning(), png_chunk_error(),
|
||||||
|
and png_chunk_warning() from pngpriv.h to png.h to make them visible
|
||||||
|
to libpng-calling applications.
|
||||||
|
Moved OS dependent code from arm/arm_init.c, to allow the included
|
||||||
|
implementation of the ARM NEON discovery function to be set at
|
||||||
|
build-time and provide sample implementations from the current code in the
|
||||||
|
contrib/arm-neon subdirectory. The __linux__ code has also been changed to
|
||||||
|
compile and link on Android by using /proc/cpuinfo, and the old linux code
|
||||||
|
is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
|
||||||
|
dependencies apart from opening /proc/cpuinfo and is C90 compliant.
|
||||||
|
Check for info_ptr == NULL early in png_read_end() so we don't need to
|
||||||
|
run all the png_handle_*() and depend on them to return if info_ptr == NULL.
|
||||||
|
This improves the performance of png_read_end(png_ptr, NULL) and makes
|
||||||
|
it more robust against future programming errors.
|
||||||
|
Check for __has_extension before using it in pngconf.h, to
|
||||||
|
support older Clang versions (Jeremy Sequoia).
|
||||||
|
Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
|
||||||
|
so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
|
||||||
|
Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
|
||||||
|
after recognizing the IDAT chunk, which avoids an infinite loop while
|
||||||
|
reading a datastream whose first IDAT chunk is of zero-length.
|
||||||
|
This fixes CERT VU#684412 and CVE-2014-0333.
|
||||||
|
Don't recognize known sRGB profiles as sRGB if they have been hacked,
|
||||||
|
but don't reject them and don't issue a copyright violation warning.
|
||||||
|
Minor editing of contrib/arm-neon/README and contrib/examples/*.c
|
||||||
|
Moved some documentation from png.h to libpng.3 and libpng-manual.txt
|
||||||
|
|
||||||
|
Version 1.7.0beta33 [February 27, 2014]
|
||||||
|
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
||||||
|
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
||||||
|
|
||||||
|
Version 1.7.0beta34 [March 17, 2014]
|
||||||
|
Treat CRC error handling with png_set_crc_action(), instead of with
|
||||||
|
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
|
||||||
|
Use "if (value != 0)" instead of "if (value)" consistently.
|
||||||
|
Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio.
|
||||||
|
Moved configuration information from the manual to the INSTALL file.
|
||||||
|
|
||||||
|
Version 1.7.0beta35 [August 6, 2014]
|
||||||
|
Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because
|
||||||
|
they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3
|
||||||
|
when using its "__builtin_pow()" function.
|
||||||
|
Silence 'unused parameter' build warnings (Cosmin).
|
||||||
|
$(CP) is now used alongside $(RM_F). Also, use 'copy' instead
|
||||||
|
of 'cp' where applicable, and applied other minor makefile changes.
|
||||||
|
Don't warn about invalid dimensions exceeding user limits.
|
||||||
|
Allow an easy replacement of the default pre-built configuration
|
||||||
|
header with a custom header, via the make PNGLIBCONF_H_PREBUILT
|
||||||
|
macro.
|
||||||
|
Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
|
||||||
|
with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
|
||||||
|
Removed scripts/makefile.elf. It has not worked since libpng-1.5.0beta14
|
||||||
|
due to elimination of the PNG_FUNCTION_EXPORT and PNG_DATA_EXPORT
|
||||||
|
definitions from pngconf.h.
|
||||||
|
Ensure that CMakeLists.txt makes the target "lib" directory before making
|
||||||
|
symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
|
||||||
|
Added opinion that the ECCN (Export Control Classification Number) for
|
||||||
|
libpng is EAR99 to the README file.
|
||||||
|
|
||||||
|
Version 1.7.0beta36 [September 27, 2014]
|
||||||
|
Updated scripts/makefiles from libpng-1.6.13beta04.
|
||||||
|
Minor updates to the manual from libpng-1.6.14beta04.
|
||||||
|
Fixed incorrect handling of the iTXt compression flag in pngrutil.c
|
||||||
|
(bug report by Shunsaku Hirata). Bug was introduced in libpng-1.6.0.
|
||||||
|
|
||||||
|
Version 1.7.0beta37 [September 28, 2014]
|
||||||
|
Merged scripts/*, pngvalid.c and pngfix.c with libpng-1.6.14beta04.
|
||||||
|
|
||||||
|
Version 1.7.0beta38 [October 17, 2014]
|
||||||
|
Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa
|
||||||
|
Removed unused "text_len" parameter from private function png_write_zTXt().
|
||||||
|
Conditionally compile some code in png_deflate_claim(), when
|
||||||
|
PNG_WARNINGS_SUPPORTED and PNG_ERROR_TEXT_SUPPORTED are disabled.
|
||||||
|
Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
|
||||||
|
Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
|
||||||
|
to pnglibconf.dfa.
|
||||||
|
Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
|
||||||
|
to make it possible to configure a libpng that supports iCCP but not TEXT.
|
||||||
|
Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
|
||||||
|
Only mark text chunks as written after successfully writing them.
|
||||||
|
|
||||||
|
Version 1.7.0beta39 [November 1, 2014]
|
||||||
|
Ported cosmetic changes from libpng-1.6.15beta02.
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
|
(subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe.
|
to subscribe)
|
||||||
|
or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
|
Glenn R-P
|
||||||
|
|||||||
66
AUTHORS
66
AUTHORS
@@ -1,66 +0,0 @@
|
|||||||
PNG REFERENCE LIBRARY AUTHORS
|
|
||||||
=============================
|
|
||||||
|
|
||||||
This is the list of PNG Reference Library ("libpng") Contributing
|
|
||||||
Authors, for copyright and licensing purposes.
|
|
||||||
|
|
||||||
* Adam Richter
|
|
||||||
* Andreas Dilger
|
|
||||||
* Chris Blume
|
|
||||||
* Cosmin Truta
|
|
||||||
* Dave Martindale
|
|
||||||
* Eric S. Raymond
|
|
||||||
* Gilles Vollant
|
|
||||||
* Glenn Randers-Pehrson
|
|
||||||
* Greg Roelofs
|
|
||||||
* Guy Eric Schalnat
|
|
||||||
* James Yu
|
|
||||||
* John Bowler
|
|
||||||
* Kevin Bracey
|
|
||||||
* Lucas Chollet
|
|
||||||
* Magnus Holmgren
|
|
||||||
* Mandar Sahastrabuddhe
|
|
||||||
* Manfred Schlaegl
|
|
||||||
* Mans Rullgard
|
|
||||||
* Matt Sarett
|
|
||||||
* Mike Klein
|
|
||||||
* Pascal Massimino
|
|
||||||
* Paul Schmidt
|
|
||||||
* Philippe Antoine
|
|
||||||
* Qiang Zhou
|
|
||||||
* Sam Bushell
|
|
||||||
* Samuel Williams
|
|
||||||
* Simon-Pierre Cadieux
|
|
||||||
* Tim Wegner
|
|
||||||
* Tom Lane
|
|
||||||
* Tom Tanner
|
|
||||||
* Vadim Barkov
|
|
||||||
* Willem van Schaik
|
|
||||||
* Zhijie Liang
|
|
||||||
* Apple Inc.
|
|
||||||
- Zixu Wang (王子旭)
|
|
||||||
* Arm Holdings
|
|
||||||
- Richard Townsend
|
|
||||||
* Google LLC
|
|
||||||
- Dan Field
|
|
||||||
- Dragoș Tiselice
|
|
||||||
- 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
|
|
||||||
files in the "projects", "scripts" and "tests" directories, have
|
|
||||||
other copyright owners, but are released under the libpng license.
|
|
||||||
|
|
||||||
Some files in the "ci" and "contrib" directories, as well as some
|
|
||||||
of the tools-generated files that are distributed with libpng, have
|
|
||||||
other copyright owners, and are released under other open source
|
|
||||||
licenses.
|
|
||||||
1373
CMakeLists.txt
1373
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
251
INSTALL
251
INSTALL
@@ -1,25 +1,24 @@
|
|||||||
Installing libpng
|
|
||||||
|
Installing libpng
|
||||||
|
|
||||||
Contents
|
Contents
|
||||||
|
|
||||||
I. Simple installation
|
I. Simple installation
|
||||||
II. Rebuilding the configure scripts
|
II. Rebuilding the configure scripts
|
||||||
III. Using scripts/makefile*
|
III. Using scripts/makefile*
|
||||||
IV. Using cmake
|
IV. Using cmake
|
||||||
V. Directory structure
|
V. Directory structure
|
||||||
VI. Building with project files
|
VI. Building with project files
|
||||||
VII. Building with makefiles
|
VII. Building with makefiles
|
||||||
VIII. Configuring libpng for 16-bit platforms
|
VIII. Configuring libpng for 16-bit platforms
|
||||||
IX. Configuring for DOS
|
IX. Configuring for DOS
|
||||||
X. Configuring for Medium Model
|
X. Configuring for Medium Model
|
||||||
XI. Prepending a prefix to exported symbols
|
XI. Prepending a prefix to exported symbols
|
||||||
XII. Configuring for compiler xxx:
|
XII. Configuring for compiler xxx:
|
||||||
XIII. Removing unwanted object code
|
XIII. Removing unwanted object code
|
||||||
XIV. Enabling or disabling hardware optimizations
|
XIV. 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
|
XV. Configuring libpng for multiprocessing
|
||||||
XVI. Setjmp/longjmp issues
|
XVI. Other sources of information about libpng
|
||||||
XVII. Common linking failures
|
|
||||||
XVIII. Other sources of information about libpng
|
|
||||||
|
|
||||||
I. Simple installation
|
I. Simple installation
|
||||||
|
|
||||||
@@ -48,9 +47,7 @@ If configure does not work on your system, or if you have a need to
|
|||||||
change configure.ac or Makefile.am, and you have a reasonably
|
change configure.ac or Makefile.am, and you have a reasonably
|
||||||
up-to-date set of tools, running ./autogen.sh in a git clone before
|
up-to-date set of tools, running ./autogen.sh in a git clone before
|
||||||
running ./configure may fix the problem. To be really sure that you
|
running ./configure may fix the problem. To be really sure that you
|
||||||
aren't using any of the included pre-built scripts, especially if you
|
aren't using any of the included pre-built scripts, you can do this:
|
||||||
are building from a tar distribution instead of a git distribution,
|
|
||||||
do this:
|
|
||||||
|
|
||||||
./configure --enable-maintainer-mode
|
./configure --enable-maintainer-mode
|
||||||
make maintainer-clean
|
make maintainer-clean
|
||||||
@@ -78,8 +75,8 @@ Or you can use one of the "projects" in the "projects" directory.
|
|||||||
|
|
||||||
Before installing libpng, you must first install zlib, if it
|
Before installing libpng, you must first install zlib, if it
|
||||||
is not already on your system. zlib can usually be found
|
is not already on your system. zlib can usually be found
|
||||||
wherever you got libpng; otherwise go to https://zlib.net/. You can
|
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
||||||
place zlib in the same directory as libpng or in another directory.
|
zlib in in the same directory as libpng or in another directory.
|
||||||
|
|
||||||
If your system already has a preinstalled zlib you will still need
|
If your system already has a preinstalled zlib you will still need
|
||||||
to have access to the zlib.h and zconf.h include files that
|
to have access to the zlib.h and zconf.h include files that
|
||||||
@@ -90,24 +87,22 @@ standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
|
|||||||
and LD_LIBRARY_PATH in your environment before running "make test"
|
and LD_LIBRARY_PATH in your environment before running "make test"
|
||||||
or "make distcheck":
|
or "make distcheck":
|
||||||
|
|
||||||
ZLIBLIB=/path/to/lib export ZLIBLIB
|
ZLIBLIB=/path/to/lib export ZLIBLIB
|
||||||
ZLIBINC=/path/to/include export ZLIBINC
|
ZLIBINC=/path/to/include export ZLIBINC
|
||||||
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
|
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
|
||||||
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
||||||
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
||||||
|
|
||||||
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
||||||
in your environment and type
|
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
|
||||||
|
|
||||||
make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test
|
|
||||||
|
|
||||||
IV. Using cmake
|
IV. Using cmake
|
||||||
|
|
||||||
If you want to use "cmake" (see www.cmake.org), type
|
If you want to use "cmake" (see www.cmake.org), type
|
||||||
|
|
||||||
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
As when using the simple configure method described above, "/path" points to
|
As when using the simple configure method described above, "/path" points to
|
||||||
the installation directory where you want to put the libpng "lib", "include",
|
the installation directory where you want to put the libpng "lib", "include",
|
||||||
@@ -121,24 +116,22 @@ or "zlib128") so that you have directories called "zlib" and "libpng".
|
|||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
.. (the parent directory)
|
.. (the parent directory)
|
||||||
libpng (this directory)
|
libpng (this directory)
|
||||||
INSTALL (this file)
|
INSTALL (this file)
|
||||||
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 +139,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 +147,23 @@ 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
|
||||||
|
|
||||||
UNIX example:
|
MSDOS example: copy scripts\makefile.msc makefile
|
||||||
|
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||||
cp scripts/makefile.std Makefile
|
UNIX example: 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 +180,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 then 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 +220,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,14 +232,14 @@ 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
|
||||||
never going to use a capability, you can change the #define to #undef
|
never going to use a capability, you can change the #define to #undef
|
||||||
before recompiling libpng and save yourself code and data space, or
|
before recompiling libpng and save yourself code and data space, or
|
||||||
you can turn off individual capabilities with defines that begin with
|
you can turn off individual capabilities with defines that begin with
|
||||||
"PNG_NO_".
|
PNG_NO_.
|
||||||
|
|
||||||
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
||||||
|
|
||||||
@@ -279,61 +271,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. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||||
|
|
||||||
Certain hardware capabilities, such as the Intel SSE instructions,
|
|
||||||
are normally detected at run time. Enable them with configure options
|
|
||||||
such as one of
|
|
||||||
|
|
||||||
--enable-arm-neon=yes
|
|
||||||
--enable-mips-msa=yes
|
|
||||||
--enable-intel-sse=yes
|
|
||||||
--enable-powerpc-vsx=yes
|
|
||||||
--enable-riscv-rvv=yes
|
|
||||||
|
|
||||||
or enable them all at once with
|
|
||||||
|
|
||||||
--enable-hardware-optimizations=yes
|
|
||||||
|
|
||||||
or, if you are not using "configure", you can use one
|
|
||||||
or more of
|
|
||||||
|
|
||||||
CPPFLAGS += "-DPNG_ARM_NEON"
|
|
||||||
CPPFLAGS += "-DPNG_MIPS_MSA"
|
|
||||||
CPPFLAGS += "-DPNG_INTEL_SSE"
|
|
||||||
CPPFLAGS += "-DPNG_POWERPC_VSX"
|
|
||||||
CPPFLAGS += "-DPNG_RISCV_RVV"
|
|
||||||
|
|
||||||
See for example scripts/makefile.linux-opt
|
|
||||||
|
|
||||||
If you wish to avoid using them,
|
|
||||||
you can disable them via the configure option
|
|
||||||
|
|
||||||
--disable-hardware-optimizations
|
|
||||||
|
|
||||||
to disable them all, or
|
|
||||||
|
|
||||||
--enable-intel-sse=no
|
|
||||||
|
|
||||||
to disable a particular one,
|
|
||||||
or via compiler-command options such as
|
|
||||||
|
|
||||||
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_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"
|
|
||||||
by default. To disable them, use
|
|
||||||
|
|
||||||
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
|
|
||||||
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no \
|
|
||||||
-DPNG_RISCV_RVV=no
|
|
||||||
|
|
||||||
or disable them all at once with
|
|
||||||
|
|
||||||
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
|
|
||||||
|
|
||||||
XIII. 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
|
||||||
@@ -369,7 +307,7 @@ only png_longjmp_ptr, which must match the C longjmp function.) The new
|
|||||||
approach is documented in pngconf.h
|
approach is documented in pngconf.h
|
||||||
|
|
||||||
Despite these changes, libpng 1.5.0 only supports the native C function
|
Despite these changes, libpng 1.5.0 only supports the native C function
|
||||||
calling standard on those platforms tested so far ("__cdecl" on Microsoft
|
calling standard on those platforms tested so far (__cdecl on Microsoft
|
||||||
Windows). This is because the support requirements for alternative
|
Windows). This is because the support requirements for alternative
|
||||||
calling conventions seem to no longer exist. Developers who find it
|
calling conventions seem to no longer exist. Developers who find it
|
||||||
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
||||||
@@ -424,7 +362,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
|
XV. Configuring libpng for multiprocessing
|
||||||
|
|
||||||
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
|
||||||
@@ -433,35 +371,32 @@ your application is going to be using multiple threads, you should
|
|||||||
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
|
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
|
||||||
-DPNG_NO_SETJMP on your compile line, or with
|
-DPNG_NO_SETJMP on your compile line, or with
|
||||||
|
|
||||||
#undef PNG_SETJMP_SUPPORTED
|
#undef PNG_SETJMP_SUPPORTED
|
||||||
|
|
||||||
in your pnglibconf.h or pngusr.h.
|
in your pnglibconf.h or pngusr.h.
|
||||||
|
|
||||||
Starting with libpng-1.6.0, the library included a "simplified API".
|
|
||||||
This requires setjmp/longjmp, so you must either build the library
|
|
||||||
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
|
||||||
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
|
||||||
|
|
||||||
XV. Common linking failures
|
|
||||||
|
|
||||||
If your application fails to find libpng or zlib entries while linking:
|
|
||||||
|
|
||||||
Be sure "-lz" appears after "-lpng" on your linking command.
|
|
||||||
|
|
||||||
Be sure you have built libpng, zlib, and your application for the
|
|
||||||
same platform (e.g., 32-bit or 64-bit).
|
|
||||||
|
|
||||||
If you are using the vstudio project, observe the WARNING in
|
|
||||||
project/vstudio/README.txt.
|
|
||||||
|
|
||||||
XVI. Other sources of information about libpng:
|
XVI. 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
|
Using the ./configure script -- 16 December 2002.
|
||||||
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
|
=================================================
|
||||||
This document is released under the libpng license.
|
|
||||||
For conditions of distribution and use, see the disclaimer
|
The ./configure script should work compatibly with what scripts/makefile.*
|
||||||
and license in png.h.
|
did, however there are some options you might need to add to configure
|
||||||
|
explicitly, which previously was done semi-automatically (if you didn't edit
|
||||||
|
scripts/makefile.* yourself, that is)
|
||||||
|
|
||||||
|
CFLAGS="-Wall -O -funroll-loops \
|
||||||
|
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||||
|
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||||
|
|
||||||
|
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||||
|
/usr/include/libpng17, or whatever.
|
||||||
|
|
||||||
|
If you find that the configure script is out-of-date or is not supporting
|
||||||
|
your platform properly, try running autogen.sh to regenerate "configure",
|
||||||
|
"Makefile.in", and the other configuration files. Then try configure again.
|
||||||
|
|
||||||
|
|||||||
181
LICENSE
181
LICENSE
@@ -1,134 +1,111 @@
|
|||||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
PNG Reference Library License version 2
|
This copy of the libpng notices is provided for your convenience. In case of
|
||||||
---------------------------------------
|
any discrepancy between this copy and the notices in the file png.h that is
|
||||||
|
included in the libpng distribution, the latter shall prevail.
|
||||||
|
|
||||||
* Copyright (c) 1995-2025 The PNG Reference Library Authors.
|
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||||
* Copyright (c) 2018-2025 Cosmin Truta.
|
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
|
||||||
|
|
||||||
The software is supplied "as is", without warranty of any kind,
|
If you modify libpng you may insert additional notices immediately following
|
||||||
express or implied, including, without limitation, the warranties
|
this sentence.
|
||||||
of merchantability, fitness for a particular purpose, title, and
|
|
||||||
non-infringement. In no event shall the Copyright owners, or
|
|
||||||
anyone distributing the software, be liable for any damages or
|
|
||||||
other liability, whether in contract, tort or otherwise, arising
|
|
||||||
from, out of, or in connection with the software, or the use or
|
|
||||||
other dealings in the software, even if advised of the possibility
|
|
||||||
of such damage.
|
|
||||||
|
|
||||||
Permission is hereby granted to use, copy, modify, and distribute
|
This code is released under the libpng license.
|
||||||
this software, or portions hereof, for any purpose, without fee,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you
|
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta39, November 1, 2014, are
|
||||||
must not claim that you wrote the original software. If you
|
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||||
use this software in a product, an acknowledgment in the product
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
documentation would be appreciated, but is not required.
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and must
|
Cosmin Truta
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This Copyright notice may not be removed or altered from any
|
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
|
||||||
source or altered source distribution.
|
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
||||||
|
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||||
|
with the following individuals added to the list of Contributing Authors
|
||||||
|
|
||||||
|
Simon-Pierre Cadieux
|
||||||
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
Eric S. Raymond
|
||||||
-----------------------------------------------------------------------
|
Gilles Vollant
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
|
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
|
||||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
|
||||||
added to the list of Contributing Authors:
|
|
||||||
|
|
||||||
Simon-Pierre Cadieux
|
|
||||||
Eric S. Raymond
|
|
||||||
Mans Rullgard
|
|
||||||
Cosmin Truta
|
|
||||||
Gilles Vollant
|
|
||||||
James Yu
|
|
||||||
Mandar Sahastrabuddhe
|
|
||||||
Google Inc.
|
|
||||||
Vadim Barkov
|
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
There is no warranty against interference with your enjoyment of
|
There is no warranty against interference with your enjoyment of the
|
||||||
the library or against infringement. There is no warranty that our
|
library or against infringement. There is no warranty that our
|
||||||
efforts or the library will fulfill any of your particular purposes
|
efforts or the library will fulfill any of your particular purposes
|
||||||
or needs. This library is provided with all faults, and the entire
|
or needs. This library is provided with all faults, and the entire
|
||||||
risk of satisfactory quality, performance, accuracy, and effort is
|
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
with the user.
|
the user.
|
||||||
|
|
||||||
Some files in the "contrib" directory and some configure-generated
|
|
||||||
files that are distributed with libpng have other copyright owners, and
|
|
||||||
are released under other open source licenses.
|
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
|
||||||
libpng-0.96, and are distributed according to the same disclaimer and
|
distributed according to the same disclaimer and license as libpng-0.96,
|
||||||
license as libpng-0.96, with the following individuals added to the
|
with the following individuals added to the list of Contributing Authors:
|
||||||
list of Contributing Authors:
|
|
||||||
|
|
||||||
Tom Lane
|
Tom Lane
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
Willem van Schaik
|
Willem van Schaik
|
||||||
|
|
||||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||||
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
and are distributed according to the same disclaimer and license as
|
Distributed according to the same disclaimer and license as libpng-0.88,
|
||||||
libpng-0.88, with the following individuals added to the list of
|
with the following individuals added to the list of Contributing Authors:
|
||||||
Contributing Authors:
|
|
||||||
|
|
||||||
John Bowler
|
John Bowler
|
||||||
Kevin Bracey
|
Kevin Bracey
|
||||||
Sam Bushell
|
Sam Bushell
|
||||||
Magnus Holmgren
|
Magnus Holmgren
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
Tom Tanner
|
Tom Tanner
|
||||||
|
|
||||||
Some files in the "scripts" directory have other copyright owners,
|
|
||||||
but are released under this license.
|
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
For the purposes of this copyright and license, "Contributing Authors"
|
For the purposes of this copyright and license, "Contributing Authors"
|
||||||
is defined as the following set of individuals:
|
is defined as the following set of individuals:
|
||||||
|
|
||||||
Andreas Dilger
|
Andreas Dilger
|
||||||
Dave Martindale
|
Dave Martindale
|
||||||
Guy Eric Schalnat
|
Guy Eric Schalnat
|
||||||
Paul Schmidt
|
Paul Schmidt
|
||||||
Tim Wegner
|
Tim Wegner
|
||||||
|
|
||||||
The PNG Reference Library is supplied "AS IS". The Contributing
|
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||||
Authors and Group 42, Inc. disclaim all warranties, expressed or
|
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||||
implied, including, without limitation, the warranties of
|
including, without limitation, the warranties of merchantability and of
|
||||||
merchantability and of fitness for any purpose. The Contributing
|
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||||
Authors and Group 42, Inc. assume no liability for direct, indirect,
|
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||||
incidental, special, exemplary, or consequential damages, which may
|
or consequential damages, which may result from the use of the PNG
|
||||||
result from the use of the PNG Reference Library, even if advised of
|
Reference Library, even if advised of the possibility of such damage.
|
||||||
the possibility of such damage.
|
|
||||||
|
|
||||||
Permission is hereby granted to use, copy, modify, and distribute this
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
source code, or portions hereof, for any purpose, without fee, subject
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
to the following restrictions:
|
to the following restrictions:
|
||||||
|
|
||||||
1. The origin of this source code must not be misrepresented.
|
1. The origin of this source code must not be misrepresented.
|
||||||
|
|
||||||
2. Altered versions must be plainly marked as such and must not
|
2. Altered versions must be plainly marked as such and must not
|
||||||
be misrepresented as being the original source.
|
be misrepresented as being the original source.
|
||||||
|
|
||||||
3. This Copyright notice may not be removed or altered from any
|
3. This Copyright notice may not be removed or altered from any
|
||||||
source or altered source distribution.
|
source or altered source distribution.
|
||||||
|
|
||||||
The Contributing Authors and Group 42, Inc. specifically permit,
|
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
without fee, and encourage the use of this source code as a component
|
fee, and encourage the use of this source code as a component to
|
||||||
to supporting the PNG file format in commercial products. If you use
|
supporting the PNG file format in commercial products. If you use this
|
||||||
this source code in a product, acknowledgment is not required but would
|
source code in a product, acknowledgment is not required but would be
|
||||||
be appreciated.
|
appreciated.
|
||||||
|
|
||||||
|
|
||||||
|
A "png_get_copyright" function is available, for convenient use in "about"
|
||||||
|
boxes and the like:
|
||||||
|
|
||||||
|
printf("%s",png_get_copyright(NULL));
|
||||||
|
|
||||||
|
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||||
|
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||||
|
|
||||||
|
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
||||||
|
certification mark of the Open Source Initiative.
|
||||||
|
|
||||||
|
Glenn Randers-Pehrson
|
||||||
|
glennrp at users.sourceforge.net
|
||||||
|
November 1, 2014
|
||||||
|
|||||||
140
Makefile.am
140
Makefile.am
@@ -1,32 +1,16 @@
|
|||||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
# Makefile.am:
|
||||||
|
# Source file for Makefile.in (and hence Makefile)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018-2025 Cosmin Truta
|
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
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
|
||||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
|
||||||
if HAVE_CLOCK_GETTIME
|
|
||||||
check_PROGRAMS += timepng
|
|
||||||
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 +22,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
|
||||||
|
|
||||||
@@ -54,41 +37,36 @@ pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
|||||||
pngimage_SOURCES = contrib/libtests/pngimage.c
|
pngimage_SOURCES = contrib/libtests/pngimage.c
|
||||||
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
timepng_SOURCES = contrib/libtests/timepng.c
|
|
||||||
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
|
|
||||||
|
|
||||||
# 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/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\
|
||||||
tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
|
tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
|
||||||
tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
|
tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
|
||||||
tests/pngvalid-progressive-size\
|
tests/pngvalid-progressive-interlace-size\
|
||||||
tests/pngvalid-progressive-interlace-standard\
|
tests/pngvalid-progressive-interlace-standard\
|
||||||
tests/pngvalid-transform\
|
tests/pngvalid-progressive-interlace-transform\
|
||||||
tests/pngvalid-progressive-standard tests/pngvalid-standard\
|
tests/pngvalid-progressive-standard tests/pngvalid-standard\
|
||||||
tests/pngstest-1.8 tests/pngstest-1.8-alpha tests/pngstest-linear\
|
tests/pngstest-0g01 tests/pngstest-0g02 tests/pngstest-0g04\
|
||||||
tests/pngstest-linear-alpha tests/pngstest-none tests/pngstest-none-alpha\
|
tests/pngstest-0g08 tests/pngstest-0g16 tests/pngstest-2c08\
|
||||||
tests/pngstest-sRGB tests/pngstest-sRGB-alpha tests/pngunknown-IDAT\
|
tests/pngstest-2c16 tests/pngstest-3p01 tests/pngstest-3p02\
|
||||||
|
tests/pngstest-3p04 tests/pngstest-3p08 tests/pngstest-4a08\
|
||||||
|
tests/pngstest-4a16 tests/pngstest-6a08 tests/pngstest-6a16\
|
||||||
|
tests/pngstest-error tests/pngunknown-IDAT\
|
||||||
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
|
|
||||||
|
# These tests are expected, and required, to fail:
|
||||||
|
XFAIL_TESTS = tests/pngstest-error
|
||||||
|
|
||||||
# man pages
|
# man pages
|
||||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||||
@@ -108,46 +86,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
|
|
||||||
endif
|
|
||||||
|
|
||||||
if PNG_MIPS_MSA
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
|
|
||||||
mips/filter_msa_intrinsics.c
|
|
||||||
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
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
|
|
||||||
intel/filter_sse2_intrinsics.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if PNG_POWERPC_VSX
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
|
|
||||||
powerpc/filter_vsx_intrinsics.c
|
|
||||||
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
|
endif
|
||||||
|
|
||||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
@@ -170,14 +109,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
|
||||||
@@ -192,37 +123,36 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
|||||||
# from those directories being included. This only works if the configure is
|
# from those directories being included. This only works if the configure is
|
||||||
# not done in the source directory!
|
# not done in the source directory!
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
||||||
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
|
||||||
|
|
||||||
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk
|
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
|
||||||
|
|
||||||
CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
||||||
check.new pnglibconf.h pngprefix.h symbols.new pngtest-log.txt \
|
check.new pnglibconf.* pngprefix.h symbols.new pngtest-log.txt \
|
||||||
pnglibconf.out pnglibconf.c pnglibconf.pre pnglibconf.dfn \
|
|
||||||
$(SCRIPT_CLEANFILES)
|
$(SCRIPT_CLEANFILES)
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
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}
|
||||||
|
|
||||||
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
|
# DFNCPP is normally just "CPP -E" - the C preprocessor - but on Solaris and
|
||||||
# other operating systems (NeXT?) the C preprocessor selected by configure
|
# maybe other operating systems (NeXT?) the C preprocessor selected by configure
|
||||||
# checks input tokens for validity - effectively it performs part of the ANSI-C
|
# checks input tokens for validity - effectively it performs part of the ANSI-C
|
||||||
# parsing - and therefore fails with the .df files. configure.ac has special
|
# parsing - and therefore fails with the .df files. configure.ac has special
|
||||||
# checks for this and sets DFNCPP appropriately.
|
# checks for this and sets DFNCPP appropriately.
|
||||||
DFNCPP = @DFNCPP@
|
DFNCPP = @DFNCPP@
|
||||||
|
|
||||||
SUFFIXES = .chk .out
|
SUFFIXES = .chk .dfn .out
|
||||||
|
|
||||||
$(PNGLIB_BASENAME).pc: libpng.pc
|
$(PNGLIB_BASENAME).pc: libpng.pc
|
||||||
cp libpng.pc $@
|
cp libpng.pc $@
|
||||||
@@ -235,6 +165,8 @@ scripts/prefix.out: png.h pngconf.h pnglibconf.out
|
|||||||
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
|
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
|
||||||
scripts/intprefix.out: pnglibconf.h
|
scripts/intprefix.out: pnglibconf.h
|
||||||
|
|
||||||
|
pnglibconf.out: config.h
|
||||||
|
|
||||||
libpng.sym: scripts/sym.out
|
libpng.sym: scripts/sym.out
|
||||||
rm -f $@
|
rm -f $@
|
||||||
cp $? $@
|
cp $? $@
|
||||||
@@ -246,7 +178,7 @@ if DO_PNG_PREFIX
|
|||||||
# Rename functions in scripts/prefix.out with a PNG_PREFIX prefix.
|
# Rename functions in scripts/prefix.out with a PNG_PREFIX prefix.
|
||||||
# Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual
|
# Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual
|
||||||
# implementation of the macro).
|
# implementation of the macro).
|
||||||
pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst
|
pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst config.h
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(AWK) 's==0 && NR>1{print prev}\
|
$(AWK) 's==0 && NR>1{print prev}\
|
||||||
s==0{prev=$$0}\
|
s==0{prev=$$0}\
|
||||||
@@ -294,7 +226,6 @@ contrib/libtests/timepng.o: pnglibconf.h
|
|||||||
|
|
||||||
contrib/tools/makesRGB.o: pnglibconf.h
|
contrib/tools/makesRGB.o: pnglibconf.h
|
||||||
contrib/tools/pngfix.o: pnglibconf.h
|
contrib/tools/pngfix.o: pnglibconf.h
|
||||||
contrib/tools/pngcp.o: pnglibconf.h
|
|
||||||
|
|
||||||
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
||||||
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
||||||
@@ -308,17 +239,18 @@ if DO_PNG_PREFIX
|
|||||||
SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
|
SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.c.out:
|
.dfn.out:
|
||||||
rm -f $@ $*.tf[12]
|
rm -f $@ $*.c $*.tf[12]
|
||||||
test -d scripts || mkdir scripts || test -d scripts
|
test -d scripts || mkdir scripts || test -d scripts
|
||||||
|
echo '#include "$<"' >$*.c
|
||||||
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
|
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
|
||||||
$(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1
|
$(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
|
||||||
$(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
|
$(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
|
||||||
rm -f $*.tf1
|
rm -f $*.c $*.tf1
|
||||||
mv $*.tf2 $@
|
mv $*.tf2 $@
|
||||||
|
|
||||||
# The .c file for pnglibconf.h is machine generated
|
# The .dfn file for pnglibconf.h is machine generated
|
||||||
pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
|
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
|
||||||
rm -f $@ $*.tf[45]
|
rm -f $@ $*.tf[45]
|
||||||
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
|
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
|
||||||
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
|
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
|
||||||
@@ -338,7 +270,7 @@ scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.ou
|
|||||||
|
|
||||||
# used on demand to regenerate the standard header, CPPFLAGS should
|
# used on demand to regenerate the standard header, CPPFLAGS should
|
||||||
# be empty - no non-standard defines
|
# be empty - no non-standard defines
|
||||||
scripts/pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
|
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
|
||||||
rm -f $@ pnglibconf.tf[67]
|
rm -f $@ pnglibconf.tf[67]
|
||||||
test -z "$(CPPFLAGS)"
|
test -z "$(CPPFLAGS)"
|
||||||
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
||||||
|
|||||||
2610
Makefile.in
2610
Makefile.in
File diff suppressed because it is too large
Load Diff
343
README
343
README
@@ -1,88 +1,56 @@
|
|||||||
README for libpng version 1.6.51.git
|
README for libpng version 1.7.0beta39 - November 1, 2014 (shared library 17.0)
|
||||||
====================================
|
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,
|
||||||
files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings.
|
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 in
|
||||||
For usage information and restrictions (what little they are) on libpng,
|
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 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,93 +60,156 @@ 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
|
The changes made to the library, and bugs fixed are based on discussions
|
||||||
Windows DLL, and new APIs for accessing data in the `info_struct`.
|
on the PNG-implement mailing list and not on material submitted
|
||||||
Experimental functions included the ability to set weighting and cost
|
privately to Guy, Andreas, or Glenn. They will forward any good
|
||||||
factors for row filter selection, direct reads of integers from buffers
|
suggestions to the list.
|
||||||
on big-endian processors that support misaligned data access, faster
|
|
||||||
methods of doing alpha composition, and more accurate 16-to-8 bit color
|
|
||||||
conversion. Some of these experimental functions, such as the weighted
|
|
||||||
filter heuristics, have since been removed.
|
|
||||||
|
|
||||||
Files included in this distribution
|
For a detailed description on using libpng, read libpng-manual.txt. For
|
||||||
-----------------------------------
|
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||||
|
information and restrictions (what little they are) on libpng, see
|
||||||
|
png.h. For a description on using zlib (the compression library used by
|
||||||
|
libpng) and zlib's restrictions, see zlib.h
|
||||||
|
|
||||||
ANNOUNCE => Announcement of this version, with recent changes
|
I have included a general makefile, as well as several machine and
|
||||||
AUTHORS => List of contributing authors
|
compiler specific ones, but you may have to modify one for your own needs.
|
||||||
CHANGES => Description of changes between libpng versions
|
|
||||||
INSTALL => Instructions to install libpng
|
|
||||||
LICENSE => License to use and redistribute libpng
|
|
||||||
README => This file
|
|
||||||
TODO => Things not implemented in the current library
|
|
||||||
TRADEMARK => Trademark information
|
|
||||||
example.c => Example code for using libpng functions
|
|
||||||
libpng.3 => Manual page for libpng (includes libpng-manual.txt)
|
|
||||||
libpng-manual.txt => Description of libpng and its functions
|
|
||||||
libpngpf.3 => Manual page for libpng's private functions (deprecated)
|
|
||||||
png.5 => Manual page for the PNG format
|
|
||||||
png.c => Basic interface functions common to library
|
|
||||||
png.h => Library function and interface declarations (public)
|
|
||||||
pngpriv.h => Library function and interface declarations (private)
|
|
||||||
pngconf.h => System specific library configuration (public)
|
|
||||||
pngstruct.h => png_struct declaration (private)
|
|
||||||
pnginfo.h => png_info struct declaration (private)
|
|
||||||
pngdebug.h => debugging macros (private)
|
|
||||||
pngerror.c => Error/warning message I/O functions
|
|
||||||
pngget.c => Functions for retrieving info from struct
|
|
||||||
pngmem.c => Memory handling functions
|
|
||||||
pngbar.png => PNG logo, 88x31
|
|
||||||
pngnow.png => PNG logo, 98x31
|
|
||||||
pngpread.c => Progressive reading functions
|
|
||||||
pngread.c => Read data/helper high-level functions
|
|
||||||
pngrio.c => Lowest-level data read I/O functions
|
|
||||||
pngrtran.c => Read data transformation functions
|
|
||||||
pngrutil.c => Read data utility functions
|
|
||||||
pngset.c => Functions for storing data into the info_struct
|
|
||||||
pngtest.c => Library test program
|
|
||||||
pngtest.png => Library test sample image
|
|
||||||
pngtrans.c => Common data transformation functions
|
|
||||||
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/ => Optimized code for ARM Neon
|
|
||||||
intel/ => Optimized code for INTEL SSE2
|
|
||||||
loongarch/ => Optimized code for LoongArch LSX
|
|
||||||
mips/ => Optimized code for MIPS MSA and MIPS MMI
|
|
||||||
powerpc/ => Optimized code for PowerPC VSX
|
|
||||||
riscv/ => Optimized code for the RISC-V platform
|
|
||||||
ci/ => Scripts for continuous integration
|
|
||||||
contrib/ => External contributions
|
|
||||||
arm-neon/ => Optimized code for the ARM-NEON platform
|
|
||||||
mips-msa/ => Optimized code for the MIPS-MSA platform
|
|
||||||
powerpc-vsx/ => Optimized code for the POWERPC-VSX platform
|
|
||||||
examples/ => Examples of libpng usage
|
|
||||||
gregbook/ => Source code for PNG reading and writing, from
|
|
||||||
"PNG: The Definitive Guide" by Greg Roelofs,
|
|
||||||
O'Reilly, 1999
|
|
||||||
libtests/ => Test programs
|
|
||||||
pngexif/ => Program to inspect the EXIF information in PNG files
|
|
||||||
pngminim/ => Minimal decoder, encoder, and progressive decoder
|
|
||||||
programs demonstrating the use of pngusr.dfa
|
|
||||||
pngminus/ => Simple pnm2png and png2pnm programs
|
|
||||||
pngsuite/ => Test images
|
|
||||||
riscv-rvv/ => Optimized code for the RISC-V Vector platform
|
|
||||||
testpngs/ => Test images
|
|
||||||
tools/ => Various tools
|
|
||||||
visupng/ => VisualPng, a Windows viewer for PNG images
|
|
||||||
projects/ => Project files and workspaces for various IDEs
|
|
||||||
owatcom/ => OpenWatcom project
|
|
||||||
visualc71/ => Microsoft Visual C++ 7.1 workspace
|
|
||||||
vstudio/ => Microsoft Visual Studio workspace
|
|
||||||
scripts/ => Scripts and makefiles for building libpng
|
|
||||||
(see scripts/README.txt for the complete list)
|
|
||||||
tests/ => Test scripts
|
|
||||||
|
|
||||||
Good luck, and happy coding!
|
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
||||||
|
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||||
|
versions which can cause the output of invalid compression streams for
|
||||||
|
some images. You will definitely need zlib 1.0.4 or later if you are
|
||||||
|
taking advantage of the MS-DOS "far" structure allocation for the small
|
||||||
|
and medium memory models. 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.
|
||||||
|
|
||||||
* Cosmin Truta (current maintainer, since 2018)
|
zlib should be available at the same place that libpng is, or at zlib.net.
|
||||||
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
|
|
||||||
* Andreas Eric Dilger (former maintainer, 1996-1997)
|
You may also want a copy of the PNG specification. It is available
|
||||||
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||||
(formerly of Group 42, Inc.)
|
these at http://www.libpng.org/pub/png/documents/
|
||||||
|
|
||||||
|
This code is currently being archived at libpng.sf.net in the
|
||||||
|
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
|
||||||
|
in any of those places, e-mail me, and I'll help you find it.
|
||||||
|
|
||||||
|
I am not a lawyer, but I believe that the Export Control Classification
|
||||||
|
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
controls or International Traffic in Arms Regulations (ITAR) because it
|
||||||
|
is open source, publicly available software, that does not contain any
|
||||||
|
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
|
||||||
|
|
||||||
|
If you have any code changes, requests, problems, etc., please e-mail
|
||||||
|
them to me. Also, I'd appreciate any make files or project files,
|
||||||
|
and any modifications you needed to make to get libpng to compile,
|
||||||
|
along with a #define variable to tell what compiler/system you are on.
|
||||||
|
If you needed to add transformations to libpng, or wish libpng would
|
||||||
|
provide the image in a different way, drop me a note (and code, if
|
||||||
|
possible), so I can consider supporting the transformation.
|
||||||
|
Finally, if you get any warning messages when compiling libpng
|
||||||
|
(note: not zlib), and they are easy to fix, I'd appreciate the
|
||||||
|
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||||
|
|
||||||
|
This release was created and will be supported by myself (of course
|
||||||
|
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
||||||
|
development group.
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to png-mng-implement at
|
||||||
|
lists.sourceforge.net (subscription required; visit
|
||||||
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
|
to subscribe) or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
|
You can't reach Guy, the original libpng author, at the addresses
|
||||||
|
given in previous versions of this document. He and Andreas will
|
||||||
|
read mail addressed to the png-implement list, however.
|
||||||
|
|
||||||
|
Please do not send general questions about PNG. Send them to
|
||||||
|
png-mng-misc at lists.sf.net (subscription required; visit
|
||||||
|
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
||||||
|
subscribe). If you have a question about something
|
||||||
|
in the PNG specification that is related to using libpng, send it
|
||||||
|
to me. Send me any questions that start with "I was using libpng,
|
||||||
|
and ...". If in doubt, send questions to me. I'll bounce them
|
||||||
|
to others, if necessary.
|
||||||
|
|
||||||
|
Please do not send suggestions on how to change PNG. We have
|
||||||
|
been discussing PNG for nineteen years now, and it is official and
|
||||||
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
|
it may be used later.
|
||||||
|
|
||||||
|
Files in this distribution:
|
||||||
|
|
||||||
|
ANNOUNCE => Announcement of this version, with recent changes
|
||||||
|
CHANGES => Description of changes between libpng versions
|
||||||
|
KNOWNBUG => List of known bugs and deficiencies
|
||||||
|
LICENSE => License to use and redistribute libpng
|
||||||
|
README => This file
|
||||||
|
TODO => Things not implemented in the current library
|
||||||
|
Y2KINFO => Statement of Y2K compliance
|
||||||
|
example.c => Example code for using libpng functions
|
||||||
|
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||||
|
libpng-manual.txt => Description of libpng and its functions
|
||||||
|
libpngpf.3 => manual page for libpng's private functions
|
||||||
|
png.5 => manual page for the PNG format
|
||||||
|
png.c => Basic interface functions common to library
|
||||||
|
png.h => Library function and interface declarations (public)
|
||||||
|
pngpriv.h => Library function and interface declarations (private)
|
||||||
|
pngconf.h => System specific library configuration (public)
|
||||||
|
pngstruct.h => png_struct declaration (private)
|
||||||
|
pnginfo.h => png_info struct declaration (private)
|
||||||
|
pngdebug.h => debugging macros (private)
|
||||||
|
pngerror.c => Error/warning message I/O functions
|
||||||
|
pngget.c => Functions for retrieving info from struct
|
||||||
|
pngmem.c => Memory handling functions
|
||||||
|
pngbar.png => PNG logo, 88x31
|
||||||
|
pngnow.png => PNG logo, 98x31
|
||||||
|
pngpread.c => Progressive reading functions
|
||||||
|
pngread.c => Read data/helper high-level functions
|
||||||
|
pngrio.c => Lowest-level data read I/O functions
|
||||||
|
pngrtran.c => Read data transformation functions
|
||||||
|
pngrutil.c => Read data utility functions
|
||||||
|
pngset.c => Functions for storing data into the info_struct
|
||||||
|
pngtest.c => Library test program
|
||||||
|
pngtest.png => Library test sample image
|
||||||
|
pngtrans.c => Common data transformation functions
|
||||||
|
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
|
||||||
|
contrib => Contributions
|
||||||
|
examples => Example programs
|
||||||
|
gregbook => source code for PNG reading and writing, from
|
||||||
|
Greg Roelofs' "PNG: The Definitive Guide",
|
||||||
|
O'Reilly, 1999
|
||||||
|
libtests => Test programs
|
||||||
|
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||||
|
programs demonstrating use of pngusr.dfa
|
||||||
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
|
pngsuite => Test images
|
||||||
|
tools => Various tools
|
||||||
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
|
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.
|
||||||
|
|
||||||
|
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
||||||
|
Internet: glennrp at users.sourceforge.net
|
||||||
|
|
||||||
|
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
|
Internet: adilger at enel.ucalgary.ca
|
||||||
|
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||||
|
|
||||||
|
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||||
|
(formerly of Group 42, Inc)
|
||||||
|
Internet: gschal at infinet.com
|
||||||
|
|||||||
49
TODO
49
TODO
@@ -1,22 +1,29 @@
|
|||||||
TODO list for libpng
|
/*
|
||||||
--------------------
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
* Fix all defects (duh!)
|
Final bug fixes.
|
||||||
* cHRM transformation.
|
Better C++ wrapper/full C++ implementation?
|
||||||
* Palette creation.
|
Fix problem with C++ and EXTERN "C".
|
||||||
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
cHRM transformation.
|
||||||
* Improved dithering.
|
Remove setjmp/longjmp usage in favor of returning error codes.
|
||||||
* Multi-lingual error and warning message support.
|
Palette creation.
|
||||||
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
* Man pages for function calls.
|
Improved dithering.
|
||||||
* Better documentation.
|
Multi-lingual error and warning message support.
|
||||||
* Better filter selection
|
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||||
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
Make profile checking optional via a png_set_something() call.
|
||||||
* Histogram creation.
|
Man pages for function calls.
|
||||||
* Text conversion between different code pages (e.g., Latin-1 to Mac).
|
Better documentation.
|
||||||
* Avoid building gamma tables whenever possible.
|
Better filter selection
|
||||||
* Greater precision in changing to linear gamma for compositing against
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
background, and in doing rgb-to-gray transformations.
|
Histogram creation.
|
||||||
* Investigate pre-incremented loop counters and other loop constructions.
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
* Interpolated method of handling interlacing.
|
Avoid building gamma tables whenever possible.
|
||||||
* More validations for libpng transformations.
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
|
background and doing rgb-to-gray transformation.
|
||||||
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
|
Add interpolated method of handling interlacing.
|
||||||
|
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
||||||
|
Extend pngvalid.c to validate more of the libpng transformations.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
TRADEMARK
|
|
||||||
=========
|
|
||||||
|
|
||||||
The name "libpng" has not been registered by the Copyright owners
|
|
||||||
as a trademark in any jurisdiction. However, because libpng has
|
|
||||||
been distributed and maintained world-wide, continually since 1995,
|
|
||||||
the Copyright owners claim "common-law trademark protection" in any
|
|
||||||
jurisdiction where common-law trademark is recognized.
|
|
||||||
1378
aclocal.m4
vendored
1378
aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,21 +1,22 @@
|
|||||||
|
|
||||||
/* arm_init.c - NEON optimised filter functions
|
/* arm_init.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 2014,2016 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
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
*/
|
*/
|
||||||
|
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||||
/* This module requires POSIX 1003.1 functions. */
|
* called.
|
||||||
|
*/
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
|
|
||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
#if PNG_ARM_NEON_OPT > 0
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||||
/* WARNING: it is strongly recommended that you do not build libpng with
|
/* WARNING: it is strongly recommended that you do not build libpng with
|
||||||
@@ -30,30 +31,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
|
||||||
@@ -69,7 +65,6 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
|||||||
* wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF,
|
* wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF,
|
||||||
* as documented in png.h
|
* as documented in png.h
|
||||||
*/
|
*/
|
||||||
png_debug(1, "in png_init_filter_functions_neon");
|
|
||||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||||
switch ((pp->options >> PNG_ARM_NEON) & 3)
|
switch ((pp->options >> PNG_ARM_NEON) & 3)
|
||||||
{
|
{
|
||||||
@@ -135,4 +130,4 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
#endif /* READ */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|||||||
@@ -1,60 +1,246 @@
|
|||||||
/* filter_neon.S - placeholder file
|
|
||||||
|
/* filter_neon.S - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 Cosmin Truta
|
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||||
|
* Written by Mans Rullgard, 2011.
|
||||||
|
* Last changed in libpng 1.6.8 [December 19, 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* IMPORTANT NOTE:
|
/* This is required to get the symbol renames, which are #defines, and also
|
||||||
*
|
* includes the definition (or not) of PNG_ARM_NEON_OPT and
|
||||||
* Historically, the hand-coded assembler implementation of Neon optimizations
|
* PNG_ARM_NEON_IMPLEMENTATION.
|
||||||
* 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
|
|
||||||
* 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"
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
#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
|
||||||
|
.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_READ_SUPPORTED */
|
||||||
#endif /* READ */
|
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
|
||||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||||
*
|
*
|
||||||
|
* Last changed in libpng 1.6.8 [December 19, 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
|
||||||
@@ -12,16 +14,10 @@
|
|||||||
|
|
||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
|
|
||||||
/* 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)
|
#include <arm_neon.h>
|
||||||
# include <arm64_neon.h>
|
|
||||||
#else
|
|
||||||
# include <arm_neon.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
* however this code will only work with appropriate alignment. arm/arm_init.c
|
||||||
@@ -35,15 +31,11 @@
|
|||||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||||
* warning; note that the code is safe because there never is an alias between
|
* warning; note that the code is safe because there never is an alias between
|
||||||
* the input and output pointers.
|
* the input and output pointers.
|
||||||
*
|
|
||||||
* When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
|
|
||||||
* to vst4_lane_u32, because of an internal compiler error inside MSVC.
|
|
||||||
* To avoid this compiler bug, we use a temporary variable (vdest_val) to store
|
|
||||||
* the result of png_ldr.
|
|
||||||
*/
|
*/
|
||||||
#define png_ldr(type,pointer)\
|
#define png_ldr(type,pointer)\
|
||||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
#if PNG_ARM_NEON_OPT > 0
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -54,8 +46,6 @@ png_read_filter_row_up_neon(png_row_infop row_info, png_bytep row,
|
|||||||
png_bytep rp_stop = row + row_info->rowbytes;
|
png_bytep rp_stop = row + row_info->rowbytes;
|
||||||
png_const_bytep pp = prev_row;
|
png_const_bytep pp = prev_row;
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_up_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||||
{
|
{
|
||||||
uint8x16_t qrp, qpp;
|
uint8x16_t qrp, qpp;
|
||||||
@@ -81,8 +71,6 @@ png_read_filter_row_sub3_neon(png_row_infop row_info, png_bytep row,
|
|||||||
uint8x8x4_t vdest;
|
uint8x8x4_t vdest;
|
||||||
vdest.val[3] = vdup_n_u8(0);
|
vdest.val[3] = vdup_n_u8(0);
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_sub3_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop;)
|
for (; rp < rp_stop;)
|
||||||
{
|
{
|
||||||
uint8x8_t vtmp1, vtmp2;
|
uint8x8_t vtmp1, vtmp2;
|
||||||
@@ -124,23 +112,18 @@ png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
|
|||||||
uint8x8x4_t vdest;
|
uint8x8x4_t vdest;
|
||||||
vdest.val[3] = vdup_n_u8(0);
|
vdest.val[3] = vdup_n_u8(0);
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_sub4_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop; rp += 16)
|
for (; rp < rp_stop; rp += 16)
|
||||||
{
|
{
|
||||||
uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
uint8x8x4_t vrp = *vrpt;
|
uint8x8x4_t vrp = *vrpt;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
uint32x2x4_t vdest_val;
|
|
||||||
|
|
||||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
||||||
|
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
|
||||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PNG_UNUSED(prev_row)
|
PNG_UNUSED(prev_row)
|
||||||
@@ -164,8 +147,6 @@ png_read_filter_row_avg3_neon(png_row_infop row_info, png_bytep row,
|
|||||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||||
vrp = *vrpt;
|
vrp = *vrpt;
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_avg3_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop; pp += 12)
|
for (; rp < rp_stop; pp += 12)
|
||||||
{
|
{
|
||||||
uint8x8_t vtmp1, vtmp2, vtmp3;
|
uint8x8_t vtmp1, vtmp2, vtmp3;
|
||||||
@@ -225,15 +206,12 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
|||||||
uint8x8x4_t vdest;
|
uint8x8x4_t vdest;
|
||||||
vdest.val[3] = vdup_n_u8(0);
|
vdest.val[3] = vdup_n_u8(0);
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_avg4_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||||
{
|
{
|
||||||
uint32x2x4_t vtmp;
|
uint32x2x4_t vtmp;
|
||||||
uint8x8x4_t *vrpt, *vppt;
|
uint8x8x4_t *vrpt, *vppt;
|
||||||
uint8x8x4_t vrp, vpp;
|
uint8x8x4_t vrp, vpp;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
uint32x2x4_t vdest_val;
|
|
||||||
|
|
||||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
@@ -251,8 +229,7 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
|||||||
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||||
|
|
||||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,8 +279,6 @@ png_read_filter_row_paeth3_neon(png_row_infop row_info, png_bytep row,
|
|||||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||||
vrp = *vrpt;
|
vrp = *vrpt;
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_paeth3_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop; pp += 12)
|
for (; rp < rp_stop; pp += 12)
|
||||||
{
|
{
|
||||||
uint8x8x2_t *vppt;
|
uint8x8x2_t *vppt;
|
||||||
@@ -363,15 +338,12 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
|||||||
uint8x8x4_t vdest;
|
uint8x8x4_t vdest;
|
||||||
vdest.val[3] = vdup_n_u8(0);
|
vdest.val[3] = vdup_n_u8(0);
|
||||||
|
|
||||||
png_debug(1, "in png_read_filter_row_paeth4_neon");
|
|
||||||
|
|
||||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||||
{
|
{
|
||||||
uint32x2x4_t vtmp;
|
uint32x2x4_t vtmp;
|
||||||
uint8x8x4_t *vrpt, *vppt;
|
uint8x8x4_t *vrpt, *vppt;
|
||||||
uint8x8x4_t vrp, vpp;
|
uint8x8x4_t vrp, vpp;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
uint32x2x4_t vdest_val;
|
|
||||||
|
|
||||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
@@ -391,11 +363,10 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
|||||||
|
|
||||||
vlast = vpp.val[3];
|
vlast = vpp.val[3];
|
||||||
|
|
||||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
||||||
#endif /* READ */
|
|
||||||
|
|||||||
@@ -1,150 +0,0 @@
|
|||||||
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
|
||||||
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
|
|
||||||
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pngpriv.h"
|
|
||||||
|
|
||||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64)
|
|
||||||
# include <arm64_neon.h>
|
|
||||||
#else
|
|
||||||
# include <arm_neon.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
|
|
||||||
void
|
|
||||||
png_riffle_palette_neon(png_structrp png_ptr)
|
|
||||||
{
|
|
||||||
png_const_colorp palette = png_ptr->palette;
|
|
||||||
png_bytep riffled_palette = png_ptr->riffled_palette;
|
|
||||||
png_const_bytep trans_alpha = png_ptr->trans_alpha;
|
|
||||||
int num_trans = png_ptr->num_trans;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Initially black, opaque. */
|
|
||||||
uint8x16x4_t w = {{
|
|
||||||
vdupq_n_u8(0x00),
|
|
||||||
vdupq_n_u8(0x00),
|
|
||||||
vdupq_n_u8(0x00),
|
|
||||||
vdupq_n_u8(0xff),
|
|
||||||
}};
|
|
||||||
|
|
||||||
png_debug(1, "in png_riffle_palette_neon");
|
|
||||||
|
|
||||||
/* First, riffle the RGB colours into an RGBA8 palette.
|
|
||||||
* The alpha component is set to opaque for now.
|
|
||||||
*/
|
|
||||||
for (i = 0; i < 256; i += 16)
|
|
||||||
{
|
|
||||||
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
|
|
||||||
w.val[0] = v.val[0];
|
|
||||||
w.val[1] = v.val[1];
|
|
||||||
w.val[2] = v.val[2];
|
|
||||||
vst4q_u8(riffled_palette + (i << 2), w);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fix up the missing transparency values. */
|
|
||||||
for (i = 0; i < num_trans; i++)
|
|
||||||
riffled_palette[(i << 2) + 3] = trans_alpha[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Expands a palettized row into RGBA8. */
|
|
||||||
int
|
|
||||||
png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|
||||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
|
||||||
{
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
const png_uint_32 *riffled_palette =
|
|
||||||
png_aligncastconst(png_const_uint_32p, png_ptr->riffled_palette);
|
|
||||||
const png_uint_32 pixels_per_chunk = 4;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
|
||||||
|
|
||||||
PNG_UNUSED(row)
|
|
||||||
if (row_width < pixels_per_chunk)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* This function originally gets the last byte of the output row.
|
|
||||||
* The NEON part writes forward from a given position, so we have
|
|
||||||
* to seek this back by 4 pixels x 4 bytes.
|
|
||||||
*/
|
|
||||||
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_uint_32)) - 1);
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i += pixels_per_chunk)
|
|
||||||
{
|
|
||||||
uint32x4_t cur;
|
|
||||||
png_bytep sp = *ssp - i, dp = *ddp - (i << 2);
|
|
||||||
cur = vld1q_dup_u32 (riffled_palette + *(sp - 3));
|
|
||||||
cur = vld1q_lane_u32(riffled_palette + *(sp - 2), cur, 1);
|
|
||||||
cur = vld1q_lane_u32(riffled_palette + *(sp - 1), cur, 2);
|
|
||||||
cur = vld1q_lane_u32(riffled_palette + *(sp - 0), cur, 3);
|
|
||||||
vst1q_u32((void *)dp, cur);
|
|
||||||
}
|
|
||||||
if (i != row_width)
|
|
||||||
{
|
|
||||||
/* Remove the amount that wasn't processed. */
|
|
||||||
i -= pixels_per_chunk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Decrement output pointers. */
|
|
||||||
*ssp = *ssp - i;
|
|
||||||
*ddp = *ddp - (i << 2);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Expands a palettized row into RGB8. */
|
|
||||||
int
|
|
||||||
png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|
||||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
|
||||||
{
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
png_const_bytep palette = (png_const_bytep)png_ptr->palette;
|
|
||||||
const png_uint_32 pixels_per_chunk = 8;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
|
||||||
|
|
||||||
PNG_UNUSED(row)
|
|
||||||
if (row_width <= pixels_per_chunk)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Seeking this back by 8 pixels x 3 bytes. */
|
|
||||||
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_color)) - 1);
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i += pixels_per_chunk)
|
|
||||||
{
|
|
||||||
uint8x8x3_t cur;
|
|
||||||
png_bytep sp = *ssp - i, dp = *ddp - ((i << 1) + i);
|
|
||||||
cur = vld3_dup_u8(palette + sizeof(png_color) * (*(sp - 7)));
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 6)), cur, 1);
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 5)), cur, 2);
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 4)), cur, 3);
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 3)), cur, 4);
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 2)), cur, 5);
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 1)), cur, 6);
|
|
||||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 0)), cur, 7);
|
|
||||||
vst3_u8((void *)dp, cur);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != row_width)
|
|
||||||
{
|
|
||||||
/* Remove the amount that wasn't processed. */
|
|
||||||
i -= pixels_per_chunk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Decrement output pointers. */
|
|
||||||
*ssp = *ssp - i;
|
|
||||||
*ddp = *ddp - ((i << 1) + i);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION */
|
|
||||||
16
autogen.sh
16
autogen.sh
@@ -73,18 +73,16 @@ done
|
|||||||
# present bad things are happening.
|
# present bad things are happening.
|
||||||
#
|
#
|
||||||
# The autotools generated files:
|
# The autotools generated files:
|
||||||
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
|
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"
|
||||||
#
|
#
|
||||||
# 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
|
||||||
#
|
#
|
||||||
@@ -195,7 +193,7 @@ case "$mode" in
|
|||||||
if test -d .git
|
if test -d .git
|
||||||
then
|
then
|
||||||
exec >&2
|
exec >&2
|
||||||
echo "ERROR: running autoreconf on an initialized system"
|
echo "ERROR: running autoreconf on an initialized sytem"
|
||||||
echo " This is not necessary; it is only necessary to remake the"
|
echo " This is not necessary; it is only necessary to remake the"
|
||||||
echo " autotools generated files if Makefile.am or configure.ac"
|
echo " autotools generated files if Makefile.am or configure.ac"
|
||||||
echo " change and make does the right thing with:"
|
echo " change and make does the right thing with:"
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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.
|
|
||||||
25
ci/README.md
25
ci/README.md
@@ -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
|
|
||||||
142
ci/ci_lint.sh
142
ci/ci_lint.sh
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
111
ci/lib/ci.lib.sh
111
ci/lib/ci.lib.sh
@@ -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
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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 "$@"
|
|
||||||
@@ -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"
|
|
||||||
@@ -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"
|
|
||||||
@@ -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"
|
|
||||||
@@ -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"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
364
compile
364
compile
@@ -1,364 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
# Wrapper for compilers which do not understand '-c -o'.
|
|
||||||
|
|
||||||
scriptversion=2025-06-18.21; # UTC
|
|
||||||
|
|
||||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
|
||||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
|
||||||
# distribute this file as part of a program that contains a
|
|
||||||
# configuration script generated by Autoconf, you may include it under
|
|
||||||
# the same distribution terms that you use for the rest of that program.
|
|
||||||
|
|
||||||
# This file is maintained in Automake, please report
|
|
||||||
# bugs to <bug-automake@gnu.org> or send patches to
|
|
||||||
# <automake-patches@gnu.org>.
|
|
||||||
|
|
||||||
nl='
|
|
||||||
'
|
|
||||||
|
|
||||||
# We need space, tab and new line, in precisely that order. Quoting is
|
|
||||||
# there to prevent tools from complaining about whitespace usage.
|
|
||||||
IFS=" "" $nl"
|
|
||||||
|
|
||||||
file_conv=
|
|
||||||
|
|
||||||
# func_file_conv build_file unneeded_conversions
|
|
||||||
# Convert a $build file to $host form and store it in $file
|
|
||||||
# Currently only supports Windows hosts. If the determined conversion
|
|
||||||
# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
|
|
||||||
# conversion will take place.
|
|
||||||
func_file_conv ()
|
|
||||||
{
|
|
||||||
file=$1
|
|
||||||
case $file in
|
|
||||||
/ | /[!/]*) # absolute file, and not a UNC file
|
|
||||||
if test -z "$file_conv"; then
|
|
||||||
# lazily determine how to convert abs files
|
|
||||||
case `uname -s` in
|
|
||||||
MINGW*)
|
|
||||||
if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
|
|
||||||
# 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 environment.
|
|
||||||
file_conv=cygwin
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
file_conv=wine
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
case $file_conv/,$2, in
|
|
||||||
*,$file_conv,*)
|
|
||||||
# This is the optimization mentioned above:
|
|
||||||
# If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
|
|
||||||
;;
|
|
||||||
mingw/*)
|
|
||||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
|
||||||
;;
|
|
||||||
cygwin/*)
|
|
||||||
file=`cygpath -w "$file" || echo "$file"`
|
|
||||||
;;
|
|
||||||
wine/*)
|
|
||||||
file=`winepath -w "$file" || echo "$file"`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# func_cl_dashL linkdir
|
|
||||||
# Make cl look for libraries in LINKDIR
|
|
||||||
func_cl_dashL ()
|
|
||||||
{
|
|
||||||
func_file_conv "$1"
|
|
||||||
if test -z "$lib_path"; then
|
|
||||||
lib_path=$file
|
|
||||||
else
|
|
||||||
lib_path="$lib_path;$file"
|
|
||||||
fi
|
|
||||||
linker_opts="$linker_opts -LIBPATH:$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
# func_cl_dashl library
|
|
||||||
# Do a library search-path lookup for cl
|
|
||||||
func_cl_dashl ()
|
|
||||||
{
|
|
||||||
lib=$1
|
|
||||||
found=no
|
|
||||||
save_IFS=$IFS
|
|
||||||
IFS=';'
|
|
||||||
for dir in $lib_path $LIB
|
|
||||||
do
|
|
||||||
IFS=$save_IFS
|
|
||||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
|
||||||
found=yes
|
|
||||||
lib=$dir/$lib.dll.lib
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if test -f "$dir/$lib.lib"; then
|
|
||||||
found=yes
|
|
||||||
lib=$dir/$lib.lib
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if test -f "$dir/lib$lib.a"; then
|
|
||||||
found=yes
|
|
||||||
lib=$dir/lib$lib.a
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$save_IFS
|
|
||||||
|
|
||||||
if test "$found" != yes; then
|
|
||||||
lib=$lib.lib
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# func_cl_wrapper cl arg...
|
|
||||||
# Adjust compile command to suit cl
|
|
||||||
func_cl_wrapper ()
|
|
||||||
{
|
|
||||||
# Assume a capable shell
|
|
||||||
lib_path=
|
|
||||||
shared=:
|
|
||||||
linker_opts=
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$eat"; then
|
|
||||||
eat=
|
|
||||||
else
|
|
||||||
case $1 in
|
|
||||||
-o)
|
|
||||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
|
||||||
eat=1
|
|
||||||
case $2 in
|
|
||||||
*.o | *.lo | *.[oO][bB][jJ])
|
|
||||||
func_file_conv "$2"
|
|
||||||
set x "$@" -Fo"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
func_file_conv "$2"
|
|
||||||
set x "$@" -Fe"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
-I)
|
|
||||||
eat=1
|
|
||||||
func_file_conv "$2" mingw
|
|
||||||
set x "$@" -I"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-I*)
|
|
||||||
func_file_conv "${1#-I}" mingw
|
|
||||||
set x "$@" -I"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-l)
|
|
||||||
eat=1
|
|
||||||
func_cl_dashl "$2"
|
|
||||||
set x "$@" "$lib"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-l*)
|
|
||||||
func_cl_dashl "${1#-l}"
|
|
||||||
set x "$@" "$lib"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-L)
|
|
||||||
eat=1
|
|
||||||
func_cl_dashL "$2"
|
|
||||||
;;
|
|
||||||
-L*)
|
|
||||||
func_cl_dashL "${1#-L}"
|
|
||||||
;;
|
|
||||||
-static)
|
|
||||||
shared=false
|
|
||||||
;;
|
|
||||||
-Wl,*)
|
|
||||||
arg=${1#-Wl,}
|
|
||||||
save_ifs="$IFS"; IFS=','
|
|
||||||
for flag in $arg; do
|
|
||||||
IFS="$save_ifs"
|
|
||||||
linker_opts="$linker_opts $flag"
|
|
||||||
done
|
|
||||||
IFS="$save_ifs"
|
|
||||||
;;
|
|
||||||
-Xlinker)
|
|
||||||
eat=1
|
|
||||||
linker_opts="$linker_opts $2"
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
|
||||||
func_file_conv "$1"
|
|
||||||
set x "$@" -Tp"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
|
||||||
func_file_conv "$1" mingw
|
|
||||||
set x "$@" "$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
if test -n "$linker_opts"; then
|
|
||||||
linker_opts="-link$linker_opts"
|
|
||||||
fi
|
|
||||||
exec "$@" $linker_opts
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
eat=
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
'')
|
|
||||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
-h | --h*)
|
|
||||||
cat <<\EOF
|
|
||||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
|
||||||
|
|
||||||
Wrapper for compilers which do not understand '-c -o'.
|
|
||||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
|
||||||
arguments, and rename the output as expected.
|
|
||||||
|
|
||||||
If you are trying to build a whole package this is not the
|
|
||||||
right script to run: please start by reading the file 'INSTALL'.
|
|
||||||
|
|
||||||
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
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
-v | --v*)
|
|
||||||
echo "compile (GNU Automake) $scriptversion"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
|
||||||
clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \
|
|
||||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
|
||||||
func_cl_wrapper "$@" # Doesn't return...
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
ofile=
|
|
||||||
cfile=
|
|
||||||
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$eat"; then
|
|
||||||
eat=
|
|
||||||
else
|
|
||||||
case $1 in
|
|
||||||
-o)
|
|
||||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
|
||||||
# So we strip '-o arg' only if arg is an object.
|
|
||||||
eat=1
|
|
||||||
case $2 in
|
|
||||||
*.o | *.obj)
|
|
||||||
ofile=$2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set x "$@" -o "$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*.c)
|
|
||||||
cfile=$1
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -z "$ofile" || test -z "$cfile"; then
|
|
||||||
# If no '-o' option was seen then we might have been invoked from a
|
|
||||||
# pattern rule where we don't need one. That is ok -- this is a
|
|
||||||
# normal compilation that the losing compiler can handle. If no
|
|
||||||
# '.c' file was seen then we are probably linking. That is also
|
|
||||||
# ok.
|
|
||||||
exec "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Name of file we expect compiler to create.
|
|
||||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
|
||||||
|
|
||||||
# Create the lock directory.
|
|
||||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
|
||||||
# that we are using for the .o file. Also, base the name on the expected
|
|
||||||
# object file name, since that is what matters with a parallel build.
|
|
||||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
|
||||||
while true; do
|
|
||||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
# FIXME: race condition here if user kills between mkdir and trap.
|
|
||||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
|
||||||
|
|
||||||
# Run the compile.
|
|
||||||
"$@"
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
if test -f "$cofile"; then
|
|
||||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
|
||||||
elif test -f "${cofile}bj"; then
|
|
||||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rmdir "$lockdir"
|
|
||||||
exit $ret
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# mode: shell-script
|
|
||||||
# sh-indentation: 2
|
|
||||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
|
||||||
# time-stamp-start: "scriptversion="
|
|
||||||
# time-stamp-format: "%Y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-time-zone: "UTC0"
|
|
||||||
# time-stamp-end: "; # UTC"
|
|
||||||
# End:
|
|
||||||
1815
config.guess
vendored
1815
config.guess
vendored
File diff suppressed because it is too large
Load Diff
138
config.h.in
138
config.h.in
@@ -1,138 +0,0 @@
|
|||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
||||||
#undef HAVE_DLFCN_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'feenableexcept' function. */
|
|
||||||
#undef HAVE_FEENABLEEXCEPT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#undef HAVE_INTTYPES_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'm' library (-lm). */
|
|
||||||
#undef HAVE_LIBM
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'z' library (-lz). */
|
|
||||||
#undef HAVE_LIBZ
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'pow' function. */
|
|
||||||
#undef HAVE_POW
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#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. */
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#undef HAVE_STRINGS_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#undef HAVE_STRING_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#undef HAVE_SYS_STAT_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#undef HAVE_SYS_TYPES_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#undef HAVE_UNISTD_H
|
|
||||||
|
|
||||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
|
||||||
#undef LT_OBJDIR
|
|
||||||
|
|
||||||
/* Name of package */
|
|
||||||
#undef PACKAGE
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#undef PACKAGE_BUGREPORT
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#undef PACKAGE_NAME
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#undef PACKAGE_STRING
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#undef PACKAGE_TARNAME
|
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#undef PACKAGE_URL
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#undef PACKAGE_VERSION
|
|
||||||
|
|
||||||
/* Turn on ARM Neon optimizations at run-time */
|
|
||||||
#undef PNG_ARM_NEON_API_SUPPORTED
|
|
||||||
|
|
||||||
/* Check for ARM Neon support at run-time */
|
|
||||||
#undef PNG_ARM_NEON_CHECK_SUPPORTED
|
|
||||||
|
|
||||||
/* Enable ARM Neon optimizations */
|
|
||||||
#undef PNG_ARM_NEON_OPT
|
|
||||||
|
|
||||||
/* Enable Intel SSE optimizations */
|
|
||||||
#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 */
|
|
||||||
#undef PNG_MIPS_MSA_API_SUPPORTED
|
|
||||||
|
|
||||||
/* Check for MIPS MSA support at run-time */
|
|
||||||
#undef PNG_MIPS_MSA_CHECK_SUPPORTED
|
|
||||||
|
|
||||||
/* Enable MIPS MSA optimizations */
|
|
||||||
#undef PNG_MIPS_MSA_OPT
|
|
||||||
|
|
||||||
/* Turn on POWERPC VSX optimizations at run-time */
|
|
||||||
#undef PNG_POWERPC_VSX_API_SUPPORTED
|
|
||||||
|
|
||||||
/* Check for POWERPC VSX support at run-time */
|
|
||||||
#undef PNG_POWERPC_VSX_CHECK_SUPPORTED
|
|
||||||
|
|
||||||
/* Enable POWERPC VSX optimizations */
|
|
||||||
#undef PNG_POWERPC_VSX_OPT
|
|
||||||
|
|
||||||
/* Enable RISCV RVV optimizations */
|
|
||||||
#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
|
|
||||||
|
|
||||||
/* Define to 1 if your <sys/time.h> declares 'struct tm'. */
|
|
||||||
#undef TM_IN_SYS_TIME
|
|
||||||
|
|
||||||
/* Version number of package */
|
|
||||||
#undef VERSION
|
|
||||||
|
|
||||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
|
||||||
nothing if this is not supported. Do not define if restrict is
|
|
||||||
supported only directly. */
|
|
||||||
#undef restrict
|
|
||||||
/* Work around a bug in older versions of Sun C++, which did not
|
|
||||||
#define __restrict__ or support _Restrict or __restrict__
|
|
||||||
even though the corresponding Sun C compiler ended up with
|
|
||||||
"#define restrict _Restrict" or "#define restrict __restrict__"
|
|
||||||
in the previous line. This workaround can be removed once
|
|
||||||
we assume Oracle Developer Studio 12.5 (2016) or later. */
|
|
||||||
#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
|
|
||||||
# define _Restrict
|
|
||||||
# define __restrict__
|
|
||||||
#endif
|
|
||||||
2354
config.sub
vendored
2354
config.sub
vendored
File diff suppressed because it is too large
Load Diff
658
configure.ac
658
configure.ac
@@ -1,12 +1,5 @@
|
|||||||
# configure.ac
|
# configure.ac
|
||||||
|
|
||||||
# Copyright (c) 2018-2024 Cosmin Truta
|
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl
|
dnl
|
||||||
dnl Minor upgrades (compatible ABI): increment the package version
|
dnl Minor upgrades (compatible ABI): increment the package version
|
||||||
@@ -25,8 +18,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.7.0beta39],[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
|
||||||
@@ -36,7 +29,7 @@ AC_CONFIG_MACRO_DIR([scripts/autoconf])
|
|||||||
# 1.13 is required for parallel tests
|
# 1.13 is required for parallel tests
|
||||||
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
|
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
|
||||||
# The following line causes --disable-maintainer-mode to be the default to
|
# The following line causes --disable-maintainer-mode to be the default to
|
||||||
# configure. This is necessary because libpng distributions cannot rely on the
|
# configure, this is necessary because libpng distributions cannot rely on the
|
||||||
# time stamps of the autotools generated files being correct
|
# time stamps of the autotools generated files being correct
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
@@ -46,17 +39,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.7.0beta39
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=6
|
PNGLIB_MINOR=7
|
||||||
PNGLIB_RELEASE=51
|
PNGLIB_RELEASE=0
|
||||||
|
|
||||||
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
|
||||||
@@ -67,54 +60,33 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
|
dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
|
||||||
dnl compatible later version may be used
|
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
|
||||||
# necessary to use a different preprocessor for .dfn files
|
# necessary to use a different preprocessor for .dfn files
|
||||||
DFNCPP="$CPP"
|
DFNCPP="$CPP -E"
|
||||||
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,52 +107,148 @@ 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.
|
# Checks for header files.
|
||||||
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining
|
AC_HEADER_STDC
|
||||||
# _POSIX_SOURCE to 1. This is incompatible with the new default mode, so
|
# Headers used in pngpriv.h:
|
||||||
# we test for that and force the "-std=c89" compiler option:
|
AC_CHECK_HEADERS([assert.h stdlib.h string.h float.h fp.h math.h m68881.h])
|
||||||
AC_MSG_CHECKING([if we need to force back C standard to C89])
|
# Additional headers used in pngconf.h:
|
||||||
AC_COMPILE_IFELSE(
|
AC_CHECK_HEADERS([limits.h stddef.h stdio.h setjmp.h time.h])
|
||||||
[AC_LANG_PROGRAM([
|
# Used by pngread.c (for the simplified API):
|
||||||
[#define _POSIX_SOURCE 1]
|
AC_CHECK_HEADERS([errno.h])
|
||||||
[#include <stdio.h>]
|
# The following are not required for the standard 'make' build of libpng:
|
||||||
])],
|
# Additional requirements of contrib/libtests/makepng.c:
|
||||||
AC_MSG_RESULT(no),[
|
AC_CHECK_HEADERS([ctype.h])
|
||||||
if test "x$GCC" != "xyes"; then
|
# Additional requirements of contrib/libtests/pngvalid.c:
|
||||||
AC_MSG_ERROR(
|
AC_CHECK_HEADERS([fenv.h])
|
||||||
[Forcing back to C89 is required but the flags are only known for GCC])
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
CFLAGS="$CFLAGS -std=c89"
|
|
||||||
])
|
|
||||||
|
|
||||||
# Checks for structures and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_STRUCT_TM
|
# Most of these have been removed from 1.7.0 because they checked for non-ANSI-C
|
||||||
|
# behaviors and the result were, anyway, not used by earlier versions of libpng.
|
||||||
AC_C_RESTRICT
|
AC_C_RESTRICT
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions; these need to be in order, least demanding to
|
||||||
AC_CHECK_FUNCS([pow], ,
|
# most because the -l directives are added to the head of the list at each
|
||||||
[AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])])
|
# check.
|
||||||
|
# ANSI-C functions: all are required but they don't have to be implemented in
|
||||||
|
# libc, it is perfectly ok to configure with an extra, wrapper, library preset
|
||||||
|
# in LIBS. NOTE: this list may not be complete
|
||||||
|
AC_CHECK_FUNCS([memset memcpy strncpy],,
|
||||||
|
AC_MSG_FAILURE([missing ANSI-C functions]))
|
||||||
|
|
||||||
# Some later POSIX 1003.1 functions are required for test programs, failure
|
# floor and ceil are required for FLOATING_POINT, but they can be turned off on
|
||||||
# here is soft (the corresponding test program is not built).
|
# the configure command line (and they are independent.) Default is to 'on'
|
||||||
AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
|
AC_ARG_ENABLE([floating-point],
|
||||||
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
AS_HELP_STRING([[[--enabled-floating-point]]],
|
||||||
|
[Enable floating point APIs (default: yes)]),,
|
||||||
|
[enable_floating_point=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(zlib-prefix,
|
AC_ARG_ENABLE([fixed-point],
|
||||||
AS_HELP_STRING([[[--with-zlib-prefix]]],
|
AS_HELP_STRING([[[--enable-fixed-point]]],
|
||||||
[prefix that may have been used in installed zlib]),
|
[Enable fixed point APIs (default: yes)]),,
|
||||||
[ZPREFIX=${withval}],
|
[enable_fixed_point=yes])
|
||||||
[ZPREFIX='z_'])
|
|
||||||
AC_CHECK_LIB([z], [zlibVersion], ,
|
AC_ARG_ENABLE([floating-arithmetic],
|
||||||
[AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], ,
|
AS_HELP_STRING([[[--enable-floating-arithmetic]]],
|
||||||
[AC_MSG_ERROR([zlib not installed])])])
|
[Use floating point arithmetic internally (default: yes)]),,
|
||||||
|
[enable_floating_arithmetic=yes])
|
||||||
|
|
||||||
|
# Check for a requirement for math library support
|
||||||
|
if test "$enable_floating_arithmetic" = yes
|
||||||
|
then
|
||||||
|
AC_SEARCH_LIBS([floor],[m],,
|
||||||
|
[AC_MSG_WARN([not found])
|
||||||
|
enable_floating_arithmetic=no])
|
||||||
|
AC_SEARCH_LIBS([frexp],[m],,
|
||||||
|
[AC_MSG_WARN([not found])
|
||||||
|
enable_floating_arithmetic=no])
|
||||||
|
AC_SEARCH_LIBS([modf],[m],,
|
||||||
|
[AC_MSG_WARN([not found])
|
||||||
|
enable_floating_arithmetic=no])
|
||||||
|
AC_SEARCH_LIBS([atof],[m],,
|
||||||
|
[AC_MSG_WARN([not found])
|
||||||
|
enable_floating_arithmetic=no])
|
||||||
|
AC_SEARCH_LIBS([pow],[m],,
|
||||||
|
[AC_MSG_WARN([not found])
|
||||||
|
enable_floating_arithmetic=no])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the relevant defines if required (only if required), this will override
|
||||||
|
# anything on the command line.
|
||||||
|
if test "$enable_floating_point" != yes
|
||||||
|
then
|
||||||
|
AC_MSG_NOTICE([Floating point APIs disabled])
|
||||||
|
AC_DEFINE([PNG_NO_FLOATING_POINT],[1],
|
||||||
|
[No support for floating point APIs])
|
||||||
|
fi
|
||||||
|
if test "$enable_fixed_point" != yes
|
||||||
|
then
|
||||||
|
AC_MSG_NOTICE([Fixed point APIs disabled])
|
||||||
|
AC_DEFINE([PNG_NO_FIXED_POINT],[1],
|
||||||
|
[No support for fixed point APIs])
|
||||||
|
fi
|
||||||
|
if test "$enable_floating_arithmetic" != yes
|
||||||
|
then
|
||||||
|
AC_MSG_NOTICE([Fixed point arithmetic will be used])
|
||||||
|
AC_DEFINE([PNG_NO_FLOATING_ARITHMETIC],[1],
|
||||||
|
[No support for floating point arithmetic])
|
||||||
|
fi
|
||||||
|
|
||||||
# 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
|
||||||
# library (typically), it's not an error if it is not found.
|
# library (typically), it's not an error if it is not found.
|
||||||
AC_CHECK_LIB([m], [feenableexcept])
|
AC_SEARCH_LIBS([feenableexcept],[m],AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],
|
||||||
AC_CHECK_FUNCS([feenableexcept])
|
[Define to 1 if the feenableexcept function is available]))
|
||||||
|
# Required by pngvalid:
|
||||||
|
AC_SEARCH_LIBS([ceil],[m])
|
||||||
|
|
||||||
|
# zlib checks and arguments;
|
||||||
|
# package zlib: argument is the name of the library
|
||||||
|
# zlib-header: the name of the header file
|
||||||
|
# zlib-prefix: the prefix for library functions, if any
|
||||||
|
AC_ARG_WITH([zlib],
|
||||||
|
AS_HELP_STRING([[[--with-zlib=<name>]]],
|
||||||
|
[base name of the zlib implementation (e.g. 'z')]),,
|
||||||
|
[with_zlib='z'])
|
||||||
|
|
||||||
|
z_prefix=
|
||||||
|
AC_ARG_WITH([zlib-prefix],
|
||||||
|
AS_HELP_STRING([[[--with-zlib-prefix=<prefix>]]],
|
||||||
|
[prefix for zlib API functions]),
|
||||||
|
[if test "$withval" = "" -o "$withval" = yes; then
|
||||||
|
with_zlib_prefix='z_'
|
||||||
|
AC_DEFINE([PNG_ZLIB_PREFIX],[z_],[Standard zlib prefix])
|
||||||
|
elif test "${withval}" != "no"; then
|
||||||
|
AC_DEFINE_UNQUOTED([PNG_ZLIB_PREFIX],[${withval}],
|
||||||
|
[User defined zlib prefix])
|
||||||
|
else
|
||||||
|
with_zlib_prefix=
|
||||||
|
fi
|
||||||
|
if test "$with_zlib_prefix" != ""; then
|
||||||
|
AC_DEFINE([Z_PREFIX],[1],[Tell zlib.h to prefix function names])
|
||||||
|
z_prefix="#define Z_PREFIX 1"
|
||||||
|
fi])
|
||||||
|
|
||||||
|
AC_ARG_WITH([zlib-header],
|
||||||
|
AS_HELP_STRING([[[--with-zlib-header='<file>' or '"file"']]],
|
||||||
|
[C include argument to locate zlib header file, e.g. <zlib.h>, take
|
||||||
|
care to put single quotes round this on the command line]),
|
||||||
|
[AC_DEFINE_UNQUOTED([PNG_ZLIB_HEADER],[${withval}],[Zlib header file])],
|
||||||
|
with_zlib_header='<zlib.h>')
|
||||||
|
|
||||||
|
# AC_CHECK_LIB isn't quite enough for this because we need the special header
|
||||||
|
# file too.
|
||||||
|
LIBS="-l${with_zlib} $LIBS"
|
||||||
|
AC_MSG_CHECKING(
|
||||||
|
[[Library '${with_zlib}' and #include ${with_zlib_header} for symbol '${with_zlib_prefix}zlibVersion']])
|
||||||
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[
|
||||||
|
${z_prefix}
|
||||||
|
#include ${with_zlib_header}
|
||||||
|
]],
|
||||||
|
[[(void)${with_zlib_prefix}zlibVersion();]])],
|
||||||
|
AC_MSG_RESULT([ok]),
|
||||||
|
AC_MSG_FAILURE([not found]))
|
||||||
|
|
||||||
AC_MSG_CHECKING([if using Solaris linker])
|
AC_MSG_CHECKING([if using Solaris linker])
|
||||||
SLD=`$LD --version 2>&1 | grep Solaris`
|
SLD=`$LD --version 2>&1 | grep Solaris`
|
||||||
@@ -226,9 +294,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 \
|
| ${DFNCPP-${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,90 +381,20 @@ 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
|
# ARM
|
||||||
# =======
|
# ===
|
||||||
#
|
#
|
||||||
AC_ARG_ENABLE([hardware-optimizations],
|
# ARM NEON (SIMD) support.
|
||||||
AS_HELP_STRING([[[--enable-hardware-optimizations]]],
|
|
||||||
[Enable hardware optimizations: =no/off, yes/on.]),
|
|
||||||
[case "$enableval" in
|
|
||||||
no|off)
|
|
||||||
# disable hardware optimization on all systems:
|
|
||||||
enable_arm_neon=no
|
|
||||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
|
||||||
[Disable ARM_NEON optimizations])
|
|
||||||
enable_mips_msa=no
|
|
||||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
|
||||||
[Disable MIPS_MSA optimizations])
|
|
||||||
enable_mips_mmi=no
|
|
||||||
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
|
|
||||||
[Disable MIPS_MMI optimizations])
|
|
||||||
enable_powerpc_vsx=no
|
|
||||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
|
||||||
[Disable POWERPC VSX optimizations])
|
|
||||||
enable_intel_sse=no
|
|
||||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
|
||||||
[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:
|
|
||||||
case "$host_cpu" in
|
|
||||||
arm*|aarch64*)
|
|
||||||
enable_arm_neon=yes
|
|
||||||
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
|
|
||||||
[Enable ARM_NEON optimizations])
|
|
||||||
;;
|
|
||||||
mipsel*|mips64el*)
|
|
||||||
enable_mips_mmi=yes
|
|
||||||
enable_mips_msa=yes
|
|
||||||
AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
|
|
||||||
[Enable MIPS_MMI optimizations])
|
|
||||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
|
||||||
[Enable MIPS_MSA optimizations])
|
|
||||||
;;
|
|
||||||
i?86|x86_64)
|
|
||||||
enable_intel_sse=yes
|
|
||||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
|
||||||
[Enable Intel SSE optimizations])
|
|
||||||
;;
|
|
||||||
powerpc*|ppc64*)
|
|
||||||
enable_powerpc_vsx=yes
|
|
||||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
|
||||||
[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])
|
|
||||||
|
|
||||||
# ARM NEON
|
|
||||||
# ========
|
|
||||||
|
|
||||||
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 +402,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,336 +412,28 @@ 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*) :;;
|
||||||
*) test "$enable_arm_neon" != '' ;;
|
*) test "$enable_arm_neon" != '';;
|
||||||
esac])
|
|
||||||
|
|
||||||
# MIPS MSA
|
|
||||||
# ========
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([mips-msa],
|
|
||||||
AS_HELP_STRING([[[--enable-mips-msa]]],
|
|
||||||
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on.]
|
|
||||||
[no/off: disable the optimizations;]
|
|
||||||
[check: use internal checking code (deprecated and poorly supported);]
|
|
||||||
[api: disable by default, enable by a call to png_set_option;]
|
|
||||||
[yes/on: turn on unconditionally.]
|
|
||||||
[If not specified: determined by the compiler.]),
|
|
||||||
[case "$enableval" in
|
|
||||||
no|off)
|
|
||||||
# disable the default enabling on __mips_msa systems:
|
|
||||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
|
||||||
[Disable MIPS MSA optimizations])
|
|
||||||
# Prevent inclusion of the assembler files below:
|
|
||||||
enable_mips_msa=no ;;
|
|
||||||
check)
|
|
||||||
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
|
||||||
[Check for MIPS MSA support at run-time]);;
|
|
||||||
api)
|
|
||||||
AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
|
|
||||||
[Turn on MIPS MSA optimizations at run-time]);;
|
|
||||||
yes|on)
|
|
||||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
|
||||||
[Enable MIPS MSA optimizations])
|
|
||||||
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';]
|
|
||||||
[if you want the optimizations unconditionally,]
|
|
||||||
[pass '-mmsa -mfp64' to the compiler.]);;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:]
|
|
||||||
[invalid argument])
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or
|
|
||||||
# where MIPS optimizations were explicitly requested. (This allows a fallback
|
|
||||||
# if a future host CPU does not match 'mips*'.)
|
|
||||||
|
|
||||||
AM_CONDITIONAL([PNG_MIPS_MSA],
|
|
||||||
[test "$enable_mips_msa" != 'no' &&
|
|
||||||
case "$host_cpu" in
|
|
||||||
mipsel*|mips64el*) : ;;
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# MIPS MMI
|
|
||||||
# ========
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([mips-mmi],
|
|
||||||
AS_HELP_STRING([[[--enable-mips-mmi]]],
|
|
||||||
[Enable MIPS MMI optimizations: =no/off, check, api, yes/on.]
|
|
||||||
[no/off: disable the optimizations;]
|
|
||||||
[check: use internal checking code (deprecated and poorly supported);]
|
|
||||||
[api: disable by default, enable by a call to png_set_option;]
|
|
||||||
[yes/on: turn on unconditionally.]
|
|
||||||
[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],
|
|
||||||
AS_HELP_STRING([[[--enable-intel-sse]]],
|
|
||||||
[Enable Intel SSE optimizations: =no/off, yes/on.]
|
|
||||||
[no/off: disable the optimizations;]
|
|
||||||
[yes/on: enable the optimizations.]
|
|
||||||
[If not specified: determined by the compiler.]),
|
|
||||||
[case "$enableval" in
|
|
||||||
no|off)
|
|
||||||
# disable the default enabling:
|
|
||||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
|
||||||
[Disable Intel SSE optimizations])
|
|
||||||
# Prevent inclusion of the assembler files below:
|
|
||||||
enable_intel_sse=no ;;
|
|
||||||
yes|on)
|
|
||||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
|
||||||
[Enable Intel SSE optimizations]);;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:]
|
|
||||||
[invalid argument])
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or
|
|
||||||
# where Intel optimizations were explicitly requested. (This allows a fallback
|
|
||||||
# if a future host CPU does not match 'x86*'.)
|
|
||||||
AM_CONDITIONAL([PNG_INTEL_SSE],
|
|
||||||
[test "$enable_intel_sse" != 'no' &&
|
|
||||||
case "$host_cpu" in
|
|
||||||
i?86|x86_64) : ;;
|
|
||||||
*) test "$enable_intel_sse" != '' ;;
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# POWERPC VSX
|
|
||||||
# ===========
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([powerpc-vsx],
|
|
||||||
AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
|
||||||
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.]
|
|
||||||
[no/off: disable the optimizations;]
|
|
||||||
[check: use internal checking code;]
|
|
||||||
[api: disable by default, enable by a call to png_set_option;]
|
|
||||||
[yes/on: turn on unconditionally.]
|
|
||||||
[If not specified: determined by the compiler.]),
|
|
||||||
[case "$enableval" in
|
|
||||||
no|off)
|
|
||||||
# disable the default enabling on __ppc64__ systems:
|
|
||||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
|
||||||
[Disable POWERPC VSX optimizations])
|
|
||||||
# Prevent inclusion of the platform-specific files below:
|
|
||||||
enable_powerpc_vsx=no ;;
|
|
||||||
check)
|
|
||||||
AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
|
|
||||||
[Check for POWERPC VSX support at run-time])
|
|
||||||
AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README]
|
|
||||||
[for the list of supported systems.]);;
|
|
||||||
api)
|
|
||||||
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
|
|
||||||
[Turn on POWERPC VSX optimizations at run-time]);;
|
|
||||||
yes|on)
|
|
||||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
|
||||||
[Enable POWERPC VSX optimizations])
|
|
||||||
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';]
|
|
||||||
[if you want the optimizations unconditionally,]
|
|
||||||
[pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:]
|
|
||||||
[invalid argument])
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# Add PowerPC-specific files to all builds where $host_cpu is powerpc
|
|
||||||
# ('powerpc*') or where PowerPC optimizations were explicitly requested.
|
|
||||||
# (This allows a fallback if a future host CPU does not match 'powerpc*'.)
|
|
||||||
|
|
||||||
AM_CONDITIONAL([PNG_POWERPC_VSX],
|
|
||||||
[test "$enable_powerpc_vsx" != 'no' &&
|
|
||||||
case "$host_cpu" in
|
|
||||||
powerpc*|ppc64*) : ;;
|
|
||||||
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])
|
esac])
|
||||||
|
|
||||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||||
|
|
||||||
# Config files, substituting as above
|
# Config files, substituting as above
|
||||||
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
AC_CONFIG_FILES([Makefile libpng.pc])
|
||||||
AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
AC_CONFIG_FILES([libpng-config], [chmod +x libpng-config])
|
||||||
[chmod +x libpng-config])
|
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# https://editorconfig.org
|
|
||||||
|
|
||||||
root = false
|
|
||||||
|
|
||||||
[*.[ch]]
|
|
||||||
indent_size = unset
|
|
||||||
indent_style = unset
|
|
||||||
max_doc_length = unset
|
|
||||||
max_line_length = unset
|
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
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
|
||||||
libpng proper and are not used for building the library, although some are used
|
libpng proper and are not used for building the library.
|
||||||
for testing the library via "make check".
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
OPERATING SYSTEM SPECIFIC ARM NEON DETECTION
|
OPERATING SYSTEM SPECIFIC ARM NEON DETECTION
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
Detection of the ability to execute ARM NEON on an ARM processor requires
|
Detection of the ability to exexcute ARM NEON on an ARM processor requires
|
||||||
operating system support. (The information is not available in user mode.)
|
operating system support. (The information is not available in user mode.)
|
||||||
|
|
||||||
HOW TO USE THIS
|
HOW TO USE THIS
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -16,14 +17,13 @@
|
|||||||
*
|
*
|
||||||
* Documentation:
|
* Documentation:
|
||||||
* http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
|
* http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
|
||||||
* https://code.google.com/p/android/issues/detail?id=49065
|
* http://code.google.com/p/android/issues/detail?id=49065
|
||||||
*
|
*
|
||||||
* NOTE: this requires that libpng is built against the Android NDK and linked
|
* NOTE: this requires that libpng is built against the Android NDK and linked
|
||||||
* with an implementation of the Android ARM 'cpu-features' library. The code
|
* with an implementation of the Android ARM 'cpu-features' library. The code
|
||||||
* 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
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
*
|
*
|
||||||
* 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
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
*
|
*
|
||||||
* SEE contrib/arm-neon/README before reporting bugs
|
* SEE contrib/arm-neon/README before reporting bugs
|
||||||
*
|
*
|
||||||
* STATUS: COMPILED, TESTED
|
* STATUS: COMPILED, TESTED
|
||||||
@@ -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 */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/* contrib/arm-neon/linux.c
|
/* contrib/arm-neon/linux.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by John Bowler, 2014, 2017.
|
* 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
|
||||||
@@ -15,10 +16,9 @@
|
|||||||
* png_have_neon implemented for Linux by reading the widely available
|
* png_have_neon implemented for Linux by reading the widely available
|
||||||
* pseudo-file /proc/cpuinfo.
|
* pseudo-file /proc/cpuinfo.
|
||||||
*
|
*
|
||||||
* 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 assumes that /proc/cpuinfo is never localized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -62,7 +62,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
|
|
||||||
counter=0;
|
counter=0;
|
||||||
state = Feature;
|
state = Feature;
|
||||||
/* FALLTHROUGH */
|
/* FALL THROUGH */
|
||||||
|
|
||||||
case Feature:
|
case Feature:
|
||||||
/* Match 'FEATURE', ASCII case insensitive. */
|
/* Match 'FEATURE', ASCII case insensitive. */
|
||||||
@@ -72,10 +72,10 @@ png_have_neon(png_structp png_ptr)
|
|||||||
state = Colon;
|
state = Colon;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* did not match 'feature' */
|
/* did not match 'feature' */
|
||||||
state = SkipLine;
|
state = SkipLine;
|
||||||
/* FALLTHROUGH */
|
/* FALL THROUGH */
|
||||||
|
|
||||||
case SkipLine:
|
case SkipLine:
|
||||||
skipLine:
|
skipLine:
|
||||||
@@ -110,7 +110,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
|
|
||||||
state = Neon;
|
state = Neon;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
/* FALLTHROUGH */
|
/* FALL THROUGH */
|
||||||
|
|
||||||
case Neon:
|
case Neon:
|
||||||
/* Look for 'neon' tag */
|
/* Look for 'neon' tag */
|
||||||
@@ -122,7 +122,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = SkipTag;
|
state = SkipTag;
|
||||||
/* FALLTHROUGH */
|
/* FALL THROUGH */
|
||||||
|
|
||||||
case SkipTag:
|
case SkipTag:
|
||||||
/* Skip non-space characters */
|
/* Skip non-space characters */
|
||||||
@@ -152,10 +152,8 @@ png_have_neon(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
# pngcp.dfa
|
|
||||||
# Build time configuration of libpng
|
|
||||||
#
|
|
||||||
# Author: John Bowler
|
|
||||||
# Copyright: (c) John Bowler, 2016
|
|
||||||
# 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 support for pngcp. This means just png_read_png,
|
|
||||||
# png_write_png and small number of configuration settings.
|
|
||||||
#
|
|
||||||
everything = off
|
|
||||||
|
|
||||||
# This option is specific to this configuration; it adds a #define to the
|
|
||||||
# generated pnglibconf.h which turns on the (not portable) timing option for
|
|
||||||
# pngcp. Note that any option is automatically preceded by PNG_; there is no
|
|
||||||
# way round this and this is deliberate.
|
|
||||||
option PNGCP_TIMING
|
|
||||||
|
|
||||||
# Because of the everything off above the option must also be turned on. This
|
|
||||||
# may not be done in one step because it is safer and avoids mis-spelled options
|
|
||||||
# in user .dfa files to error out if an unrecognized option is turned on.
|
|
||||||
option PNGCP_TIMING on
|
|
||||||
|
|
||||||
# Options to turn on png_read_png and png_write_png:
|
|
||||||
option INFO_IMAGE on
|
|
||||||
option SEQUENTIAL_READ on
|
|
||||||
option EASY_ACCESS on
|
|
||||||
option WRITE on
|
|
||||||
option WRITE_16BIT on
|
|
||||||
option WRITE_FILTER on
|
|
||||||
|
|
||||||
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
|
||||||
# pngcp can work without explicit known chunk reading support
|
|
||||||
option UNKNOWN_CHUNKS on
|
|
||||||
option SET_UNKNOWN_CHUNKS on
|
|
||||||
option HANDLE_AS_UNKNOWN on
|
|
||||||
option SAVE_UNKNOWN_CHUNKS on
|
|
||||||
option WRITE_UNKNOWN_CHUNKS on
|
|
||||||
|
|
||||||
# pngcp needs this to handle palette files with invalid indices:
|
|
||||||
option CHECK_FOR_INVALID_INDEX on
|
|
||||||
option GET_PALETTE_MAX on
|
|
||||||
|
|
||||||
# Pre-libpng 1.7 pngcp has to stash text chunks manually, post 1.7 without this
|
|
||||||
# text chunks should be handled as unknown ok.
|
|
||||||
option TEXT on
|
|
||||||
|
|
||||||
# this is used to turn off limits:
|
|
||||||
option USER_LIMITS on
|
|
||||||
option SET_USER_LIMITS on
|
|
||||||
|
|
||||||
# these are just required for specific customizations
|
|
||||||
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
|
||||||
option WRITE_CUSTOMIZE_COMPRESSION on
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
...
|
|
||||||
@@ -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.
|
||||||
@@ -20,4 +21,4 @@ ORIGINAL AUTHORS
|
|||||||
of the people below claim any rights with regard to the contents of this
|
of the people below claim any rights with regard to the contents of this
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
John Bowler <jbowler at acm.org>
|
John Bowler <jbowler@acm.org>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* without processing the image. Notice that some header information may occur
|
* without processing the image. Notice that some header information may occur
|
||||||
* after the image data. Textual data and comments are an example; the approach
|
* after the image data. Textual data and comments are an example; the approach
|
||||||
* in this file won't work reliably for such data because it only looks for the
|
* in this file won't work reliably for such data because it only looks for the
|
||||||
* information in the section of the file that precedes the image data.
|
* information in the section of the file that preceeds the image data.
|
||||||
*
|
*
|
||||||
* Compile and link against libpng and zlib, plus anything else required on the
|
* Compile and link against libpng and zlib, plus anything else required on the
|
||||||
* system you use.
|
* system you use.
|
||||||
@@ -26,19 +26,13 @@
|
|||||||
|
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
|
||||||
#if !defined(PNG_iCCP_SUPPORTED) || !defined(PNG_READ_SUPPORTED)
|
|
||||||
#error This program requires libpng supporting the iCCP chunk and the read API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int verbose = 1;
|
static int verbose = 1;
|
||||||
static png_byte no_profile[] = "no profile";
|
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 +65,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 +76,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 +103,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 +115,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 +151,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 +166,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;
|
||||||
|
|||||||
@@ -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,32 @@
|
|||||||
*/
|
*/
|
||||||
#include "../../png.h"
|
#include "../../png.h"
|
||||||
|
|
||||||
#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)(((PNG_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,9 +69,9 @@ 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);
|
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||||
|
|
||||||
switch (png_get_color_type(png_ptr, info_ptr))
|
switch (png_get_color_type(png_ptr, info_ptr))
|
||||||
{
|
{
|
||||||
@@ -90,29 +85,27 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
|||||||
*/
|
*/
|
||||||
case PNG_COLOR_TYPE_PALETTE:
|
case PNG_COLOR_TYPE_PALETTE:
|
||||||
{
|
{
|
||||||
int index = component(row, x, 0, bit_depth, 1);
|
PNG_CONST unsigned int index = component(row, x, 0, bit_depth, 1);
|
||||||
png_colorp palette = NULL;
|
png_colorp palette = NULL;
|
||||||
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 +115,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 +136,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 +144,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 +161,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 +182,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 +200,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 +240,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 +297,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 +321,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 +347,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*- pngtopng
|
/*- pngtopng
|
||||||
*
|
*
|
||||||
* COPYRIGHT: Written by John Cunningham Bowler, 2011, 2017.
|
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
|
||||||
* To the extent possible under law, the author has waived all copyright and
|
* 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:
|
* related or neighboring rights to this work. This work is published from:
|
||||||
* United States.
|
* United States.
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
* 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>
|
||||||
@@ -21,14 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "../../png.h"
|
#include "../../png.h"
|
||||||
|
|
||||||
#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,38 +46,37 @@ 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);
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
/* 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
|
||||||
|
* complete the read because of running out of memory.
|
||||||
|
*/
|
||||||
|
png_image_free(&image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
* the cleanup on error and success, but in this case we couldn't
|
|
||||||
* complete the read because of running out of memory and so libpng
|
|
||||||
* has not got to the point where it can do cleanup.
|
|
||||||
*/
|
|
||||||
png_image_free(&image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,664 +0,0 @@
|
|||||||
/*- simpleover
|
|
||||||
*
|
|
||||||
* COPYRIGHT: Written by John Cunningham Bowler, 2015.
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Read several PNG files, which should have an alpha channel or transparency
|
|
||||||
* information, and composite them together to produce one or more 16-bit
|
|
||||||
* linear RGBA intermediates. This involves doing the 'over' compositing
|
|
||||||
* operation to combine the alpha channels and corresponding data.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* channel), and apply the intermediate image generated above to specified
|
|
||||||
* locations in the image.
|
|
||||||
*
|
|
||||||
* The command line has the general format:
|
|
||||||
*
|
|
||||||
* simpleover <background.png> [output.png]
|
|
||||||
* {--sprite=width,height,name {[--at=x,y] {sprite.png}}}
|
|
||||||
* {--add=name {x,y}}
|
|
||||||
*
|
|
||||||
* The --sprite and --add options may occur multiple times. They are executed
|
|
||||||
* in order. --add may refer to any sprite already read.
|
|
||||||
*
|
|
||||||
* This code is intended to show how to composite multiple images together
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* (leftmost on the command line) being at the bottom and the last on the top.
|
|
||||||
*/
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
/* Normally use <png.h> here to get the installed libpng, but this is done to
|
|
||||||
* ensure the code picks up the local libpng implementation, so long as this
|
|
||||||
* file is linked against a sufficiently recent libpng (1.6+) it is ok to
|
|
||||||
* change this to <png.h>:
|
|
||||||
*/
|
|
||||||
#include "../../png.h"
|
|
||||||
|
|
||||||
#if !defined(PNG_SIMPLIFIED_READ_SUPPORTED)
|
|
||||||
#error This program requires libpng supporting the simplified read API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define sprite_name_chars 15
|
|
||||||
struct sprite
|
|
||||||
{
|
|
||||||
FILE *file;
|
|
||||||
png_uint_16p buffer;
|
|
||||||
unsigned int width;
|
|
||||||
unsigned int height;
|
|
||||||
char name[sprite_name_chars + 1];
|
|
||||||
};
|
|
||||||
|
|
||||||
#if 0 /* div by 65535 test program */
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main(void)
|
|
||||||
{
|
|
||||||
double err = 0;
|
|
||||||
unsigned int xerr = 0;
|
|
||||||
unsigned int r = 32769;
|
|
||||||
unsigned int x = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
unsigned int t = x + (x >> 16) /*+ (x >> 31)*/ + r;
|
|
||||||
double v = x, errtest;
|
|
||||||
|
|
||||||
if (t < x)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "overflow: %u+%u -> %u\n", x, r, t);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* div by 65535 test program */
|
|
||||||
|
|
||||||
static void
|
|
||||||
sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
|
||||||
png_imagep image, const png_uint_16 *buffer)
|
|
||||||
{
|
|
||||||
/* This is where the Porter-Duff 'Over' operator is evaluated; change this
|
|
||||||
* code to change the operator (this could be parameterized). Any other
|
|
||||||
* image processing operation could be used here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Check for an x or y offset that pushes any part of the image beyond the
|
|
||||||
* right or bottom of the sprite:
|
|
||||||
*/
|
|
||||||
if ((y_offset < 0 || /*SAFE*/ (unsigned)y_offset < sprite->height) &&
|
|
||||||
(x_offset < 0 || /*SAFE*/ (unsigned)x_offset < sprite->width))
|
|
||||||
{
|
|
||||||
unsigned int y = 0;
|
|
||||||
|
|
||||||
if (y_offset < 0)
|
|
||||||
y = -y_offset; /* Skip to first visible row */
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
unsigned int x = 0;
|
|
||||||
|
|
||||||
if (x_offset < 0)
|
|
||||||
x = -x_offset;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
/* In and out are RGBA values, so: */
|
|
||||||
const png_uint_16 *in_pixel = buffer + (y * image->width + x) * 4;
|
|
||||||
png_uint_32 in_alpha = in_pixel[3];
|
|
||||||
|
|
||||||
/* This is the optimized Porter-Duff 'Over' operation, when the
|
|
||||||
* input alpha is 0 the output is not changed.
|
|
||||||
*/
|
|
||||||
if (in_alpha > 0)
|
|
||||||
{
|
|
||||||
png_uint_16 *out_pixel = sprite->buffer +
|
|
||||||
((y + y_offset) * sprite->width + (x + x_offset)) * 4;
|
|
||||||
|
|
||||||
/* This is the weight to apply to the output: */
|
|
||||||
in_alpha = 65535 - in_alpha;
|
|
||||||
|
|
||||||
if (in_alpha > 0)
|
|
||||||
{
|
|
||||||
/* The input must be composed onto the output. This means
|
|
||||||
* multiplying the current output pixel value by the inverse
|
|
||||||
* of the input alpha (1-alpha). A division is required but
|
|
||||||
* it is by the constant 65535. Approximate this as:
|
|
||||||
*
|
|
||||||
* (x + (x >> 16) + 32769) >> 16;
|
|
||||||
*
|
|
||||||
* This is exact (and does not overflow) for all values of
|
|
||||||
* x in the range 0..65535*65535. (Note that the calculation
|
|
||||||
* produces the closest integer; the maximum error is <0.5).
|
|
||||||
*/
|
|
||||||
png_uint_32 tmp;
|
|
||||||
|
|
||||||
# define compose(c) \
|
|
||||||
tmp = out_pixel[c] * in_alpha; \
|
|
||||||
tmp = (tmp + (tmp >> 16) + 32769) >> 16; \
|
|
||||||
out_pixel[c] = tmp + in_pixel[c]
|
|
||||||
|
|
||||||
/* The following is very vectorizable... */
|
|
||||||
compose(0);
|
|
||||||
compose(1);
|
|
||||||
compose(2);
|
|
||||||
compose(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
out_pixel[0] = in_pixel[0];
|
|
||||||
out_pixel[1] = in_pixel[1];
|
|
||||||
out_pixel[2] = in_pixel[2];
|
|
||||||
out_pixel[3] = in_pixel[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (++x < image->width);
|
|
||||||
} while (++y < image->height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
create_sprite(struct sprite *sprite, int *argc, const char ***argv)
|
|
||||||
{
|
|
||||||
/* Read the arguments and create this sprite. The sprite buffer has already
|
|
||||||
* been allocated. This reads the input PNGs one by one in linear format,
|
|
||||||
* composes them onto the sprite buffer (the code in the function above)
|
|
||||||
* then saves the result, converting it on the fly to PNG RGBA 8-bit format.
|
|
||||||
*/
|
|
||||||
while (*argc > 0)
|
|
||||||
{
|
|
||||||
char tombstone;
|
|
||||||
int x = 0, y = 0;
|
|
||||||
|
|
||||||
if ((*argv)[0][0] == '-' && (*argv)[0][1] == '-')
|
|
||||||
{
|
|
||||||
/* The only supported option is --at. */
|
|
||||||
if (sscanf((*argv)[0], "--at=%d,%d%c", &x, &y, &tombstone) != 2)
|
|
||||||
break; /* success; caller will parse this option */
|
|
||||||
|
|
||||||
++*argv, --*argc;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The argument has to be a file name */
|
|
||||||
png_image image;
|
|
||||||
|
|
||||||
image.version = PNG_IMAGE_VERSION;
|
|
||||||
image.opaque = NULL;
|
|
||||||
|
|
||||||
if (png_image_begin_read_from_file(&image, (*argv)[0]))
|
|
||||||
{
|
|
||||||
png_uint_16p buffer;
|
|
||||||
|
|
||||||
image.format = PNG_FORMAT_LINEAR_RGB_ALPHA;
|
|
||||||
|
|
||||||
buffer = malloc(PNG_IMAGE_SIZE(image));
|
|
||||||
|
|
||||||
if (buffer != NULL)
|
|
||||||
{
|
|
||||||
if (png_image_finish_read(&image, NULL /*background*/, buffer,
|
|
||||||
0 /*row_stride*/, NULL /*colormap*/))
|
|
||||||
{
|
|
||||||
/* This is the place where the Porter-Duff 'Over' operator
|
|
||||||
* needs to be done by this code. In fact, any image
|
|
||||||
* processing required can be done here; the data is in
|
|
||||||
* the correct format (linear, 16-bit) and source and
|
|
||||||
* destination are in memory.
|
|
||||||
*/
|
|
||||||
sprite_op(sprite, x, y, &image, buffer);
|
|
||||||
free(buffer);
|
|
||||||
++*argv, --*argc;
|
|
||||||
/* And continue to the next argument */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
free(buffer);
|
|
||||||
fprintf(stderr, "simpleover: read %s: %s\n", (*argv)[0],
|
|
||||||
image.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
|
|
||||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
|
||||||
|
|
||||||
/* png_image_free must be called if we abort the Simplified API
|
|
||||||
* read because of a problem detected in this code. If problems
|
|
||||||
* are detected in the Simplified API it cleans up itself.
|
|
||||||
*/
|
|
||||||
png_image_free(&image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Failed to read the first argument: */
|
|
||||||
fprintf(stderr, "simpleover: %s: %s\n", (*argv)[0], image.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; /* failure */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All the sprite operations have completed successfully. Save the RGBA
|
|
||||||
* buffer as a PNG using the simplified write API.
|
|
||||||
*/
|
|
||||||
sprite->file = tmpfile();
|
|
||||||
|
|
||||||
if (sprite->file != NULL)
|
|
||||||
{
|
|
||||||
png_image save;
|
|
||||||
|
|
||||||
memset(&save, 0, sizeof save);
|
|
||||||
save.version = PNG_IMAGE_VERSION;
|
|
||||||
save.opaque = NULL;
|
|
||||||
save.width = sprite->width;
|
|
||||||
save.height = sprite->height;
|
|
||||||
save.format = PNG_FORMAT_LINEAR_RGB_ALPHA;
|
|
||||||
save.flags = PNG_IMAGE_FLAG_FAST;
|
|
||||||
save.colormap_entries = 0;
|
|
||||||
|
|
||||||
if (png_image_write_to_stdio(&save, sprite->file, 1 /*convert_to_8_bit*/,
|
|
||||||
sprite->buffer, 0 /*row_stride*/,
|
|
||||||
NULL /*colormap*/))
|
|
||||||
{
|
|
||||||
/* Success; the buffer is no longer needed: */
|
|
||||||
free(sprite->buffer);
|
|
||||||
sprite->buffer = NULL;
|
|
||||||
return 1; /* ok */
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
fprintf(stderr, "simpleover: write sprite %s: %s\n", sprite->name,
|
|
||||||
save.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
fprintf(stderr,
|
|
||||||
"simpleover: sprite %s: could not allocate tmpfile: %s\n",
|
|
||||||
sprite->name, strerror(errno));
|
|
||||||
|
|
||||||
return 0; /* fail */
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
|
|
||||||
int *argc, const char ***argv)
|
|
||||||
{
|
|
||||||
/* Given a --add argument naming this sprite, perform the operations listed
|
|
||||||
* in the following arguments. The arguments are expected to have the form
|
|
||||||
* (x,y), which is just an offset at which to add the sprite to the
|
|
||||||
* output.
|
|
||||||
*/
|
|
||||||
while (*argc > 0)
|
|
||||||
{
|
|
||||||
char tombstone;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
if ((*argv)[0][0] == '-' && (*argv)[0][1] == '-')
|
|
||||||
return 1; /* success */
|
|
||||||
|
|
||||||
if (sscanf((*argv)[0], "%d,%d%c", &x, &y, &tombstone) == 2)
|
|
||||||
{
|
|
||||||
/* Now add the new image into the sprite data, but only if it
|
|
||||||
* will fit.
|
|
||||||
*/
|
|
||||||
if (x < 0 || y < 0 ||
|
|
||||||
/*SAFE*/ (unsigned)x >= output->width ||
|
|
||||||
/*SAFE*/ (unsigned)y >= output->height ||
|
|
||||||
sprite->width > output->width - x ||
|
|
||||||
sprite->height > output->height - y)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: sprite %s @ (%d,%d) outside image\n",
|
|
||||||
sprite->name, x, y);
|
|
||||||
/* Could just skip this, but for the moment it is an error */
|
|
||||||
return 0; /* error */
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Since we know the sprite fits we can just read it into the
|
|
||||||
* output using the simplified API.
|
|
||||||
*/
|
|
||||||
png_image in;
|
|
||||||
|
|
||||||
in.version = PNG_IMAGE_VERSION;
|
|
||||||
rewind(sprite->file);
|
|
||||||
|
|
||||||
if (png_image_begin_read_from_stdio(&in, sprite->file))
|
|
||||||
{
|
|
||||||
in.format = PNG_FORMAT_RGB; /* force compose */
|
|
||||||
|
|
||||||
if (png_image_finish_read(
|
|
||||||
&in, NULL /*background*/,
|
|
||||||
out_buf + (y * output->width + x) * 3 /*RGB*/,
|
|
||||||
output->width * 3 /*row_stride*/, NULL /*colormap*/))
|
|
||||||
{
|
|
||||||
++*argv, --*argc;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The read failed: */
|
|
||||||
fprintf(stderr, "simpleover: add sprite %s: %s\n", sprite->name,
|
|
||||||
in.message);
|
|
||||||
return 0; /* error */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: --add='%s': invalid position %s\n",
|
|
||||||
sprite->name, (*argv)[0]);
|
|
||||||
return 0; /* error */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1; /* ok */
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
|
||||||
const char **argv)
|
|
||||||
{
|
|
||||||
int result = 1; /* success */
|
|
||||||
# define csprites 10 /*limit*/
|
|
||||||
# define str(a) #a
|
|
||||||
int nsprites = 0;
|
|
||||||
struct sprite sprites[csprites];
|
|
||||||
|
|
||||||
while (argc > 0)
|
|
||||||
{
|
|
||||||
result = 0; /* fail */
|
|
||||||
|
|
||||||
if (strncmp(argv[0], "--sprite=", 9) == 0)
|
|
||||||
{
|
|
||||||
char tombstone;
|
|
||||||
|
|
||||||
if (nsprites < csprites)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
sprites[nsprites].width = sprites[nsprites].height = 0;
|
|
||||||
sprites[nsprites].name[0] = 0;
|
|
||||||
|
|
||||||
n = sscanf(argv[0],
|
|
||||||
"--sprite=%u,%u,%" str(sprite_name_chars) "s%c",
|
|
||||||
&sprites[nsprites].width, &sprites[nsprites].height,
|
|
||||||
sprites[nsprites].name, &tombstone);
|
|
||||||
|
|
||||||
if ((n == 2 || n == 3) &&
|
|
||||||
(sprites[nsprites].width > 0) &&
|
|
||||||
(sprites[nsprites].height > 0))
|
|
||||||
{
|
|
||||||
size_t buf_size, tmp;
|
|
||||||
|
|
||||||
/* Default a name if not given. */
|
|
||||||
if (sprites[nsprites].name[0] == 0)
|
|
||||||
sprintf(sprites[nsprites].name, "sprite-%d", nsprites + 1);
|
|
||||||
|
|
||||||
/* Allocate a buffer for the sprite and calculate the buffer
|
|
||||||
* size:
|
|
||||||
*/
|
|
||||||
buf_size = sizeof(png_uint_16[4]);
|
|
||||||
buf_size *= sprites[nsprites].width;
|
|
||||||
buf_size *= sprites[nsprites].height;
|
|
||||||
|
|
||||||
/* This can overflow a (size_t); check for this: */
|
|
||||||
tmp = buf_size;
|
|
||||||
tmp /= sprites[nsprites].width;
|
|
||||||
tmp /= sprites[nsprites].height;
|
|
||||||
|
|
||||||
if (tmp == sizeof(png_uint_16[4]))
|
|
||||||
{
|
|
||||||
sprites[nsprites].buffer = malloc(buf_size);
|
|
||||||
/* This buffer must be initialized to transparent: */
|
|
||||||
memset(sprites[nsprites].buffer, 0, buf_size);
|
|
||||||
|
|
||||||
if (sprites[nsprites].buffer != NULL)
|
|
||||||
{
|
|
||||||
sprites[nsprites].file = NULL;
|
|
||||||
++argv, --argc;
|
|
||||||
|
|
||||||
if (create_sprite(sprites + nsprites++, &argc, &argv))
|
|
||||||
{
|
|
||||||
result = 1; /* still ok */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break; /* error */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Overflow, or OOM */
|
|
||||||
fprintf(stderr, "simpleover: %s: sprite too large\n", argv[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: %s: invalid sprite (%u,%u)\n",
|
|
||||||
argv[0],
|
|
||||||
sprites[nsprites].width, sprites[nsprites].height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: %s: too many sprites\n", argv[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (strncmp(argv[0], "--add=", 6) == 0)
|
|
||||||
{
|
|
||||||
const char *name = argv[0] + 6;
|
|
||||||
int isprite = nsprites;
|
|
||||||
|
|
||||||
++argv, --argc;
|
|
||||||
|
|
||||||
while (--isprite >= 0)
|
|
||||||
{
|
|
||||||
if (strcmp(sprites[isprite].name, name) == 0)
|
|
||||||
{
|
|
||||||
if (!add_sprite(output, out_buf, sprites + isprite,
|
|
||||||
&argc, &argv))
|
|
||||||
goto out; /* error in add_sprite */
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isprite < 0) /* sprite not found */
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: --add='%s': sprite not found\n",
|
|
||||||
name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: %s: unrecognized operation\n", argv[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = 1; /* ok */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up the cache of sprites: */
|
|
||||||
out:
|
|
||||||
while (--nsprites >= 0)
|
|
||||||
{
|
|
||||||
if (sprites[nsprites].buffer != NULL)
|
|
||||||
free(sprites[nsprites].buffer);
|
|
||||||
|
|
||||||
if (sprites[nsprites].file != NULL)
|
|
||||||
(void)fclose(sprites[nsprites].file);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, const char **argv)
|
|
||||||
{
|
|
||||||
int result = 1; /* default to fail */
|
|
||||||
|
|
||||||
if (argc >= 2)
|
|
||||||
{
|
|
||||||
int argi = 2;
|
|
||||||
const char *output = NULL;
|
|
||||||
png_image image;
|
|
||||||
|
|
||||||
if (argc > 2 && argv[2][0] != '-' /*an operation*/)
|
|
||||||
{
|
|
||||||
output = argv[2];
|
|
||||||
argi = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
image.version = PNG_IMAGE_VERSION;
|
|
||||||
image.opaque = NULL;
|
|
||||||
|
|
||||||
if (png_image_begin_read_from_file(&image, argv[1]))
|
|
||||||
{
|
|
||||||
png_bytep buffer;
|
|
||||||
|
|
||||||
image.format = PNG_FORMAT_RGB; /* 24-bit RGB */
|
|
||||||
|
|
||||||
buffer = malloc(PNG_IMAGE_SIZE(image));
|
|
||||||
|
|
||||||
if (buffer != NULL)
|
|
||||||
{
|
|
||||||
png_color background = {0, 0xff, 0}; /* fully saturated green */
|
|
||||||
|
|
||||||
if (png_image_finish_read(&image, &background, buffer,
|
|
||||||
0 /*row_stride*/, NULL /*colormap*/))
|
|
||||||
{
|
|
||||||
/* At this point png_image_finish_read has cleaned up the
|
|
||||||
* allocated data in png_image, and only the buffer needs to be
|
|
||||||
* freed.
|
|
||||||
*
|
|
||||||
* Perform the remaining operations:
|
|
||||||
*/
|
|
||||||
if (simpleover_process(&image, buffer,
|
|
||||||
argc - argi, argv + argi))
|
|
||||||
{
|
|
||||||
/* Write the output: */
|
|
||||||
if ((output != NULL &&
|
|
||||||
png_image_write_to_file(
|
|
||||||
&image, output, 0 /*convert_to_8bit*/, buffer,
|
|
||||||
0 /*row_stride*/, NULL /*colormap*/)) ||
|
|
||||||
(output == NULL &&
|
|
||||||
png_image_write_to_stdio(
|
|
||||||
&image, stdout, 0 /*convert_to_8bit*/, buffer,
|
|
||||||
0 /*row_stride*/, NULL /*colormap*/)))
|
|
||||||
result = 0;
|
|
||||||
|
|
||||||
else
|
|
||||||
fprintf(stderr, "simpleover: write %s: %s\n",
|
|
||||||
output == NULL ? "stdout" : output,
|
|
||||||
image.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* else simpleover_process writes an error message */
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
fprintf(stderr, "simpleover: read %s: %s\n", argv[1],
|
|
||||||
image.message);
|
|
||||||
|
|
||||||
free(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
|
|
||||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
* complete the read because of running out of memory.
|
|
||||||
*/
|
|
||||||
png_image_free(&image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Failed to read the first argument: */
|
|
||||||
fprintf(stderr, "simpleover: %s: %s\n", argv[1], image.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Usage message */
|
|
||||||
fprintf(
|
|
||||||
stderr,
|
|
||||||
"simpleover: usage: simpleover background.png [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"
|
|
||||||
" on fully saturated green.\n"
|
|
||||||
"\n"
|
|
||||||
" Optionally, before output, process additional PNG files:\n"
|
|
||||||
"\n"
|
|
||||||
" --sprite=width,height,name {[--at=x,y] {sprite.png}}\n"
|
|
||||||
" Produce a transparent sprite of size (width,height) and with\n"
|
|
||||||
" name 'name'.\n"
|
|
||||||
" For each sprite.png composite it is using a Porter-Duff 'Over'\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"
|
|
||||||
"\n"
|
|
||||||
" --add='name' {x,y}\n"
|
|
||||||
" Optionally, before output, composite a sprite, 'name', which\n"
|
|
||||||
" must have been previously produced using --sprite at each\n"
|
|
||||||
" offset (x,y) in the output image. Each sprite must fit\n"
|
|
||||||
" completely within the output image.\n"
|
|
||||||
"\n"
|
|
||||||
" PNG files are processed in the order they occur on the command\n"
|
|
||||||
" line and thus the first PNG processed appears as the bottommost\n"
|
|
||||||
" in the output image.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user