Fix libretro-build.sh to work with recent changes

This commit is contained in:
T. Joseph Carter 2015-04-05 22:55:22 -07:00
parent fa4e6dc099
commit e40e427f86

View File

@ -243,9 +243,9 @@ build_makefile() {
libretro_build_core() {
local opengl_type
if [ -n "${LIBRETRO_LOG_CORE}" ]; then
printf -v log_core "$LIBRETRO_LOG_DIR/$LIBRETRO_LOG_CORE" "$1"
[ -z "$LIBRETRO_LOG_APPEND" ] && : > $log_core
if [ -n "${LIBRETRO_LOG_MODULE}" ]; then
printf -v log_module "$LIBRETRO_LOG_DIR/$LIBRETRO_LOG_MODULE" "$1"
[ -z "$LIBRETRO_LOG_APPEND" ] && : > $log_module
fi
eval "core_name=\${libretro_${1}_name:-$1}"
@ -278,27 +278,26 @@ libretro_build_core() {
echo "Building ${1}..."
lecho "Building ${1}..."
if [ -n "$log_core" ]; then
if [ -n "$log_module" ]; then
exec 6>&1
echo "Building ${1}..." >> $log_core
echo "Building ${1}..." >> $log_module
# TODO: Possibly a shell function for tee?
if [[ -n "$LIBRETRO_DEVELOPER" && -n "${cmd_tee:=$(find_tool "tee")}" ]]; then
exec > >($cmd_tee -a $log_core)
exec > >($cmd_tee -a $log_module)
else
exec > $log_core
exec > $log_module
fi
fi
case "$core_build_rule" in
generic_makefile)
for a in configure preclean prebuild prepkg; do
if [ "$(type -t libretro_${1}_build_$a 2> /dev/null)" = "function" ]; then
eval "core_build_$a=libretro_${1}_build_$a"
else
eval "core_build_$a="
fi
done
# As of right now, only configure is used for now...
if [ "$(type -t libretro_${1}_configure 2> /dev/null)" = "function" ]; then
eval "core_configure=libretro_${1}_configure"
else
eval "core_configure=do_nothing"
fi
eval "core_build_makefile=\$libretro_${1}_build_makefile"
eval "core_build_subdir=\$libretro_${1}_build_subdir"
eval "core_build_args=\$libretro_${1}_build_args"
@ -327,7 +326,7 @@ libretro_build_core() {
exit 1
;;
esac
if [ -n "$log_core" ]; then
if [ -n "$log_module" ]; then
exec 1>&6 6>&-
fi
}
@ -365,33 +364,21 @@ summary() {
local num_fail="$(numwords $build_fail)"
local fmt_fail="${fmt_output:+$(echo " $build_fail" | $fmt_output)}"
for output in "" ${LIBRETRO_LOG_SUPER:+$log_super}; do
if [ -n "$output" ]; then
exec 6>&1
exec >> $output
use_color=""
fi
{
echo ""
if [[ -z "$build_success" && -z "$build_fail" ]]; then
echo "No build actions performed."
continue
fi
if [[ -z "$build_success" && -z "$build_fail" ]]; then
lsecho "No build actions performed."
return
fi
if [ -n "$build_success" ]; then
echo "$(color 32)$num_success core(s)$(color) successfully processed:"
echo "$fmt_success"
fi
if [ -n "$build_fail" ]; then
echo "$(color 31)$num_fail core(s)$(color) failed:"
echo "$fmt_fail"
fi
}
if [ -n "$output" ]; then
exec 1>&6 6>&-
use_color="$want_color"
fi
done
if [ -n "$build_success" ]; then
secho "$(color 32)$num_success core(s)$(color) successfully processed:"
lecho "$num_success core(s) successfully processed:"
lsecho "$fmt_success"
fi
if [ -n "$build_fail" ]; then
secho "$(color 31)$num_fail core(s)$(color) failed:"
lecho "$num_fail core(s) failed:"
lsecho "$fmt_fail"
fi
}
create_dist_dir() {
@ -445,7 +432,6 @@ build_libretro_mame_prerule() {
[ "$MAME_GIT_TINY" -eq 1 ] && mame_targets="mame mess"
for target in $mame_targets; do
echo_cmd "$MAKE -f Makefile.libretro $extra_args platform=\"$FORMAT_COMPILER_TARGET\" \"-j$JOBS\" clean-osd" || die 'Failed to clean MAME OSD'
echo_cmd "$MAKE -f Makefile.libretro $extra_args \"TARGET=$target\" platform=\"$FORMAT_COMPILER_TARGET\" $MAME_COMPILER \"-j$JOBS\"" || die "Failed to build $target"
copy_core_to_dist "$target"
ret=$?