Considering that pnglibconf is a whole mini-system for configuring and
building libpng, it should be placed in its own dedicated subdirectory.
Any future additions, including tests and documentation, should go into
this subdirectory.
One exception: pnglibconf.h.prebuilt is moved to the top-level source
directory, where pnglibconf.h would be. This follows the organization
pattern typically used with the "*.in" files, for example.
All references to the pnglibconf artifacts, found in machine-readable
code and in human-readable comments, are updated accordingly.
Add scripts/makefile.c89 and refactor scripts/makefile.emcc,
scripts/makefile.clang and scripts/makefile.gcc
Refactor variable definitions inside scripts/makefile.clang,
scripts/makefile.gcc and scripts/makefile.emcc, and start using
the option `-pedantic-errors` unconditionally. This option was
first implemented in GCC version 3.1, and it was available in
Clang and in other Clang-based compilers (e.g. Emscripten) from
the beginning.
Add scripts/makefile.c89, derived from the above makefiles, but
with `-pedantic-errors -std=c89`. We aren't enabling the C89 level
by default, to avoid any incompatibility, whether intentional or
accidental, with the compiler's default language level. However,
we are still continuing to support C89 in the 'libpng16' branch,
and this special makefile can be used for testing purposes.
The change removes the need for build configuration of target specific
code such as SIMD enhancements.
The extensible framework is based on checks in the new file named
pngtarget.h and allows per target description of requirements and
capabilities using macros with the prefix PNG_TARGET_. These macros are
interpreted by the core libpng code in a target independent way.
The PNG_TARGET_ prefixed macros describe the target specific
implementation and document how to include it. The actual inclusion of
the code is done, at present, by a single target independent core file
named pngsimd.c.
This approach ensures that no special configuration in the build system
is required on any system. It is not required on a system which is
compiling for the build host where we can reasonably assume that the
compiler is correctly set up. Neither is it required for cross builds
so long as the toolchain is correctly set up. In this case the
toolchain means the cross build system and any ancilliary programs it
requires.
More details of the implementation are included in the source files
named pngtarget.h and pngsimd.c. These files document in C comments how
additional target specific code might be added.
The changes consist primarily of movement of target specific code from
the core libpng source files to the existing target specific
subdirectories such as the ones named intel and arm. This isolates the
code into the corresponding subdirectory and eliminates the requirement
for changes across the libpng structure.
As part of this the ARM processor NEON instruction set specific palette
to RGB code has been generalised to allow implementation in other
architectures. The resultant updated version of the original (ARM Ltd)
implementation has been moved to the subdirectory named arm.
In addition some selected changes have been included to allow testing
with higher warning levels than the typical compiler defaults.
Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Remove all makefiles that used to serve specific Unix and Unix-ish
operating systems. We still retain the generic Unix makefile.std,
as well as the compiler-specific (Unix and non-Unix) makefiles and
scripts.
Update scripts/README.md and manuals/libpng-install.txt accordingly.
Split AR_RC into AR and ARFLAGS. The variables AR and ARFLAGS are
de-facto standards (like CC and CFLAGS, LD and LDFLAGS, etc.) that
may be overridden when running make. Moreover, configuring CC, LD,
AR, etc., to point to a cross-platform compiler, linker, librarian,
etc., is a de-facto standard practice as well.
Also remove the MKDIR_P variable definitions from all makefiles.
They've been leftovers from the removal of the "install*" targets.
Fix the legacy makefile builds on ARM, MIPS and PowerPC, where
hardware-optimized compilation was enabled by default in the generic
source files, but without including the machine-specific source files.
Delete scripts/makefile.linux-opt.
Considering that "-Wextra" is a more descriptive alternative to "-W",
and that "-Wundef" is a highly useful warning option that has been
available in ancient versions of gcc (version 2.x), we replace all
occurrences of "-W -Wall" with "-Wall -Wextra -Wundef".
Also clean up the makefiles.
Delete variables (ALIGN, ARCH, DOCS) and targets (writelock) that are
no longer necessary.
Reorder the object file lists alphabetically, consistently across all
makefiles and build scripts.
Apply other minor fixes.
from the source files, along with "#define PNG_EXPOSE_INTERNAL_STRUCTURES"
and "#define PNG_NO_PEDANTIC_WARNINGS" (John Bowler).
Also created new pngdebug.h and moved debug definitions there.
to prevent warnings about direct access to png structs by libpng functions
while building libpng. They need to be tested, especially
those using compilers other than gcc.