summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/functions61
-rw-r--r--scripts/show-config.sh118
-rw-r--r--scripts/show-tuple.sh (renamed from scripts/showConfig.sh.in)0
-rw-r--r--scripts/showSamples.sh225
5 files changed, 179 insertions, 226 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 7abc2a7..553a363 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1,4 +1,3 @@
crosstool-NG.sh
saveSample.sh
-showConfig.sh
scripts.mk
diff --git a/scripts/functions b/scripts/functions
index 402de86..d46ac36 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1,5 +1,6 @@
# -*- mode: sh; tab-width: 4 -*-
# vi: ts=4:sw=4:sts=4:et
+# vim: filetype=sh :
# This file contains some useful common functions
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
@@ -1891,6 +1892,10 @@ CT_PackageRun()
eval "local ${v}=\${CT_${use}_${v^^}}"
done
+ if [ -z "${pkg_name}" ]; then
+ CT_Abort "Internal ct-ng error: '${sym}' not defined, please report a bug"
+ fi
+
for v in archive_filename archive_dirname; do
# kconfig and shell have different quoting rules, so it seems impossible to make
# kconfig quote '$' properly for eval (i.e. not have it expanded when loading the
@@ -2213,3 +2218,59 @@ CT_GetPkgVersion()
CT_PackageRun "${1}" __do_GetPkgVersion
eval "${2}=\"${rv}\""
}
+
+# Get a package version selected to build. May return an empty string.
+# Usage: CT_GetPkgBuildVersion PKG VAR
+# where PKG may refer to a specific package (e.g. GCC) or package choice
+# (e.g. LIBC).
+CT_GetPkgBuildVersion()
+{
+ local category="${1}"
+ local component="${2}"
+ local var="${3}"
+ local choicename tmp pkg build_version
+
+ # If it is for a choice, not a menu, get the choice name
+ eval "choicename=\${CT_${category}}"
+
+ # Find the associated package
+ eval "pkg=\${CT_${category}_${component}_PKG_KSYM}"
+ if [ -z "${pkg}" ]; then
+ # This component does not have an associated package,
+ # return the component name.
+ if [ -n "${choicename}" ]; then
+ eval "${var}=\"${choicename}\""
+ fi
+ return
+ fi
+
+ __do_GetPkgBuildVersion() {
+ tmp="${pkg_name}-${version}"
+ if [ "${src_devel}" = "y" ]; then
+ tmp+="-${devel_vcs}"
+ if [ -n "${devel_revision}" ]; then
+ tmp+="-${devel_revision}"
+ fi
+ elif [ "${src_custom}" = "y" ]; then
+ tmp+="-custom"
+ fi
+ if [ -n "${choicename}" -a "${pkg}" != "${component}" ]; then
+ tmp+=" (${choicename})"
+ fi
+ }
+
+ CT_PackageRun "${pkg}" __do_GetPkgBuildVersion
+ eval "${var}=\"${tmp}\""
+}
+
+# Get a package version as selected by a generated choice in kconfig.
+CT_GetChoicePkgBuildVersion()
+{
+ local choice="${1}"
+ local var="${2}"
+ local component
+
+ # Find the selected component
+ eval "component=\${CT_${choice}_CHOICE_KSYM}"
+ CT_GetPkgBuildVersion "${choice}" "${component}" "${var}"
+}
diff --git a/scripts/show-config.sh b/scripts/show-config.sh
new file mode 100644
index 0000000..9e56f07
--- /dev/null
+++ b/scripts/show-config.sh
@@ -0,0 +1,118 @@
+# Parses all samples on the command line, and for each of them, prints
+# the versions of the main tools
+
+# Use tools discovered by ./configure
+. "${CT_LIB_DIR}/paths.sh"
+. "${CT_LIB_DIR}/scripts/functions"
+
+[ "$1" = "-v" ] && opt="$1" && shift
+
+# GREP_OPTIONS screws things up.
+export GREP_OPTIONS=
+
+fieldwidth=15
+
+# Dummy version which is invoked from .config
+CT_Mirrors() { :; }
+
+# Dump a short package description with a name and version in a format
+# " <name>[-<version>]"
+dump_pkgs_desc()
+{
+ local category="${1}"
+ local field="${2}"
+ shift 2
+ local show_version
+ local tmp
+
+ printf " %-*s :" ${fieldwidth} "${field}"
+ while [ -n "${1}" ]; do
+ eval "tmp=\"\${CT_${category}_${1}}\""
+ if [ -n "${tmp}" ]; then
+ CT_GetPkgBuildVersion "${category}" "${1}" show_version
+ printf " %s" "${show_version}"
+ fi
+ shift
+ done
+ printf "\n"
+}
+
+# Dump a short package description with a name and version in a format
+# " <name>[-<version>]"
+dump_choice_desc()
+{
+ local category="${1}"
+ local field="${2}"
+ local show_version
+
+ CT_GetChoicePkgBuildVersion "${category}" show_version
+ printf " %-*s : %s\n" ${fieldwidth} "${field}" "${show_version}"
+}
+
+# Dump a single sample
+# Note: we use the specific .config.sample config file
+dump_single_sample()
+{
+ local verbose=0
+ local complibs
+ [ "$1" = "-v" ] && verbose=1 && shift
+ local sample="$1"
+ . $(pwd)/.config.sample
+
+ case "${sample}" in
+ current)
+ sample_type="l"
+ sample="$( ${CT_NG} show-tuple )"
+ case "${CT_TOOLCHAIN_TYPE}" in
+ canadian)
+ sample="${CT_HOST},${sample}"
+ ;;
+ esac
+ ;;
+ *) if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
+ sample_top="${CT_TOP_DIR}"
+ sample_type="L"
+ else
+ sample_top="${CT_LIB_DIR}"
+ sample_type="G"
+ fi
+ ;;
+ esac
+ printf "[%s" "${sample_type}"
+ [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf "."
+ [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf "."
+ printf "] %s\n" "${sample}"
+ if [ ${verbose} -ne 0 ]; then
+ case "${CT_TOOLCHAIN_TYPE}" in
+ cross) ;;
+ canadian)
+ printf " %-*s : %s\n" ${fieldwidth} "Host" "${CT_HOST}"
+ ;;
+ esac
+ # FIXME get choice/menu names from generated kconfig files as well
+ # FIXME get the list of menu components from generated kconfig files
+ dump_choice_desc KERNEL "OS"
+ dump_pkgs_desc COMP_LIBS "Companion libs" GMP MPFR MPC ISL CLOOG LIBELF EXPAT NCURSES \
+ LIBICONV GETTEXT
+ dump_choice_desc BINUTILS "Binutils"
+ dump_choice_desc CC "Compiler"
+ printf " %-*s : %s" ${fieldwidth} "Languages" "C"
+ [ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++"
+ [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
+ [ "${CT_CC_LANG_JAVA}" = "y" ] && printf ",Java"
+ [ "${CT_CC_LANG_ADA}" = "y" ] && printf ",ADA"
+ [ "${CT_CC_LANG_OBJC}" = "y" ] && printf ",Objective-C"
+ [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ",Objective-C++"
+ [ "${CT_CC_LANG_GOLANG}" = "y" ] && printf ",Go"
+ [ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}"
+ printf "\n"
+
+ dump_choice_desc LIBC "C library"
+ dump_pkgs_desc DEBUG "Debug tools" DUMA GDB LTRACE STRACE
+ dump_pkgs_desc COMP_TOOLS "Companion tools" AUTOCONF AUTOMAKE LIBTOOL M4 MAKE
+ fi
+}
+
+for sample in "${@}"; do
+ dump_single_sample ${opt} "${sample}"
+done
diff --git a/scripts/showConfig.sh.in b/scripts/show-tuple.sh
index 9031b3c..9031b3c 100644
--- a/scripts/showConfig.sh.in
+++ b/scripts/show-tuple.sh
diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh
deleted file mode 100644
index 3ec165e..0000000
--- a/scripts/showSamples.sh
+++ /dev/null
@@ -1,225 +0,0 @@
-# Parses all samples on the command line, and for each of them, prints
-# the versions of the main tools
-
-# Use tools discovered by ./configure
-. "${CT_LIB_DIR}/paths.sh"
-
-[ "$1" = "-v" ] && opt="$1" && shift
-[ "$1" = "-w" ] && opt="$1" && shift
-[ "$1" = "-W" ] && opt="$1" && shift
-
-# GREP_OPTIONS screws things up.
-export GREP_OPTIONS=
-
-# Dummy version which is invoked from .config
-CT_Mirrors() { :; }
-
-# Dump a single sample
-# Note: we use the specific .config.sample config file
-dump_single_sample() {
- local verbose=0
- local wiki=0
- local complibs
- [ "$1" = "-v" ] && verbose=1 && shift
- [ "$1" = "-w" ] && wiki=1 && shift
- local sample="$1"
- . $(pwd)/.config.sample
-
- # libc needs some love
- # TBD after conversion of gen-kconfig to template, use CT_LIBC_USE as a selector for other variables
- # (i.e. whether to use CT_GLIBC_VERSION or CT_MUSL_VERSION)
- local libc_name="${CT_LIBC}"
- local libc_ver ksym
-
- ksym=${libc_name//[^0-9A-Za-z_]/_}
- ksym=${ksym^^}
- case ${ksym} in
- GLIBC|NEWLIB)
- if eval "[ \"\${CT_${ksym}_USE_LINARO}\" = y ]"; then
- ksym="${ksym}_LINARO"
- fi
- ;;
- UCLIBC)
- if [ "${CT_UCLIBC_USE_UCLIBC_NG_ORG}" = y ]; then
- ksym="${ksym}_NG"
- fi
- ;;
- esac
- eval "libc_ver=\"\${CT_${ksym}_VERSION}\""
-
- case "${sample}" in
- current)
- sample_type="l"
- sample="$( ${CT_NG} show-tuple )"
- case "${CT_TOOLCHAIN_TYPE}" in
- canadian)
- sample="${CT_HOST},$sample"
- ;;
- esac
- ;;
- *) if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
- sample_top="${CT_TOP_DIR}"
- sample_type="L"
- else
- sample_top="${CT_LIB_DIR}"
- sample_type="G"
- fi
- ;;
- esac
- if [ ${wiki} -eq 0 ]; then
- width=14
- printf "[%s" "${sample_type}"
- [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf "."
- [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf "."
- printf "] %s\n" "${sample}"
- if [ ${verbose} -ne 0 ]; then
- case "${CT_TOOLCHAIN_TYPE}" in
- cross) ;;
- canadian)
- printf " %-*s : %s\n" ${width} "Host" "${CT_HOST}"
- ;;
- esac
- # TBD currently only Linux is used. General handling for single-select (compiler/binutils/libc/os) and multi-select (debug/companions) components?
- printf " %-*s : %s\n" ${width} "OS" "${CT_KERNEL}${CT_LINUX_VERSION:+-}${CT_LINUX_VERSION}"
- if [ -n "${CT_GMP}" \
- -o -n "${CT_MPFR}" \
- -o -n "${CT_ISL}" \
- -o -n "${CT_CLOOG}" \
- -o -n "${CT_MPC}" \
- -o -n "${CT_LIBELF}" \
- -o -n "${CT_EXPAT}" \
- -o -n "${CT_NCURSES}" \
- -o -n "${CT_GMP_TARGET}" \
- -o -n "${CT_MPFR_TARGET}" \
- -o -n "${CT_ISL_TARGET}" \
- -o -n "${CT_CLOOG_TARGET}" \
- -o -n "${CT_MPC_TARGET}" \
- -o -n "${CT_LIBELF_TARGET}" \
- -o -n "${CT_EXPAT_TARGET}" \
- -o -n "${CT_NCURSES_TARGET}" \
- ]; then
- printf " %-*s :" ${width} "Companion libs"
- complibs=1
- fi
- [ -z "${CT_GMP}" -a -z "${CT_GMP_TARGET}" ] || printf " gmp-%s" "${CT_GMP_VERSION}"
- [ -z "${CT_MPFR}" -a -z "${CT_MPFR_TARGET}" ] || printf " mpfr-%s" "${CT_MPFR_VERSION}"
- [ -z "${CT_ISL}" -a -z "${CT_ISL_TARGET}" ] || printf " isl-%s" "${CT_ISL_VERSION}"
- [ -z "${CT_CLOOG}" -a -z "${CT_CLOOG_TARGET}" ] || printf " cloog-%s" "${CT_CLOOG_VERSION}"
- [ -z "${CT_MPC}" -a -z "${CT_MPC_TARGET}" ] || printf " mpc-%s" "${CT_MPC_VERSION}"
- [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s" "${CT_LIBELF_VERSION}"
- [ -z "${CT_EXPAT}" -a -z "${CT_EXPAT_TARGET}" ] || printf " expat-%s" "${CT_EXPAT_VERSION}"
- [ -z "${CT_NCURSES}" -a -z "${CT_NCURSES_TARGET}" ] || printf " ncurses-%s" "${CT_NCURSES_VERSION}"
- [ -z "${complibs}" ] || printf "\n"
- printf " %-*s : %s\n" ${width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
- printf " %-*s :" ${width} "C compilers"
- cc=$(echo ${CT_CC} | ${awk} '{ print toupper($0)}')
- version=$(eval echo \${CT_${cc}_VERSION})
- compiler=$(echo $cc | ${awk} '{print tolower($0)}')
- printf " $compiler-$version"
- printf "\n"
- printf " %-*s : %s" ${width} "Languages" "C"
- [ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++"
- [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
- [ "${CT_CC_LANG_JAVA}" = "y" ] && printf ",Java"
- [ "${CT_CC_LANG_ADA}" = "y" ] && printf ",ADA"
- [ "${CT_CC_LANG_OBJC}" = "y" ] && printf ",Objective-C"
- [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ",Objective-C++"
- [ "${CT_CC_LANG_GOLANG}" = "y" ] && printf ",Go"
- [ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}"
- printf "\n"
- printf " %-*s : %s (threads: %s)\n" ${width} "C library" "${libc_name}${libc_ver:+-}${libc_ver}" "${CT_THREADS}"
- printf " %-*s :" ${width} "Tools"
- [ "${CT_DEBUG_DUMA}" ] && printf " duma-${CT_DUMA_VERSION}"
- [ "${CT_DEBUG_GDB}" ] && printf " gdb-${CT_GDB_VERSION}"
- [ "${CT_DEBUG_LTRACE}" ] && printf " ltrace-${CT_LTRACE_VERSION}"
- [ "${CT_DEBUG_STRACE}" ] && printf " strace-${CT_STRACE_VERSION}"
- printf "\n"
- fi
- else
- case "${CT_TOOLCHAIN_TYPE}" in
- cross)
- printf "| ''${sample}'' | "
- ;;
- canadian)
- printf "| ''"
- printf "${sample}" |${sed} -r -e 's/.*,//'
- printf "'' | ${CT_HOST} "
- ;;
- *) ;;
- esac
- printf "| "
- [ "${CT_EXPERIMENTAL}" = "y" ] && printf "**X**"
- [ -f "${sample_top}/samples/${sample}/broken" ] && printf "**B**"
- printf " | ''${CT_KERNEL}'' |"
- if [ "${CT_KERNEL}" != "bare-metal" ];then
- if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" = "y" ]; then
- printf " //custom// "
- else
- printf " ${CT_LINUX_VERSION} "
- fi
- fi
- printf "| ${CT_BINUTILS_VERSION} "
- printf "| "
- cc=$(echo ${CT_CC} | ${awk} '{ print toupper($0)}')
- version=$(eval echo \${CT_${cc}_VERSION})
- compiler=$(echo $cc | ${awk} '{print tolower($0)}')
- printf " $compiler | $version"
- printf " "
- printf "| ''${libc_name}'' |"
- if [ "${libc_name}" != "none" ]; then
- printf " ${libc_ver} "
- fi
- printf "| ${CT_THREADS:-none} "
- printf "| ${CT_ARCH_FLOAT} "
- printf "| C"
- [ "${CT_CC_LANG_CXX}" = "y" ] && printf ", C++"
- [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ", Fortran"
- [ "${CT_CC_LANG_JAVA}" = "y" ] && printf ", Java"
- [ "${CT_CC_LANG_ADA}" = "y" ] && printf ", ADA"
- [ "${CT_CC_LANG_OBJC}" = "y" ] && printf ", Objective-C"
- [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ", Objective-C++"
- [ -n "${CT_CC_LANG_OTHERS}" ] && printf "\\\\\\\\ Others: ${CT_CC_LANG_OTHERS}"
- printf " "
- ( . "${sample_top}/samples/${sample}/reported.by"
- if [ -n "${reporter_name}" ]; then
- if [ -n "${reporter_url}" ]; then
- printf "| [[${reporter_url}|${reporter_name}]] "
- else
- printf "| ${reporter_name} "
- fi
- else
- printf "| (//unknown//) "
- fi
- )
- sample_updated="$( git log -n1 --pretty=format:'%ci' "${sample_top}/samples/${sample}" \
- |${awk} '{ print $1; }' )"
- printf "| ${sample_updated} "
- echo "|"
- fi
-}
-
-if [ "${opt}" = "-w" -a ${#} -eq 0 ]; then
- printf "^ %s |||||||||||||||\n" "$( date "+%Y%m%d.%H%M %z" )"
- printf "^ Target "
- printf "^ Host "
- printf "^ Status "
- printf "^ Kernel headers\\\\\\\\ version ^"
- printf "^ binutils\\\\\\\\ version "
- printf "^ C compiler\\\\\\\\ version ^"
- printf "^ C library\\\\\\\\ version ^"
- printf "^ Threading\\\\\\\\ model "
- printf "^ Floating point\\\\\\\\ support "
- printf "^ Languages "
- printf "^ Initially\\\\\\\\ reported by "
- printf "^ Last\\\\\\\\ updated "
- echo "^"
- exit 0
-elif [ "${opt}" = "-W" ]; then
- printf "^ Total: ${#} samples || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is currently BROKEN. |||||||||||||"
- echo ""
- exit 0
-fi
-
-for sample in "${@}"; do
- ( dump_single_sample ${opt} "${sample}" )
-done