scripts/showSamples.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Oct 23 13:45:48 2008 +0000 (2008-10-23)
changeset 965 45ddf096def1
parent 851 6add2c0b63cd
child 999 0056905eea2b
permissions -rwxr-xr-x
Push the calculation of the tuple's kernel part down to kernel's build scripts:
- update the kernel script's API with the function CT_DiKernelTupleValues
- update doc accordingly (also with the architecture change, missing in the previous commit)
- small clean-up in the main script, remove useless test

/trunk/scripts/build/kernel/bare-metal.sh | 5 5 0 0 +++++
/trunk/scripts/build/kernel/linux.sh | 5 5 0 0 +++++
/trunk/scripts/crosstool.sh | 31 13 18 0 +++++++++++++------------------
/trunk/scripts/functions | 15 8 7 0 ++++++++-------
/trunk/docs/overview.txt | 13 9 4 0 +++++++++----
5 files changed, 40 insertions(+), 29 deletions(-)
     1 #!/bin/bash
     2 
     3 # Parses all samples on the command line, and for each of them, prints
     4 # the versions of the main tools
     5 
     6 [ "$1" = "-v" ] && opt="$1" && shift
     7 [ "$1" = "-w" ] && opt="$1" && shift
     8 
     9 # GREP_OPTIONS screws things up.
    10 export GREP_OPTIONS=
    11 
    12 # Dump a single sample
    13 dump_single_sample() {
    14     local verbose=0
    15     [ "$1" = "-v" ] && verbose=1 && shift
    16     [ "$1" = "-w" ] && wiki=1 && shift
    17     local width="$1"
    18     local sample="$2"
    19     if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
    20         sample_top="${CT_TOP_DIR}"
    21         sample_type="l"
    22     else
    23         sample_top="${CT_LIB_DIR}"
    24         sample_type="g"
    25     fi
    26     . "${sample_top}/samples/${sample}/crosstool.config"
    27     if [ -z "${wiki}" ]; then
    28         printf "  %-*s  [%s" ${width} "${sample}" "${sample_type}"
    29         [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf " "
    30         [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf " "
    31         echo "]"
    32         if [ ${verbose} -ne 0 ]; then
    33             echo    "    OS        : ${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
    34             if [ "${CT_GMP_MPFR}" = "y" ]; then
    35                 echo    "    GMP/MPFR  : gmp-${CT_GMP_VERSION} / mpfr-${CT_MPFR_VERSION}"
    36             fi
    37             echo    "    binutils  : binutils-${CT_BINUTILS_VERSION}"
    38             printf  "    C compiler: ${CT_CC}-${CT_CC_VERSION} (C"
    39             [ "${CT_CC_LANG_CXX}" = "y"     ] && printf ",C++"
    40             [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
    41             [ "${CT_CC_LANG_JAVA}" = "y"    ] && printf ",Java"
    42             [ "${CT_CC_LANG_ADA}" = "y"     ] && printf ",ADA"
    43             [ "${CT_CC_LANG_OBJC}" = "y"    ] && printf ",Objective-C"
    44             [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ",Objective-C++"
    45             [ -n "${CT_CC_LANG_OTHERS}"     ] && printf ",${CT_CC_LANG_OTHERS}"
    46             echo    ")"
    47             echo    "    C library : ${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}"
    48             printf  "    Tools     :"
    49             [ "${CT_LIBELF}"  ] && printf " libelf-${CT_LIBELF_VERSION}"
    50             [ "${CT_SSTRIP}"  ] && printf " sstrip"
    51             [ "${CT_DMALLOC}" ] && printf " dmalloc-${CT_DMALLOC_VERSION}"
    52             [ "${CT_DUMA}"    ] && printf " duma-${CT_DUMA_VERSION}"
    53             [ "${CT_GDB}"     ] && printf " gdb-${CT_GDB_VERSION}"
    54             [ "${CT_LTRACE}"  ] && printf " ltrace-${CT_LTRACE_VERSION}"
    55             [ "${CT_STRACE}"  ] && printf " strace-${CT_STRACE_VERSION}"
    56             echo
    57         fi
    58     else
    59         printf "| ''${sample}''  "
    60         printf "|  "
    61         [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X"
    62         [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B"
    63         printf '  '
    64         printf "|  ''${CT_KERNEL}''  "
    65         if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" = "y" ]; then
    66             printf "|  //custom//  "
    67         else
    68             printf "|  ${CT_KERNEL_VERSION}  "
    69         fi
    70         printf "|  ${CT_BINUTILS_VERSION}  "
    71         printf "|  ''${CT_CC}''  "
    72         printf "|  ${CT_CC_VERSION}  "
    73         printf "|  ''${CT_LIBC}''  "
    74         printf "|  ${CT_LIBC_VERSION}  "
    75         printf "|  ${CT_THREADS_NPTL:+NPTL}${CT_THREADS_LINUXTHREADS:+linuxthreads}${CT_THREADS_NONE:+none}  "
    76         printf "|  ${CT_ARCH_FLOAT_HW:+hard}${CT_ARCH_FLOAT_SW:+soft} float  "
    77         printf "|  C"
    78         [ "${CT_CC_LANG_CXX}" = "y"     ] && printf ", C++"
    79         [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ", Fortran"
    80         [ "${CT_CC_LANG_JAVA}" = "y"    ] && printf ", Java"
    81         [ "${CT_CC_LANG_ADA}" = "y"     ] && printf ", ADA"
    82         [ "${CT_CC_LANG_OBJC}" = "y"    ] && printf ", Objective-C"
    83         [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ", Objective-C++"
    84         [ -n "${CT_CC_LANG_OTHERS}"     ] && printf "\\\\\\\\ Others: ${CT_CC_LANG_OTHERS}"
    85         printf "  "
    86         ( . "${sample_top}/samples/${sample}/reported.by"
    87           if [ -n "${reporter_name}" ]; then
    88               if [ -n "${reporter_url}" ]; then
    89                   printf "|  [[${reporter_url}|${reporter_name}]]  "
    90               else
    91                   printf "|  ${reporter_name}  "
    92               fi
    93           else
    94               printf "|  [[http://ymorin.is-a-geek.org/|YEM]]  "
    95           fi
    96         )
    97         sample_updated=$(date -u "+%Y%m%d"                                                  \
    98                               -d "$(LC_ALL=C svn info ${sample_top}/samples/${sample}       \
    99                                     |GREP_OPTIONS= egrep '^Last Changed Date:'              \
   100                                     |sed -r -e 's/^[^:]+: //;'                              \
   101                                             -e 's/^(.+:.. [+-][[:digit:]]{4}) \(.+\)$/\1/;' \
   102                                    )"                                                       \
   103                         )
   104         printf "|  ${sample_updated}  "
   105         echo "|"
   106     fi
   107 }
   108 
   109 # Get largest sample width
   110 width=0
   111 for sample in "${@}"; do
   112     [ ${#sample} -gt ${width} ] && width=${#sample}
   113 done
   114 
   115 if [ "${opt}" = -w ]; then
   116     echo "^ @@DATE@@  ^ |||||||||||||"
   117     printf "^ Target "
   118     printf "^  Status  "
   119     printf "^  Kernel headers\\\\\\\\ version  ^"
   120     printf "^  binutils\\\\\\\\ version  "
   121     printf "^  C compiler\\\\\\\\ version  ^"
   122     printf "^  C library\\\\\\\\ version  ^"
   123     printf "^  Threading\\\\\\\\ model  "
   124     printf "^  Floating point\\\\\\\\ support  "
   125     printf "^  Languages  "
   126     printf "^  Initially\\\\\\\\ reported by  "
   127     printf "^  Last\\\\\\\\ updated  "
   128     echo   "^"
   129 fi
   130 
   131 for sample in "${@}"; do
   132     ( dump_single_sample ${opt} ${width} "${sample}" )
   133 done
   134 
   135 if [ "${opt}" = -w ]; then
   136     printf "^ Total: ${#@} samples  | ''X'': sample uses features marked as being EXPERIMENTAL.\\\\\\\\ ''B'': sample is curently BROKEN. |||||||||||||"
   137     echo   ""
   138 elif [ -z "${opt}" ]; then
   139     echo '      l (local)       : sample was found in current directory'
   140     echo '      g (global)      : sample was installed with crosstool-NG'
   141     echo '      X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
   142     echo '      B (BORKEN)      : sample is currently broken'
   143 fi