crosstool-ng/scripts/build/companion_tools.sh
Alexey Neyman 7a94c81e5b Rework configure logic wrt GNU autotools
Rather than requiring them of a certain version, detect if they are present
(and have sufficient version) and select an appropriate companion tool
otherwise. The reason is that, for example, most recent gettext requires
automake 1.15, but the newest available CentOS has 1.13. Hence, the option
to "upgrade your system" does not apply, and the warning comment above
the companion tools is rather scary.

With this approach, it will work out of the box - either by using the host's
tools, or by building them as needed. Note that the user can still change
the setting in the config.

While there, propagate the new version checking macro to awk/bash/host binutils,
and switch from --with-foo=xxx to officially blessed FOO=xxx: the latter
does not require checking for bogus values (i.e., --with-foo, --without-foo)
and AC_PROG_* macros recognize the corresponding settings without further
modifications. For now, I kept --with-foo=, if only to complain and steer
people to the new way. To be cleaned up after a release.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-27 20:40:47 -08:00

59 lines
1.7 KiB
Bash

# Wrapper to build the companion tools facilities
# List all companion tools facilities, and parse their scripts
CT_COMP_TOOLS_FACILITY_LIST=
for f in "${CT_LIB_DIR}/scripts/build/companion_tools/"*.sh; do
_f="$(basename "${f}" .sh)"
_f="${_f#???-}"
__f="CT_COMP_TOOLS_${_f}"
if [ "${!__f}" = "y" ]; then
CT_DoLog DEBUG "Enabling companion tool '${_f}'"
. "${f}"
CT_COMP_TOOLS_FACILITY_LIST="${CT_COMP_TOOLS_FACILITY_LIST} ${_f}"
else
CT_DoLog DEBUG "Disabling companion tool '${_f}'"
fi
done
# Download the companion tools facilities
do_companion_tools_get() {
for f in ${CT_COMP_TOOLS_FACILITY_LIST}; do
do_companion_tools_${f}_get
done
}
# Extract and patch the companion tools facilities
do_companion_tools_extract() {
for f in ${CT_COMP_TOOLS_FACILITY_LIST}; do
do_companion_tools_${f}_extract
done
}
# Build the companion tools facilities for build
do_companion_tools_for_build() {
for f in ${CT_COMP_TOOLS_FACILITY_LIST}; do
do_companion_tools_${f}_for_build
done
}
# Build the companion tools facilities for host
do_companion_tools_for_host() {
case "${CT_TOOLCHAIN_TYPE}" in
# For native/cross, build==host, skip: the tools were built
# earlier by do_companion_tools_for_build.
native|cross)
return
;;
# For canadian/cross-native, only need to build tools for host
# if explicitly requested.
canadian|cross-native)
if [ -z "${CT_COMP_TOOLS_FOR_HOST}" ]; then
return
fi
;;
esac
for f in ${CT_COMP_TOOLS_FACILITY_LIST}; do
do_companion_tools_${f}_for_host
done
}