44 Commits

Author SHA1 Message Date
Cosmin Truta
738f5e743c ci: Add more checks to ci_verify_version.sh; refactor
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.
2025-02-20 11:59:16 +02:00
Cosmin Truta
f20e66aa93 chore: Apply some of the missed updates to the copyright year 2025-02-19 13:15:14 +02:00
Cosmin Truta
bb7e922914 ci: Introduce the CI_NO_BUILD flag
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.
2025-02-17 21:13:32 +02:00
Cosmin Truta
fcb0bca15f chore: Update the .editorconfig file; add/update README files
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)
2025-01-22 23:19:49 +02:00
Cosmin Truta
7c90057cfe [libpng16] ci: Verification should pass regardless of autoconf artifacts
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'.
2024-10-07 21:48:04 +03:00
Cosmin Truta
1bf304c43c [libpng16] ci: Use modern CMake command options in ci_verify_cmake.sh
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'.
2024-10-06 22:39:51 +03:00
Cosmin Truta
bcb3124141 [libpng16] ci: Update ci_lint.sh to recognize .editorconfig-checker.json
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'.
2024-09-17 19:14:28 +03:00
Cosmin Truta
68d7ce8040 ci: Get ready for the upcoming branch 'libpng18' 2024-09-14 22:41:01 +03:00
Cosmin Truta
e3c7b26fbd ci: Fix bad (but innocuous) copy pasta in ci_verify_version.sh 2024-09-14 16:38:02 +03:00
Cosmin Truta
7e18d14296 ci: Add the targets/ subdirectory to facilitate cross-platform testing
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.
2024-09-05 22:23:30 +03:00
Cosmin Truta
6b5a2da072 Fix "ci: Fix the reporting in ci_lint.sh"
This fixes commit dddaf0c625a8daea4d027cb57380b7fac6f58285.

