From 1d724767bdedac22682fe23e88b4fe0033cb58f4 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Fri, 1 Sep 2017 14:24:29 -0700 Subject: [PATCH 1/2] 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 --- config/toolchain.in | 22 +++++++++++++++++++--- scripts/build/binutils/binutils.sh | 4 ++-- scripts/build/cc/gcc.sh | 4 ++-- scripts/build/debug/300-gdb.sh | 2 +- scripts/build/libc/glibc.sh | 4 ++-- scripts/crosstool-NG.sh.in | 6 +++++- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/config/toolchain.in b/config/toolchain.in index f9a56b97..6d3ff290 100644 --- a/config/toolchain.in +++ b/config/toolchain.in @@ -76,6 +76,22 @@ config STATIC_TOOLCHAIN NOTE: this has no connection to whether the target libraries will be 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 string prompt "Toolchain ID string" @@ -86,10 +102,10 @@ config TOOLCHAIN_PKGVERSION the output of gcc --version, and also in binutils, glibc, gdb and gdbserver. - If this string is left empty, the actual package version will be: - "crosstool-NG ${CT_VERSION}" - Otherwise, it will be: + If this is enabled, it will either be added to the crosstool-NG version: "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. diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index e0fe7f40..703a6fab 100644 --- a/scripts/build/binutils/binutils.sh +++ b/scripts/build/binutils/binutils.sh @@ -154,7 +154,7 @@ do_binutils_backend() { extra_config+=( --enable-plugins ) fi 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}") fi if [ "${CT_MULTILIB}" = "y" ]; then @@ -307,7 +307,7 @@ do_binutils_for_target() { CT_DoLog EXTRA "Configuring binutils for target" 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}") fi if [ "${CT_MULTILIB}" = "y" ]; then diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 54dd514c..2609873a 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -357,7 +357,7 @@ do_gcc_core_backend() { fi 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}") if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then @@ -874,7 +874,7 @@ do_gcc_backend() { done [ "${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}") case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 19d9d6dc..e3a40d07 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -19,7 +19,7 @@ do_debug_gdb_build() { esac 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}") fi diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index c09ff5cd..0cf58f35 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -168,7 +168,7 @@ do_libc_backend_once() { *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");; 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}") touch config.cache @@ -484,7 +484,7 @@ do_libc_locales() { # a harmless: `configure: WARNING: unrecognized options: --with-bugurl...` # If it's set, use it, if is a recognized option. if [ ! "${CT_TOOLCHAIN_PKGVERSION}" = "" ]; then - extra_config+=("--with-pkgversion=${CT_PKGVERSION}") + [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}") fi if [ ! "${CT_TOOLCHAIN_BUGURL}" = "" ]; then [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index d5066e21..9c09b5e4 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -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[@]}" ) # 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 CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs" From b0f14b0dfa1b8a060ba75c5a7294241857f51b3c Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Fri, 1 Sep 2017 13:31:35 -0700 Subject: [PATCH 2/2] config: Show crosstool-NG version in .config This was previously available in 6c62da480344 but was then removed in cb7fcbe1ef4f. Add it back since it will be helpful if the user wants to hide the crosstool-NG version in the pkgversion. To get the new version, a defconfig from "ct-ng savedefconfig" or "ct-ng oldconfig" must be used in combination with "ct-ng menuconfig" or "ct-ng nconfig". Signed-off-by: Nathan Chancellor --- config/config.in | 1 + config/global.in | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/config/config.in b/config/config.in index 6b0b911d..f941301c 100644 --- a/config/config.in +++ b/config/config.in @@ -1,3 +1,4 @@ +mainmenu "crosstool-NG $CT_VERSION Configuration" source "config/configure.in" source "config/global.in" source "config/target.in" diff --git a/config/global.in b/config/global.in index 2860f1a8..0dff199c 100644 --- a/config/global.in +++ b/config/global.in @@ -1,5 +1,9 @@ # Overall toolchain configuration: paths, jobs, etc... +config CT_VERSION + string + option env="CT_VERSION" + # Allow unconditional usage of tristates config MODULES bool