delliott
bb45fc85ba
All checks were successful
continuous-integration/drone/push Build is passing
Another attempt at #4516 Adds a small fix for tag map generation #4516 introduces build failures, but testing indicates that those failures would have been resolved by a full rebuild. Hence this pr. Co-authored-by: Darragh Elliott <me@delliott.xyz> Reviewed-on: #4553 Co-authored-by: delliott <delliott@fsfe.org> Co-committed-by: delliott <delliott@fsfe.org>
83 lines
2.5 KiB
Bash
Executable File
83 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Dependency check function
|
|
check_dependencies() {
|
|
depends="$@"
|
|
deperrors=''
|
|
for depend in $depends; do
|
|
if ! which "$depend" >/dev/null 2>&1; then
|
|
deperrors="$depend $deperrors"
|
|
fi
|
|
done
|
|
if [ -n "$deperrors" ]; then
|
|
printf '\033[1;31m'
|
|
cat <<-EOF
|
|
The build script depends on some other programs to function.
|
|
Not all of those programs could be located on your system.
|
|
Please use your package manager to install the following programs:
|
|
EOF
|
|
printf '\n\033[0;31m%s\n' "$deperrors"
|
|
exit 1
|
|
fi 1>&2
|
|
}
|
|
|
|
# Check dependencies for all kinds of build envs (e.g. development, fsfe.org)
|
|
check_dependencies realpath rsync xsltproc xmllint sed find egrep grep wc make tee date iconv wget shuf python3
|
|
|
|
if ! make --version | grep -q "GNU Make 4"; then
|
|
echo "The build script requires GNU Make 4.x"
|
|
exit 1
|
|
fi
|
|
|
|
basedir="${0%/*}/.."
|
|
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
|
|
readonly start_time="$(date +%s)"
|
|
|
|
. "$basedir/build/arguments.sh"
|
|
|
|
# Check special dependencies for (test.)fsfe.org build server
|
|
if [ "$build_env" == "fsfe.org" ] || [ "$build_env" == "test.fsfe.org" ]; then
|
|
check_dependencies lessc
|
|
fi
|
|
|
|
statusdir="${statusdir/#\~/$HOME}"
|
|
if [ -n "$statusdir" ]; then
|
|
mkdir -p "$statusdir"
|
|
[ ! -w "$statusdir" -o ! -d "$statusdir" ] &&
|
|
die "Unable to set up status directory in \"$statusdir\",\n" \
|
|
"either select a status directory that exists and is writable,\n" \
|
|
"or run the build script without output to a status directory"
|
|
fi
|
|
readonly statusdir="${statusdir:+$(realpath "$statusdir")}"
|
|
|
|
buildpids=$(
|
|
ps -eo command |
|
|
egrep "[s]h ${0} .*" |
|
|
wc -l
|
|
)
|
|
if [ $command = "build_into" -o $command = "git_build_into" ] && [ "$buildpids" -gt 2 ]; then
|
|
debug "build script is already running"
|
|
exit 1
|
|
fi
|
|
|
|
[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
|
|
[ -z "$inc_buildrun" ] && . "$basedir/build/buildrun.sh"
|
|
[ -z "$inc_makerules" ] && . "$basedir/build/makerules.sh"
|
|
[ -z "$inc_processor" ] && . "$basedir/build/processor.sh"
|
|
[ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
|
|
|
|
case "$command" in
|
|
git_build_into) if [ -f "${statusdir}/full_build" ]; then
|
|
debug "discovered flag file, performing full build"
|
|
rm "${statusdir}/full_build"
|
|
build_into
|
|
else
|
|
git_build_into
|
|
fi ;;
|
|
build_into) build_into ;;
|
|
build_run) buildrun ;;
|
|
process_file) process_file "$workfile" "$processor" ;;
|
|
build_xmlstream) build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" ;;
|
|
tree_maker) tree_maker "$tree" "$target" ;;
|
|
esac
|