From 4955cee0ccdb3ba1a121439666a5091ded28e260 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Tue, 17 Feb 2015 12:03:38 -0800 Subject: [PATCH] Make my build summary work without using files (we lose pretty formatting for now) --- libretro-build-common.sh | 37 ++++++++++++++++++------------------- libretro-config.sh | 15 +++------------ 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/libretro-build-common.sh b/libretro-build-common.sh index 4c705048..d9b938a8 100755 --- a/libretro-build-common.sh +++ b/libretro-build-common.sh @@ -37,12 +37,10 @@ RESET_FORMAT_COMPILER_TARGET=$FORMAT_COMPILER_TARGET RESET_FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET_ALT build_summary_log() { - if [ -n "${BUILD_SUMMARY}" ]; then - if [ "${1}" -eq "0" ]; then - echo ${2} >> ${BUILD_SUCCESS} - else - echo ${2} >> ${BUILD_FAIL} - fi + if [ "$1" -eq "0" ]; then + printf -v build_success "%s%s\n" "$build_success" "$2" + else + printf -v build_fail "%s%s\n" "$build_fail" "$2" fi } @@ -641,23 +639,24 @@ build_libretro_mupen64() { } build_summary() { - if [ -z "${NOBUILD_SUMMARY}" ]; then - echo "=== Core Build Summary ===" > ${BUILD_SUMMARY} - if [ -r "${BUILD_SUCCESS}" ]; then - echo "`wc -l < ${BUILD_SUCCESS}` core(s) successfully built:" >> ${BUILD_SUMMARY} - ${BUILD_SUMMARY_FMT} ${BUILD_SUCCESS} >> ${BUILD_SUMMARY} + if [ -z "$NOBUILD_SUMMARY" ]; then + printf -v summary "=== Core Build Summary ===\n\n" + if [ -n "$build_success" ]; then + printf -v summary "%s%s\n" "$summary" "$(echo $build_success | wc -w) core(s) successfully built:" + printf -v summary "%s%s\n\n" "$summary" "$(echo $build_success)" else - echo " 0 cores successfully built. :(" >> ${BUILD_SUMMARY} - echo "`wc -l < ${BUILD_FAIL}` core(s) failed to build:" + printf -v summary "%s%s\n\n" "$summary" " 0 cores successfully built. :(" fi - if [ -r "${BUILD_FAIL}" ]; then - echo "`wc -l < ${BUILD_FAIL}` core(s) failed to build:" >> ${BUILD_SUMMARY} - ${BUILD_SUMMARY_FMT} ${BUILD_FAIL} >> ${BUILD_SUMMARY} + if [ -n "$build_fail" ]; then + printf -v summary "%s%s\n" "$summary" "$(echo $build_fail | wc -w) core(s) failed to build:" + printf -v summary "%s%s\n\n" "$summary" "$(echo $build_fail)" else - echo " 0 cores failed to build! :D" >> ${BUILD_SUMMARY} + printf -v summary "%s%s\n\n" "$summary" " 0 cores failed to build! :D" fi - rm -f $BUILD_SUCCESS $BUILD_FAIL - cat ${BUILD_SUMMARY} + if [ -n "$BUILD_SUMMARY" ]; then + echo "$summary" > "$BUILD_SUMMARY" + fi + echo "$summary" fi } diff --git a/libretro-config.sh b/libretro-config.sh index bdb59c4a..b8e10747 100755 --- a/libretro-config.sh +++ b/libretro-config.sh @@ -194,19 +194,10 @@ fi #CORE BUILD SUMMARY #================== -# Remove this to enable the core build summary -export BUILD_SUMMARY=1 +# Uncomment this to disable the core build summary +# NOBUILD_SUMMARY=1 -BUILD_SUMMARY=${WORKDIR}/build-summary.log -BUILD_SUCCESS=${WORKDIR}/build-success.log -BUILD_FAIL=${WORKDIR}/build-fail.log -if [ -z "${BUILD_SUMMARY_FMT}" ]; then - if command -v column >/dev/null; then - BUILD_SUMMARY_FMT=column - else - BUILD_SUMMARY_FMT=cat - fi -fi +BUILD_SUMMARY="$WORKDIR/build-summary.log" #USER DEFINES