The way to reliably `find` executable files is different on BSD, Mac
and Linux, unfortunately.
2024-02-17 18:28:01 +02:00
Cosmin Truta
dddaf0c625 ci: Fix the reporting in ci_lint.sh
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`.
2024-02-17 16:32:21 +02:00
Cosmin Truta
72c4520d3c ci: Allow the user to force an in-tree cleanup before verification
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.
2024-02-17 11:56:35 +02:00
Cosmin Truta
f74d5ecce8 ci: Pacify shellcheck version 0.8 and apply other linting improvements
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.
2024-02-15 14:37:24 +02:00
Cosmin Truta
fb65436e06 ci: Fix the check of PNG_LIBPNG_VER_BUILD in ci_verify_version.sh
`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.
2024-02-12 12:22:43 +02:00
Cosmin Truta
63c715b7d7 ci: Remove the workaround for CI_AR from ci_verify_makefiles.sh 2024-02-11 23:49:08 +02:00
Cosmin Truta
8120345c89 ci: Update (again) the ci_verify_*.sh scripts; update .shellcheckrc
Apply stylistic improvements and remove a shellcheck exclusion.
2024-02-11 15:24:03 +02:00
Cosmin Truta
7a6148290f ci: Update the ci_verify_*.sh scripts.
Bring the coding patterns in line with the newest scripts.
2024-02-10 16:45:26 +02:00
Cosmin Truta
c6ee62af2e ci: Add ci_verify_version.sh
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.
2024-02-09 18:00:24 +02:00
Cosmin Truta
46b79d4716 ci: Update and rename ci_lint_ci.sh to ci_lint.sh; update .shellcheckrc
The ci_lint.sh program can now lint the entire libpng source tree.
2024-02-08 21:37:42 +02:00
Cosmin Truta
49eeb1f8ba ci: Add ci_shellify.sh
This program can shellify png.h, configure.ac and CMakeLists.txt.
2024-02-08 19:17:33 +02:00
Cosmin Truta
366c9c6a24 ci: Reformat all scripts using 1TBS
One may truly embrace the stylishness of the One True Brace Style.
2024-02-06 16:20:33 +02:00
Cosmin Truta
c9ac5bdba4 ci: Add a pre-build checkup stage to ci_verify_configure.sh
Also update comments and tracing printouts in ci/ci_*.sh
2024-02-04 21:53:15 +02:00
Cosmin Truta
6159bad8a9 ci: Relicense again the CI scripts, from Boost License to MIT License
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>
2024-01-22 23:55:18 +02:00
Cosmin Truta
3285bf0d4c ci: Add help options; add checks for the boolean environment options 2024-01-22 23:45:23 +02:00
Cosmin Truta
e755fb79ba ci: Quick-fix ci_verify_cmake.sh
Avoid using `cmake --option=value` and `ctest --option=value`, to stay
compatible with older versions of CMake.
2023-10-19 00:26:54 +03:00
Cosmin Truta
53d2188fa5 ci: Update the support for cross-build verifications; refactor
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.
2023-10-18 19:36:38 +03:00
Cosmin Truta
ee9d6d7bf2 ci: Improve the support for cross-build verifications
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.
2023-07-30 17:07:25 +03:00
Cosmin Truta
f8e5fa92b0 ci: Fix ci_verify_cmake.sh; improve ci.lib.sh
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.
2023-07-09 12:27:51 +03:00
Cosmin Truta
c81516e943 ci: Fix bad copy pasta in ci_verify_configure.sh 2023-07-08 23:46:53 +03:00
Cosmin Truta
0b7bc40de1 ci: Introduce CI_HOST_* and CI_TARGET_*
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.
2023-07-04 19:40:05 +03:00
Cosmin Truta
82414985c1 ci: Add ci_lint_ci.sh and .shellcheckrc
Add ci_lint_ci.sh for linting the CI config files and scripts.
The linting is based on yamllint and shellcheck.
2023-07-04 00:12:32 +03:00
Cosmin Truta
c0616f1017 ci: Add ci.lib.ch; update ci_verify_*.sh accordingly
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.
2023-07-03 22:59:24 +03:00
Cosmin Truta
c741d1e392 ci: Relicense the CI scripts to the Boost Software License version 1.0
Fetch LICENSE_BSL_1_0.txt from http://www.boost.org/LICENSE_1_0.txt
and update the copyright notice in all ci_* scripts.

Append "SPDX-License-Identifier" tags after each copyright notice;
see https://github.com/david-a-wheeler/spdx-tutorial/#spdx-tutorial
2023-07-03 19:14:33 +03:00
Cosmin Truta
66fede80d2 ci: Update the CI scripts
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.
2023-02-05 17:09:00 +02:00
Cosmin Truta
9db8cff6ef ci: Fix verification under Cygwin Bash + CMake + Visual Studio; update
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).
2022-11-27 21:58:07 +02:00
Cosmin Truta
b445aade83 ci: Rename the ci_* scripts
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.
2022-11-27 21:05:42 +02:00
Cosmin Truta
d72cda543c ci: Trace the paths of executable files found on the build machine
Also add markers to trace the boundaries of configuration and build
steps.
2022-09-14 21:56:47 +03:00
Cosmin Truta
081e6751ab ci: Update the CI scripts
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.
2022-09-04 19:41:33 +03:00
Cosmin Truta
8c3fdb0ac1 ci: Update the CI scripts
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.
2021-03-15 20:23:26 -04:00
Cosmin Truta
c2e2cd2ec5 ci: Fix the Visual Studio verification on AppVeyor CI
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}.
2020-12-31 03:29:11 -05:00
Cosmin Truta
c3f209178b ci: Recognize more CI_ variables for better cross-platform verification
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.
2020-12-31 00:41:01 -05:00
Cosmin Truta
2f753e260c ci: Verify the install target
Add support for the install target in ci_autotools.sh and ci_cmake.sh.
Also add the environment option CI_NO_INSTALL.
2020-05-24 22:09:45 -04:00
Cosmin Truta
3676fd324a ci: Add a new top-level directory, dedicated for CI verification
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.
2020-05-18 21:30:30 -04:00