mirror of
https://github.com/glennrp/libpng.git
synced 2026-10-24 08:39:18 +03:00
Also change the copyright notice format in source files: - Old format: "Copyright (c) <Author> <Year>-<Year>" - New format: "Copyright (C) <Author> <Year>" The new format is meant to reduce the diff output and to alleviate the maintenance burden; the use of lowercase "(c)" vs. uppercase "(C)" is meant to distinguish between the old format and the new format. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
46 lines
1.3 KiB
Bash
Executable File
46 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -o errexit -o pipefail -o posix
|
|
|
|
# Copyright (C) 2019 Cosmin Truta
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# shellcheck source=ci/lib/ci.lib.sh
|
|
source "$(dirname "$0")/../lib/ci.lib.sh"
|
|
|
|
function ci_shellify_cmake {
|
|
# Convert CMake lists text, specifically originating
|
|
# from CMakeLists.txt, to shell scripting text.
|
|
# Select only the easy-to-parse definitions of PNGLIB_*.
|
|
sed -n -e '/^ *set *(PNGLIB_[^ ]* * [$"0-9A-Za-z_].*)/ p' |
|
|
sed -e 's/^ *set *(PNG\([^ ]*\) * \([^() ]*\)).*$/PNG\1=\2/' \
|
|
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/'
|
|
}
|
|
|
|
function usage {
|
|
echo "usage: $CI_SCRIPT_NAME [<options>] CMakeLists.txt"
|
|
echo "options: -?|-h|--help"
|
|
exit "${@:-0}"
|
|
}
|
|
|
|
function main {
|
|
local opt
|
|
while getopts ":" opt
|
|
do
|
|
# This ain't a while-loop. It only pretends to be.
|
|
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
|
|
ci_err "unknown option: '$1'"
|
|
done
|
|
shift $((OPTIND - 1))
|
|
[[ $# -eq 0 ]] && usage 2
|
|
[[ $# -eq 1 ]] || ci_err "too many operands"
|
|
# And... go!
|
|
test -e "$1" || ci_err "no such file: '$1'"
|
|
filename="$(basename -- "$1")"
|
|
[[ $filename == [Cc][Mm]ake[Ll]ists.txt ]] || {
|
|
ci_err "incorrect operand: '$1' (expecting: 'CMakeLists.txt')"
|
|
}
|
|
ci_shellify_cmake <"$1"
|
|
}
|
|
|
|
main "$@"
|