-
Notifications
You must be signed in to change notification settings - Fork 7
Add support for v1.6.50 #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for v1.6.50 #9
Conversation
Introduce CI_TARGET_TRIPLET and CI_TARGET_ABI. Rename CI_HOST_MACHINE and CI_TARGET_MACHINE, respectively, to CI_HOST_ARCH and CI_TARGET_ARCH, following on the conventional target triplet nomenclature. Introduce CI_BUILD_SYSTEM and CI_BUILD_ARCH, following on the GNU Autotools (host/build/target) practice and nomenclature. Ensure that CI_TARGET_SYSTEM, CI_TARGET_ARCH and CI_TARGET_ABI are all initialized when verifying a cross-platform build. Work around an obscure CMake error by ensuring that CMake variables (CMAKE_AR and CMAKE_RANLIB) are initialized to the full executable paths of their CI_* equivalents (CI_AR and CI_RANLIB). Implement other general-purpose improvements: * Check all CI_NO_* variables in an arithmetic context, to allow setting them explicitly to zero in external configurations. * Label the assertions with descriptions of what's being asserted. * Add more comments and tracing printouts.
This PR adds two set of options to the configure script:
--enable-png-tests/--disable-png-tests
and
--enable-png-tools/--disable-png-tools
By using this feature, a user will be allowed to build only library if
needed, which will be useful on platforms not able to build the tools
and/or the tests.
This PR leaves the existing behaviour as default setting, by building
both the tools and the tests if the options are not used.
CMakeLists.txt already supports this feature with the options PNG_TESTS
and PNG_EXECUTABLES. After this commit, Autotools will provide the same
feature.
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Rename
--enable-png-tests/--disable-png-tests
--enable-png-tools/--disable-png-tools
to
--enable-tests/--disable-tests
--enable-tools/--disable-tools
respectively.
While the `PNG_` prefix is necessary in CMakeLists.txt, a corresponding
`--...-png-` option qualifier would be redundant in a configure script.
For the sake of consistency with a recent addition to the configure script, the option name PNG_EXECUTABLES (introduced in libpng-1.6.38) shall become PNG_TOOLS. PNG_EXECUTABLES is still maintained as a deprecated option, allowing the applications that use it to be built without modification, but a deprecation warning will be issued.
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
1. Set `cmake_minimum_required` to 3.5 (see https://cmake.org/cmake/help/latest/release/3.27.html) 2. Specify the version of CMake project 3. Remove the redundant call to `cmake_policy` 4. Use `CMAKE_INSTALL_BINDIR` and `CMAKE_INSTALL_INCLUDEDIR` 5. Use private library linking for tools and test programs 6. Don't activate testing if it was not enabled Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Rename `CI_HOST_ARCH` and `CI_HOST_SYSTEM`, to `CI_BUILD_ARCH` and `CI_BUILD_SYSTEM`, following the nomenclature used by GNU Autotools. Unfortunately, the word "host" has confusingly opposite meanings in CMake (and Bazel, etc.) vs. Autotools (and Meson, etc.) Remove `CI_TARGET_TRIPLET` and `CI_TARGET_ABI` (for now). Introduce the function `ci_expr` as a fast and easy equivalent of `expr >/dev/null`. Rephrase the assertions using an implementation pattern that is more expressive, yet (arguably) just as readable. Remove `ci_assert`. Modify the main functions to display more useful information in case of usage error.
Update the Travis CI matrix: * Run ASan and UBSan unconditionally on FreeBSD and Linux, and not at all on Mac. * Remove the `CI_NO_TEST=1` runs from the environment column. Update the AppVeyor CI matrix: * Replace `CI_NO_TEST=1` with `CI_CMAKE_VARS=-DPNG_TESTS=0` when testing Visual Studio on ARM64. Also apply minor stylistic changes.
Avoid using `cmake --option=value` and `ctest --option=value`, to stay compatible with older versions of CMake.
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This reverts commit 9c1dc4d. 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>
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
1. automatic linking of the library and add include directory 2. properly specify include directories Signed-off-by: Cosmin Truta <ctruta@gmail.com>
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.
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.
Use the `CMAKE_HOST_SOLARIS` variable, introduced in CMake 3.6, and raise `cmake_minimum_required` accordingly.
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>
The old implementation of png_have_msa() caused a bus error, if a word in /proc/cpuinfo was longer than 10 characters. In the original implementation, `word[10]` was too short, and `word[i++] = ch` caused a stack smash if the characters between spaces were more than 10. And also, fclose(f) should be called before leaving. For example on loongson ls3a4000 cpu platform: $ cat /proc/cpuinfo system type : Generic Loongson64 System machine : loongson,loongson64g-4core-ls7a processor : 0 cpu model : ICT Loongson-3 V0.1 FPU V0.1 BogoMIPS : 3594.02 wait instruction : yes microsecond timers : yes tlb_entries : 2112 extra interrupt vector : no hardware watchpoint : no isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 ASEs implemented : vz msa loongson-mmi loongson-cam loongson-ext loongson-ext2 shadow register sets : 1 kscratch registers : 6 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available processor : 1 cpu model : ICT Loongson-3 V0.1 FPU V0.1 BogoMIPS : 3611.26 wait instruction : yes microsecond timers : yes tlb_entries : 2112 extra interrupt vector : no hardware watchpoint : no isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 ASEs implemented : vz msa loongson-mmi loongson-cam loongson-ext loongson-ext2 shadow register sets : 1 kscratch registers : 6 package : 0 core : 1 VCED exceptions : not available VCEI exceptions : not available Co-authored-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: Sui Jingfeng <15330273260@189.cn> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
The <stdint.h> header is a standard C99 header, and a MIPS-specific header, but it is not a standard C89 header. It should not be included until ensuring that the code being compiled is MIPS-specific.
makepngs.sh relies on a Bash feature in one of its case statements, ";;&"; this should be made explicit in the shebang. intgamma.sh declares a function in a manner which may fail in non-Bash sh implementations, this patch uses the correct syntax. Based on a patch by Roflcopter4: joncampbell123/dosbox-x#3850 Signed-off-by: Stephen Kitt <steve@sk2.org>
This reverts the code to a variant of my old style of doing an 'fclose' correctly and adds comments explaining why it is so difficult. Thanks to @ihsinme for pointing out the error on github.com Signed-off-by: John Bowler <jbowler@acm.org>
The old note about this function being unlikely to work correctly was likely incorrect.
Raise the minimum required CMake version to 3.5. Add the configuration option `PNGMINUS_USE_SYSTEM_PNG` for compiling and linking with the system libpng library instead of the internal one. Remove the old configuration option `PNGMINUS_USE_STATIC_LIBRARIES`. When using the internal libpng (via `PNGMINUS_USE_SYSTEM_PNG=OFF`), simply enforce static linking and produce single-file executables. Rename the scripts "png2pnm.sh" (etc.) to "test_png2pnm.sh" (etc.), to make it obvious that they are test drivers, not program launchers. Add a .gitignore file for project-specific build and test artifacts.
Improve png2pnm.c:
* Add support for writing 16-bit raw PNM image files.
Fix and improve pnm2png.c:
* Add support for reading 16-bit raw PNM image files.
* Fix the parsing of arbitrarily long numeric strings.
In the parsing of PNM tokens, we can and we should avoid storing
more than one leading '0' in the token buffer. All valid (in-range)
numeric strings must fit in this limited-size buffer, regardless of
their actual length in the input file.
* Refactor the PNM parsing in order to make it more capable to handle
various kinds of input file errors.
* Remove the volatile qualifiers from all variable declarations.
Their original purpose was to appease old (and incorrect) warnings
issued by ancient optimizing compilers.
* Print a note about the program's lack of support for the PAM ("P7")
file format when the input is in this format.
* Add FIXME notes about the need to signal incorrect or incomplete
input files. (For png2pnm, this is done inside libpng.)
Improve and modernize png2pnm.c: * Remove the explicit reading of the input PNG file signature. Libpng is now able to read it, check it, and issue an appropriate error message in case of magic number mismatch or file corruption. (See the function `png_read_sig`.) * Remove the explicit allocation and dealocation of the image data. Libpng is now able to manage all the image data automatically. (See the function `png_read_png`.) * Specify the needed image transformations without a-priori checking the image type for applicability. * Use the `png_set_expand_gray_1_2_4_to_8` transformation. Since libpng version 1.2.9, this transformation (if needed) must be enabled separately from `png_set_expand`. Improve and modernize pnm2png.c: * Modify the allocation of image data, in order to match libpng's internal allocation model. * Transfer the ownership of the image data from the `pnm2png` function to libpng, which will manage and dealocate it at the right time. (See the functions `png_set_image_rows` and `png_data_freer`.) Refactor, clean up, etc.
The pngminus programs use several PNG image transformations: `png_set_expand`, `png_set_expand_1_2_4_to_8`, etc. (in png2pnm.c); `png_set_packing`, `png_set_invert_mono`, etc. (in pnm2png.c). The availability of all of these transformations in libpng is now required at compile time. On the topic of transformations, apply an unrelated fix to the use of `png_set_gamma`.
Defer the program termination on error until all files are closed and (if applicable) all incompletely-written output files are deleted. In addition, perform the following maintenance tasks: * Rename and document the internal helpers used by the functions `png2pnm` and `pnm2png`. * Unset the executable permission bits for the *.bat test programs.
Allow the CMake build to work properly, even if file paths (in the
source directory, in the build directory, or in the install directory)
might contain whitespace characters.
Improve the check for compilers that might use MSVC Runtime library
headers on Windows. We use POSIX-ish ("deprecated") functions, even
on Windows, and we want no spurious warnings.
Tidy up the CMake file: rearrange declarations, rewrite comments, etc.
Counter-intuitively, defining the PNG_DEBUG macro as 1 (i.e. setting the debug verbosity level to 1) does *not* cause any of the existing debug traces to show up. This setting would have worked if we had trace statements like `png_debug(0, message)`, but we don't have any. Debug traces do show up for verbosity levels from 2 to 5. The libpng manual describes in detail how they are meant to be used. According to the history of the CMake file, as well as the history of other project files, PNG_DEBUG was never set to a numeric value larger than 1. In other words, these debug settings inside these build files never produced any output in any (unmodified) libpng version. (As for the configure build, PNG_DEBUG has no special treatment there.) Considering the plethora of alternative methods to pass C preprocessor options through our build files, scripts and projects onto libpng, we'd rather discontinue PNG_DEBUG as a dedicated build option.
A funny thing happened while refactoring the function argument parsing
in the `PNGGenConfig` module: the processing of dependencies inside
the CMake function `generate_copy` got fixed, thanks to an inadvertent
typo correction!
Going down the rabbit hole, we uncovered two issues:
1. A typo in `scripts/cmake/PNGGenConfig.cmake` caused a dependency
declaration to disappear, disrupting the graph. Fortunately, this
disruption was being mitigated by an additional set of (redundant)
symbolic target declarations that kept the CMake build going.
2. The exact string matching inside `scripts/cmake/gensrc.cmake.in`
imposed an artificial limitation, disallowing the use of absolute
file paths.
The typo correction in (1), and the use of regex matching instead of
exact string matching in (2), allowed us to use absolute file paths
in the main CMake file, consistently, thus allowing CMake to recognize
them as uniquely-identifiable nodes in the dependency graph. There
should be no further need to have extra symbolic targets for proper
node identification.
In the end, we shaved off the redundant symbolic target declarations,
retaining only `png_genfiles` and `png_genprebuilt`.
Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Add contrib/examples/.clang-format, tailored to fit the existing code as closely as possible. The end goal is to set up automatic formatting for the entire libpng source tree. We're doing this experiment in this subdirectory, for now. Also make refactoring changes, as follows: * Rewrite the preprocessor checks `#if PNG_FOO_SUPPORTED` to stop compilation immediately, with a descriptive `#error` about what needs to be supported. * Rewrite and reflow comments, add braces and brackets, and make other minor modifications that are suited for the clang-format'ed code.
This is a fix of commit 5631b9b "build: Implement various improvements to the CMake file"
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This is a cherry-pick of commit df3b917 from branch 'libpng18'.
In some cases, the vector extension is not supported, although the compiler allows the "v" flag in `-march` and includes `<riscv_vector>` without raising an error. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
PNG_AFTER_IDAT was not set by the IDAT read code if unknown chunk handling was turned on. This was hidden in the current tests by checks within the text handling chunks. (For example, pngtest.png has a zTXt chunk after IDAT.) This change modifies both the sequential and the progressive reader to reliably set PNG_AFTER_IDAT when the first non-IDAT chunk is seen and before that chunk is processed. The change is minimalist; PNG_HAVE_CHUNK_AFTER_IDAT can probably be removed and replaced with PNG_AFTER_IDAT. Making the latter change is something to be considered in libpng2. Co-authored-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Detect the availability of `libm` on the target platform. Previously, `libm` was detected on the host platform only. Also introduce the variable `PNG_LINK_LIBRARIES`. Stop using `M_LIBRARY`, which was not namespace-clean.
Also make editorial changes regarding the previous PNG specifications.
|
I just did cpp-pm/hunter#823 today XD could you move the PR to cpp-pm/libpng repo. This one is legacy we dont control hunter-packages |
Just did. Thanks. cpp-pm#1 PS. There is another PR for the minizip package hunter-packages/minizip#4 Maybe you also need to create a new repo. |
|
https://github.com/cpp-pm/minizip already exists, please move PR as well. Thanks! |
This pull request adds support for libpng v1.6.50.
It is an update based on the official libpng repo at https://github.com/pnggroup/libpng/tree/v1.6.50
Changes are confined to the Hunter-specific CMake configuration files (CMakeLists.txt and cmake/Config.cmake.in).
Tested and confirmed working on macOS.