mirror of
https://github.com/libretro/libretro-super
synced 2025-04-16 14:42:46 +00:00
Start of logging subsystem
This commit is contained in:
parent
12c13eb55d
commit
910a8010f8
@ -1,5 +1,6 @@
|
|||||||
# vim: set ts=3 sw=3 noet ft=sh : bash
|
# vim: set ts=3 sw=3 noet ft=sh : bash
|
||||||
|
|
||||||
|
. "$BASE_DIR/script-modules/log.sh"
|
||||||
. "$BASE_DIR/script-modules/util.sh"
|
. "$BASE_DIR/script-modules/util.sh"
|
||||||
. "$BASE_DIR/script-modules/fetch-rules.sh"
|
. "$BASE_DIR/script-modules/fetch-rules.sh"
|
||||||
. "$BASE_DIR/script-modules/cpu.sh"
|
. "$BASE_DIR/script-modules/cpu.sh"
|
||||||
@ -58,8 +59,6 @@ build_summary_log() {
|
|||||||
else
|
else
|
||||||
export build_fail="$build_fail$2 "
|
export build_fail="$build_fail$2 "
|
||||||
fi
|
fi
|
||||||
echo "Called with \"$@\""
|
|
||||||
echo "Build success: $build_success"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_core_to_dist() {
|
copy_core_to_dist() {
|
||||||
@ -350,44 +349,40 @@ build_libretro_test() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
build_summary() {
|
summary() {
|
||||||
echo "Build success: $build_success"
|
|
||||||
fmt_output="$(find_tool "fmt" "cat")"
|
fmt_output="$(find_tool "fmt" "cat")"
|
||||||
local num_success="$(echo $build_success | wc -w)"
|
local num_success="$(echo $build_success | wc -w)"
|
||||||
local fmt_success="$(echo " $build_success" | $fmt_output)"
|
local fmt_success="$(echo " $build_success" | $fmt_output)"
|
||||||
local num_fail="$(echo $build_fail | wc -w)"
|
local num_fail="$(echo $build_fail | wc -w)"
|
||||||
local fmt_fail="$(echo " $build_fail" | $fmt_output)"
|
local fmt_fail="$(echo " $build_fail" | $fmt_output)"
|
||||||
|
|
||||||
|
for output in "" ${LIBRETRO_LOG_SUPER:+$super_log}; do
|
||||||
|
if [ -n "$output" ]; then
|
||||||
|
exec 6>&1
|
||||||
|
exec > $output
|
||||||
|
use_color=""
|
||||||
|
fi
|
||||||
|
{
|
||||||
echo ""
|
echo ""
|
||||||
if [[ -z "$build_success" && -z "$build_fail" ]]; then
|
if [[ -z "$build_success" && -z "$build_fail" ]]; then
|
||||||
echo "No build actions performed."
|
echo "No build actions performed."
|
||||||
return
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$build_success" ]; then
|
if [ -n "$build_success" ]; then
|
||||||
echo "$(color 32)$num_success core(s)$(color) successfully built:"
|
echo "$(color 32)$num_success core(s)$(color) successfully processed:"
|
||||||
echo "$fmt_success"
|
echo "$fmt_success"
|
||||||
fi
|
fi
|
||||||
if [ -n "$build_fail" ]; then
|
if [ -n "$build_fail" ]; then
|
||||||
echo "$(color 31)$num_fail core(s)$(color) failed to build:"
|
echo "$(color 31)$num_fail core(s)$(color) failed:"
|
||||||
echo "$fmt_fail"
|
echo "$fmt_fail"
|
||||||
fi
|
fi
|
||||||
if [ -n "$LIBRETRO_LOGDIR" ]; then
|
}
|
||||||
{
|
if [ -n "$output" ]; then
|
||||||
if [ -n "$build_success" ]; then
|
exec 1>&6 6>&-
|
||||||
echo "$num_success core(s) successfully built:"
|
use_color="$want_color"
|
||||||
echo "$fmt_success"
|
|
||||||
fi
|
fi
|
||||||
if [ -n "$build_fail" ]; then
|
done
|
||||||
echo "$num_fail core(s) failed to build:"
|
|
||||||
echo "$fmt_fail"
|
|
||||||
fi
|
|
||||||
} > $LIBRETRO_LOGDIR/build_summary.log 2>&1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
summary() {
|
|
||||||
build_summary
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_dist_dir() {
|
create_dist_dir() {
|
||||||
|
@ -268,12 +268,36 @@ if [[ "$FORMAT_COMPILER_TARGET" = "osx" && -z "$NOUNIVERSAL" ]]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#LOGGING
|
# OUTPUT AND LOGGING
|
||||||
#=======
|
# ==================
|
||||||
|
#
|
||||||
|
# libretro-super has two kinds of output, the basic kind showing what the
|
||||||
|
# script is doing in a big-picture sense, and the commands and output from
|
||||||
|
# individual commands. End-users don't necessarily need to see this more
|
||||||
|
# detailed output, except when we're talking about huge cores like mame.
|
||||||
|
#
|
||||||
|
# If each can be directed to null, to the screen, to a log file, or to both
|
||||||
|
# the screen and a log file, you end up with the following truth table, along
|
||||||
|
# with my assessment of the usefulness of each combination:
|
||||||
|
#
|
||||||
|
# Basic Detailed Usefulness
|
||||||
|
# screen screen developer
|
||||||
|
# screen both developer
|
||||||
|
# both both developer
|
||||||
|
# screen log end-user
|
||||||
|
# log log buildbot
|
||||||
|
|
||||||
# Uncomment this to enable per-core logging
|
# Uncomment this to avoid clobbering logs
|
||||||
#LIBRETRO_LOGDIR=$WORKDIR/log
|
#LIBRETRO_LOG_APPEND=1
|
||||||
|
|
||||||
|
# Change this to adjust where logs are written
|
||||||
|
#LIBRETRO_LOG_DIR="$WORKDIR/log"
|
||||||
|
|
||||||
|
# Change this to rename the libretro-super main log file
|
||||||
|
#LIBRETRO_LOG_SUPER="libretro-super.txt"
|
||||||
|
|
||||||
|
# Change this to rename core log files (%s for core's "safe" name)
|
||||||
|
#LIBRETRO_LOG_CORE="%s.txt"
|
||||||
|
|
||||||
# BUILD_REVISIONS
|
# BUILD_REVISIONS
|
||||||
# ===============
|
# ===============
|
||||||
|
@ -15,6 +15,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
. "$BASE_DIR/libretro-config.sh"
|
. "$BASE_DIR/libretro-config.sh"
|
||||||
|
. "$BASE_DIR/script-modules/log.sh"
|
||||||
. "$BASE_DIR/script-modules/util.sh"
|
. "$BASE_DIR/script-modules/util.sh"
|
||||||
. "$BASE_DIR/script-modules/fetch-rules.sh"
|
. "$BASE_DIR/script-modules/fetch-rules.sh"
|
||||||
. "$BASE_DIR/script-modules/modules.sh"
|
. "$BASE_DIR/script-modules/modules.sh"
|
||||||
|
28
script-modules/log.sh
Normal file
28
script-modules/log.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# vim: set ts=3 sw=3 noet ft=sh : bash
|
||||||
|
|
||||||
|
color() {
|
||||||
|
[ -n "$use_color" ] && echo -n "[0;${1:-0}m"
|
||||||
|
}
|
||||||
|
|
||||||
|
lecho() {
|
||||||
|
if [ -n "$LIBRETRO_LOG_SUPER" ]; then
|
||||||
|
echo "$@" >> $super_log
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LIBRETRO_LOG_DIR="${LIBRETRO_LOG_DIR:-$WORKDIR/log}"
|
||||||
|
LIBRETRO_LOG_SUPER="${LIBRETRO_LOG_SUPER:-libretro-super.txt}"
|
||||||
|
LIBRETRO_LOG_CORE="${LIBRETRO_LOG_CORE:-%s.txt}"
|
||||||
|
mkdir -p "$LIBRETRO_LOG_DIR"
|
||||||
|
if [ -n "$LIBRETRO_LOG_SUPER" ]; then
|
||||||
|
super_log="$LIBRETRO_LOG_DIR/$LIBRETRO_LOG_SUPER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -t 1 || -n $FORCE_COLOR ]]; then
|
||||||
|
want_color=1
|
||||||
|
use_color=1
|
||||||
|
else
|
||||||
|
want_color=""
|
||||||
|
use_color=""
|
||||||
|
fi
|
@ -15,16 +15,3 @@ find_tool() {
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
color() {
|
|
||||||
[ -n "$NO_COLOR" ] && return
|
|
||||||
|
|
||||||
echo -n "[0;${1:-0}m"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -t 1 ]; then
|
|
||||||
if [ -z "$FORCE_COLOR" ]; then
|
|
||||||
NO_COLOR=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user