config: Add package versioning flexibility

Some users (like myself) may want to omit the crosstool-NG version
from the binaries' versioning output, as it can be incredibly long
and not too helpful. Add a config option to disable it. The possible
combinations are as follows:

- crosstool-NG version (default)
- crosstool-NG version - custom toolchain ID
- Custom toolchain ID
- No crosstool-NG version OR custom toolchain ID

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
This commit is contained in:
Nathan Chancellor 2017-09-01 14:24:29 -07:00
parent 98b6a5a450
commit 1d724767bd
6 changed files with 31 additions and 11 deletions

View File

@ -76,6 +76,22 @@ config STATIC_TOOLCHAIN
NOTE: this has no connection to whether the target libraries will be NOTE: this has no connection to whether the target libraries will be
dynamic or static. This only applies to the tools themselves. dynamic or static. This only applies to the tools themselves.
config SHOW_CT_VERSION
bool
prompt "Add crosstool-NG version to --version output"
default y
help
If yes, the crosstool-NG version will be included in the output of
gcc --version, and also in binutils, glibc, gdb and gdbserver.
If this is enabled, the package version will include:
"crosstool-NG ${CT_VERSION}"
If this is disabled and no ID string is given below, the default
of each individual package will be used.
This is passed to the configure flag --with-pkgversion.
config TOOLCHAIN_PKGVERSION config TOOLCHAIN_PKGVERSION
string string
prompt "Toolchain ID string" prompt "Toolchain ID string"
@ -86,10 +102,10 @@ config TOOLCHAIN_PKGVERSION
the output of gcc --version, and also in binutils, glibc, gdb and the output of gcc --version, and also in binutils, glibc, gdb and
gdbserver. gdbserver.
If this string is left empty, the actual package version will be: If this is enabled, it will either be added to the crosstool-NG version:
"crosstool-NG ${CT_VERSION}"
Otherwise, it will be:
"crosstool-NG ${CT_VERSION} - ${CT_TOOLCHAIN_PKGVERSION}" "crosstool-NG ${CT_VERSION} - ${CT_TOOLCHAIN_PKGVERSION}"
Or it will be entirely on its own:
"${CT_TOOLCHAIN_PKGVERSION}"
This is passed to the configure flag --with-pkgversion. This is passed to the configure flag --with-pkgversion.

View File

@ -154,7 +154,7 @@ do_binutils_backend() {
extra_config+=( --enable-plugins ) extra_config+=( --enable-plugins )
fi fi
if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
fi fi
if [ "${CT_MULTILIB}" = "y" ]; then if [ "${CT_MULTILIB}" = "y" ]; then
@ -307,7 +307,7 @@ do_binutils_for_target() {
CT_DoLog EXTRA "Configuring binutils for target" CT_DoLog EXTRA "Configuring binutils for target"
if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
fi fi
if [ "${CT_MULTILIB}" = "y" ]; then if [ "${CT_MULTILIB}" = "y" ]; then

View File

@ -357,7 +357,7 @@ do_gcc_core_backend() {
fi fi
done done
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
@ -874,7 +874,7 @@ do_gcc_backend() {
done done
[ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared") [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared")
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in

View File

@ -19,7 +19,7 @@ do_debug_gdb_build() {
esac esac
if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
fi fi

View File

@ -168,7 +168,7 @@ do_libc_backend_once() {
*) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");; *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
esac esac
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
touch config.cache touch config.cache
@ -484,7 +484,7 @@ do_libc_locales() {
# a harmless: `configure: WARNING: unrecognized options: --with-bugurl...` # a harmless: `configure: WARNING: unrecognized options: --with-bugurl...`
# If it's set, use it, if is a recognized option. # If it's set, use it, if is a recognized option.
if [ ! "${CT_TOOLCHAIN_PKGVERSION}" = "" ]; then if [ ! "${CT_TOOLCHAIN_PKGVERSION}" = "" ]; then
extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
fi fi
if [ ! "${CT_TOOLCHAIN_BUGURL}" = "" ]; then if [ ! "${CT_TOOLCHAIN_BUGURL}" = "" ]; then
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")

View File

@ -168,7 +168,11 @@ CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC
CT_CC_GCC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" ) CT_CC_GCC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" )
# Compute the package version string # Compute the package version string
CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOLCHAIN_PKGVERSION}}" if [ "${CT_SHOW_CT_VERSION}" = "y" ]; then
CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOLCHAIN_PKGVERSION}}"
else
CT_PKGVERSION="${CT_TOOLCHAIN_PKGVERSION}"
fi
# Compute the working directories names # Compute the working directories names
CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs" CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"