In addition to png.h, configure.ac and CMakeLists.txt, the script
ci_verify_version.sh is now able to verify libpng-config-head.in also.
For the benefit of readability, the old script ci_shellify.sh has been
split into smaller, independent scriptlets: libexec/ci_shellify_*.sh.
The linting script ci_lint.sh has been updated as needed.
For testing purposes (e.g. wanting to see if "make distclean" works
correctly with and without building), as well as development purposes
(e.g. wanting to inspect the artifacts produced in the configuration
stage), add `CI_NO_BUILD` to the family of contrarians.
Add various missing pieces to their right places:
* Update .editorconfig in order to let editorconfig-checker know that
aclocal.m4 (which is auto-generated) may contain trailing whitespace.
* Add ci/README.md.
* Update scripts/README.txt.
TODO:
Integrate editorconfig-checker into the linting workflow on GitHub.
(See .github/workflows/lint.yml)
Allow ci_verify_configure.sh to pass regardless whether the configure
script and the associated configure control files are present.
This is necessary for the branches newer than 'libpng16', where these
artifacts are no longer auto-generated by default.
This is a cherry-pick of commit 09ec97edc099538d548a67253b990660c912af4f
from branch 'libpng18'.
Due to raising the minimum CMake version to 3.14, we can now run the
CMake build verification (ci_verify_cmake.sh) from the libpng source
dir, just as in the other scripts (ci_verify_*.sh). This is possible
thanks to the modern CMake command options `cmake -B` and `cmake -S`.
We can finally simplify the implementation of ci_verify_cmake.sh by
removing a code complication that was annoying, and yet, necessary in
peculiar Bash-on-Windows setups.
Fun fact:
CMake version 3.14 was released on 2019-03-14. Reportedly, on purpose!
This is a cherry-pick of commit 558dfbb7570cb74205f978f11504b217a2c03c2c
from branch 'libpng18'.
As the editorconfig-checker program is transitioning from using
the .ecrc config file to the .editorconfig-checker.json config file,
the older program versions do not recognize the new config file name.
Update ci_lint.sh to instruct editorconfig-checker to pick up its
configuration from the new config file name, regardless of the program
version.
Also update ci_lint.sh to instruct yamllint to check all *.json files,
including .editorconfig-checker.json.
This is a cherry-pick of commit 77f88338a19a223cc678e1a6a04888a31c78dabf
from branch 'libpng18'.
Considering that a non-trivial amount of libpng code is arch-specific,
we should perform cross-platform builds (with cross-platform toolchains)
and test runs (on emulated architectures) in our routine verification.
The content of ci/targets/ shall consist of target description files,
written in the standard shell language. These files may be source'd as
needed, before running the verification scripts ci/ci_verify_*.sh.
Here is the initial list of target systems:
Android, Cygwin, FreeBSD, Linux, MSDOS, Windows.
And here is the initial list of target architectures:
ARM, MIPS, PowerPC, RISC-V, x86.
This fixes commit dddaf0c625a8daea4d027cb57380b7fac6f58285.
The way to reliably `find` executable files is different on BSD, Mac
and Linux, unfortunately.
The variable `CI_LINT_COUNTER` was incremented inside subshells, but
remained unchanged in the main shell process. The errors detected by
the internal linters remained unreported by the main script. (Oopsie!)
Besides fixing this defect, considering that only a pass/fail status
is needed, we are replacing `CI_LINT_COUNTER` with `CI_LINT_STATUS`.
Introduce the environment option CI_FORCE:
* ci_verify_configure.sh is known to fail if an existing build
configuration is found in the top-level directory.
Setting CI_FORCE=1 will run `make distclean` before verification.
* ci_verify_makefiles.sh cannot be reliably executed if random
object files are found in the top-level directory.
Setting CI_FORCE=1 will run `rm *.o *.obj` before verification.
* ci_verify_cmake.sh is not known at this time to fail for similar
reasons; but if it does, we will use CI_FORCE to trigger any
necessary pre-build cleanup.
Work around a limitation in the `shellcheck source` directive, which
does not recognize quotes in shellcheck versions older than 0.9.
Also extend the checks for YAML files over the entire source tree, in
preparation for the introduction of the GitHub Actions config file.
`PNG_LIBPNG_VER_BUILD` should be zero for public releases and non-zero
for development versions. The ci_verify_version.sh script should check
this requirement as such.
This program verifies the libpng source tree, expecting consistent
definitions of version numbers in the C source code, in the Autoconf
scripts, and in the CMake scripts.
The version verification is performed as follows. (Please note that
the version definitions in png.h are checked twice.)
* The files png.h, configure.ac and CMakeLists.txt are checked by
the ci_verify_version.sh program.
* The files png.h, png.c and pngtest.c are checked by the pngtest
program.
Many build scripts, ports and other third-party add-ons that are
circulating around appear to be distributed under the MIT License.
Examples include the Vcpkg build system (including the libpng port)
and the Meson build definitions (including the libpng definition).
I am, therefore, relicensing our CI scripts once more, as the sole
author (so far), just in case that any of the CI code might travel
from/to such projects. Hopefully, this one last license will stick.
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.
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.
Fix ci_verify_cmake.sh: sync up CI_BUILD_TO_INSTALL_RELDIR with
CI_INSTALL_DIR. (Oopsie!)
Replace slashes, backslashes and dots with underlines in system
names and machine hardware names. These names are now included in
the output directory naming scheme.
Replace CI_SYSTEM_NAME and CI_MACHINE_NAME with CI_HOST_SYSTEM and
CI_HOST_MACHINE, respectively.
Introduce CI_TARGET_SYSTEM and CI_TARGET_MACHINE, defaulting to
CI_HOST_SYSTEM and CI_HOST_MACHINE, respectively.
Use CI_TARGET_SYSTEM and CI_TARGET_MACHINE in the naming scheme of
target build and install directories, in order to allow concurrent
verification builds for multiple cross-platform targets.
Move the common declarations and initializations from ci_verify_*.sh
to ci.lib.sh, and update them as follows:
* Simplify the ci_ function names.
* Refactor the CI_ variable names:
- Add the new variable CI_TOPLEVEL_DIR.
- Rename the variables CI_SCRIPTNAME, CI_SCRIPTDIR, etc.,
to CI_SCRIPT_NAME, CI_SCRIPT_DIR, etc.
- Rename the variables CI_SRCDIR_FROM_BUILDDIR, etc., to
CI_BUILD_TO_SRC_RELDIR, etc.
* Add new functions inside ci.lib.sh:
- Replace ci_err with ci_err_usage, ci_err_fatal, ci_err_internal.
- Add the new functions ci_warn and ci_assert.
* Simplify the ci_ function names inside ci_verify_*.sh.
Apply the following changes:
* Update CI_BUILDDIR and CI_INSTALLDIR to reflect the new script
names.
* Introduce CI_SRCDIR_FROM_BUILDDIR and CI_INSTALLDIR_FROM_BUILDDIR
to the cmake build, to ensure that the Windows tools can handle
native Windows paths correctly when executed via Bash-on-Windows.
* Stop guessing and using CI_SRCDIR_NATIVE and CI_INSTALLDIR_NATIVE
in the cmake build, since we now have a better solution.
* Show the ninja program version in ninja-based cmake builds.
* Move the cleanup of previous builds into separate functions, and
do it in a cleaner manner. No pun intended.
Fix autodetection and use of the cygpath executable on Windows.
Add a new variable CI_CMAKE_TOOLCHAIN_FILE to ci_verify_cmake.sh.
This should help in future cross-platform testing.
Remove the implicit initialization of CI_CC, CI_LD and CI_LIBS from
ci_verify_makefiles.sh. This should help the testing of default values
of their respective make variables (CC, LD and LIBS).
Give the CI scripts new names that better reflect what they do, and
make room for activities such as linting or dependency installation:
* Rename ci_autotools.sh to ci_verify_configure.sh.
* Rename ci_cmake.sh to ci_verify_cmake.sh.
* Rename ci_legacy.sh to ci_verify_makefiles.sh.
Also rename CI_LEGACY_MAKEFILES to CI_MAKEFILES.
Update the config files for Travis CI and AppVeyor CI accordingly.
Apply the following changes:
* Set CI_CMAKE_GENERATOR to "Ninja" by default in ci_cmake.sh.
* Set CI_CC to cc by default in ci_autotools.sh.
* Rename CI_SYSNAME to CI_SYSTEM_NAME; add CI_MACHINE_NAME.
* Apply other minor changes and fixes.
Implement the following updates:
* Add CI_SYSNAME and set it to `uname -s`.
* Set the default CI_CC value to "clang" on all BSD systems.
* Replace CI_SRCDIR_REL_BUILDDIR and CI_INSTALLDIR_REL_BUILDDIR
with CI_SRCDIR_NATIVE and CI_INSTALLDIR_NATIVE.
The former variables were hard-coded and error-prone; the new
variables are computed and safe to use.
The Unix paths in Bash do not mix well with the Windows paths in CMake.
The uppercase and the lowercase environment variables do not mix well
in MSBuild. Et cetera.
On AppVeyor CI, verification of Windows builds with the Visual Studio
toolchain used to work, perhaps due to one or more lucky coincidences,
but it stopped working after an upgrade on the AppVeyor CI site.
Update ci_cmake.sh as follows:
* Use POSIX commands like "mkdir" and "rm" instead of CMake commands
like "make_directory" and "remove_directory".
* Avoid using absolute paths in the CMake command line; use relative
paths that are accessible from both Bash and Windows.
* Clean up incidental mixtures of Windows and Bash-on-Windows
environment variables like {$TEMP,$Temp,$temp} and {$TMP,$Tmp,$tmp}.
For ci_autotools.sh, customize CPP, CPPFLAGS, AR, RANLIB, LD, LDFLAGS
via CI_CPP, CI_CPP_FLAGS, CI_AR, CI_RANLIB, CI_LD, CI_LD_FLAGS.
For ci_cmake.sh and ci_legacy.sh, customize AR, AR_RC and RANLIB via
CI_AR and CI_RANLIB.
Rewrite portions of ci_legacy.sh to match the style of ci_cmake.sh.
Update the ci_*.sh scripts and move them to the more conventional
ci/ directory. Update .appveyor.yml and .travis.yml, as well as
the AUTHORS file, accordingly.
Speed up ci_cmake.sh: add "-DPNG_TESTS=OFF" to the list of CMake
variables if CI_NO_TEST is true.
Remove "sudo: false" from .travis.yml.
Refactor .appveyor.yml.