702 Commits

Author SHA1 Message Date
Filip Wasil
ffb8e8b26f Fix and improve the RISC-V Vector (RVV) implementation
Changes include manually merged code from Manfred SCHLAEGL.

Co-authored-by: Manfred SCHLAEGL <manfred.schlaegl@gmx.at>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-01 17:44:00 +03:00
Dragoș Tiselice
cc5ee6b213 Add optimized RISC-V Vector functions
Largely based off of the ARM NEON implementation.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-01 17:44:00 +03:00
Cosmin Truta
b4800bae33 Bump version to 1.6.49.git 2025-05-01 14:50:23 +03:00
Cosmin Truta
ea12796820 Release libpng version 1.6.48 2025-04-30 16:51:46 +03:00
Cosmin Truta
3e67531078 chore: Add a TODO note in .cmake-format.yaml; reformat CMakeLists.txt
Apply some (but not all) of the suggestions made by the cmake-format
program. Meanwhile, the cmake-lint program is (still) happy.
2025-04-29 17:30:30 +03:00
Cosmin Truta
23bdc7a6c4 build: Add the CMake build option PNG_LIBCONF_HEADER
Running the pnglibconf scripts (script/*.awk) is not always possible.
An AWK interpreter is not always guaranteed to be available; and even
if it is, there are limitations when making cross-platform libpng
builds, especially when the differences between the host platform and
the target platform are significant. For example:
 * Building for the Windows (MinGW) target on a Unix development host;
 * Building for the iOS target on a macOS development host;
 * Building for the Android target on any development host.

In such scenarios, a preconfigured (i.e. prebuilt) pnglibconf.h file,
either taken from the libpng source tree or provided by the user who
wants to make a custom libpng build, becomes a necessity.

In this commit we introduce the build option `PNG_LIBCONF_HEADER` in
order to address this specific use case.

We also specify a version range (3.14...4.0) for the minimum required
CMake program, to future-proof the CMake build for just a little bit
longer.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-28 20:44:53 +03:00
Cosmin Truta
5d09501462 Bump version to 1.6.48.git 2025-02-19 13:07:40 +02:00
Cosmin Truta
872555f4ba Release libpng version 1.6.47 2025-02-18 11:18:30 +02:00
Cosmin Truta
171bdd3a6c Bump version to 1.6.47.git 2025-01-27 18:32:44 +02:00
Cosmin Truta
0024abd279 Release libpng version 1.6.46 2025-01-23 19:02:04 +02:00
Cosmin Truta
8ffc967e8a Bump version to 1.6.46.git 2025-01-08 19:26:11 +02:00
Cosmin Truta
51f5bd68b9 Release libpng version 1.6.45 2025-01-07 18:31:22 +02:00
Cosmin Truta
2a845ff819 build: Move portions from the main CMake file to separate modules
In preparation for the upcoming changes in the build system, any parts
of the CMake file that are unlikely to be affected should be moved out
of the way. This should facilitate an easier resync between the branch
'libpng16' and its successor(s).

Specifically:
 * Move the functions `generate_chk`, `generate_out`, `generate_source`
   and `generate_copy` to scripts/cmake/PNGGenConfig.cmake.
 * Move the function `png_add_test` to scripts/cmake/PNGTest.cmake.
 * Leave the function `create_symlink` in place, but add a TODO note.
   As we raised the minimum required CMake version to 3.14, we should
   now be able to use CMake's built-in function instead.
2025-01-06 17:09:10 +02:00
Cosmin Truta
4599354be8 [libpng16] test: Move cicp-display-p3_reencoded.png to contrib/testpngs/png-3/
Update the main CMake file and the auxiliary test scripts accordingly.

This is a cherry-pick of commit fe277b7752990be35523832a546aec478437968a
from branch 'libpng18'.
2025-01-02 20:01:25 +02:00
Lucas CHOLLET
75748d93ce [libpng16] Add support for reading and writing the cICP chunk
This chunk was added in the third edition of the PNG specification and
contains Coding Independent Code Points (related to color space
description). It is fairly simple as it only contains four fields of one
byte each: Colour Primaries, Transfer Function, Matrix Coefficients,
Video Full Range Flag.

The test file originally comes from the related WPT test case:
https://github.com/web-platform-tests/wpt/blob/master/png/support/cicp-display-p3.png

Note that I reencoded the file to make it match libpng's default
encoding parameters (it only modifies the IDAT chunk).

This is a cherry-pick of commit 65925ad4b2cbed934d5d850fe764dc46c4becbcb
from branch 'libpng18'.

Reviewed-by: John Bowler <jbowler@acm.org>
Reviewed-by: Chris Blume <ProgramMax@gmail.com>
Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-02 11:15:20 +02:00
Cosmin Truta
8b1d489bce [libpng16] style: Resolve the remaining warnings issued by cmake-lint
Resolve the indentation issues raised by cmake-lint on a fragment of
CMakeLists.txt that no longer exists in branch 'libpng18'.
2024-10-12 19:37:50 +03:00
Cosmin Truta
a7a8faeefa [libpng16] style: Add a cmake-format config file and satisfy cmake-lint
Introduce CMake file linting, based on the cmakelang project by
Josh Bialkowski (@cheshirekow).

Fix various style issues in the CMake files:
 * Add the missing copyright header to PNGConfig.cmake.
 * Resolve a "missing docstring" warning raised by cmake-lint.
 * Rewrite all docstrings in the style of CMake's own documentation.
 * Fix whitespace inconsistencies.

References:
 * https://pypi.org/project/cmakelang
 * https://github.com/cheshirekow/cmake_format

This is a cherry-pick of commit c317fe31114d92d05d44bf98c9b559edf4656b9c
from branch 'libpng18'.
2024-10-12 19:37:50 +03:00
John Bowler
d7d950e8bd [libpng16] chore: Clean up the leading blank lines from all source files
The leading blank lines are apparently an artefact of an older source
control system.  They are not required and they look like accidents,
because starting a source file with a blank line is not a regular habit
of software developers nowadays.

This is a cherry-pick of commit 37cc20add8fb5b83bb5299a26cd3b41e0f776017
from branch 'libpng18'.

Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-11 11:51:04 +03:00
Cosmin Truta
642b5d81e3 [libpng16] build: Raise the minimum required CMake version to 3.14
Start using the features guaranteed to be available in CMake 3.14.
Specifically, use the ability of `find_package(ZLIB)` to pick up zlib
from the ZLIB_ROOT variable (if given).

This is a cherry-pick of commit 00343a761e41e56acaeb0517aec5325d3b951837
from branch 'libpng18'.
2024-10-06 21:54:21 +03:00
Cosmin Truta
ef153d5325 Bump version to 1.6.45.git 2024-09-14 11:46:34 +03:00
Cosmin Truta
f5e92d7697 Release libpng version 1.6.44 2024-09-12 23:44:44 +03:00
Green Sky
8cc22a8c15 cmake: Fix an error in the declaration of target include directories
Properly declare target include directories for generated includes.
Previously the non targeted `include_directories()` was used, which
had issue when using the `png_static` target in a submodule.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-10 23:50:55 +03:00
Cosmin Truta
843dbb7579 Revert "cmake: Fix an error in the declaration of target include directories"
This reverts commit 1d1cc9ae18f677201bf7e47928c30562df967756.

The verification has failed. (Oopsie!)
2024-09-10 22:41:03 +03:00
Green Sky
1d1cc9ae18 cmake: Fix an error in the declaration of target include directories
Properly declare target include directories for generated includes.
Previously the non targeted `include_directories()` was used, which
had issue when using the `png_static` target in a submodule.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-10 22:03:13 +03:00
Benjamin Buch
0e204b7364 build: Add a CMake config file compatible with the FindPNG module
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-08 21:57:37 +03:00
Cosmin Truta
33ef48b6d6 cmake: Fix the handling of PNG_HARDWARE_OPTIMIZATIONS on FreeBSD/amd64
Because of a missing "amd64" string (in lowercase) in a regex match,
the CMake build was unable to pick up the PNG_HARDWARE_OPTIMIZATIONS
flag on FreeBSD/amd64 (and possibly other amd64 systems as well).

Rename the target arch variable from TARGET_ARCH to a more idiomatic
PNG_TARGET_ARCHITECTURE, and set it to an always-lowercase string.
The follow-on checks are now simpler and easier to get right.
2024-09-04 18:32:03 +03:00
Ross Burton
9e538750d9 arm: Remove obsolete assembler implementation filter_neon.S
This file contains hand-coded assembler implementations of the filter
functions for 32-bit Arm platforms.  These are only used when the
compiler doesn't support neon intrinsics (added to GCC 4.3 in 2008) or
is exactly GCC 4.5.4 (released 2012), both of which are sufficiently
unlikely to be true that it's fair to say the assembler is no longer
used.

This commit deletes filter_neon.S and removes the now obsolete
preprocessor logic in pngpriv.h.

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-06-15 23:09:34 +03:00
John Bowler
ceed2a3cf6 SECURITY: disable build of filter_neon.S on arm
This fixes the bug https://github.com/pnggroup/libpng/issues/505
"libpng does not support PAC/BTI on aarch64 targets" which arises
because the build mechanisms (both cmake and configure) assemble
arm/filter_neon.S even though it ends up completely empty.  The empty
file effectively poisons the so that the PAC/BTI support gets disabled.

The fix is minimal; it simply removes arm/filter_neon.S from the list of
sources included in the 64-bit ARM builds build.  Note that this was
already done in cmake for MSVC - it's not clear whether this change was
a partial fix for the same issue.

This version of the fix ONLY affects aarch64 (arm64) builds; 32-bit ARM
systems can still invoke the assembler if required and, indeed, there
should be no change whatsover to those builds.

The assembler code could not be used on 64-bit systems in any case so
in practice there is no material change to 64-bit builds either.

TESTING: pull the changes then type "autoreconf" if using configure (not
required for cmake).

TESTS: cmake has not been tested because cross-builds with cmake
currently fail to find the zlib installation from the cmake system root
path.  The following has been tested with configure cross builds:

armv7-linux-gnueabi [no neon support]
armv7a-linux-gnueabi [no neon support]
armv7a-hardfloat-linux-gnueabi [neon support not enabled]
armv7a-hardfloat-linux-gnueabi -mfpu=neon [uses intrinics]
armv7a-hardfloat-linux-gnueabi -mfpu=neon
        -DPNG_ARM_NEON_IMPLEMENTATION=2 [uses assembler]
aarch64-linux-gnu [uses intrinsics]
aarch64-linux-gnu -DPNG_ARM_NEON_OPT=0 [neon support disabled]

Signed-off-by: John Bowler <jbowler@acm.org>
2024-05-31 10:18:28 -07:00
Cosmin Truta
f1848a3b56 Bump version to 1.6.44.git 2024-02-24 13:32:56 +02:00
Cosmin Truta
ed217e3e60 Release libpng version 1.6.43 2024-02-23 11:51:40 +02:00
Cosmin Truta
890231026d chore: Delete comments and config settings and stuff from here and there 2024-02-22 17:00:05 +02:00
Benjamin Buch
7b888092b9 build: Mark the installed libpng headers as system headers in CMake
Modern compilers can disable the warnings that originate from system
headers. This change allows them to do so with the libpng headers.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-21 23:26:07 +02:00
Cosmin Truta
d165a20ae4 build: Improve the search for an AWK processor in the CMake build
Add nawk to the list of AWK-processing programs that are known to work,
and show the search result in the CMake log.
2024-02-19 20:51:26 +02:00
Cosmin Truta
aa95dee697 build: Update the CMake build options PNG_TOOLS and PNG_FRAMEWORK
Update the PNG_TOOLS option: set it to OFF by default when the
target is an embedded system, yet still allow it to be overridden.

Update the PNG_FRAMEWORK option: force it back to OFF and print a
warning if the option was ON but the target is not an Apple system.
2024-02-19 14:25:55 +02:00
Dan Rosser
e7ba9c0dfc build: Fix a CMake build regression introduced in version 1.6.41
This fixes commit 4edbb4da81626a7342a22824d7a8f60a3ea71bd0.

During the move of CMake scripts to the scripts/cmake/ subdirectory,
some of the workflows have been broken.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-19 11:19:52 +02:00
Cosmin Truta
4191872d0d chore: Update the .editorconfig files and pacify editorconfig-checker 2024-02-15 18:29:26 +02:00
guxiwei
2aebfb4aa9 loongarch: Add cmake support 2024-02-01 21:17:37 +02:00
Cosmin Truta
4356cb0709 Bump version to 1.6.43.git 2024-01-31 11:32:51 +02:00
Cosmin Truta
ba980b8f0c Release libpng version 1.6.41 2024-01-24 18:59:00 +02:00
Cosmin Truta
4edbb4da81 build: Move scripts/*.cmake.in to scripts/cmake/; add cmake/AUTHORS.md
From the libpng licensing point of view, the build projects, the build
scripts, the test scripts, the CI verification scripts, et cetera, have
not traditionally been part of libpng proper, although some of these,
including the CMake-based build, have been released under the libpng
license.

Considering how the CMake build grew as a result of many contributions
from many contributing authors over a long time, one may argue that it
almost became an individual piece of software in its own right.

Moving on, everything CMake-related shall be placed in the subdirectory
scripts/cmake/ (except, of course, the main CMakeLists.txt). Moreover,
contributing authors shall be acknowledged in scripts/cmake/AUTHORS.md.

Please see scripts/cmake/README.md for more information.
2024-01-22 17:24:59 +02:00
gxw
ce4b632dd7 Optimize png16 with loongson mmi for 64-bit os 2024-01-17 22:46:16 +02:00
Cosmin Truta
85f866dea3 cmake: Enable policy CMP0074 for ZLIB_ROOT; deprecate PNG_BUILD_ZLIB
Although the minimum required CMake version is 3.6, this policy will
only have effect under CMake 3.12 or newer.

Reported-by: Jacob Harding <54728054+jacobharding@users.noreply.github.com>
2023-12-20 19:12:42 +02:00
Cosmin Truta
2fff013a69 cmake: Raise the minimum required version to 3.6 and use its features
Use the `CMAKE_HOST_SOLARIS` variable, introduced in CMake 3.6, and
raise `cmake_minimum_required` accordingly.
2023-12-13 20:24:33 +02:00
Cosmin Truta
acfd50ae0b cmake: Clean up functions, string operations, regular expressions, etc.
Remove the inclusion of the external module `CMakeParseArguments`.
Function argument parsing became a first-class feature in CMake 3.5.

Delete the function `find_symbol_prefix`. It is no longer used.

Use variables instead of strings in string operations where possible.
Prevent CMake from getting confused by string values that might be
accidentally identical to unrelated keywords.

Clean up spurious `.*` sequences in regex matching operations.

Rephrase a comment.
2023-12-11 20:51:06 +02:00
Cosmin Truta
8fc13a8704 cmake: Enable the libpng framework build by default on Apple systems
The PNG_FRAMEWORK option used to be off by default. It was possible to
turn it on, regardless of the underlying operating system, but doing so
outside of an Apple OS broke the libpng build.

PNG_FRAMEWORK is now on by default, conditionally defined on Apple
systems only, and it is ignored (without breaking the build) elsewhere.

Other minor changes have also been applied.
2023-12-08 23:22:39 +02:00
Timothy Lyanguzov
1460b3ce78 cmake: Use Zlib as a package
1. automatic linking of the library and add include directory
2. properly specify include directories

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-08 14:57:36 +02:00
Cosmin Truta
e1088f99d4 Redo "cmake: Fix CPU architecture regexes"
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-07 23:17:56 +02:00
Cosmin Truta
d65b3ebf00 Revert "cmake: Fix CPU architecture regexes"
This reverts commit 9c1dc4d13dab823d6441d417546ebeee3994389b.

The new regex for Intel can match "x86_64", but it fails with "x86".
Moreover, the new regex for MIPS needs more testing on all MIPS ISAs.

Reported-by: Clinton Ingram <clinton.ingram@outlook.com>
2023-12-07 23:17:56 +02:00
Clinton Ingram
a3d1a35b98 cmake: Don't add Unix ASM file to the ARM-specific source list for MSVC
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-07 16:11:12 +02:00
Cosmin Truta
9c1dc4d13d cmake: Fix CPU architecture regexes
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-07 16:11:12 +02:00