mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
388 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7cecdcae07 | ||
![]() |
cf59edd364 | ||
![]() |
2b978915d8 | ||
![]() |
254a64ec30 | ||
![]() |
9eb25bd899 | ||
![]() |
8087a21d0a | ||
![]() |
2e5f296bfa | ||
![]() |
4266c75f40 | ||
![]() |
f451a4de09 | ||
![]() |
6aa47debba | ||
![]() |
3391bb98e3 | ||
![]() |
21895b05ab | ||
![]() |
be81ebe1a4 | ||
![]() |
edf46621f3 | ||
![]() |
5dc5937b30 | ||
![]() |
7084241c75 | ||
![]() |
640204280f | ||
![]() |
740366c32b | ||
![]() |
5d53dfd20c | ||
![]() |
5b62726ced | ||
![]() |
a5830bfcb1 | ||
![]() |
3bca02e274 | ||
![]() |
197bbfe0d5 | ||
![]() |
0cc6436ef5 | ||
![]() |
f04c457a51 | ||
![]() |
5631b9b952 | ||
![]() |
dc71f481ff | ||
![]() |
e2c1579816 | ||
![]() |
cff8620272 | ||
![]() |
5be32eb35c | ||
![]() |
611bf1016c | ||
![]() |
0e37c0b477 | ||
![]() |
7108843467 | ||
![]() |
2b0eb78656 | ||
![]() |
ffb8e8b26f | ||
![]() |
cc5ee6b213 | ||
![]() |
b4800bae33 | ||
![]() |
ea12796820 | ||
![]() |
643dbda7d6 | ||
![]() |
34e3f7a65b | ||
![]() |
3e67531078 | ||
![]() |
23bdc7a6c4 | ||
![]() |
69a3e5bfd1 | ||
![]() |
c90491724e | ||
![]() |
98448e372d | ||
![]() |
f2b0f5fe1c | ||
![]() |
7101a5569f | ||
![]() |
e046c0dc3b | ||
![]() |
34005e3d3d | ||
![]() |
44f97f08d7 | ||
![]() |
044536de92 | ||
![]() |
738f5e743c | ||
![]() |
f20e66aa93 | ||
![]() |
5d09501462 | ||
![]() |
872555f4ba | ||
![]() |
bb7e922914 | ||
![]() |
b20e6fb314 | ||
![]() |
5356b94169 | ||
![]() |
812c34c13c | ||
![]() |
68e090e700 | ||
![]() |
8c7ed2e3b2 | ||
![]() |
2519a03418 | ||
![]() |
c4b20d0a3a | ||
![]() |
a8242dd947 | ||
![]() |
171bdd3a6c | ||
![]() |
0024abd279 | ||
![]() |
fcb0bca15f | ||
![]() |
deadeea7a2 | ||
![]() |
9cc729b523 | ||
![]() |
36a16fd761 | ||
![]() |
4d7c99334e | ||
![]() |
19a5a5eba3 | ||
![]() |
8a28d0558e | ||
![]() |
03660a516b | ||
![]() |
f753baae52 | ||
![]() |
92e8581f12 | ||
![]() |
8ffc967e8a | ||
![]() |
51f5bd68b9 | ||
![]() |
3714c584b1 | ||
![]() |
2a845ff819 | ||
![]() |
0cc367aaea | ||
![]() |
3042f74de0 | ||
![]() |
4599354be8 | ||
![]() |
823c2d80dc | ||
![]() |
75748d93ce | ||
![]() |
6f786ff0f6 | ||
![]() |
c1cc0f3f4c | ||
![]() |
d9d70e6506 | ||
![]() |
76e5ec217f | ||
![]() |
65470ac86c | ||
![]() |
8b1d489bce | ||
![]() |
a7a8faeefa | ||
![]() |
d7d950e8bd | ||
![]() |
f14d5fcd1e | ||
![]() |
7c90057cfe | ||
![]() |
1bf304c43c | ||
![]() |
9ee82380da | ||
![]() |
642b5d81e3 | ||
![]() |
d3cf9b6e22 | ||
![]() |
d288a1dd36 | ||
![]() |
0a27b48e94 | ||
![]() |
65cd5fa3e5 | ||
![]() |
f3a45ac2e9 | ||
![]() |
d161ce6116 | ||
![]() |
b3bcbf9f82 | ||
![]() |
b8a0a5401f | ||
![]() |
529e69e76a | ||
![]() |
cd5e582fd6 | ||
![]() |
bcb3124141 | ||
![]() |
cb08862674 | ||
![]() |
18ab7d09dd | ||
![]() |
68d7ce8040 | ||
![]() |
c0f3dd43d8 | ||
![]() |
222dd7ca49 | ||
![]() |
e3c7b26fbd | ||
![]() |
b7276eca01 | ||
![]() |
ef153d5325 | ||
![]() |
f5e92d7697 | ||
![]() |
88ab4f592d | ||
![]() |
3117b5f94a | ||
![]() |
5a7e87fc04 | ||
![]() |
8cc22a8c15 | ||
![]() |
843dbb7579 | ||
![]() |
1d1cc9ae18 | ||
![]() |
1964d560e9 | ||
![]() |
68ba4f1f7d | ||
![]() |
0e204b7364 | ||
![]() |
53a7f4e320 | ||
![]() |
fcdec9c66e | ||
![]() |
222086586b | ||
![]() |
40878fd6dc | ||
![]() |
20f819c29e | ||
![]() |
7e18d14296 | ||
![]() |
43d6ad3e15 | ||
![]() |
33ef48b6d6 | ||
![]() |
532fec0214 | ||
![]() |
e4a31f024b | ||
![]() |
9e538750d9 | ||
![]() |
ceed2a3cf6 | ||
![]() |
f1848a3b56 | ||
![]() |
ed217e3e60 | ||
![]() |
e1fa61daa8 | ||
![]() |
80691b9da2 | ||
![]() |
890231026d | ||
![]() |
3b9a73ed3e | ||
![]() |
e05ebfba7c | ||
![]() |
ec2e58c16a | ||
![]() |
7b888092b9 | ||
![]() |
14a348ddc8 | ||
![]() |
29e31f622f | ||
![]() |
d165a20ae4 | ||
![]() |
aa95dee697 | ||
![]() |
e7ba9c0dfc | ||
![]() |
6b5a2da072 | ||
![]() |
dddaf0c625 | ||
![]() |
72c4520d3c | ||
![]() |
0fa3c0f698 | ||
![]() |
4191872d0d | ||
![]() |
42c8fcbff9 | ||
![]() |
f74d5ecce8 | ||
![]() |
fb65436e06 | ||
![]() |
63c715b7d7 | ||
![]() |
1cdde11877 | ||
![]() |
8120345c89 | ||
![]() |
7a6148290f | ||
![]() |
c6ee62af2e | ||
![]() |
46b79d4716 | ||
![]() |
49eeb1f8ba | ||
![]() |
366c9c6a24 | ||
![]() |
920db2ecc0 | ||
![]() |
cc8006c48d | ||
![]() |
aa9023bbd0 | ||
![]() |
c9ac5bdba4 | ||
![]() |
ab6d97b7c8 | ||
![]() |
9138be341b | ||
![]() |
ce1f1f001e | ||
![]() |
805ed7a2d4 | ||
![]() |
2aebfb4aa9 | ||
![]() |
7f1f960d4f | ||
![]() |
59a68c83f0 | ||
![]() |
3bd304e5f4 | ||
![]() |
f0c578748b | ||
![]() |
2d7da9db8a | ||
![]() |
4356cb0709 | ||
![]() |
35d9f5ea52 | ||
![]() |
31439b6b8d | ||
![]() |
537c66660e | ||
![]() |
ac944e2b36 | ||
![]() |
ba980b8f0c | ||
![]() |
27e548af25 | ||
![]() |
92b2128a75 | ||
![]() |
6159bad8a9 | ||
![]() |
3285bf0d4c | ||
![]() |
4edbb4da81 | ||
![]() |
9a774b9156 | ||
![]() |
671661849a | ||
![]() |
438a518611 | ||
![]() |
8fb49b8b94 | ||
![]() |
144b348e07 | ||
![]() |
1a0d7a7481 | ||
![]() |
866fdf6f8f | ||
![]() |
6f8257e437 | ||
![]() |
269b753496 | ||
![]() |
2b814cde29 | ||
![]() |
893b8113f0 | ||
![]() |
7ec2bd28c7 | ||
![]() |
70d10da35c | ||
![]() |
064f992187 | ||
![]() |
46f1106a3f | ||
![]() |
a7fe3414e5 | ||
![]() |
ce4b632dd7 | ||
![]() |
6b0d1bd75b | ||
![]() |
2a4f0f5aee | ||
![]() |
7dacc4d5aa | ||
![]() |
da109d3e6e | ||
![]() |
f9348b77da | ||
![]() |
2ea11e2235 | ||
![]() |
b60316f4ee | ||
![]() |
050ce505e4 | ||
![]() |
2a23247420 | ||
![]() |
6b241f3786 | ||
![]() |
b3521c60af | ||
![]() |
6beae586d6 | ||
![]() |
bdbbcaa457 | ||
![]() |
abb8d4a71f | ||
![]() |
c993ae4c67 | ||
![]() |
6abf8c1e91 | ||
![]() |
0dfe422e9f | ||
![]() |
71b9b5e16e | ||
![]() |
9f9f8d8e63 | ||
![]() |
437b24a958 | ||
![]() |
2ed5a70bca | ||
![]() |
85f866dea3 | ||
![]() |
2fff013a69 | ||
![]() |
acfd50ae0b | ||
![]() |
8fc13a8704 | ||
![]() |
1460b3ce78 | ||
![]() |
e1088f99d4 | ||
![]() |
d65b3ebf00 | ||
![]() |
a3d1a35b98 | ||
![]() |
9c1dc4d13d | ||
![]() |
e755fb79ba | ||
![]() |
f79c85e22d | ||
![]() |
53d2188fa5 | ||
![]() |
f2294569cf | ||
![]() |
1547b335e4 | ||
![]() |
b2ef6edbe8 | ||
![]() |
5a6ea1822b | ||
![]() |
22ad62c25e | ||
![]() |
71475b064f | ||
![]() |
ee9d6d7bf2 | ||
![]() |
f8e5fa92b0 | ||
![]() |
c81516e943 | ||
![]() |
0b7bc40de1 | ||
![]() |
82414985c1 | ||
![]() |
c0616f1017 | ||
![]() |
c741d1e392 | ||
![]() |
ad9e42a877 | ||
![]() |
d7f77bf271 | ||
![]() |
f135775ad4 | ||
![]() |
afc6c595bf | ||
![]() |
e6c5bf46c4 | ||
![]() |
8be5c147d5 | ||
![]() |
f7abe3c419 | ||
![]() |
82097c2108 | ||
![]() |
e519af8b49 | ||
![]() |
efc96c9d59 | ||
![]() |
aab24fa1b3 | ||
![]() |
efa9c2e920 | ||
![]() |
c22ef3b2e3 | ||
![]() |
66fede80d2 | ||
![]() |
59fa76e164 | ||
![]() |
70fda1837d | ||
![]() |
aeb26da4cb | ||
![]() |
cd0ea2a7f5 | ||
![]() |
9923515ff4 | ||
![]() |
61bfdb0cb0 | ||
![]() |
9db8cff6ef | ||
![]() |
b445aade83 | ||
![]() |
3c152a8ef7 | ||
![]() |
5a0b7e9c29 | ||
![]() |
b126f80710 | ||
![]() |
3c761b5135 | ||
![]() |
07b8803110 | ||
![]() |
32f465a66b | ||
![]() |
074e2eaab0 | ||
![]() |
790fef342b | ||
![]() |
8a5732fcb3 | ||
![]() |
77c3a39299 | ||
![]() |
8cfdb5436d | ||
![]() |
f6036c0aeb | ||
![]() |
689e06516b | ||
![]() |
33de006e12 | ||
![]() |
9b5488054b | ||
![]() |
04c016d79f | ||
![]() |
b8ca9108ac | ||
![]() |
e56f79c0c6 | ||
![]() |
12222e6fbd | ||
![]() |
9b65ad49d3 | ||
![]() |
3f991d5092 | ||
![]() |
b422bc1181 | ||
![]() |
6fc5119423 | ||
![]() |
0a158f3506 | ||
![]() |
50d7a85154 | ||
![]() |
2733482d8e | ||
![]() |
3d57708c91 | ||
![]() |
abccfd7968 | ||
![]() |
823ef44f01 | ||
![]() |
d72cda543c | ||
![]() |
3c67eeca51 | ||
![]() |
b60656ecdc | ||
![]() |
c64655d058 | ||
![]() |
8b7b99c1db | ||
![]() |
62c027d4df | ||
![]() |
e9e9801a84 | ||
![]() |
0c2388cdae | ||
![]() |
9cb84c4cb9 | ||
![]() |
8c542ad9df | ||
![]() |
2abaf81e0f | ||
![]() |
ad0245bb96 | ||
![]() |
1f974dd2a9 | ||
![]() |
3ec225dd41 | ||
![]() |
36bd1bbd54 | ||
![]() |
0406deb1ca | ||
![]() |
5f5f98a1a9 | ||
![]() |
f10c6bb603 | ||
![]() |
f16427e58e | ||
![]() |
6aff792b66 | ||
![]() |
ed8840a36f | ||
![]() |
efdb24e54b | ||
![]() |
1f20bc1e85 | ||
![]() |
bbab57105b | ||
![]() |
a1a81cc2ac | ||
![]() |
c3a1d8424c | ||
![]() |
eda0f47f46 | ||
![]() |
3848c73ab4 | ||
![]() |
dd8db8105c | ||
![]() |
763c77e628 | ||
![]() |
840af2eda6 | ||
![]() |
8a354b41e9 | ||
![]() |
0fe598d2f6 | ||
![]() |
cbf8c64b58 | ||
![]() |
6a42bc1c8e | ||
![]() |
9e32b6f1ad | ||
![]() |
cc0e959722 | ||
![]() |
403422674d | ||
![]() |
bfb0abe4d9 | ||
![]() |
081e6751ab | ||
![]() |
103f8346e3 | ||
![]() |
723b2d9f2e | ||
![]() |
b7ea74c97d | ||
![]() |
8c3fdb0ac1 | ||
![]() |
a37d483651 | ||
![]() |
3796518809 | ||
![]() |
8ca01083d6 | ||
![]() |
cd03aaf7bf | ||
![]() |
c4bd411c35 | ||
![]() |
2224c8ea7b | ||
![]() |
e2bb5e7512 | ||
![]() |
d6e13b2acd | ||
![]() |
c2e2cd2ec5 | ||
![]() |
c3f209178b | ||
![]() |
dbe3e0c43e | ||
![]() |
2f753e260c | ||
![]() |
f5d5f5ae0e | ||
![]() |
3676fd324a | ||
![]() |
28c0f8895e | ||
![]() |
87378bc21d | ||
![]() |
6c6f7d105a | ||
![]() |
6842c58adc | ||
![]() |
a6fc80300f | ||
![]() |
5e8b45c436 | ||
![]() |
6dd99ca9c8 | ||
![]() |
52ee167644 | ||
![]() |
eb6767273a | ||
![]() |
9f734b13f4 | ||
![]() |
3cec1a16f5 | ||
![]() |
50bd1abdb1 | ||
![]() |
2dd5630eae | ||
![]() |
b9155ce3fd | ||
![]() |
2c0aee56a0 | ||
![]() |
301f7a1429 | ||
![]() |
386707c6d1 | ||
![]() |
216387f6f7 | ||
![]() |
b9e811fa99 | ||
![]() |
cdbb8ec7aa | ||
![]() |
72fa126446 | ||
![]() |
5df8e982e2 |
81
.appveyor.yml
Normal file
81
.appveyor.yml
Normal file
@ -0,0 +1,81 @@
|
||||
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'
|
94
.cmake-format.yaml
Normal file
94
.cmake-format.yaml
Normal file
@ -0,0 +1,94 @@
|
||||
# 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
|
55
.editorconfig
Normal file
55
.editorconfig
Normal file
@ -0,0 +1,55 @@
|
||||
# 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
|
9
.editorconfig-checker.json
Normal file
9
.editorconfig-checker.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Disable": {
|
||||
"IndentSize": true
|
||||
},
|
||||
"Exclude": [
|
||||
".git/",
|
||||
"out/"
|
||||
]
|
||||
}
|
31
.github/workflows/lint.yml
vendored
Normal file
31
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
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
Normal file
159
.gitignore
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
# 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
|
7
.yamllint.yml
Normal file
7
.yamllint.yml
Normal file
@ -0,0 +1,7 @@
|
||||
extends: default
|
||||
rules:
|
||||
document-start: disable
|
||||
document-end: disable
|
||||
line-length: disable
|
||||
truthy:
|
||||
check-keys: false
|
44
ANNOUNCE
44
ANNOUNCE
@ -1,5 +1,13 @@
|
||||
libpng 1.6.37 - April 14, 2019
|
||||
==============================
|
||||
libpng 1.6.51.git
|
||||
=================
|
||||
|
||||
This is a development version, not intended to be a public release.
|
||||
It will be replaced by a public release, or by another development
|
||||
version, at a later time.
|
||||
|
||||
|
||||
libpng 1.6.50 - July 1, 2025
|
||||
============================
|
||||
|
||||
This is a public release of libpng, intended for use in production code.
|
||||
|
||||
@ -9,13 +17,13 @@ Files available for download
|
||||
|
||||
Source files with LF line endings (for Unix/Linux):
|
||||
|
||||
* libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
|
||||
* libpng-1.6.37.tar.gz
|
||||
* 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):
|
||||
|
||||
* lp1637.7z (LZMA-compressed, recommended)
|
||||
* lp1637.zip
|
||||
* lpng1650.7z (LZMA-compressed, recommended)
|
||||
* lpng1650.zip (deflate-compressed)
|
||||
|
||||
Other information:
|
||||
|
||||
@ -25,20 +33,18 @@ Other information:
|
||||
* TRADEMARK.md
|
||||
|
||||
|
||||
Changes since the previous public release (version 1.6.36)
|
||||
----------------------------------------------------------
|
||||
Changes from version 1.6.49 to version 1.6.50
|
||||
---------------------------------------------
|
||||
|
||||
* Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
||||
* Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
|
||||
* Fixed a memory leak in pngtest.c.
|
||||
* Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
|
||||
contrib/pngminus; refactor.
|
||||
* Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
|
||||
(Contributed by Willem van Schaik)
|
||||
* Fixed a typo in the libpng license v2.
|
||||
(Contributed by Miguel Ojeda)
|
||||
* Added makefiles for AddressSanitizer-enabled builds.
|
||||
* Cleaned up various makefiles.
|
||||
* Improved the detection of the RVV Extension on the RISC-V platform.
|
||||
(Contributed by Filip Wasil)
|
||||
* Replaced inline ASM with C intrinsics in the RVV code.
|
||||
(Contributed by Filip Wasil)
|
||||
* Fixed a decoder defect in which unknown chunks trailing IDAT, set
|
||||
to go through the unknown chunk handler, incorrectly triggered
|
||||
out-of-place IEND errors.
|
||||
(Contributed by John Bowler)
|
||||
* Fixed the CMake file for cross-platform builds that require `libm`.
|
||||
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||
|
39
AUTHORS
39
AUTHORS
@ -4,7 +4,9 @@ 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
|
||||
@ -15,12 +17,17 @@ Authors, for copyright and licensing purposes.
|
||||
* 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
|
||||
@ -30,16 +37,30 @@ Authors, for copyright and licensing purposes.
|
||||
* Vadim Barkov
|
||||
* Willem van Schaik
|
||||
* Zhijie Liang
|
||||
* Apple Inc.
|
||||
- Zixu Wang (王子旭)
|
||||
* Arm Holdings
|
||||
- Richard Townsend
|
||||
* Google Inc.
|
||||
- Matt Sarett
|
||||
- Mike Klein
|
||||
- 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.
|
||||
files in the "projects", "scripts" and "tests" directories, have
|
||||
other copyright owners, but are released under the libpng license.
|
||||
|
||||
Some files in the "contrib" directory, and some tools-generated files
|
||||
that are distributed with libpng, have other copyright owners, and are
|
||||
released under other open source licenses.
|
||||
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.
|
||||
|
201
CHANGES
201
CHANGES
@ -204,7 +204,7 @@ Version 0.97 [January, 1998]
|
||||
Added simple sRGB support (Glenn R-P)
|
||||
Easier conditional compiling, e.g.,
|
||||
define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
|
||||
all configurable options can be selected from command-line instead
|
||||
all configurable options can be selected from command line instead
|
||||
of having to edit pngconf.h (Glenn R-P)
|
||||
Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
|
||||
Added more conditions for png_do_background, to avoid changing
|
||||
@ -942,7 +942,7 @@ Version 1.0.8 [July 24, 2000]
|
||||
Version 1.0.9beta1 [November 10, 2000]
|
||||
Fixed typo in scripts/makefile.hpux
|
||||
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
||||
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
||||
Fixed sequence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
||||
Changed "cdrom.com" in documentation to "libpng.org"
|
||||
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
||||
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
||||
@ -2295,7 +2295,7 @@ Version 1.4.0beta58 [May 14, 2009]
|
||||
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
|
||||
|
||||
Version 1.4.0beta59 [May 15, 2009]
|
||||
Reformated sources in libpng style (3-space intentation, comment format)
|
||||
Reformatted sources in libpng style (3-space indentation, comment format)
|
||||
Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG)
|
||||
Added sections about the git repository and our coding style to the
|
||||
documentation
|
||||
@ -2661,7 +2661,7 @@ Version 1.4.1beta06 [January 28, 2010]
|
||||
|
||||
Version 1.4.1beta07 [February 6, 2010]
|
||||
Folded some long lines in the source files.
|
||||
Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
|
||||
Added definable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
|
||||
and a PNG_USER_LIMITS_SUPPORTED flag.
|
||||
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
|
||||
png_ptr->png_user_chunk_malloc_max.
|
||||
@ -3886,7 +3886,7 @@ Version 1.6.0beta06 [January 24, 2012]
|
||||
Version 1.6.0beta07 [January 28, 2012]
|
||||
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
|
||||
compiler issues slightly different warnings from those issued by the
|
||||
current vesions of GCC. This eliminates those warnings by
|
||||
current versions of GCC. This eliminates those warnings by
|
||||
adding/removing casts and small code rewrites.
|
||||
Updated configure.ac from autoupdate: added --enable-werror option.
|
||||
Also some layout regularization and removal of introduced tab characters
|
||||
@ -3919,7 +3919,7 @@ Version 1.6.0beta08 [February 1, 2012]
|
||||
version checking to configure.ac
|
||||
Improved pngstest speed by not doing redundant tests and add const to
|
||||
the background parameter of png_image_finish_read. The --background
|
||||
option is now done automagically only when required, so that commandline
|
||||
option is now done automagically only when required, so that command-line
|
||||
option no longer exists.
|
||||
Cleaned up pngpriv.h to consistently declare all functions and data.
|
||||
Also eliminated PNG_CONST_DATA, which is apparently not needed but we
|
||||
@ -4052,7 +4052,7 @@ Version 1.6.0beta16 [March 6, 2012]
|
||||
(in fact this is harmless, but the PNG data produced may be sub-optimal).
|
||||
|
||||
Version 1.6.0beta17 [March 10, 2012]
|
||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
||||
Reject all iCCP chunks after the first, even if the first one is invalid.
|
||||
Deflate/inflate was reworked to move common zlib calls into single
|
||||
functions [rw]util.c. A new shared keyword check routine was also added
|
||||
@ -4962,7 +4962,7 @@ Version 1.6.13beta01 [July 4, 2014]
|
||||
Changed "if defined(__ARM_NEON__)" to
|
||||
"if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
|
||||
Fixed clang no-warning builds: png_digit was defined but never used.
|
||||
|
||||
|
||||
Version 1.6.13beta02 [July 21, 2014]
|
||||
Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
|
||||
(bug report from Wolfgang S. Kechel). Bug was introduced in libpng-1.6.11.
|
||||
@ -5453,7 +5453,7 @@ Version 1.6.21beta01 [December 11, 2015]
|
||||
Version 1.6.21beta02 [December 14, 2015]
|
||||
Moved png_check_keyword() from pngwutil.c to pngset.c
|
||||
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
|
||||
in the BigEndian tests by not testing it, making the BE code the same
|
||||
in the BigEndian tests by not testing it, making the BE code the same
|
||||
as the LE version.
|
||||
Fixes to pngvalid for various reduced build configurations (eliminate unused
|
||||
statics) and a fix for the case in rgb_to_gray when the digitize option
|
||||
@ -5517,7 +5517,7 @@ Version 1.6.22beta03 [March 9, 2016]
|
||||
Added a common-law trademark notice and export control information
|
||||
to the LICENSE file, png.h, and the man page.
|
||||
Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
|
||||
were accidentally removed from libpng-1.6.17.
|
||||
were accidentally removed from libpng-1.6.17.
|
||||
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
|
||||
(Robert C. Seacord).
|
||||
Removed dubious "#if INT_MAX" test from png.h that was added to
|
||||
@ -5927,7 +5927,7 @@ Version 1.6.32beta03 [August 2, 2017]
|
||||
(Bug report from the OSS-fuzz project).
|
||||
|
||||
Version 1.6.32beta04 [August 2, 2017]
|
||||
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
|
||||
Replaced local eXIf_buf with info_ptr->eXIf_buf in png_handle_eXIf().
|
||||
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
||||
|
||||
Version 1.6.32beta05 [August 2, 2017]
|
||||
@ -5950,7 +5950,7 @@ Version 1.6.32beta09 [August 3, 2017]
|
||||
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
|
||||
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
|
||||
Fixed five-byte error in the calculation of IDAT maximum possible size.
|
||||
|
||||
|
||||
Version 1.6.32beta10 [August 5, 2017]
|
||||
Moved chunk-length check into a png_check_chunk_length() private
|
||||
function (Suggested by Max Stepin).
|
||||
@ -6103,6 +6103,183 @@ Version 1.6.37 [April 14, 2019]
|
||||
Added makefiles for AddressSanitizer-enabled builds.
|
||||
Cleaned up various makefiles.
|
||||
|
||||
Version 1.6.38 [September 14, 2022]
|
||||
Added configurations and scripts for continuous integration.
|
||||
Fixed various errors in the handling of tRNS, hIST and eXIf.
|
||||
Implemented many stability improvements across all platforms.
|
||||
Updated the internal documentation.
|
||||
|
||||
Version 1.6.39 [November 20, 2022]
|
||||
Changed the error handler of oversized chunks (i.e. larger than
|
||||
PNG_USER_CHUNK_MALLOC_MAX) from png_chunk_error to png_benign_error.
|
||||
Fixed a buffer overflow error in contrib/tools/pngfix.
|
||||
Fixed a memory leak (CVE-2019-6129) in contrib/tools/pngcp.
|
||||
Disabled the ARM Neon optimizations by default in the CMake file,
|
||||
following the default behavior of the configure script.
|
||||
Allowed configure.ac to work with the trunk version of autoconf.
|
||||
Removed the support for "install" targets from the legacy makefiles;
|
||||
removed the obsolete makefile.cegcc.
|
||||
Cleaned up the code and updated the internal documentation.
|
||||
|
||||
Version 1.6.40 [June 21, 2023]
|
||||
Fixed the eXIf chunk multiplicity checks.
|
||||
Fixed a memory leak in pCAL processing.
|
||||
Corrected the validity report about tRNS inside png_get_valid().
|
||||
Fixed various build issues on *BSD, Mac and Windows.
|
||||
Updated the configurations and the scripts for continuous integration.
|
||||
Cleaned up the code, the build scripts, and the documentation.
|
||||
|
||||
Version 1.6.41 [January 24, 2024]
|
||||
Added SIMD-optimized code for the LoongArch LSX hardware.
|
||||
(Contributed by GuXiWei, JinBo and ZhangLixia)
|
||||
Fixed the run-time discovery of MIPS MSA hardware.
|
||||
(Contributed by Sui Jingfeng)
|
||||
Fixed an off-by-one error in the function png_do_check_palette_indexes(),
|
||||
which failed to recognize errors that might have existed in the first
|
||||
column of a broken palette-encoded image. This was a benign regression
|
||||
accidentally introduced in libpng-1.6.33. No pixel was harmed.
|
||||
(Contributed by Adam Richter; reviewed by John Bowler)
|
||||
Fixed, improved and modernized the contrib/pngminus programs, i.e.,
|
||||
png2pnm.c and pnm2png.c
|
||||
Removed old and peculiar portability hacks that were meant to silence
|
||||
warnings issued by gcc version 7.1 alone.
|
||||
(Contributed by John Bowler)
|
||||
Fixed and modernized the CMake file, and raised the minimum required
|
||||
CMake version from 3.1 to 3.6.
|
||||
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
|
||||
Allowed the configure script to disable the building of auxiliary tools
|
||||
and tests, thus catching up with the CMake file.
|
||||
(Contributed by Carlo Bramini)
|
||||
Fixed a build issue on Mac.
|
||||
(Contributed by Zixu Wang)
|
||||
Moved the Autoconf macro files to scripts/autoconf.
|
||||
Moved the CMake files (except for the main CMakeLists.txt) to
|
||||
scripts/cmake and moved the list of their contributing authors to
|
||||
scripts/cmake/AUTHORS.md
|
||||
Updated the CI configurations and scripts.
|
||||
Relicensed the CI scripts to the MIT License.
|
||||
Improved the test coverage.
|
||||
(Contributed by John Bowler)
|
||||
|
||||
Version 1.6.42 [January 29, 2024]
|
||||
Fixed the implementation of the macro function png_check_sig().
|
||||
This was an API regression, introduced in libpng-1.6.41.
|
||||
(Reported by Matthieu Darbois)
|
||||
Fixed and updated the libpng manual.
|
||||
|
||||
Version 1.6.43 [February 23, 2024]
|
||||
Fixed the row width check in png_check_IHDR().
|
||||
This corrected a bug that was specific to the 16-bit platforms,
|
||||
and removed a spurious compiler warning from the 64-bit builds.
|
||||
(Reported by Jacek Caban; fixed by John Bowler)
|
||||
Added eXIf chunk support to the push-mode reader in pngpread.c.
|
||||
(Contributed by Chris Blume)
|
||||
Added contrib/pngexif for the benefit of the users who would like
|
||||
to inspect the content of eXIf chunks.
|
||||
Added contrib/conftest/basic.dfa, a basic build-time configuration.
|
||||
(Contributed by John Bowler)
|
||||
Fixed a preprocessor condition in pngread.c that broke build-time
|
||||
configurations like contrib/conftest/pngcp.dfa.
|
||||
(Contributed by John Bowler)
|
||||
Added CMake build support for LoongArch LSX.
|
||||
(Contributed by GuXiWei)
|
||||
Fixed a CMake build error that occurred under a peculiar state of the
|
||||
dependency tree. This was a regression introduced in libpng-1.6.41.
|
||||
(Contributed by Dan Rosser)
|
||||
Marked the installed libpng headers as system headers in CMake.
|
||||
(Contributed by Benjamin Buch)
|
||||
Updated the build support for RISCOS.
|
||||
(Contributed by Cameron Cawley)
|
||||
Updated the makefiles to allow cross-platform builds to initialize
|
||||
conventional make variables like AR and ARFLAGS.
|
||||
Added various improvements to the CI scripts in areas like version
|
||||
consistency verification and text linting.
|
||||
Added version consistency verification to pngtest.c also.
|
||||
|
||||
Version 1.6.44 [September 12, 2024]
|
||||
Hardened calculations in chroma handling to prevent overflows, and
|
||||
relaxed a constraint in cHRM validation to accomodate the standard
|
||||
ACES AP1 set of color primaries.
|
||||
(Contributed by John Bowler)
|
||||
Removed the ASM implementation of ARM Neon optimizations and updated
|
||||
the build accordingly. Only the remaining C implementation shall be
|
||||
used from now on, thus ensuring the support of the PAC/BTI security
|
||||
features on ARM64.
|
||||
(Contributed by Ross Burton and John Bowler)
|
||||
Fixed the pickup of the PNG_HARDWARE_OPTIMIZATIONS option in the
|
||||
CMake build on FreeBSD/amd64. This is an important performance fix
|
||||
on this platform.
|
||||
Applied various fixes and improvements to the CMake build.
|
||||
(Contributed by Eric Riff, Benjamin Buch and Erik Scholz)
|
||||
Added fuzzing targets for the simplified read API.
|
||||
(Contributed by Mikhail Khachayants)
|
||||
Fixed a build error involving pngtest.c under a custom config.
|
||||
This was a regression introduced in a code cleanup in libpng-1.6.43.
|
||||
(Contributed by Ben Wagner)
|
||||
Fixed and improved the config files for AppVeyor CI and Travis CI.
|
||||
|
||||
Version 1.6.45 [January 7, 2025]
|
||||
Added support for the cICP chunk.
|
||||
(Contributed by Lucas Chollet and John Bowler)
|
||||
Adjusted and improved various checks in colorspace calculations.
|
||||
(Contributed by John Bowler)
|
||||
Rearranged the write order of colorspace chunks for better conformance
|
||||
with the PNG v3 draft specification.
|
||||
(Contributed by John Bowler)
|
||||
Raised the minimum required CMake version from 3.6 to 3.14.
|
||||
Forked off a development branch for libpng version 1.8.
|
||||
|
||||
Version 1.6.46 [January 23, 2025]
|
||||
Added support for the mDCV and cLLI chunks.
|
||||
(Contributed by John Bowler)
|
||||
Fixed a build issue affecting C89 compilers.
|
||||
This was a regression introduced in libpng-1.6.45.
|
||||
(Contributed by John Bowler)
|
||||
Added makefile.c89, specifically for testing C89 compilers.
|
||||
Cleaned up contrib/pngminus: corrected an old typo, removed an old
|
||||
workaround, and updated the CMake file.
|
||||
|
||||
Version 1.6.47 [February 18, 2025]
|
||||
Modified the behaviour of colorspace chunks in order to adhere
|
||||
to the new precedence rules formulated in the latest draft of
|
||||
the PNG Specification.
|
||||
(Contributed by John Bowler)
|
||||
Fixed a latent bug in `png_write_iCCP`.
|
||||
This would have been a read-beyond-end-of-malloc vulnerability,
|
||||
introduced early in the libpng-1.6.0 development, yet (fortunately!)
|
||||
it was inaccessible before the above-mentioned modification of the
|
||||
colorspace precedence rules, due to pre-existing colorspace checks.
|
||||
(Reported by Bob Friesenhahn; fixed by John Bowler)
|
||||
|
||||
Version 1.6.48 [April 30, 2025]
|
||||
Fixed the floating-point version of the mDCv setter `png_set_mDCv`.
|
||||
(Reported by Mohit Bakshi; fixed by John Bowler)
|
||||
Added #error directives to discourage the inclusion of private
|
||||
libpng implementation header files in PNG-supporting applications.
|
||||
Added the CMake build option `PNG_LIBCONF_HEADER`, to be used as an
|
||||
alternative to `DFA_XTRA`.
|
||||
Removed the Travis CI configuration files, with heartfelt thanks for
|
||||
their generous support of our project over the past five years!
|
||||
|
||||
Version 1.6.49 [June 12, 2025]
|
||||
Added SIMD-optimized code for the RISC-V Vector Extension (RVV).
|
||||
(Contributed by Manfred Schlaegl, Dragos Tiselice and Filip Wasil)
|
||||
Added various fixes and improvements to the build scripts and to
|
||||
the sample code.
|
||||
|
||||
Version 1.6.50 [July 1, 2025]
|
||||
Improved the detection of the RVV Extension on the RISC-V platform.
|
||||
(Contributed by Filip Wasil)
|
||||
Replaced inline ASM with C intrinsics in the RVV code.
|
||||
(Contributed by Filip Wasil)
|
||||
Fixed a decoder defect in which unknown chunks trailing IDAT, set
|
||||
to go through the unknown chunk handler, incorrectly triggered
|
||||
out-of-place IEND errors.
|
||||
(Contributed by John Bowler)
|
||||
Fixed the CMake file for cross-platform builds that require `libm`.
|
||||
|
||||
Version 1.6.51 [TODO]
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||
Subscription is required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
1435
CMakeLists.txt
1435
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
98
INSTALL
98
INSTALL
@ -1,4 +1,3 @@
|
||||
|
||||
Installing libpng
|
||||
|
||||
Contents
|
||||
@ -128,16 +127,18 @@ Your directory structure should look like this:
|
||||
README
|
||||
*.h, *.c => libpng source files
|
||||
CMakeLists.txt => "cmake" script
|
||||
ci
|
||||
ci_*.sh
|
||||
configuration files:
|
||||
configure.ac, configure, Makefile.am, Makefile.in,
|
||||
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh, etc.
|
||||
contrib
|
||||
arm-neon, conftest, examples, gregbook, libtests, pngminim,
|
||||
pngminus, pngsuite, tools, visupng
|
||||
pngminus, pngsuite, tools, visupng, riscv-rvv
|
||||
projects
|
||||
cbuilder5, owatcom, visualc71, vstudio, xcode
|
||||
owatcom, visualc71, vstudio
|
||||
scripts
|
||||
makefile.*
|
||||
*.def (module definition files)
|
||||
@ -145,7 +146,7 @@ Your directory structure should look like this:
|
||||
pngtest.png
|
||||
etc.
|
||||
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
|
||||
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||
@ -153,28 +154,27 @@ endings) and zip (DOS style line endings) formats.
|
||||
|
||||
VI. Building with project files
|
||||
|
||||
If you are building libpng with MSVC, you can enter the
|
||||
libpng projects\visualc71 or vstudio directory and follow the instructions
|
||||
in README.txt.
|
||||
If you are building libpng with Microsoft Visual Studio, you can enter
|
||||
the directory projects\visualc71 or projects\vstudio and follow the
|
||||
instructions in README.txt.
|
||||
|
||||
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||
then come back here and run "configure" or choose the appropriate
|
||||
makefile.sys in the scripts directory.
|
||||
Otherwise, enter the zlib directory and follow the instructions in
|
||||
zlib/README, then come back here and run "configure" or choose the
|
||||
appropriate makefile in the scripts directory.
|
||||
|
||||
VII. Building with makefiles
|
||||
|
||||
Copy the file (or files) that you need from the
|
||||
scripts directory into this directory, for example
|
||||
|
||||
MSDOS example:
|
||||
|
||||
copy scripts\makefile.msc makefile
|
||||
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||
|
||||
UNIX example:
|
||||
|
||||
cp scripts/makefile.std makefile
|
||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||
cp scripts/makefile.std Makefile
|
||||
make
|
||||
|
||||
Windows example:
|
||||
|
||||
nmake -f scripts\makefile.vcwin32
|
||||
|
||||
Read the makefile to see if you need to change any source or
|
||||
target directories to match your preferences.
|
||||
@ -191,36 +191,33 @@ test. For more confidence, you can run another test by typing
|
||||
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
|
||||
your output with the result shown in contrib/pngsuite/README.
|
||||
|
||||
Most of the makefiles will allow you to run "make install" to
|
||||
put the library in its final resting place (if you want to
|
||||
do that, run "make install" in the zlib directory first if necessary).
|
||||
Some also allow you to run "make test-installed" after you have
|
||||
run "make install".
|
||||
Most of the makefiles used to allow you to run "make install" to put
|
||||
the library in its final resting place, but that feature is no longer
|
||||
supported. The only tested and supported manners to install libpng are
|
||||
the conventional build and install procedures driven by the configure
|
||||
script or by the CMake file.
|
||||
|
||||
VIII. Configuring libpng for 16-bit platforms
|
||||
VIII. Configuring for DOS and other 16-bit platforms
|
||||
|
||||
You will want to look into zconf.h to tell zlib (and thus libpng) that
|
||||
it cannot allocate more than 64K at a time. Even if you can, the memory
|
||||
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
|
||||
|
||||
IX. Configuring for DOS
|
||||
Officially, the support for 16-bit platforms has been removed.
|
||||
|
||||
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()
|
||||
call. See zlib.h or zconf.h in the zlib library for more information.
|
||||
|
||||
X. Configuring for Medium Model
|
||||
You may be or may not be in luck if you target the "large" memory 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.
|
||||
|
||||
Libpng's support for medium model has been tested on most of the popular
|
||||
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
|
||||
defined, and FAR gets defined to far in pngconf.h, and you should be
|
||||
all set. Everything in the library (except for zlib's structure) is
|
||||
expecting far data. You must use the typedefs with the p or pp on
|
||||
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 *".
|
||||
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() call.
|
||||
You will also have to look into zconf.h to tell zlib (and thus libpng)
|
||||
that it cannot allocate more than 64K at a time. Even if you can, the
|
||||
memory won't be accessible. Therefore, you should limit zlib and libpng
|
||||
to 64K by defining MAXSEG_64K.
|
||||
|
||||
XI. Prepending a prefix to exported symbols
|
||||
IX. Prepending a prefix to exported symbols
|
||||
|
||||
Starting with libpng-1.6.0, you can configure libpng (when using the
|
||||
"configure" script) to prefix all exported symbols by means of the
|
||||
@ -231,7 +228,7 @@ identifier). This creates a set of macros in pnglibconf.h, so this is
|
||||
transparent to applications; their function calls get transformed by
|
||||
the macros to use the modified names.
|
||||
|
||||
XII. Configuring for compiler xxx:
|
||||
X. Configuring for compiler xxx:
|
||||
|
||||
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.
|
||||
@ -243,7 +240,7 @@ As of libpng-1.5.0, pngpriv.h also includes three other private header
|
||||
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
|
||||
that previously appeared in the public headers.
|
||||
|
||||
XIII. Removing unwanted object code
|
||||
XI. Removing unwanted object code
|
||||
|
||||
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
|
||||
@ -282,7 +279,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
|
||||
those sections that are actually used will be loaded into memory.
|
||||
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
XII. Enabling or disabling hardware optimizations
|
||||
|
||||
Certain hardware capabilities, such as the Intel SSE instructions,
|
||||
are normally detected at run time. Enable them with configure options
|
||||
@ -292,6 +289,7 @@ such as one of
|
||||
--enable-mips-msa=yes
|
||||
--enable-intel-sse=yes
|
||||
--enable-powerpc-vsx=yes
|
||||
--enable-riscv-rvv=yes
|
||||
|
||||
or enable them all at once with
|
||||
|
||||
@ -304,6 +302,7 @@ or more of
|
||||
CPPFLAGS += "-DPNG_MIPS_MSA"
|
||||
CPPFLAGS += "-DPNG_INTEL_SSE"
|
||||
CPPFLAGS += "-DPNG_POWERPC_VSX"
|
||||
CPPFLAGS += "-DPNG_RISCV_RVV"
|
||||
|
||||
See for example scripts/makefile.linux-opt
|
||||
|
||||
@ -320,19 +319,21 @@ 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_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_MIPS_MSA=no -DPNG_POWERPC_VSX=no \
|
||||
-DPNG_RISCV_RVV=no
|
||||
|
||||
or disable them all at once with
|
||||
|
||||
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
|
||||
|
||||
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
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
|
||||
file and in the GIT repository logs. These will be of no concern to the vast
|
||||
@ -423,7 +424,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
|
||||
libpng, because than the settings would not accurately reflect the settings
|
||||
that were used to build libpng.
|
||||
|
||||
XVI. Setjmp/longjmp issues
|
||||
XIV. Setjmp/longjmp issues
|
||||
|
||||
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
|
||||
@ -441,7 +442,7 @@ 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.
|
||||
|
||||
XVII. Common linking failures
|
||||
XV. Common linking failures
|
||||
|
||||
If your application fails to find libpng or zlib entries while linking:
|
||||
|
||||
@ -453,12 +454,13 @@ If your application fails to find libpng or zlib entries while linking:
|
||||
If you are using the vstudio project, observe the WARNING in
|
||||
project/vstudio/README.txt.
|
||||
|
||||
XVIII. 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
|
||||
files, in the individual makefiles, in png.h, and the manual pages
|
||||
libpng.3 and png.5.
|
||||
|
||||
Copyright (c) 2022 Cosmin Truta
|
||||
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
|
||||
|
4
LICENSE
4
LICENSE
@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||
PNG Reference Library License version 2
|
||||
---------------------------------------
|
||||
|
||||
* Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2019 Cosmin Truta.
|
||||
* Copyright (c) 1995-2025 The PNG Reference Library Authors.
|
||||
* 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.
|
||||
|
64
Makefile.am
64
Makefile.am
@ -1,6 +1,6 @@
|
||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||
#
|
||||
# Copyright (c) 2018 Cosmin Truta
|
||||
# Copyright (c) 2018-2025 Cosmin Truta
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@ -9,16 +9,24 @@
|
||||
|
||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I scripts
|
||||
ACLOCAL_AMFLAGS = -I scripts/autoconf
|
||||
|
||||
# test programs - run on make check, make distcheck
|
||||
if ENABLE_TESTS
|
||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
||||
if HAVE_CLOCK_GETTIME
|
||||
check_PROGRAMS += timepng
|
||||
endif
|
||||
else
|
||||
check_PROGRAMS=
|
||||
endif
|
||||
|
||||
# Utilities - installed
|
||||
if ENABLE_TOOLS
|
||||
bin_PROGRAMS= pngfix png-fix-itxt
|
||||
else
|
||||
bin_PROGRAMS=
|
||||
endif
|
||||
|
||||
# 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,
|
||||
@ -30,6 +38,7 @@ bin_PROGRAMS= pngfix png-fix-itxt
|
||||
# always wrong and always very confusing.
|
||||
BUILT_SOURCES = pnglibconf.h
|
||||
|
||||
if ENABLE_TESTS
|
||||
pngtest_SOURCES = pngtest.c
|
||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
@ -48,19 +57,22 @@ 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_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
|
||||
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
endif
|
||||
|
||||
# Generally these are single line shell scripts to run a test with a particular
|
||||
# set of parameters:
|
||||
if ENABLE_TESTS
|
||||
TESTS =\
|
||||
tests/pngtest\
|
||||
tests/pngtest-badpngs\
|
||||
tests/pngtest-all\
|
||||
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
||||
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
||||
tests/pngvalid-gamma-expand16-background\
|
||||
@ -76,6 +88,7 @@ TESTS =\
|
||||
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
|
||||
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
|
||||
tests/pngimage-quick tests/pngimage-full
|
||||
endif
|
||||
|
||||
# man pages
|
||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||
@ -95,7 +108,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||
|
||||
if PNG_ARM_NEON
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||
arm/filter_neon_intrinsics.c \
|
||||
arm/palette_neon_intrinsics.c
|
||||
endif
|
||||
|
||||
@ -104,6 +117,13 @@ 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
|
||||
@ -114,6 +134,22 @@ 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
|
||||
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||
@ -134,6 +170,14 @@ else
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||
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/*
|
||||
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||
pkginclude_HEADERS= png.h pngconf.h
|
||||
@ -150,7 +194,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||
EXTRA_DIST= \
|
||||
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||
CMakeLists.txt example.c libpng-manual.txt
|
||||
|
||||
@ -166,7 +210,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
||||
config.sub configure depcomp install-sh ltmain.sh missing
|
||||
|
||||
# PNG_COPTS give extra options for the C compiler to be used on all compilation
|
||||
# steps (unless targe_CFLAGS is specified; that will take precedence over
|
||||
# steps (unless target_CFLAGS is specified; that will take precedence over
|
||||
# AM_CFLAGS)
|
||||
PNG_COPTS = @PNG_COPTS@
|
||||
AM_CFLAGS = ${PNG_COPTS}
|
||||
|
662
Makefile.in
662
Makefile.in
File diff suppressed because it is too large
Load Diff
299
README
299
README
@ -1,57 +1,88 @@
|
||||
README for libpng version 1.6.37 - April 14, 2019
|
||||
=================================================
|
||||
README for libpng version 1.6.51.git
|
||||
====================================
|
||||
|
||||
See the note about version numbers near the top of png.h.
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
See the note about version numbers near the top of `png.h`.
|
||||
See `INSTALL` for instructions on how to install libpng.
|
||||
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||
libpng-*.tar.xz or if you want UNIX-style line endings in the text
|
||||
files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||
Libpng comes in several distribution formats. Get `libpng-*.tar.gz`
|
||||
or `libpng-*.tar.xz` if you want UNIX-style line endings in the text
|
||||
files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings.
|
||||
|
||||
Version 0.89 was the first official release of libpng. Don't let the
|
||||
fact that it's the first release fool you. The libpng library has been
|
||||
in extensive use and testing since mid-1995. By late 1997 it had
|
||||
finally gotten to the stage where there hadn't been significant
|
||||
changes to the API in some time, and people have a bad feeling about
|
||||
libraries with versions < 1.0. Version 1.0.0 was released in
|
||||
March 1998.
|
||||
For a detailed description on using libpng, read `libpng-manual.txt`.
|
||||
For examples of libpng in a program, see `example.c` and `pngtest.c`.
|
||||
For usage information and restrictions (what little they are) on libpng,
|
||||
see `png.h`. For a description on using zlib (the compression library
|
||||
used by libpng) and zlib's restrictions, see `zlib.h`.
|
||||
|
||||
****
|
||||
Note that some of the changes to the png_info structure render this
|
||||
You should use zlib 1.0.4 or later to run this, but it _may_ work with
|
||||
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||
versions which can cause the output of invalid compression streams for
|
||||
some images.
|
||||
|
||||
You should also note that zlib is a compression library that is useful
|
||||
for more things than just PNG files. You can use zlib as a drop-in
|
||||
replacement for `fread()` and `fwrite()`, if you are so inclined.
|
||||
|
||||
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
|
||||
earlier versions if you are using a shared library. The type of the
|
||||
"filler" parameter for png_set_filler() has changed from png_byte to
|
||||
png_uint_32, which will affect shared-library applications that use
|
||||
this function.
|
||||
`filler` parameter for `png_set_filler()` has changed from `png_byte`
|
||||
to `png_uint_32`, which will affect shared-library applications that
|
||||
use this function.
|
||||
|
||||
To avoid problems with changes to the internals of the png info_struct,
|
||||
To avoid problems with changes to the internals of the `info_struct`,
|
||||
new APIs have been made available in 0.95 to avoid direct application
|
||||
access to info_ptr. These functions are the png_set_<chunk> and
|
||||
png_get_<chunk> functions. These functions should be used when
|
||||
accessing/storing the info_struct data, rather than manipulating it
|
||||
access to `info_ptr`. These functions are the `png_set_<chunk>` and
|
||||
`png_get_<chunk>` functions. These functions should be used when
|
||||
accessing/storing the `info_struct` data, rather than manipulating it
|
||||
directly, to avoid such problems in the future.
|
||||
|
||||
It is important to note that the APIs did not make current programs
|
||||
that access the info struct directly incompatible with the new
|
||||
library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
|
||||
be a transitional release, members of the png_struct and the
|
||||
info_struct can still be accessed, but the compiler will issue a
|
||||
be a transitional release, members of the `png_struct` and the
|
||||
`info_struct` can still be accessed, but the compiler will issue a
|
||||
warning about deprecated usage. Since libpng-1.5.0, direct access
|
||||
to these structs is not allowed, and the definitions of the structs
|
||||
reside in private pngstruct.h and pnginfo.h header files that are not
|
||||
accessible to applications. It is strongly suggested that new
|
||||
programs use the new APIs (as shown in example.c and pngtest.c), and
|
||||
older programs be converted to the new format, to facilitate upgrades
|
||||
in the future.
|
||||
****
|
||||
|
||||
Additions since 0.90 include the ability to compile libpng as a
|
||||
Windows DLL, and new APIs for accessing data in the info struct.
|
||||
Experimental functions include the ability to set weighting and cost
|
||||
factors for row filter selection, direct reads of integers from buffers
|
||||
on big-endian processors that support misaligned data access, faster
|
||||
methods of doing alpha composition, and more accurate 16->8 bit color
|
||||
conversion.
|
||||
reside in private `pngstruct.h` and `pnginfo.h` header files that are
|
||||
not accessible to applications. It is strongly suggested that new
|
||||
programs use the new APIs (as shown in `example.c` and `pngtest.c`),
|
||||
and older programs be converted to the new format, to facilitate
|
||||
upgrades in the future.
|
||||
|
||||
The additions since 0.89 include the ability to read from a PNG stream
|
||||
which has had some (or all) of the signature bytes read by the calling
|
||||
@ -61,118 +92,88 @@ the library action on the detection of chunk CRC errors. It is possible
|
||||
to set different actions based on whether the CRC error occurred in a
|
||||
critical or an ancillary chunk.
|
||||
|
||||
For a detailed description on using libpng, read libpng-manual.txt.
|
||||
For examples of libpng in a program, see example.c and pngtest.c. For
|
||||
usage information and restrictions (what little they are) on libpng,
|
||||
see png.h. For a description on using zlib (the compression library
|
||||
used by libpng) and zlib's restrictions, see zlib.h
|
||||
The additions since 0.90 include the ability to compile libpng as a
|
||||
Windows DLL, and new APIs for accessing data in the `info_struct`.
|
||||
Experimental functions included the ability to set weighting and cost
|
||||
factors for row filter selection, direct reads of integers from buffers
|
||||
on big-endian processors that support misaligned data access, faster
|
||||
methods of doing alpha composition, and more accurate 16-to-8 bit color
|
||||
conversion. Some of these experimental functions, such as the weighted
|
||||
filter heuristics, have since been removed.
|
||||
|
||||
I have included a general makefile, as well as several machine and
|
||||
compiler specific ones, but you may have to modify one for your own
|
||||
needs.
|
||||
Files included in this distribution
|
||||
-----------------------------------
|
||||
|
||||
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
||||
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||
versions which can cause the output of invalid compression streams for
|
||||
some images.
|
||||
|
||||
You should also note that zlib is a compression library that is useful
|
||||
for more things than just PNG files. You can use zlib as a drop-in
|
||||
replacement for fread() and fwrite(), if you are so inclined.
|
||||
|
||||
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 libpng.sourceforge.io in the
|
||||
[DOWNLOAD] area, and at http://libpng.download/src .
|
||||
|
||||
This release, based in a large way on Glenn's, Guy's and Andreas'
|
||||
earlier work, was created and will be supported by myself and the PNG
|
||||
development group.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at
|
||||
lists.sourceforge.net (subscription required; visit
|
||||
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 required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
||||
subscribe).
|
||||
|
||||
Files in this distribution:
|
||||
|
||||
ANNOUNCE => Announcement of this version, with recent changes
|
||||
AUTHORS => List of contributing authors
|
||||
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
|
||||
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
|
||||
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
|
||||
powerpc => Contains optimized code for the PowerPC platform
|
||||
contrib => Contributions
|
||||
arm-neon => Optimized code for ARM-NEON platform
|
||||
powerpc-vsx => Optimized code for POWERPC-VSX platform
|
||||
examples => Example programs
|
||||
gregbook => source code for PNG reading and writing, from
|
||||
Greg Roelofs' "PNG: The Definitive Guide",
|
||||
O'Reilly, 1999
|
||||
libtests => Test programs
|
||||
mips-msa => Optimized code for MIPS-MSA platform
|
||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating use of pngusr.dfa
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
testpngs
|
||||
tools => Various tools
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
intel => Optimized code for INTEL-SSE2 platform
|
||||
mips => Optimized code for MIPS platform
|
||||
projects => Contains project files and workspaces for
|
||||
building a DLL
|
||||
owatcom => Contains a WATCOM project for building libpng
|
||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
(see scripts/README.txt for the list of scripts)
|
||||
ANNOUNCE => Announcement of this version, with recent changes
|
||||
AUTHORS => List of contributing authors
|
||||
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!
|
||||
|
||||
|
43
TODO
43
TODO
@ -1,23 +1,22 @@
|
||||
TODO - list of things to do for libpng:
|
||||
TODO list for libpng
|
||||
--------------------
|
||||
|
||||
* Fix all defects (duh!)
|
||||
* Better C++ wrapper / full C++ implementation (?)
|
||||
* Fix the problems with C++ and 'extern "C"'.
|
||||
* cHRM transformation.
|
||||
* Palette creation.
|
||||
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
* Improved dithering.
|
||||
* Multi-lingual error and warning message support.
|
||||
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
||||
* Man pages for function calls.
|
||||
* Better documentation.
|
||||
* Better filter selection
|
||||
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
||||
* Histogram creation.
|
||||
* Text conversion between different code pages (e.g., Latin-1 -> Mac).
|
||||
* Avoid building gamma tables whenever possible.
|
||||
* Greater precision in changing to linear gamma for compositing against
|
||||
background, and in doing rgb-to-gray transformations.
|
||||
* Investigate pre-incremented loop counters and other loop constructions.
|
||||
* Interpolated method of handling interlacing.
|
||||
* More validations for libpng transformations.
|
||||
* Fix all defects (duh!)
|
||||
* cHRM transformation.
|
||||
* Palette creation.
|
||||
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
* Improved dithering.
|
||||
* Multi-lingual error and warning message support.
|
||||
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
||||
* Man pages for function calls.
|
||||
* Better documentation.
|
||||
* Better filter selection
|
||||
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
||||
* Histogram creation.
|
||||
* Text conversion between different code pages (e.g., Latin-1 to Mac).
|
||||
* Avoid building gamma tables whenever possible.
|
||||
* Greater precision in changing to linear gamma for compositing against
|
||||
background, and in doing rgb-to-gray transformations.
|
||||
* Investigate pre-incremented loop counters and other loop constructions.
|
||||
* Interpolated method of handling interlacing.
|
||||
* More validations for libpng transformations.
|
||||
|
476
aclocal.m4
vendored
476
aclocal.m4
vendored
@ -1,6 +1,6 @@
|
||||
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.18.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,13 +14,13 @@
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
|
||||
[m4_warning([this file was generated for autoconf 2.69.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
|
||||
[m4_warning([this file was generated for autoconf 2.72.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.16'
|
||||
[am__api_version='1.18'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.16.1], [],
|
||||
m4_if([$1], [1.18.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.16.1])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.18.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# Figure out how to run the assembler. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -78,7 +78,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -130,7 +130,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -161,7 +161,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -293,7 +293,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# When given -MP, icc 7.0 and 7.1 complain thus:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
@ -352,7 +352,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -391,7 +391,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
done
|
||||
if test $am_rc -ne 0; then
|
||||
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
|
||||
for automatic dependency tracking. Try re-running configure with the
|
||||
for automatic dependency tracking. If GNU make was not used, consider
|
||||
re-running the configure script with MAKE="gmake" (or whatever is
|
||||
necessary). You can also try re-running configure with the
|
||||
'--disable-dependency-tracking' option to at least be able to build
|
||||
the package (albeit without support for automatic dependency tracking).])
|
||||
fi
|
||||
@ -418,7 +420,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -446,6 +448,10 @@ m4_defn([AC_PROG_CC])
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.65])dnl
|
||||
m4_ifdef([_$0_ALREADY_INIT],
|
||||
[m4_fatal([$0 expanded multiple times
|
||||
]m4_defn([_$0_ALREADY_INIT]))],
|
||||
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
@ -482,7 +488,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(
|
||||
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
|
||||
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
|
||||
[ok:ok],,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
@ -514,8 +520,9 @@ AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_IF_OPTION([tar-v7], [_AM_PROG_TAR([v7])],
|
||||
[_AM_PROG_TAR([ustar])])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES([CC])],
|
||||
@ -534,7 +541,21 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
|
||||
[m4_define([AC_PROG_OBJCXX],
|
||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
|
||||
])
|
||||
AC_REQUIRE([AM_SILENT_RULES])dnl
|
||||
# Variables for tags utilities; see am/tags.am
|
||||
if test -z "$CTAGS"; then
|
||||
CTAGS=ctags
|
||||
fi
|
||||
AC_SUBST([CTAGS])
|
||||
if test -z "$ETAGS"; then
|
||||
ETAGS=etags
|
||||
fi
|
||||
AC_SUBST([ETAGS])
|
||||
if test -z "$CSCOPE"; then
|
||||
CSCOPE=cscope
|
||||
fi
|
||||
AC_SUBST([CSCOPE])
|
||||
|
||||
AC_REQUIRE([_AM_SILENT_RULES])dnl
|
||||
dnl The testsuite driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
|
||||
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
@ -542,47 +563,9 @@ AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
AC_REQUIRE([_AM_PROG_RM_F])
|
||||
AC_REQUIRE([_AM_PROG_XARGS_N])
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell bug-automake@gnu.org about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <https://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
|
||||
END
|
||||
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
|
||||
fi
|
||||
fi
|
||||
dnl The trailing newline in this macro's definition is deliberate, for
|
||||
dnl backward compatibility and to allow trailing 'dnl'-style comments
|
||||
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
|
||||
@ -615,7 +598,7 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -636,7 +619,7 @@ if test x"${install_sh+set}" != xset; then
|
||||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -658,7 +641,7 @@ AC_SUBST([am__leading_dot])])
|
||||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -693,7 +676,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -736,7 +719,7 @@ AC_SUBST([am__quote])])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -757,12 +740,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
MISSING="\${SHELL} '$am_aux_dir/missing'"
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --is-lightweight"; then
|
||||
@ -775,7 +753,7 @@ fi
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -804,7 +782,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -836,7 +814,10 @@ AC_CACHE_CHECK(
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
# aligned with autoconf, so not including core; see bug#72225.
|
||||
rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.$ac_objext \
|
||||
conftest.dSYM conftest1.$ac_ext conftest1.$ac_objext conftest1.dSYM \
|
||||
conftest2.$ac_ext conftest2.$ac_objext conftest2.dSYM
|
||||
unset am_i])
|
||||
if test "$am_cv_prog_cc_c_o" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
@ -851,7 +832,23 @@ AC_LANG_POP([C])])
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_PROG_RM_F
|
||||
# ---------------
|
||||
# Check whether 'rm -f' without any arguments works.
|
||||
# https://bugs.gnu.org/10828
|
||||
AC_DEFUN([_AM_PROG_RM_F],
|
||||
[am__rm_f_notfound=
|
||||
AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
|
||||
AC_SUBST(am__rm_f_notfound)
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -870,26 +867,181 @@ AC_DEFUN([AM_RUN_LOG],
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_SLEEP_FRACTIONAL_SECONDS
|
||||
# ----------------------------
|
||||
AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
|
||||
AC_CACHE_CHECK([whether sleep supports fractional seconds],
|
||||
am_cv_sleep_fractional_seconds, [dnl
|
||||
AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
|
||||
[am_cv_sleep_fractional_seconds=no])
|
||||
])])
|
||||
|
||||
# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
|
||||
# -----------------------------------
|
||||
# Determine the filesystem's resolution for file modification
|
||||
# timestamps. The coarsest we know of is FAT, with a resolution
|
||||
# of only two seconds, even with the most recent "exFAT" extensions.
|
||||
# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
|
||||
# nanosecond, matching clock_gettime. However, it is probably not
|
||||
# possible to delay execution of a shell script for less than one
|
||||
# millisecond, due to process creation overhead and scheduling
|
||||
# granularity, so we don't check for anything finer than that. (See below.)
|
||||
AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
|
||||
AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
|
||||
AC_CACHE_CHECK([filesystem timestamp resolution],
|
||||
am_cv_filesystem_timestamp_resolution, [dnl
|
||||
# Default to the worst case.
|
||||
am_cv_filesystem_timestamp_resolution=2
|
||||
|
||||
# Only try to go finer than 1 sec if sleep can do it.
|
||||
# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
|
||||
# - 1 sec is not much of a win compared to 2 sec, and
|
||||
# - it takes 2 seconds to perform the test whether 1 sec works.
|
||||
#
|
||||
# Instead, just use the default 2s on platforms that have 1s resolution,
|
||||
# accept the extra 1s delay when using $sleep in the Automake tests, in
|
||||
# exchange for not incurring the 2s delay for running the test for all
|
||||
# packages.
|
||||
#
|
||||
am_try_resolutions=
|
||||
if test "$am_cv_sleep_fractional_seconds" = yes; then
|
||||
# Even a millisecond often causes a bunch of false positives,
|
||||
# so just try a hundredth of a second. The time saved between .001 and
|
||||
# .01 is not terribly consequential.
|
||||
am_try_resolutions="0.01 0.1 $am_try_resolutions"
|
||||
fi
|
||||
|
||||
# In order to catch current-generation FAT out, we must *modify* files
|
||||
# that already exist; the *creation* timestamp is finer. Use names
|
||||
# that make ls -t sort them differently when they have equal
|
||||
# timestamps than when they have distinct timestamps, keeping
|
||||
# in mind that ls -t prints the *newest* file first.
|
||||
rm -f conftest.ts?
|
||||
: > conftest.ts1
|
||||
: > conftest.ts2
|
||||
: > conftest.ts3
|
||||
|
||||
# Make sure ls -t actually works. Do 'set' in a subshell so we don't
|
||||
# clobber the current shell's arguments. (Outer-level square brackets
|
||||
# are removed by m4; they're present so that m4 does not expand
|
||||
# <dollar><star>; be careful, easy to get confused.)
|
||||
if (
|
||||
set X `[ls -t conftest.ts[12]]` &&
|
||||
{
|
||||
test "$[]*" != "X conftest.ts1 conftest.ts2" ||
|
||||
test "$[]*" != "X conftest.ts2 conftest.ts1";
|
||||
}
|
||||
); then :; else
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
_AS_ECHO_UNQUOTED(
|
||||
["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
|
||||
[AS_MESSAGE_LOG_FD])
|
||||
AC_MSG_FAILURE([ls -t produces unexpected output.
|
||||
Make sure there is not a broken ls alias in your environment.])
|
||||
fi
|
||||
|
||||
for am_try_res in $am_try_resolutions; do
|
||||
# Any one fine-grained sleep might happen to cross the boundary
|
||||
# between two values of a coarser actual resolution, but if we do
|
||||
# two fine-grained sleeps in a row, at least one of them will fall
|
||||
# entirely within a coarse interval.
|
||||
echo alpha > conftest.ts1
|
||||
sleep $am_try_res
|
||||
echo beta > conftest.ts2
|
||||
sleep $am_try_res
|
||||
echo gamma > conftest.ts3
|
||||
|
||||
# We assume that 'ls -t' will make use of high-resolution
|
||||
# timestamps if the operating system supports them at all.
|
||||
if (set X `ls -t conftest.ts?` &&
|
||||
test "$[]2" = conftest.ts3 &&
|
||||
test "$[]3" = conftest.ts2 &&
|
||||
test "$[]4" = conftest.ts1); then
|
||||
#
|
||||
# Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
|
||||
# because we don't need to test make.
|
||||
make_ok=true
|
||||
if test $am_try_res != 1; then
|
||||
# But if we've succeeded so far with a subsecond resolution, we
|
||||
# have one more thing to check: make. It can happen that
|
||||
# everything else supports the subsecond mtimes, but make doesn't;
|
||||
# notably on macOS, which ships make 3.81 from 2006 (the last one
|
||||
# released under GPLv2). https://bugs.gnu.org/68808
|
||||
#
|
||||
# We test $MAKE if it is defined in the environment, else "make".
|
||||
# It might get overridden later, but our hope is that in practice
|
||||
# it does not matter: it is the system "make" which is (by far)
|
||||
# the most likely to be broken, whereas if the user overrides it,
|
||||
# probably they did so with a better, or at least not worse, make.
|
||||
# https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
|
||||
#
|
||||
# Create a Makefile (real tab character here):
|
||||
rm -f conftest.mk
|
||||
echo 'conftest.ts1: conftest.ts2' >conftest.mk
|
||||
echo ' touch conftest.ts2' >>conftest.mk
|
||||
#
|
||||
# Now, running
|
||||
# touch conftest.ts1; touch conftest.ts2; make
|
||||
# should touch ts1 because ts2 is newer. This could happen by luck,
|
||||
# but most often, it will fail if make's support is insufficient. So
|
||||
# test for several consecutive successes.
|
||||
#
|
||||
# (We reuse conftest.ts[12] because we still want to modify existing
|
||||
# files, not create new ones, per above.)
|
||||
n=0
|
||||
make=${MAKE-make}
|
||||
until test $n -eq 3; do
|
||||
echo one > conftest.ts1
|
||||
sleep $am_try_res
|
||||
echo two > conftest.ts2 # ts2 should now be newer than ts1
|
||||
if $make -f conftest.mk | grep 'up to date' >/dev/null; then
|
||||
make_ok=false
|
||||
break # out of $n loop
|
||||
fi
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
fi
|
||||
#
|
||||
if $make_ok; then
|
||||
# Everything we know to check worked out, so call this resolution good.
|
||||
am_cv_filesystem_timestamp_resolution=$am_try_res
|
||||
break # out of $am_try_res loop
|
||||
fi
|
||||
# Otherwise, we'll go on to check the next resolution.
|
||||
fi
|
||||
done
|
||||
rm -f conftest.ts?
|
||||
# (end _am_filesystem_timestamp_resolution)
|
||||
])])
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
|
||||
# This check should not be cached, as it may vary across builds of
|
||||
# different projects.
|
||||
AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[[\\\"\#\$\&\'\`$am_lf]]*)
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([unsafe absolute working directory name]);;
|
||||
esac
|
||||
case $srcdir in
|
||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
|
||||
esac
|
||||
|
||||
@ -898,49 +1050,40 @@ esac
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
am_has_slept=no
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
am_build_env_is_sane=no
|
||||
am_has_slept=no
|
||||
rm -f conftest.file
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
if (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
test "$[]2" = conftest.file
|
||||
); then
|
||||
am_build_env_is_sane=yes
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep "$am_cv_filesystem_timestamp_resolution"
|
||||
am_has_slept=yes
|
||||
done
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
if test "$[2]" = conftest.file || test $am_try -eq 2; then
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep 1
|
||||
am_has_slept=yes
|
||||
done
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
AC_MSG_RESULT([$am_build_env_is_sane])
|
||||
if test "$am_build_env_is_sane" = no; then
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
# If we didn't sleep, we still need to ensure time stamps of config.status and
|
||||
# generated files are strictly newer.
|
||||
am_sleep_pid=
|
||||
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
|
||||
( sleep 1 ) &
|
||||
AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
|
||||
( sleep "$am_cv_filesystem_timestamp_resolution" ) &
|
||||
am_sleep_pid=$!
|
||||
fi
|
||||
])
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[AC_MSG_CHECKING([that generated files are newer than configure])
|
||||
if test -n "$am_sleep_pid"; then
|
||||
@ -951,18 +1094,18 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_SILENT_RULES([DEFAULT])
|
||||
# --------------------------
|
||||
# Enable less verbose build rules; with the default set to DEFAULT
|
||||
# ("yes" being less verbose, "no" or empty being verbose).
|
||||
AC_DEFUN([AM_SILENT_RULES],
|
||||
[AC_ARG_ENABLE([silent-rules], [dnl
|
||||
# _AM_SILENT_RULES
|
||||
# ----------------
|
||||
# Enable less verbose build rules support.
|
||||
AC_DEFUN([_AM_SILENT_RULES],
|
||||
[AM_DEFAULT_VERBOSITY=1
|
||||
AC_ARG_ENABLE([silent-rules], [dnl
|
||||
AS_HELP_STRING(
|
||||
[--enable-silent-rules],
|
||||
[less verbose build output (undo: "make V=1")])
|
||||
@ -970,11 +1113,6 @@ AS_HELP_STRING(
|
||||
[--disable-silent-rules],
|
||||
[verbose build output (undo: "make V=0")])dnl
|
||||
])
|
||||
case $enable_silent_rules in @%:@ (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
|
||||
esac
|
||||
dnl
|
||||
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
|
||||
dnl do not support nested variable expansions.
|
||||
@ -993,14 +1131,6 @@ am__doit:
|
||||
else
|
||||
am_cv_make_support_nested_variables=no
|
||||
fi])
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
AC_SUBST([AM_V])dnl
|
||||
AM_SUBST_NOTMAKE([AM_V])dnl
|
||||
AC_SUBST([AM_DEFAULT_V])dnl
|
||||
@ -1009,9 +1139,37 @@ AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
|
||||
AM_BACKSLASH='\'
|
||||
AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
|
||||
dnl to AM_SILENT_RULES to change the default value.
|
||||
AC_CONFIG_COMMANDS_PRE([dnl
|
||||
case $enable_silent_rules in @%:@ (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
esac
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# AM_SILENT_RULES([DEFAULT])
|
||||
# --------------------------
|
||||
# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
|
||||
# empty being verbose).
|
||||
AC_DEFUN([AM_SILENT_RULES],
|
||||
[AC_REQUIRE([_AM_SILENT_RULES])
|
||||
AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])m4_newline
|
||||
dnl We intentionally force a newline after the assignment, since a) nothing
|
||||
dnl good can come of more text following, and b) that was the behavior
|
||||
dnl before 1.17. See https://bugs.gnu.org/72267.
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1039,7 +1197,7 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1058,7 +1216,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1104,15 +1262,19 @@ m4_if([$1], [v7],
|
||||
am_uid=`id -u || echo unknown`
|
||||
am_gid=`id -g || echo unknown`
|
||||
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
|
||||
if test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if test x$am_uid = xunknown; then
|
||||
AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
|
||||
elif test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi
|
||||
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
|
||||
if test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if test x$gm_gid = xunknown; then
|
||||
AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
|
||||
elif test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
@ -1189,8 +1351,28 @@ AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([scripts/libtool.m4])
|
||||
m4_include([scripts/ltoptions.m4])
|
||||
m4_include([scripts/ltsugar.m4])
|
||||
m4_include([scripts/ltversion.m4])
|
||||
m4_include([scripts/lt~obsolete.m4])
|
||||
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_PROG_XARGS_N
|
||||
# ----------------
|
||||
# Check whether 'xargs -n' works. It should work everywhere, so the fallback
|
||||
# is not optimized at all as we never expect to use it.
|
||||
AC_DEFUN([_AM_PROG_XARGS_N],
|
||||
[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
|
||||
AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
|
||||
3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
|
||||
AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
|
||||
am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
|
||||
])dnl
|
||||
AC_SUBST(am__xargs_n)
|
||||
])
|
||||
|
||||
m4_include([scripts/autoconf/libtool.m4])
|
||||
m4_include([scripts/autoconf/ltoptions.m4])
|
||||
m4_include([scripts/autoconf/ltsugar.m4])
|
||||
m4_include([scripts/autoconf/ltversion.m4])
|
||||
m4_include([scripts/autoconf/lt~obsolete.m4])
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
/* arm_init.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
*
|
||||
@ -10,9 +9,7 @@
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||
* called.
|
||||
*/
|
||||
/* This module requires POSIX 1003.1 functions. */
|
||||
#define _POSIX_SOURCE 1
|
||||
|
||||
#include "../pngpriv.h"
|
||||
@ -33,25 +30,30 @@
|
||||
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||
* implementation which reads /proc/cpufino.
|
||||
*/
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
#ifndef PNG_ARM_NEON_FILE
|
||||
# ifdef __linux__
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||
# if defined(__aarch64__) || defined(_M_ARM64)
|
||||
/* ARM Neon is expected to be unconditionally available on ARM64. */
|
||||
# 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
|
||||
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
|
||||
#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 */
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
# include PNG_ARM_NEON_FILE
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
|
||||
# error ALIGNED_MEMORY is required; please define PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -1,253 +1,60 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
/* filter_neon.S - placeholder file
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Copyright (c) 2024 Cosmin Truta
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* IMPORTANT NOTE:
|
||||
*
|
||||
* Historically, the hand-coded assembler implementation of Neon optimizations
|
||||
* in this module had not been in sync with the intrinsics-based implementation
|
||||
* in filter_neon_intrinsics.c and palette_neon_intrinsics.c, at least since
|
||||
* the introduction of riffled palette optimizations. Moreover, the assembler
|
||||
* code used to work on 32-bit ARM only, and it caused problems, even if empty,
|
||||
* on 64-bit ARM.
|
||||
*
|
||||
* All references to this module from our internal build scripts and projects
|
||||
* have been removed.
|
||||
*
|
||||
* For the external projects that might still expect this module to be present,
|
||||
* we leave this stub in place, for the remaining lifetime of libpng-1.6.x.
|
||||
* Everything should continue to function normally, as long as there are no
|
||||
* deliberate attempts to use the old hand-made assembler code. A build error
|
||||
* will be raised otherwise.
|
||||
*/
|
||||
|
||||
/* This is required to get the symbol renames, which are #defines, and the
|
||||
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* 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_OPT > 0
|
||||
|
||||
#ifdef __ELF__
|
||||
# define ELF
|
||||
#if defined(__clang__)
|
||||
#define GNUC_VERSION 0 /* not gcc, although it might pretend to be */
|
||||
#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
|
||||
# define ELF @
|
||||
#define GNUC_VERSION 0 /* not gcc */
|
||||
#endif
|
||||
|
||||
.arch armv7-a
|
||||
.fpu neon
|
||||
#if (GNUC_VERSION > 0) && (GNUC_VERSION < 40300)
|
||||
#error "PNG_ARM_NEON is not supported with gcc versions earlier than 4.3.0"
|
||||
#elif GNUC_VERSION == 40504
|
||||
#error "PNG_ARM_NEON is not supported with gcc version 4.5.4"
|
||||
#else
|
||||
#error "Please use 'arm/*_neon_intrinsics.c' for PNG_ARM_NEON support"
|
||||
#endif
|
||||
|
||||
.macro func name, export=0
|
||||
.macro endfunc
|
||||
ELF .size \name, . - \name
|
||||
.endfunc
|
||||
.purgem endfunc
|
||||
.endm
|
||||
.text
|
||||
|
||||
/* Explicitly specifying alignment here because some versions of
|
||||
* GAS don't align code correctly. This is harmless in correctly
|
||||
* written versions of GAS.
|
||||
*/
|
||||
.align 2
|
||||
|
||||
.if \export
|
||||
.global \name
|
||||
.endif
|
||||
ELF .type \name, STT_FUNC
|
||||
.func \name
|
||||
\name:
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_sub4_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vadd.u8 d0, d3, d4
|
||||
vadd.u8 d1, d0, d5
|
||||
vadd.u8 d2, d1, d6
|
||||
vadd.u8 d3, d2, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_sub3_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r2, #3
|
||||
mov r12, #12
|
||||
vld1.8 {q11}, [r0], r12
|
||||
1:
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d3, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d0, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], r12
|
||||
vst1.32 {d0[0]}, [r1,:32], r2
|
||||
vadd.u8 d2, d1, d6
|
||||
vst1.32 {d1[0]}, [r1], r2
|
||||
vadd.u8 d3, d2, d7
|
||||
vst1.32 {d2[0]}, [r1], r2
|
||||
vst1.32 {d3[0]}, [r1], r2
|
||||
subs r3, r3, #12
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_up_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
1:
|
||||
vld1.8 {q0}, [r1,:128]
|
||||
vld1.8 {q1}, [r2,:128]!
|
||||
vadd.u8 q0, q0, q1
|
||||
vst1.8 {q0}, [r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
vhadd.u8 d0, d3, d16
|
||||
vadd.u8 d0, d0, d4
|
||||
vhadd.u8 d1, d0, d17
|
||||
vadd.u8 d1, d1, d5
|
||||
vhadd.u8 d2, d1, d18
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
vext.8 d5, d22, d23, #3
|
||||
vhadd.u8 d0, d3, d20
|
||||
vext.8 d17, d20, d21, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vhadd.u8 d1, d0, d17
|
||||
vext.8 d18, d20, d21, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vhadd.u8 d2, d1, d18
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vext.8 d19, d21, d21, #1
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
|
||||
.macro paeth rx, ra, rb, rc
|
||||
vaddl.u8 q12, \ra, \rb @ a + b
|
||||
vaddl.u8 q15, \rc, \rc @ 2*c
|
||||
vabdl.u8 q13, \rb, \rc @ pa
|
||||
vabdl.u8 q14, \ra, \rc @ pb
|
||||
vabd.u16 q15, q12, q15 @ pc
|
||||
vcle.u16 q12, q13, q14 @ pa <= pb
|
||||
vcle.u16 q13, q13, q15 @ pa <= pc
|
||||
vcle.u16 q14, q14, q15 @ pb <= pc
|
||||
vand q12, q12, q13 @ pa <= pb && pa <= pc
|
||||
vmovn.u16 d28, q14
|
||||
vmovn.u16 \rx, q12
|
||||
vbsl d28, \rb, \rc
|
||||
vbsl \rx, \ra, d28
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_paeth4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d20, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
paeth d0, d3, d16, d20
|
||||
vadd.u8 d0, d0, d4
|
||||
paeth d1, d0, d17, d16
|
||||
vadd.u8 d1, d1, d5
|
||||
paeth d2, d1, d18, d17
|
||||
vadd.u8 d2, d2, d6
|
||||
paeth d3, d2, d19, d18
|
||||
vmov d20, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_paeth3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d4, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
paeth d0, d3, d20, d4
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d17, d20, d21, #3
|
||||
paeth d1, d0, d17, d20
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d18, d20, d21, #6
|
||||
paeth d2, d1, d18, d17
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vadd.u8 d2, d2, d6
|
||||
vext.8 d19, d21, d21, #1
|
||||
paeth d3, d2, d19, d18
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vmov d4, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 */
|
||||
#endif /* READ */
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
@ -18,7 +17,7 @@
|
||||
/* This code requires -mfpu=neon on the command line: */
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64)
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
@ -14,7 +13,7 @@
|
||||
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64)
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
@ -30,8 +29,6 @@ png_riffle_palette_neon(png_structrp png_ptr)
|
||||
int num_trans = png_ptr->num_trans;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_riffle_palette_neon");
|
||||
|
||||
/* Initially black, opaque. */
|
||||
uint8x16x4_t w = {{
|
||||
vdupq_n_u8(0x00),
|
||||
@ -40,6 +37,8 @@ png_riffle_palette_neon(png_structrp png_ptr)
|
||||
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.
|
||||
*/
|
||||
@ -64,12 +63,13 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
const png_uint_32 *riffled_palette =
|
||||
(const png_uint_32 *)png_ptr->riffled_palette;
|
||||
const png_int_32 pixels_per_chunk = 4;
|
||||
int i;
|
||||
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;
|
||||
|
||||
@ -109,10 +109,11 @@ png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||
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;
|
||||
int i;
|
||||
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;
|
||||
|
||||
|
@ -77,13 +77,14 @@ libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
|
||||
config.sub configure depcomp install-sh ltmain.sh missing\
|
||||
test-driver"
|
||||
#
|
||||
# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
|
||||
# Files generated by versions of autoconf >2.68 or automake >1.13 (i.e. later
|
||||
# versions than those required by configure.ac):
|
||||
libpng_autotools_extra="compile config.h.in~"
|
||||
#
|
||||
# These are separate because 'maintainer-clean' does not remove them.
|
||||
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
|
||||
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
|
||||
libpng_libtool_files="scripts/autoconf/libtool.m4 scripts/autoconf/ltoptions.m4\
|
||||
scripts/autoconf/ltsugar.m4 scripts/autoconf/ltversion.m4\
|
||||
scripts/autoconf/lt~obsolete.m4"
|
||||
|
||||
libpng_autotools_dirs="autom4te.cache" # not required
|
||||
#
|
||||
|
11
ci/.shellcheckrc
Normal file
11
ci/.shellcheckrc
Normal file
@ -0,0 +1,11 @@
|
||||
# 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
|
19
ci/LICENSE_MIT.txt
Normal file
19
ci/LICENSE_MIT.txt
Normal file
@ -0,0 +1,19 @@
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
25
ci/README.md
Normal file
25
ci/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
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
Executable file
142
ci/ci_lint.sh
Executable file
@ -0,0 +1,142 @@
|
||||
#!/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 "$@"
|
209
ci/ci_verify_cmake.sh
Executable file
209
ci/ci_verify_cmake.sh
Executable file
@ -0,0 +1,209 @@
|
||||
#!/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 "$@"
|
182
ci/ci_verify_configure.sh
Executable file
182
ci/ci_verify_configure.sh
Executable file
@ -0,0 +1,182 @@
|
||||
#!/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 "$@"
|
200
ci/ci_verify_makefiles.sh
Executable file
200
ci/ci_verify_makefiles.sh
Executable file
@ -0,0 +1,200 @@
|
||||
#!/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 "$@"
|
191
ci/ci_verify_version.sh
Executable file
191
ci/ci_verify_version.sh
Executable file
@ -0,0 +1,191 @@
|
||||
#!/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
Normal file
111
ci/lib/ci.lib.sh
Normal file
@ -0,0 +1,111 @@
|
||||
# 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
|
48
ci/libexec/ci_shellify_autoconf.sh
Executable file
48
ci/libexec/ci_shellify_autoconf.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/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 "$@"
|
49
ci/libexec/ci_shellify_c.sh
Executable file
49
ci/libexec/ci_shellify_c.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/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 "$@"
|
49
ci/libexec/ci_shellify_cmake.sh
Executable file
49
ci/libexec/ci_shellify_cmake.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/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 "$@"
|
46
ci/libexec/ci_shellify_shell.sh
Executable file
46
ci/libexec/ci_shellify_shell.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/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 "$@"
|
16
ci/targets/android/ci_env.aarch64-linux-android.sh
Normal file
16
ci/targets/android/ci_env.aarch64-linux-android.sh
Normal file
@ -0,0 +1,16 @@
|
||||
# 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"
|
16
ci/targets/android/ci_env.armv7a-linux-androideabi.sh
Normal file
16
ci/targets/android/ci_env.armv7a-linux-androideabi.sh
Normal file
@ -0,0 +1,16 @@
|
||||
# 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"
|
16
ci/targets/android/ci_env.i686-linux-android.sh
Normal file
16
ci/targets/android/ci_env.i686-linux-android.sh
Normal file
@ -0,0 +1,16 @@
|
||||
# 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"
|
16
ci/targets/android/ci_env.x86_64-linux-android.sh
Normal file
16
ci/targets/android/ci_env.x86_64-linux-android.sh
Normal file
@ -0,0 +1,16 @@
|
||||
# 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"
|
18
ci/targets/cygwin/ci_env.i686-pc-cygwin.sh
Normal file
18
ci/targets/cygwin/ci_env.i686-pc-cygwin.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
"
|
18
ci/targets/cygwin/ci_env.x86_64-pc-cygwin.sh
Normal file
18
ci/targets/cygwin/ci_env.x86_64-pc-cygwin.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
"
|
15
ci/targets/darwin/ci_env.arm64-apple-darwin.sh
Normal file
15
ci/targets/darwin/ci_env.arm64-apple-darwin.sh
Normal file
@ -0,0 +1,15 @@
|
||||
# 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
|
||||
"
|
15
ci/targets/darwin/ci_env.x86_64-apple-darwin.sh
Normal file
15
ci/targets/darwin/ci_env.x86_64-apple-darwin.sh
Normal file
@ -0,0 +1,15 @@
|
||||
# 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
|
||||
"
|
14
ci/targets/freebsd/ci_env.aarch64-unknown-freebsd.sh
Normal file
14
ci/targets/freebsd/ci_env.aarch64-unknown-freebsd.sh
Normal file
@ -0,0 +1,14 @@
|
||||
# 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
|
||||
"
|
14
ci/targets/freebsd/ci_env.i686-unknown-freebsd.sh
Normal file
14
ci/targets/freebsd/ci_env.i686-unknown-freebsd.sh
Normal file
@ -0,0 +1,14 @@
|
||||
# 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
|
||||
"
|
14
ci/targets/freebsd/ci_env.riscv64-unknown-freebsd.sh
Normal file
14
ci/targets/freebsd/ci_env.riscv64-unknown-freebsd.sh
Normal file
@ -0,0 +1,14 @@
|
||||
# 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
|
||||
"
|
14
ci/targets/freebsd/ci_env.x86_64-unknown-freebsd.sh
Normal file
14
ci/targets/freebsd/ci_env.x86_64-unknown-freebsd.sh
Normal file
@ -0,0 +1,14 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.aarch64-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.aarch64-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.arm-linux-gnueabi.sh
Normal file
21
ci/targets/linux/ci_env.arm-linux-gnueabi.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.arm-linux-gnueabihf.sh
Normal file
21
ci/targets/linux/ci_env.arm-linux-gnueabihf.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.i686-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.i686-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mips-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.mips-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mips64-linux-gnuabi64.sh
Normal file
21
ci/targets/linux/ci_env.mips64-linux-gnuabi64.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mips64el-linux-gnuabi64.sh
Normal file
21
ci/targets/linux/ci_env.mips64el-linux-gnuabi64.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mipsel-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.mipsel-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mipsisa32r6-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.mipsisa32r6-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mipsisa32r6el-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.mipsisa32r6el-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mipsisa64r6-linux-gnuabi64.sh
Normal file
21
ci/targets/linux/ci_env.mipsisa64r6-linux-gnuabi64.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.mipsisa64r6el-linux-gnuabi64.sh
Normal file
21
ci/targets/linux/ci_env.mipsisa64r6el-linux-gnuabi64.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.powerpc-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.powerpc-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.powerpc64-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.powerpc64-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.powerpc64le-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.powerpc64le-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.riscv64-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.riscv64-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/linux/ci_env.x86_64-linux-gnu.sh
Normal file
21
ci/targets/linux/ci_env.x86_64-linux-gnu.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
18
ci/targets/msdos/ci_env.i386-pc-msdoswatcom.sh
Normal file
18
ci/targets/msdos/ci_env.i386-pc-msdoswatcom.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
"
|
18
ci/targets/msdos/ci_env.i586-pc-msdosdjgpp.sh
Normal file
18
ci/targets/msdos/ci_env.i586-pc-msdosdjgpp.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
"
|
19
ci/targets/msdos/ci_env.i86-pc-msdoswatcom.sh
Normal file
19
ci/targets/msdos/ci_env.i86-pc-msdoswatcom.sh
Normal file
@ -0,0 +1,19 @@
|
||||
# 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
|
||||
"
|
18
ci/targets/windows/ci_env.aarch64-windows-llvm.sh
Normal file
18
ci/targets/windows/ci_env.aarch64-windows-llvm.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/windows/ci_env.i686-w64-mingw32.sh
Normal file
21
ci/targets/windows/ci_env.i686-w64-mingw32.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
18
ci/targets/windows/ci_env.i686-windows-llvm.sh
Normal file
18
ci/targets/windows/ci_env.i686-windows-llvm.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
"
|
21
ci/targets/windows/ci_env.x86_64-w64-mingw32.sh
Normal file
21
ci/targets/windows/ci_env.x86_64-w64-mingw32.sh
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
"
|
18
ci/targets/windows/ci_env.x86_64-windows-llvm.sh
Normal file
18
ci/targets/windows/ci_env.x86_64-windows-llvm.sh
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2023-2024 Cosmin Truta.
|
||||
#
|
||||
# Use, modification and distribution are subject to the MIT License.
|
||||
# Please see the accompanying file LICENSE_MIT.txt
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
export CI_TARGET_ARCH=x86_64
|
||||
export CI_TARGET_SYSTEM=windows
|
||||
|
||||
export CI_CC="clang"
|
||||
export CI_AR="llvm-ar"
|
||||
export CI_RANLIB="llvm-ranlib"
|
||||
|
||||
export CI_CMAKE_VARS="
|
||||
-DCMAKE_SYSTEM_NAME=Windows
|
||||
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
|
||||
"
|
38
compile
38
compile
@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
scriptversion=2025-06-18.21; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# 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
|
||||
@ -37,11 +37,11 @@ IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# 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) LAZY, no conversion will
|
||||
# take place.
|
||||
# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
|
||||
# conversion will take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
@ -51,9 +51,20 @@ func_file_conv ()
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=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
|
||||
;;
|
||||
*)
|
||||
@ -63,12 +74,14 @@ func_file_conv ()
|
||||
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 -m "$file" || echo "$file"`
|
||||
file=`cygpath -w "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
@ -143,7 +156,7 @@ func_cl_wrapper ()
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
*.o | *.lo | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
@ -248,14 +261,17 @@ 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 $scriptversion"
|
||||
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...
|
||||
;;
|
||||
@ -340,9 +356,9 @@ exit $ret
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-format: "%Y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
1579
config.guess
vendored
1579
config.guess
vendored
File diff suppressed because it is too large
Load Diff
56
config.h.in
56
config.h.in
@ -3,27 +3,27 @@
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `feenableexcept' function. */
|
||||
/* Define to 1 if you have the 'feenableexcept' function. */
|
||||
#undef HAVE_FEENABLEEXCEPT
|
||||
|
||||
/* 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). */
|
||||
/* Define to 1 if you have the 'm' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
/* Define to 1 if you have the 'z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
/* 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
|
||||
|
||||
@ -78,6 +78,18 @@
|
||||
/* 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
|
||||
|
||||
@ -96,31 +108,31 @@
|
||||
/* Enable POWERPC VSX optimizations */
|
||||
#undef PNG_POWERPC_VSX_OPT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
/* 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'. */
|
||||
/* Define to 1 if your <sys/time.h> declares 'struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
supported only directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __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
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
3325
config.sub
vendored
3325
config.sub
vendored
File diff suppressed because it is too large
Load Diff
427
configure.ac
427
configure.ac
@ -1,6 +1,6 @@
|
||||
# configure.ac
|
||||
|
||||
# Copyright (c) 2018 Cosmin Truta
|
||||
# Copyright (c) 2018-2024 Cosmin Truta
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
|
||||
# This code is released under the libpng license.
|
||||
@ -25,8 +25,8 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.37],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
AC_INIT([libpng],[1.6.51.git],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts/autoconf])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
# color-tests requires automake 1.11 or later
|
||||
@ -46,17 +46,17 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.37
|
||||
PNGLIB_VERSION=1.6.51.git
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=37
|
||||
PNGLIB_RELEASE=51
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
AC_CONFIG_SRCDIR([pngget.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
# Check the basic programs.
|
||||
AC_LANG([C])
|
||||
AC_PROG_CC
|
||||
AM_PROG_AS
|
||||
@ -72,16 +72,19 @@ dnl compatible later version may be used
|
||||
LT_INIT([win32-dll])
|
||||
LT_PREREQ([2.4.2])
|
||||
|
||||
# Some awks crash when confronted with pnglibconf.dfa, do a test run now
|
||||
# to make sure this doesn't happen
|
||||
AC_MSG_CHECKING([that AWK works])
|
||||
dnl Declare the AWK variable.
|
||||
AC_ARG_VAR(AWK, [AWK language processor])
|
||||
|
||||
# Some awk implementations crash when confronted with pnglibconf.dfa.
|
||||
# Run a test now, to make sure this doesn't happen.
|
||||
AC_MSG_CHECKING([if awk ($AWK) works])
|
||||
if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
|
||||
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
|
||||
${srcdir}/pngusr.dfa 1>&2
|
||||
then
|
||||
AC_MSG_RESULT([ok])
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_FAILURE([failed], 1)
|
||||
AC_MSG_FAILURE([no], 1)
|
||||
fi
|
||||
|
||||
# This is a remnant of the old cc -E validation, where it may have been
|
||||
@ -89,11 +92,29 @@ fi
|
||||
DFNCPP="$CPP"
|
||||
AC_SUBST(DFNCPP)
|
||||
|
||||
# -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_ENABLE([tests],
|
||||
AS_HELP_STRING([--disable-tests],
|
||||
[do not build the test programs (default is to build)]),
|
||||
[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,
|
||||
[additional flags for the C compiler, use this for options that would]
|
||||
[additional flags for the C compiler, to be used for options that would]
|
||||
[cause configure itself to fail])
|
||||
AC_ARG_ENABLE(werror,
|
||||
AS_HELP_STRING([[[--enable-werror[=OPT]]]],
|
||||
@ -114,10 +135,10 @@ AC_ARG_ENABLE(werror,
|
||||
CFLAGS="$sav_CFLAGS"
|
||||
fi],)
|
||||
|
||||
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
|
||||
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
|
||||
# This is incompatible with the new default mode, so we test for that and force the
|
||||
# "-std=c89" compiler option:
|
||||
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89.
|
||||
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining
|
||||
# _POSIX_SOURCE to 1. This is incompatible with the new default mode, so
|
||||
# we test for that and force the "-std=c89" compiler option:
|
||||
AC_MSG_CHECKING([if we need to force back C standard to C89])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
@ -133,22 +154,17 @@ AC_COMPILE_IFELSE(
|
||||
CFLAGS="$CFLAGS -std=c89"
|
||||
])
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
# Checks for structures and compiler characteristics.
|
||||
AC_STRUCT_TM
|
||||
AC_C_RESTRICT
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
||||
AC_CHECK_FUNCS([pow], ,
|
||||
[AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])])
|
||||
|
||||
# Some later POSIX 1003.1 functions are required for test programs, failure here
|
||||
# is soft (the corresponding test program is not built).
|
||||
AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
|
||||
# Some later POSIX 1003.1 functions are required for test programs, failure
|
||||
# here is soft (the corresponding test program is not built).
|
||||
AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
|
||||
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
||||
|
||||
AC_ARG_WITH(zlib-prefix,
|
||||
@ -156,8 +172,9 @@ AC_ARG_WITH(zlib-prefix,
|
||||
[prefix that may have been used in installed zlib]),
|
||||
[ZPREFIX=${withval}],
|
||||
[ZPREFIX='z_'])
|
||||
AC_CHECK_LIB(z, zlibVersion, ,
|
||||
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
|
||||
AC_CHECK_LIB([z], [zlibVersion], ,
|
||||
[AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], ,
|
||||
[AC_MSG_ERROR([zlib not installed])])])
|
||||
|
||||
# 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
|
||||
@ -209,9 +226,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||
if test "$have_ld_version_script" = "yes"; then
|
||||
AC_MSG_CHECKING([for symbol prefix])
|
||||
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
|
||||
| ${CPP-${CC-gcc} -E} - 2>&1 \
|
||||
| ${EGREP-grep} "^PREFIX=" \
|
||||
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
|
||||
| ${CPP:-${CC:-gcc} -E} - 2>&1 \
|
||||
| ${EGREP:-grep} "^PREFIX=" \
|
||||
| ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
|
||||
AC_SUBST(SYMBOL_PREFIX)
|
||||
AC_MSG_RESULT($SYMBOL_PREFIX)
|
||||
fi
|
||||
@ -296,7 +313,7 @@ AC_ARG_ENABLE([unversioned-libpng-config],
|
||||
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||
[test "$enable_unversioned_libpng_config" != "no"])
|
||||
|
||||
# HOST SPECIFIC OPTIONS
|
||||
# HOST-SPECIFIC OPTIONS
|
||||
# =====================
|
||||
#
|
||||
# DEFAULT
|
||||
@ -304,7 +321,7 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||
#
|
||||
AC_ARG_ENABLE([hardware-optimizations],
|
||||
AS_HELP_STRING([[[--enable-hardware-optimizations]]],
|
||||
[Enable hardware optimizations: =no/off, yes/on:]),
|
||||
[Enable hardware optimizations: =no/off, yes/on.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable hardware optimization on all systems:
|
||||
@ -314,24 +331,36 @@ AC_ARG_ENABLE([hardware-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], [0],
|
||||
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_MSA_OPT], [0],
|
||||
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)
|
||||
@ -344,21 +373,30 @@ AC_ARG_ENABLE([hardware-optimizations],
|
||||
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
|
||||
# ===
|
||||
#
|
||||
# ARM NEON (SIMD) support.
|
||||
# ARM NEON
|
||||
# ========
|
||||
|
||||
AC_ARG_ENABLE([arm-neon],
|
||||
AS_HELP_STRING([[[--enable-arm-neon]]],
|
||||
[Enable ARM NEON optimizations: =no/off, check, api, yes/on:]
|
||||
[no/off: disable the optimizations; check: use internal checking code]
|
||||
[(deprecated and poorly supported); api: disable by default, enable by]
|
||||
[a call to png_set_option; yes/on: turn on unconditionally.]
|
||||
[Enable ARM NEON optimizations: =no/off, check, api, yes/on.]
|
||||
[no/off: disable the optimizations;]
|
||||
[check: use internal checking code (deprecated and poorly supported);]
|
||||
[api: disable by default, enable by a call to png_set_option;]
|
||||
[yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
@ -366,7 +404,7 @@ AC_ARG_ENABLE([arm-neon],
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Disable ARM Neon optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_arm_neon=no;;
|
||||
enable_arm_neon=no ;;
|
||||
check)
|
||||
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
||||
[Check for ARM Neon support at run-time]);;
|
||||
@ -376,35 +414,35 @@ AC_ARG_ENABLE([arm-neon],
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
|
||||
[Enable ARM Neon optimizations])
|
||||
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass -mfpu=neon]
|
||||
[to the compiler.]);;
|
||||
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';]
|
||||
[if you want the optimizations unconditionally,]
|
||||
[pass '-mfpu=neon' to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
|
||||
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:]
|
||||
[invalid argument])
|
||||
esac])
|
||||
|
||||
# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
|
||||
# where ARM optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'arm*')
|
||||
# Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or
|
||||
# where ARM optimizations were explicitly requested. (This allows a fallback
|
||||
# if a future host CPU does not match 'arm*'.)
|
||||
|
||||
AM_CONDITIONAL([PNG_ARM_NEON],
|
||||
[test "$enable_arm_neon" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
arm*|aarch64*) :;;
|
||||
*) test "$enable_arm_neon" != '';;
|
||||
arm*|aarch64*) : ;;
|
||||
*) test "$enable_arm_neon" != '' ;;
|
||||
esac])
|
||||
|
||||
# MIPS
|
||||
# ===
|
||||
#
|
||||
# MIPS MSA (SIMD) support.
|
||||
# MIPS MSA
|
||||
# ========
|
||||
|
||||
AC_ARG_ENABLE([mips-msa],
|
||||
AS_HELP_STRING([[[--enable-mips-msa]]],
|
||||
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
|
||||
[no/off: disable the optimizations; check: use internal checking code]
|
||||
[(deprecated and poorly supported); api: disable by default, enable by]
|
||||
[a call to png_set_option; yes/on: turn on unconditionally.]
|
||||
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on.]
|
||||
[no/off: disable the optimizations;]
|
||||
[check: use internal checking code (deprecated and poorly supported);]
|
||||
[api: disable by default, enable by a call to png_set_option;]
|
||||
[yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
@ -412,7 +450,7 @@ AC_ARG_ENABLE([mips-msa],
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Disable MIPS MSA optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_mips_msa=no;;
|
||||
enable_mips_msa=no ;;
|
||||
check)
|
||||
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
||||
[Check for MIPS MSA support at run-time]);;
|
||||
@ -422,31 +460,75 @@ AC_ARG_ENABLE([mips-msa],
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
||||
[Enable MIPS MSA optimizations])
|
||||
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass '-mmsa -mfp64']
|
||||
[to the compiler.]);;
|
||||
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';]
|
||||
[if you want the optimizations unconditionally,]
|
||||
[pass '-mmsa -mfp64' to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:]
|
||||
[invalid argument])
|
||||
esac])
|
||||
|
||||
# Add MIPS specific files to all builds where 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*')
|
||||
# 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*) :;;
|
||||
mipsel*|mips64el*) : ;;
|
||||
esac])
|
||||
|
||||
# INTEL
|
||||
# =====
|
||||
#
|
||||
# INTEL SSE (SIMD) support.
|
||||
# MIPS MMI
|
||||
# ========
|
||||
|
||||
AC_ARG_ENABLE([mips-mmi],
|
||||
AS_HELP_STRING([[[--enable-mips-mmi]]],
|
||||
[Enable MIPS MMI optimizations: =no/off, check, api, yes/on.]
|
||||
[no/off: disable the optimizations;]
|
||||
[check: use internal checking code (deprecated and poorly supported);]
|
||||
[api: disable by default, enable by a call to png_set_option;]
|
||||
[yes/on: turn on unconditionally.]
|
||||
[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:]
|
||||
[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.]),
|
||||
@ -456,34 +538,34 @@ AC_ARG_ENABLE([intel-sse],
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
[Disable Intel SSE optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_intel_sse=no;;
|
||||
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 value])
|
||||
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:]
|
||||
[invalid argument])
|
||||
esac])
|
||||
|
||||
# Add Intel specific files to all builds where the 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*')
|
||||
# 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" != '';;
|
||||
i?86|x86_64) : ;;
|
||||
*) test "$enable_intel_sse" != '' ;;
|
||||
esac])
|
||||
|
||||
# PowerPC
|
||||
# ===
|
||||
#
|
||||
# PowerPC VSX (SIMD) support.
|
||||
# POWERPC VSX
|
||||
# ===========
|
||||
|
||||
AC_ARG_ENABLE([powerpc-vsx],
|
||||
AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
||||
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:]
|
||||
[no/off: disable the optimizations; check: use internal checking code]
|
||||
[api: disable by default, enable by a call to png_set_option]
|
||||
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.]
|
||||
[no/off: disable the optimizations;]
|
||||
[check: use internal checking code;]
|
||||
[api: disable by default, enable by a call to png_set_option;]
|
||||
[yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
@ -491,36 +573,171 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
||||
# 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;;
|
||||
# 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 check contrib/powerpc/README file]
|
||||
[for the list of supported OSes.]);;
|
||||
AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README]
|
||||
[for the list of supported systems.]);;
|
||||
api)
|
||||
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
|
||||
[Turn on POWERPC VSX optimizations at run-time]);;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
||||
[Enable POWERPC VSX optimizations])
|
||||
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass '-maltivec -mvsx']
|
||||
[or '-mcpu=power8'to the compiler.]);;
|
||||
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';]
|
||||
[if you want the optimizations unconditionally,]
|
||||
[pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value])
|
||||
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:]
|
||||
[invalid argument])
|
||||
esac])
|
||||
|
||||
# Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or
|
||||
# where POWERPC optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'powerpc*')
|
||||
# Add PowerPC-specific files to all builds where $host_cpu is powerpc
|
||||
# ('powerpc*') or where PowerPC optimizations were explicitly requested.
|
||||
# (This allows a fallback if a future host CPU does not match 'powerpc*'.)
|
||||
|
||||
AM_CONDITIONAL([PNG_POWERPC_VSX],
|
||||
[test "$enable_powerpc_vsx" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
powerpc*|ppc64*) :;;
|
||||
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])
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
|
9
contrib/.editorconfig
Normal file
9
contrib/.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
# https://editorconfig.org
|
||||
|
||||
root = false
|
||||
|
||||
[*.[ch]]
|
||||
indent_size = unset
|
||||
indent_style = unset
|
||||
max_doc_length = unset
|
||||
max_line_length = unset
|
@ -1,3 +1,5 @@
|
||||
External contributions to libpng
|
||||
--------------------------------
|
||||
|
||||
This "contrib" directory contains contributions which are not necessarily under
|
||||
the libpng license, although all are open source. They are not part of
|
||||
|
@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014.
|
||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -24,6 +23,7 @@
|
||||
* has been compiled only, not linked: no version of the library has been found,
|
||||
* only the header files exist in the NDK.
|
||||
*/
|
||||
|
||||
#include <cpu-features.h>
|
||||
|
||||
static int
|
||||
|
@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -22,6 +21,7 @@
|
||||
* This generic __linux__ implementation requires reading /proc/self/auxv and
|
||||
* looking at each element for one that records NEON capabilities.
|
||||
*/
|
||||
|
||||
#include <unistd.h> /* for POSIX 1003.1 */
|
||||
#include <errno.h> /* for EINTR */
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* contrib/arm-neon/linux.c
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014, 2017.
|
||||
*
|
||||
@ -19,6 +18,7 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
|
133
contrib/conftest/basic.dfa
Normal file
133
contrib/conftest/basic.dfa
Normal file
@ -0,0 +1,133 @@
|
||||
# basic.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2024
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with basic read and write support. This enables the lowest
|
||||
# level libpng read and write APIs - the "row-by-row" ones.
|
||||
#
|
||||
# Support is enabled only for those transformations that are observed to be
|
||||
# required by widely used apps or are in the v3 specification.
|
||||
#
|
||||
|
||||
everything = off
|
||||
|
||||
# The sequential read code is enabled here; the progressive code can be used
|
||||
# instead but there is no point enabling both.
|
||||
|
||||
option READ on
|
||||
option SEQUENTIAL_READ on
|
||||
option EASY_ACCESS on
|
||||
option SET_USER_LIMITS on
|
||||
option INFO_IMAGE on
|
||||
option READ_16BIT on
|
||||
|
||||
# Errors: these can be disabled but then there won't be any error messages
|
||||
# just failures and the error messages are really needed for apps:
|
||||
option WARNINGS on
|
||||
option ERROR_TEXT on
|
||||
option BENIGN_READ_ERRORS on
|
||||
|
||||
# Required for many display programs such as web browsers:
|
||||
option PROGRESSIVE_READ on
|
||||
|
||||
# Switch on the write code - this makes a minimalist encoder but with
|
||||
# interlace support turned on; otherwise png_read_png..png_write_png will
|
||||
# fail on an interlaced image.
|
||||
option WRITE on
|
||||
option WRITE_INTERLACING on
|
||||
option WRITE_16BIT on
|
||||
|
||||
# Usages of the 'fixed' APIs are relatively rare but they do occur
|
||||
# one or the other for both the API and the internal math.
|
||||
|
||||
#Fixed point:
|
||||
option FIXED_POINT on
|
||||
|
||||
#Floating point:
|
||||
option FLOATING_POINT on
|
||||
option FLOATING_ARITHMETIC on
|
||||
|
||||
# Basic error handling, IO and user memory support. The latter allows the
|
||||
# application program to provide its own implementations of 'malloc' and 'free'.
|
||||
option SETJMP on
|
||||
option STDIO on
|
||||
option USER_MEM on
|
||||
|
||||
# Gamma handling: this needs to be on for the gamma handling
|
||||
option READ_GAMMA on
|
||||
|
||||
# The supported chunks
|
||||
chunk bKGD on
|
||||
chunk cHRM on
|
||||
chunk eXIf on
|
||||
chunk gAMA on
|
||||
chunk iCCP on
|
||||
chunk iTXt on
|
||||
chunk pHYs on
|
||||
chunk sBIT on
|
||||
chunk sRGB on
|
||||
chunk tEXt on
|
||||
chunk tIME on
|
||||
chunk tRNS on
|
||||
chunk zTXt on
|
||||
|
||||
# These don't seem to be used anywhere:
|
||||
# chunk pCAL
|
||||
# chunk sCAL
|
||||
# chunk sPLT
|
||||
|
||||
# The rest of this is app dependent: none of these options are required for
|
||||
# read/write of the full range of PNG files and the normal chunk handling on
|
||||
# read.
|
||||
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
||||
option WRITE_CUSTOMIZE_COMPRESSION on
|
||||
|
||||
option READ_EXPAND on
|
||||
option READ_FILLER on
|
||||
option READ_GRAY_TO_RGB on
|
||||
option READ_INVERT on
|
||||
option READ_PACK on
|
||||
option READ_RGB_TO_GRAY on
|
||||
option READ_SCALE_16_TO_8 on
|
||||
option READ_SHIFT on
|
||||
option READ_STRIP_16_TO_8 on
|
||||
option READ_STRIP_ALPHA on
|
||||
option READ_SWAP on
|
||||
|
||||
option CONVERT_tIME on
|
||||
|
||||
# optipng
|
||||
option IO_STATE on
|
||||
option STORE_UNKNOWN_CHUNKS on
|
||||
option HANDLE_AS_UNKNOWN on
|
||||
|
||||
# pngcrush
|
||||
option READ_USER_TRANSFORM on
|
||||
option WRITE_FLUSH on
|
||||
|
||||
# pnmtopng
|
||||
chunk hIST on
|
||||
|
||||
# cairo
|
||||
option WRITE_PACKSWAP on
|
||||
option WRITE_USER_TRANSFORM on
|
||||
|
||||
# graphicsmagick
|
||||
option READ_USER_CHUNKS on
|
||||
|
||||
# Qt5.15 qtgui (gentoo package split) Qt6.6 qtbase
|
||||
option READ_BGR on
|
||||
option WRITE_BGR on
|
||||
option READ_SWAP_ALPHA on
|
||||
option WRITE_SWAP_ALPHA on
|
||||
chunk oFFs on
|
||||
|
||||
# ghostscript-gpl
|
||||
option WRITE_INVERT_ALPHA on
|
||||
option WRITE_INVERT on
|
15
contrib/conftest/fixed.dfa
Normal file
15
contrib/conftest/fixed.dfa
Normal file
@ -0,0 +1,15 @@
|
||||
# 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
|
14
contrib/conftest/float-fixed.dfa
Normal file
14
contrib/conftest/float-fixed.dfa
Normal file
@ -0,0 +1,14 @@
|
||||
# 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
|
21
contrib/conftest/nocompile-limits.dfa
Normal file
21
contrib/conftest/nocompile-limits.dfa
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
19
contrib/conftest/nolimits.dfa
Normal file
19
contrib/conftest/nolimits.dfa
Normal file
@ -0,0 +1,19 @@
|
||||
# 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
|
||||
|
13
contrib/conftest/read-full.dfa
Normal file
13
contrib/conftest/read-full.dfa
Normal file
@ -0,0 +1,13 @@
|
||||
# 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
|
13
contrib/conftest/write-full.dfa
Normal file
13
contrib/conftest/write-full.dfa
Normal file
@ -0,0 +1,13 @@
|
||||
# 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
|
143
contrib/examples/.clang-format
Normal file
143
contrib/examples/.clang-format
Normal file
@ -0,0 +1,143 @@
|
||||
---
|
||||
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,4 +1,3 @@
|
||||
|
||||
This directory (contrib/examples) contains examples of libpng usage.
|
||||
|
||||
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.
|
||||
|
@ -26,8 +26,9 @@
|
||||
|
||||
#include <png.h>
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) && \
|
||||
defined (PNG_iCCP_SUPPORTED)
|
||||
#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;
|
||||
@ -36,7 +37,8 @@ static png_byte no_profile[] = "no profile";
|
||||
static png_bytep
|
||||
extract(FILE *fp, png_uint_32 *proflen)
|
||||
{
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
|
||||
png_structp png_ptr =
|
||||
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
png_infop info_ptr = NULL;
|
||||
png_bytep result = NULL;
|
||||
|
||||
@ -69,7 +71,7 @@ extract(FILE *fp, png_uint_32 *proflen)
|
||||
png_bytep profile;
|
||||
|
||||
if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile,
|
||||
proflen) & PNG_INFO_iCCP)
|
||||
proflen) & PNG_INFO_iCCP)
|
||||
{
|
||||
result = malloc(*proflen);
|
||||
if (result != NULL)
|
||||
@ -80,7 +82,7 @@ extract(FILE *fp, png_uint_32 *proflen)
|
||||
}
|
||||
|
||||
else
|
||||
result = no_profile;
|
||||
result = no_profile;
|
||||
}
|
||||
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
@ -107,7 +109,7 @@ extract_one_file(const char *filename)
|
||||
const char *ep = strrchr(filename, '.');
|
||||
|
||||
if (ep != NULL)
|
||||
len = ep-filename;
|
||||
len = ep - filename;
|
||||
|
||||
else
|
||||
len = strlen(filename);
|
||||
@ -119,14 +121,14 @@ extract_one_file(const char *filename)
|
||||
FILE *of;
|
||||
|
||||
memcpy(output, filename, len);
|
||||
strcpy(output+len, ".icc");
|
||||
strcpy(output + len, ".icc");
|
||||
|
||||
of = fopen(output, "wb");
|
||||
if (of != NULL)
|
||||
{
|
||||
if (fwrite(profile, proflen, 1, of) == 1 &&
|
||||
fflush(of) == 0 &&
|
||||
fclose(of) == 0)
|
||||
fflush(of) == 0 &&
|
||||
fclose(of) == 0)
|
||||
{
|
||||
if (verbose)
|
||||
printf("%s -> %s\n", filename, output);
|
||||
@ -155,12 +157,15 @@ extract_one_file(const char *filename)
|
||||
}
|
||||
|
||||
else if (verbose && profile == no_profile)
|
||||
printf("%s has no profile\n", filename);
|
||||
printf("%s has no profile\n", filename);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "%s: could not open file\n", filename);
|
||||
|
||||
if (fp != NULL)
|
||||
fclose(fp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -170,7 +175,7 @@ main(int argc, char **argv)
|
||||
int i;
|
||||
int extracted = 0;
|
||||
|
||||
for (i=1; i<argc; ++i)
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
if (strcmp(argv[i], "-q") == 0)
|
||||
verbose = 0;
|
||||
@ -182,4 +187,3 @@ main(int argc, char **argv)
|
||||
/* Exit code is true if any extract succeeds */
|
||||
return extracted == 0;
|
||||
}
|
||||
#endif /* READ && STDIO && iCCP */
|
||||
|
@ -15,8 +15,8 @@
|
||||
* 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
|
||||
* image to assemble the interlaced rows. In this code
|
||||
* png_set_interlace_handling() is not called and, instead, the code handles the
|
||||
* interlace passes directly looking for the required pixel.
|
||||
* png_set_interlace_handling() is not called and, instead, the code handles
|
||||
* the interlace passes directly looking for the required pixel.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -27,34 +27,37 @@
|
||||
*/
|
||||
#include "../../png.h"
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)
|
||||
#if !defined(PNG_READ_SUPPORTED) || !defined(PNG_SEQUENTIAL_READ_SUPPORTED)
|
||||
#error This program requires libpng supporting the read and sequential read API
|
||||
#endif
|
||||
|
||||
|
||||
/* Return component 'c' of pixel 'x' from the given row. */
|
||||
static unsigned int
|
||||
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, but this means they can be up to
|
||||
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence 2^34
|
||||
* bytes wide. Since the row fitted into memory, however, the following must
|
||||
/* PNG images can be up to 2^31 pixels wide, which means they can be up to
|
||||
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence
|
||||
* 2^34 bytes wide. Since the row fitted into memory, the following must
|
||||
* work:
|
||||
*/
|
||||
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
|
||||
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
||||
|
||||
row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
|
||||
row = (png_const_bytep)(((const png_byte(*)[8])row) + bit_offset_hi);
|
||||
row += bit_offset_lo >> 3;
|
||||
bit_offset_lo &= 0x07;
|
||||
|
||||
/* 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 8 bits
|
||||
* first, so:
|
||||
* bits of the byte, and into two bytes for 16-bit values with the high
|
||||
* 8 bits first, so:
|
||||
*/
|
||||
switch (bit_depth)
|
||||
{
|
||||
case 1: return (row[0] >> (7-bit_offset_lo)) & 0x01;
|
||||
case 2: return (row[0] >> (6-bit_offset_lo)) & 0x03;
|
||||
case 4: return (row[0] >> (4-bit_offset_lo)) & 0x0f;
|
||||
case 1: return (row[0] >> (7 - bit_offset_lo)) & 0x01;
|
||||
case 2: return (row[0] >> (6 - bit_offset_lo)) & 0x03;
|
||||
case 4: return (row[0] >> (4 - bit_offset_lo)) & 0x0f;
|
||||
case 8: return row[0];
|
||||
case 16: return (row[0] << 8) + row[1];
|
||||
default:
|
||||
@ -71,7 +74,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
|
||||
*/
|
||||
static void
|
||||
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);
|
||||
|
||||
@ -92,22 +95,24 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
int num_palette = 0;
|
||||
|
||||
if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) &
|
||||
PNG_INFO_PLTE) && num_palette > 0 && palette != NULL)
|
||||
PNG_INFO_PLTE) &&
|
||||
(num_palette > 0) &&
|
||||
(palette != NULL))
|
||||
{
|
||||
png_bytep trans_alpha = NULL;
|
||||
int num_trans = 0;
|
||||
if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans,
|
||||
NULL) & PNG_INFO_tRNS) && num_trans > 0 &&
|
||||
trans_alpha != NULL)
|
||||
NULL) & PNG_INFO_tRNS) &&
|
||||
(num_trans > 0) &&
|
||||
(trans_alpha != NULL))
|
||||
printf("INDEXED %u = %d %d %d %d\n", index,
|
||||
palette[index].red, palette[index].green,
|
||||
palette[index].blue,
|
||||
index < num_trans ? trans_alpha[index] : 255);
|
||||
palette[index].red, palette[index].green,
|
||||
palette[index].blue,
|
||||
index < num_trans ? trans_alpha[index] : 255);
|
||||
|
||||
else /* no transparency */
|
||||
printf("INDEXED %u = %d %d %d\n", index,
|
||||
palette[index].red, palette[index].green,
|
||||
palette[index].blue);
|
||||
printf("INDEXED %u = %d %d %d\n", index, palette[index].red,
|
||||
palette[index].green, palette[index].blue);
|
||||
}
|
||||
|
||||
else
|
||||
@ -117,20 +122,20 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3),
|
||||
component(row, x, 1, bit_depth, 3),
|
||||
component(row, x, 2, bit_depth, 3));
|
||||
component(row, x, 1, bit_depth, 3),
|
||||
component(row, x, 2, bit_depth, 3));
|
||||
return;
|
||||
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
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;
|
||||
|
||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||
printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4),
|
||||
component(row, x, 1, bit_depth, 4),
|
||||
component(row, x, 2, bit_depth, 4),
|
||||
component(row, x, 3, bit_depth, 4));
|
||||
component(row, x, 1, bit_depth, 4),
|
||||
component(row, x, 2, bit_depth, 4),
|
||||
component(row, x, 3, bit_depth, 4));
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -138,7 +143,8 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
/* This program uses the default, <setjmp.h> based, libpng error handling
|
||||
* mechanism, therefore any local variable that exists before the call to
|
||||
@ -146,7 +152,7 @@ int main(int argc, const char **argv)
|
||||
* be declared with 'volatile' to ensure that their values don't get
|
||||
* destroyed by longjmp:
|
||||
*/
|
||||
volatile int result = 1/*fail*/;
|
||||
volatile int result = 1 /*fail*/;
|
||||
|
||||
if (argc == 4)
|
||||
{
|
||||
@ -163,8 +169,8 @@ int main(int argc, const char **argv)
|
||||
* writes error messages to stderr. Creating the png_struct is a
|
||||
* little tricky; just copy the following code.
|
||||
*/
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL);
|
||||
png_structp png_ptr =
|
||||
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
@ -184,11 +190,11 @@ int main(int argc, const char **argv)
|
||||
compression_method, filter_method;
|
||||
png_bytep row_tmp;
|
||||
|
||||
/* Now associate the recently opened (FILE*) with the default
|
||||
* libpng initialization functions. Sometimes libpng is
|
||||
* compiled without stdio support (it can be difficult to do
|
||||
* in some environments); in that case you will have to write
|
||||
* your own read callback to read data from the (FILE*).
|
||||
/* Now associate the recently opened FILE object with the
|
||||
* default libpng initialization functions. Sometimes libpng
|
||||
* is compiled without stdio support (it can be difficult to
|
||||
* do in some environments); in that case you will have to
|
||||
* write your own read callback to read data from the stream.
|
||||
*/
|
||||
png_init_io(png_ptr, f);
|
||||
|
||||
@ -202,21 +208,21 @@ int main(int argc, const char **argv)
|
||||
* space. In this case png_malloc is used - it will not
|
||||
* return if memory isn't available.
|
||||
*/
|
||||
row = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||
info_ptr));
|
||||
row =
|
||||
png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
|
||||
|
||||
/* To avoid the overhead of using a volatile auto copy row_tmp
|
||||
/* Avoid the overhead of using a volatile auto copy row_tmp
|
||||
* to a local here - just use row for the png_free below.
|
||||
*/
|
||||
row_tmp = row;
|
||||
|
||||
/* All the information we need is in the header is returned by
|
||||
* png_get_IHDR, if this fails we can now use 'png_error' to
|
||||
/* All the information we need is in the header returned by
|
||||
* png_get_IHDR. If this fails, we can use 'png_error' to
|
||||
* signal the error and return control to the setjmp above.
|
||||
*/
|
||||
if (png_get_IHDR(png_ptr, info_ptr, &width, &height,
|
||||
&bit_depth, &color_type, &interlace_method,
|
||||
&compression_method, &filter_method))
|
||||
&bit_depth, &color_type, &interlace_method,
|
||||
&compression_method, &filter_method))
|
||||
{
|
||||
int passes, pass;
|
||||
|
||||
@ -242,7 +248,7 @@ int main(int argc, const char **argv)
|
||||
/* Now read the pixels, pass-by-pass, row-by-row: */
|
||||
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 py;
|
||||
@ -299,19 +305,27 @@ int main(int argc, const char **argv)
|
||||
* are, of course, much better ways of doing this
|
||||
* than using a for loop:
|
||||
*/
|
||||
if (y == py) for (px = xstart, ppx = 0;
|
||||
px < width; px += xstep, ++ppx) if (x == px)
|
||||
if (y == py)
|
||||
{
|
||||
/* 'ppx' is the index of the pixel in the row
|
||||
* buffer.
|
||||
*/
|
||||
print_pixel(png_ptr, info_ptr, row_tmp, ppx);
|
||||
for (px = xstart, ppx = 0;
|
||||
px < width;
|
||||
px += xstep, ++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
|
||||
* found and handled the required data.
|
||||
*/
|
||||
goto pass_loop_end;
|
||||
} /* x loop */
|
||||
/* Now terminate the loops early - we have
|
||||
* found and handled the required data.
|
||||
*/
|
||||
goto pass_loop_end;
|
||||
} /* x loop */
|
||||
}
|
||||
}
|
||||
} /* y loop */
|
||||
} /* pass loop */
|
||||
|
||||
@ -323,7 +337,6 @@ int main(int argc, const char **argv)
|
||||
|
||||
else
|
||||
png_error(png_ptr, "pngpixel: png_get_IHDR failed");
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
@ -349,7 +362,8 @@ int main(int argc, const char **argv)
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngpixel: out of memory allocating png_info\n");
|
||||
fprintf(stderr,
|
||||
"pngpixel: out of memory allocating png_info\n");
|
||||
|
||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||
}
|
||||
@ -368,4 +382,3 @@ int main(int argc, const char **argv)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* READ && SEQUENTIAL_READ */
|
||||
|
@ -5,13 +5,11 @@
|
||||
* related or neighboring rights to this work. This work is published from:
|
||||
* United States.
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
*
|
||||
* Read a PNG and write it out in a fixed format, using the 'simplified API'
|
||||
* that was introduced in libpng-1.6.0.
|
||||
*
|
||||
* This sample code is just the code from the top of 'example.c' with some error
|
||||
* handling added. See example.c for more comments.
|
||||
* This sample code is just the code from 'example.c' with some error handling
|
||||
* added. See example.c in the top-level libpng directory for more comments.
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
@ -22,10 +20,15 @@
|
||||
* ensure the code picks up the local libpng implementation:
|
||||
*/
|
||||
#include "../../png.h"
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) && \
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
#if !defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||
!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;
|
||||
|
||||
@ -50,22 +53,22 @@ int main(int argc, const char **argv)
|
||||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
if (png_image_finish_read(&image, NULL/*background*/, buffer,
|
||||
0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))
|
||||
if (png_image_finish_read(&image, NULL /*background*/, buffer,
|
||||
0 /*row_stride*/, NULL /*colormap */))
|
||||
{
|
||||
if (png_image_write_to_file(&image, argv[2],
|
||||
0/*convert_to_8bit*/, buffer, 0/*row_stride*/,
|
||||
NULL/*colormap*/))
|
||||
if (png_image_write_to_file(
|
||||
&image, argv[2], 0 /*convert_to_8bit*/, buffer,
|
||||
0 /*row_stride*/, NULL /*colormap*/))
|
||||
result = 0;
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
|
||||
image.message);
|
||||
image.message);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
|
||||
image.message);
|
||||
image.message);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
@ -73,7 +76,7 @@ int main(int argc, const char **argv)
|
||||
else
|
||||
{
|
||||
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
|
||||
@ -95,4 +98,3 @@ int main(int argc, const char **argv)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* READ && WRITE */
|
||||
|
@ -6,9 +6,9 @@
|
||||
* 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 correct 'over' composition to
|
||||
* combine the alpha channels and corresponding data.
|
||||
* 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
|
||||
@ -28,8 +28,8 @@
|
||||
* 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.
|
||||
* 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>
|
||||
@ -44,54 +44,61 @@
|
||||
*/
|
||||
#include "../../png.h"
|
||||
|
||||
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
|
||||
#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];
|
||||
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) {
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
double err = 0;
|
||||
unsigned int xerr = 0;
|
||||
unsigned int r = 32769;
|
||||
unsigned int x = 0;
|
||||
|
||||
do
|
||||
{
|
||||
unsigned int x = 0;
|
||||
unsigned int t = x + (x >> 16) /*+ (x >> 31)*/ + r;
|
||||
double v = x, errtest;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
} while (++x <= 65535U * 65535U);
|
||||
|
||||
printf("error %f @ %u\n", err, xerr);
|
||||
|
||||
@ -101,7 +108,7 @@ int main(void) {
|
||||
|
||||
static void
|
||||
sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
||||
png_imagep image, const png_uint_16 *buffer)
|
||||
png_imagep image, const png_uint_16 *buffer)
|
||||
{
|
||||
/* This is where the Porter-Duff 'Over' operator is evaluated; change this
|
||||
* code to change the operator (this could be parameterized). Any other
|
||||
@ -112,8 +119,8 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
||||
/* Check for an x or y offset that pushes any part of the image beyond the
|
||||
* right or bottom of the sprite:
|
||||
*/
|
||||
if ((y_offset < 0 || (unsigned)/*SAFE*/y_offset < sprite->height) &&
|
||||
(x_offset < 0 || (unsigned)/*SAFE*/x_offset < sprite->width))
|
||||
if ((y_offset < 0 || /*SAFE*/ (unsigned)y_offset < sprite->height) &&
|
||||
(x_offset < 0 || /*SAFE*/ (unsigned)x_offset < sprite->width))
|
||||
{
|
||||
unsigned int y = 0;
|
||||
|
||||
@ -130,7 +137,7 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
||||
do
|
||||
{
|
||||
/* In and out are RGBA values, so: */
|
||||
const png_uint_16 *in_pixel = buffer + (y * image->width + x)*4;
|
||||
const png_uint_16 *in_pixel = buffer + (y * image->width + x) * 4;
|
||||
png_uint_32 in_alpha = in_pixel[3];
|
||||
|
||||
/* This is the optimized Porter-Duff 'Over' operation, when the
|
||||
@ -139,10 +146,10 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
||||
if (in_alpha > 0)
|
||||
{
|
||||
png_uint_16 *out_pixel = sprite->buffer +
|
||||
((y+y_offset) * sprite->width + (x+x_offset))*4;
|
||||
((y + y_offset) * sprite->width + (x + x_offset)) * 4;
|
||||
|
||||
/* This is the weight to apply to the output: */
|
||||
in_alpha = 65535-in_alpha;
|
||||
in_alpha = 65535 - in_alpha;
|
||||
|
||||
if (in_alpha > 0)
|
||||
{
|
||||
@ -159,9 +166,9 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
||||
*/
|
||||
png_uint_32 tmp;
|
||||
|
||||
# define compose(c)\
|
||||
tmp = out_pixel[c] * in_alpha;\
|
||||
tmp = (tmp + (tmp >> 16) + 32769) >> 16;\
|
||||
# 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... */
|
||||
@ -172,15 +179,15 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
|
||||
}
|
||||
|
||||
else
|
||||
out_pixel[0] = in_pixel[0],
|
||||
out_pixel[1] = in_pixel[1],
|
||||
out_pixel[2] = in_pixel[2],
|
||||
{
|
||||
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);
|
||||
} while (++x < image->width);
|
||||
} while (++y < image->height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,9 +231,8 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
|
||||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
if (png_image_finish_read(&image, NULL/*background*/, buffer,
|
||||
0/*row_stride*/,
|
||||
NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP*/))
|
||||
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
|
||||
@ -245,14 +251,14 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
|
||||
{
|
||||
free(buffer);
|
||||
fprintf(stderr, "simpleover: read %s: %s\n", (*argv)[0],
|
||||
image.message);
|
||||
image.message);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
|
||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||
|
||||
/* png_image_free must be called if we abort the Simplified API
|
||||
* read because of a problem detected in this code. If problems
|
||||
@ -290,8 +296,9 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
|
||||
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*/))
|
||||
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);
|
||||
@ -301,19 +308,20 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
|
||||
|
||||
else
|
||||
fprintf(stderr, "simpleover: write sprite %s: %s\n", sprite->name,
|
||||
save.message);
|
||||
save.message);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "simpleover: sprite %s: could not allocate tmpfile: %s\n",
|
||||
sprite->name, strerror(errno));
|
||||
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)
|
||||
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
|
||||
@ -334,13 +342,13 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
|
||||
* will fit.
|
||||
*/
|
||||
if (x < 0 || y < 0 ||
|
||||
(unsigned)/*SAFE*/x >= output->width ||
|
||||
(unsigned)/*SAFE*/y >= output->height ||
|
||||
sprite->width > output->width-x ||
|
||||
sprite->height > output->height-y)
|
||||
/*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);
|
||||
sprite->name, x, y);
|
||||
/* Could just skip this, but for the moment it is an error */
|
||||
return 0; /* error */
|
||||
}
|
||||
@ -359,10 +367,10 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
|
||||
{
|
||||
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 for PNG_FORMAT_FLAG_COLORMAP*/))
|
||||
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;
|
||||
@ -371,7 +379,7 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
|
||||
|
||||
/* The read failed: */
|
||||
fprintf(stderr, "simpleover: add sprite %s: %s\n", sprite->name,
|
||||
in.message);
|
||||
in.message);
|
||||
return 0; /* error */
|
||||
}
|
||||
}
|
||||
@ -379,7 +387,7 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "simpleover: --add='%s': invalid position %s\n",
|
||||
sprite->name, (*argv)[0]);
|
||||
sprite->name, (*argv)[0]);
|
||||
return 0; /* error */
|
||||
}
|
||||
}
|
||||
@ -389,10 +397,10 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
|
||||
|
||||
static int
|
||||
simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
const char **argv)
|
||||
const char **argv)
|
||||
{
|
||||
int result = 1; /* success */
|
||||
# define csprites 10/*limit*/
|
||||
# define csprites 10 /*limit*/
|
||||
# define str(a) #a
|
||||
int nsprites = 0;
|
||||
struct sprite sprites[csprites];
|
||||
@ -412,23 +420,25 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
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);
|
||||
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)
|
||||
(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);
|
||||
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 = sizeof(png_uint_16[4]);
|
||||
buf_size *= sprites[nsprites].width;
|
||||
buf_size *= sprites[nsprites].height;
|
||||
|
||||
@ -437,7 +447,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
tmp /= sprites[nsprites].width;
|
||||
tmp /= sprites[nsprites].height;
|
||||
|
||||
if (tmp == sizeof (png_uint_16 [4]))
|
||||
if (tmp == sizeof(png_uint_16[4]))
|
||||
{
|
||||
sprites[nsprites].buffer = malloc(buf_size);
|
||||
/* This buffer must be initialized to transparent: */
|
||||
@ -448,7 +458,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
sprites[nsprites].file = NULL;
|
||||
++argv, --argc;
|
||||
|
||||
if (create_sprite(sprites+nsprites++, &argc, &argv))
|
||||
if (create_sprite(sprites + nsprites++, &argc, &argv))
|
||||
{
|
||||
result = 1; /* still ok */
|
||||
continue;
|
||||
@ -466,7 +476,8 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "simpleover: %s: invalid sprite (%u,%u)\n",
|
||||
argv[0], sprites[nsprites].width, sprites[nsprites].height);
|
||||
argv[0],
|
||||
sprites[nsprites].width, sprites[nsprites].height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -480,7 +491,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
|
||||
else if (strncmp(argv[0], "--add=", 6) == 0)
|
||||
{
|
||||
const char *name = argv[0]+6;
|
||||
const char *name = argv[0] + 6;
|
||||
int isprite = nsprites;
|
||||
|
||||
++argv, --argc;
|
||||
@ -489,7 +500,8 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
{
|
||||
if (strcmp(sprites[isprite].name, name) == 0)
|
||||
{
|
||||
if (!add_sprite(output, out_buf, sprites+isprite, &argc, &argv))
|
||||
if (!add_sprite(output, out_buf, sprites + isprite,
|
||||
&argc, &argv))
|
||||
goto out; /* error in add_sprite */
|
||||
|
||||
break;
|
||||
@ -498,7 +510,8 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
|
||||
|
||||
if (isprite < 0) /* sprite not found */
|
||||
{
|
||||
fprintf(stderr, "simpleover: --add='%s': sprite not found\n", name);
|
||||
fprintf(stderr, "simpleover: --add='%s': sprite not found\n",
|
||||
name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -526,7 +539,8 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
int result = 1; /* default to fail */
|
||||
|
||||
@ -536,7 +550,7 @@ int main(int argc, const char **argv)
|
||||
const char *output = NULL;
|
||||
png_image image;
|
||||
|
||||
if (argc > 2 && argv[2][0] != '-'/*an operation*/)
|
||||
if (argc > 2 && argv[2][0] != '-' /*an operation*/)
|
||||
{
|
||||
output = argv[2];
|
||||
argi = 3;
|
||||
@ -558,7 +572,7 @@ int main(int argc, const char **argv)
|
||||
png_color background = {0, 0xff, 0}; /* fully saturated green */
|
||||
|
||||
if (png_image_finish_read(&image, &background, buffer,
|
||||
0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))
|
||||
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
|
||||
@ -566,22 +580,24 @@ int main(int argc, const char **argv)
|
||||
*
|
||||
* Perform the remaining operations:
|
||||
*/
|
||||
if (simpleover_process(&image, buffer, argc-argi, argv+argi))
|
||||
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*/)) ||
|
||||
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*/)))
|
||||
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);
|
||||
output == NULL ? "stdout" : output,
|
||||
image.message);
|
||||
}
|
||||
|
||||
/* else simpleover_process writes an error message */
|
||||
@ -589,7 +605,7 @@ int main(int argc, const char **argv)
|
||||
|
||||
else
|
||||
fprintf(stderr, "simpleover: read %s: %s\n", argv[1],
|
||||
image.message);
|
||||
image.message);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
@ -597,7 +613,7 @@ int main(int argc, const char **argv)
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
|
||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||
|
||||
/* This is the only place where a 'free' is required; libpng does
|
||||
* the cleanup on error and success, but in this case we couldn't
|
||||
@ -617,7 +633,8 @@ int main(int argc, const char **argv)
|
||||
else
|
||||
{
|
||||
/* Usage message */
|
||||
fprintf(stderr,
|
||||
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"
|
||||
@ -628,13 +645,13 @@ int main(int argc, const char **argv)
|
||||
" --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 using a Porter-Duff 'Over'\n"
|
||||
" operation at offset (x,y) in the sprite (defaulting to (0,0)).\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"
|
||||
" 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"
|
||||
@ -645,4 +662,3 @@ int main(int argc, const char **argv)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* SIMPLIFIED_READ */
|
||||
|
@ -21,7 +21,7 @@
|
||||
- 1.10: added support for non-default visuals; fixed X pixel-conversion
|
||||
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||
command-line parsing bug
|
||||
- 1.12: fixed some small X memory leaks (thanks to François Petitjean)
|
||||
- 1.12: fixed some small X memory leaks (thanks to François Petitjean)
|
||||
- 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
|
||||
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
|
@ -27,7 +27,7 @@
|
||||
- 1.11: added -usleep option for demos; fixed command-line parsing bug
|
||||
- 1.12: added -pause option for demos and testing
|
||||
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options
|
||||
- 1.21: fixed some small X memory leaks (thanks to François Petitjean)
|
||||
- 1.21: fixed some small X memory leaks (thanks to François Petitjean)
|
||||
- 1.22: fixed XFreeGC() crash bug (thanks to Patrick Welche)
|
||||
- 1.23: added -bgpat 0 mode (std white/gray checkerboard, 8x8 squares)
|
||||
- 1.30: added -loop option for -bgpat (ifdef FEATURE_LOOP); fixed bpp =
|
||||
|
@ -2,8 +2,6 @@
|
||||
#
|
||||
# Copyright (c) 2013 John Cunningham Bowler
|
||||
#
|
||||
# Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user