2015-02-17 03:19:30 +00:00
|
|
|
# vim: set ts=3 sw=3 noet ft=sh : bash
|
2013-04-30 02:45:55 +00:00
|
|
|
|
2015-03-27 23:45:38 +00:00
|
|
|
. "$BASE_DIR/script-modules/log.sh"
|
2015-02-26 08:14:05 +00:00
|
|
|
. "$BASE_DIR/script-modules/util.sh"
|
|
|
|
. "$BASE_DIR/script-modules/fetch-rules.sh"
|
|
|
|
. "$BASE_DIR/script-modules/cpu.sh"
|
2015-03-10 09:46:30 +00:00
|
|
|
. "$BASE_DIR/script-modules/modules.sh"
|
2015-02-19 06:31:02 +00:00
|
|
|
|
2015-03-01 11:42:45 +00:00
|
|
|
. "$BASE_DIR/rules.d/core-rules.sh"
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2013-10-09 00:52:48 +00:00
|
|
|
die() {
|
2015-02-17 03:19:30 +00:00
|
|
|
echo $1
|
|
|
|
#exit 1
|
2013-04-30 02:45:55 +00:00
|
|
|
}
|
|
|
|
|
2015-02-10 21:13:41 +00:00
|
|
|
#
|
2015-02-23 07:13:08 +00:00
|
|
|
# Regarding COMPILER... It didn't used to be safe. Now it is, provided that
|
|
|
|
# you are using it in a command line passed to echo_cmd without additional
|
|
|
|
# quoting, like so:
|
2015-02-10 21:13:41 +00:00
|
|
|
#
|
2015-02-23 07:13:08 +00:00
|
|
|
# echo_cmd "$MAKE TARGET=\"libretro\" $COMPILER OTHERVAR=\"$SOMETHING\""
|
2015-02-10 21:13:41 +00:00
|
|
|
#
|
2013-10-09 00:52:48 +00:00
|
|
|
if [ "${CC}" ] && [ "${CXX}" ]; then
|
2015-02-17 03:19:30 +00:00
|
|
|
COMPILER="CC=\"${CC}\" CXX=\"${CXX}\""
|
2013-05-19 10:03:25 +00:00
|
|
|
else
|
2015-02-17 03:19:30 +00:00
|
|
|
COMPILER=""
|
2013-05-19 10:03:25 +00:00
|
|
|
fi
|
|
|
|
|
2015-02-14 02:41:38 +00:00
|
|
|
echo "Compiler: CC=\"$CC\" CXX=\"$CXX\""
|
2013-05-19 10:03:25 +00:00
|
|
|
|
2015-02-18 06:32:27 +00:00
|
|
|
[[ "${ARM_NEON}" ]] && echo '=== ARM NEON opts enabled... ===' && export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-neon"
|
|
|
|
[[ "${CORTEX_A8}" ]] && echo '=== Cortex A8 opts enabled... ===' && export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-cortexa8"
|
|
|
|
[[ "${CORTEX_A9}" ]] && echo '=== Cortex A9 opts enabled... ===' && export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-cortexa9"
|
|
|
|
[[ "${ARM_HARDFLOAT}" ]] && echo '=== ARM hardfloat ABI enabled... ===' && export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-hardfloat"
|
|
|
|
[[ "${ARM_SOFTFLOAT}" ]] && echo '=== ARM softfloat ABI enabled... ===' && export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-softfloat"
|
|
|
|
[[ "$X86" ]] && echo '=== x86 CPU detected... ==='
|
|
|
|
[[ "$X86" ]] && [[ "$X86_64" ]] && echo '=== x86_64 CPU detected... ==='
|
2014-07-13 23:54:37 +00:00
|
|
|
[[ "${IOS}" ]] && echo '=== iOS =='
|
2013-08-12 02:47:00 +00:00
|
|
|
|
2015-02-18 06:32:27 +00:00
|
|
|
echo "$FORMAT_COMPILER_TARGET"
|
|
|
|
echo "$FORMAT_COMPILER_TARGET_ALT"
|
2014-10-05 11:09:13 +00:00
|
|
|
RESET_FORMAT_COMPILER_TARGET=$FORMAT_COMPILER_TARGET
|
|
|
|
RESET_FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET_ALT
|
2013-07-13 15:32:29 +00:00
|
|
|
|
2015-03-26 03:09:06 +00:00
|
|
|
# FIXME: We should use the theos toolchain without their make system which is
|
|
|
|
# buggy on Linux and doesn't do what we want anyway. It'd remove need
|
|
|
|
# for this and other hacks.
|
2015-03-10 14:46:19 +00:00
|
|
|
CORE_PREFIX=""
|
2015-02-22 11:39:13 +00:00
|
|
|
CORE_SUFFIX="_libretro${FORMAT}.$FORMAT_EXT"
|
2015-03-10 14:46:19 +00:00
|
|
|
if [ "$platform" = "theos_ios" ]; then
|
|
|
|
CORE_PREFIX="objs/obj/"
|
|
|
|
fi
|
2015-02-22 08:37:20 +00:00
|
|
|
|
|
|
|
|
2015-01-31 03:01:14 +00:00
|
|
|
build_summary_log() {
|
2015-02-23 06:28:29 +00:00
|
|
|
# Trailing spaces are intentional here
|
2015-02-17 20:03:38 +00:00
|
|
|
if [ "$1" -eq "0" ]; then
|
2015-03-26 17:50:29 +00:00
|
|
|
export build_success="$build_success$2 "
|
2015-02-17 20:03:38 +00:00
|
|
|
else
|
2015-03-26 17:50:29 +00:00
|
|
|
export build_fail="$build_fail$2 "
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
2015-01-31 03:01:14 +00:00
|
|
|
}
|
|
|
|
|
2015-03-10 18:21:54 +00:00
|
|
|
copy_core_to_dist() {
|
|
|
|
[ -z "$1" ] && return 1
|
|
|
|
dest="${2:-$1}"
|
|
|
|
echo_cmd "cp \"$CORE_PREFIX$1$CORE_SUFFIX\" \"$RARCH_DIST_DIR/$dest$CORE_SUFFIX\""
|
|
|
|
|
|
|
|
ret=$?
|
|
|
|
build_summary_log $ret "$dest"
|
|
|
|
return $ret
|
|
|
|
}
|
|
|
|
|
2015-02-19 06:31:02 +00:00
|
|
|
build_should_skip() {
|
|
|
|
[ -z "$SKIP_UNCHANGED" ] && return 1
|
2015-02-19 06:45:23 +00:00
|
|
|
|
|
|
|
[ -z "$BUILD_REVISIONS_DIR" ] && BUILD_REVISIONS_DIR="$WORKDIR/build-revisions"
|
|
|
|
build_revision_file="$BUILD_REVISIONS_DIR/$1"
|
|
|
|
|
2015-02-19 06:31:02 +00:00
|
|
|
[ ! -r "$build_revision_file" ] && return 1
|
|
|
|
|
|
|
|
read previous_revision < "$build_revision_file"
|
|
|
|
[ "$previous_revision" != "$(fetch_revision $2)" ] && return 1
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
build_save_revision() {
|
|
|
|
[ -z "$SKIP_UNCHANGED" ] && return
|
|
|
|
[ "$1" != "0" ] && return
|
2015-02-20 22:43:28 +00:00
|
|
|
echo $(fetch_revision) > "$BUILD_REVISIONS_DIR/$2"
|
2015-02-19 06:31:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-05 10:28:08 +00:00
|
|
|
check_opengl() {
|
2015-02-26 03:38:52 +00:00
|
|
|
if [ "$BUILD_LIBRETRO_GL" ]; then
|
|
|
|
if [ "$ENABLE_GLES" ]; then
|
2015-02-17 03:19:30 +00:00
|
|
|
echo '=== OpenGL ES enabled ==='
|
2015-02-18 06:32:27 +00:00
|
|
|
export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-gles"
|
|
|
|
export FORMAT_COMPILER_TARGET_ALT="$FORMAT_COMPILER_TARGET"
|
2015-02-17 03:19:30 +00:00
|
|
|
else
|
|
|
|
echo '=== OpenGL enabled ==='
|
2015-02-18 06:32:27 +00:00
|
|
|
export FORMAT_COMPILER_TARGET="$FORMAT_COMPILER_TARGET-opengl"
|
|
|
|
export FORMAT_COMPILER_TARGET_ALT="$FORMAT_COMPILER_TARGET"
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo '=== OpenGL disabled in build ==='
|
2015-02-26 03:38:52 +00:00
|
|
|
return 1
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
2015-02-26 03:38:52 +00:00
|
|
|
|
|
|
|
return 0
|
2014-10-05 10:28:08 +00:00
|
|
|
}
|
2013-07-13 22:10:43 +00:00
|
|
|
|
2014-10-05 11:09:13 +00:00
|
|
|
reset_compiler_targets() {
|
2015-02-17 03:19:30 +00:00
|
|
|
export FORMAT_COMPILER_TARGET=$RESET_FORMAT_COMPILER_TARGET
|
|
|
|
export FORMAT_COMPILER_TARGET_ALT=$RESET_FORMAT_COMPILER_TARGET_ALT
|
2014-10-05 11:09:13 +00:00
|
|
|
}
|
|
|
|
|
2015-02-06 12:00:22 +00:00
|
|
|
# $1 is corename
|
|
|
|
# $2 is subcorename
|
|
|
|
# $3 is subdir. In case there is no subdir, enter "." here
|
|
|
|
# $4 is Makefile name
|
|
|
|
# $5 is preferred platform
|
|
|
|
build_libretro_generic_makefile_subcore() {
|
2015-02-18 06:32:27 +00:00
|
|
|
build_dir="$WORKDIR/libretro-$1"
|
|
|
|
if [ -d "$build_dir" ]; then
|
|
|
|
echo "=== Building $2 ==="
|
2015-02-23 04:29:29 +00:00
|
|
|
echo_cmd "cd \"$build_dir/$3\""
|
2015-02-17 03:19:30 +00:00
|
|
|
|
2015-02-18 06:32:27 +00:00
|
|
|
if [ -z "$NOCLEAN" ]; then
|
2015-02-23 06:28:29 +00:00
|
|
|
echo_cmd "$MAKE -f \"$4\" platform=$5 -j$JOBS clean" || die "Failed to clean $2"
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
2015-02-23 06:28:29 +00:00
|
|
|
echo_cmd "$MAKE -f $4 platform=$5 -j$JOBS" || die "Failed to build $2"
|
2015-03-10 18:21:54 +00:00
|
|
|
copy_core_to_dist "$2"
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
2015-02-06 12:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_libretro_fba_cps2() {
|
2015-02-18 06:32:27 +00:00
|
|
|
build_libretro_generic_makefile_subcore "fb_alpha" "fba_cores_cps2" "svn-current/trunk/fbacores/cps2" "makefile.libretro" $FORMAT_COMPILER_TARGET
|
2015-02-06 12:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_libretro_fba_neogeo() {
|
2015-02-18 06:32:27 +00:00
|
|
|
build_libretro_generic_makefile_subcore "fb_alpha" "fba_cores_neo" "svn-current/trunk/fbacores/neogeo" "makefile.libretro" $FORMAT_COMPILER_TARGET
|
2015-02-06 12:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_libretro_fba_cps1() {
|
2015-02-18 06:32:27 +00:00
|
|
|
build_libretro_generic_makefile_subcore "fb_alpha" "fba_cores_cps1" "svn-current/trunk/fbacores/cps1" "makefile.libretro" $FORMAT_COMPILER_TARGET
|
2015-02-06 12:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-13 03:13:25 +00:00
|
|
|
build_libretro_generic() {
|
2015-02-23 04:29:29 +00:00
|
|
|
echo_cmd "cd \"$5/$2\""
|
2015-02-06 12:00:22 +00:00
|
|
|
|
2015-02-18 06:32:27 +00:00
|
|
|
if [ -z "$NOCLEAN" ]; then
|
2015-02-23 06:28:29 +00:00
|
|
|
echo_cmd "$MAKE -f \"$3\" platform=\"$4\" \"-j$JOBS\" clean" || die "Failed to clean $1"
|
2015-02-21 12:22:45 +00:00
|
|
|
fi
|
2015-02-23 07:13:08 +00:00
|
|
|
echo_cmd "$MAKE -f \"$3\" platform=\"$4\" $COMPILER \"-j$JOBS\"" || die "Failed to build $1"
|
2015-02-06 12:00:22 +00:00
|
|
|
}
|
|
|
|
|
2015-02-18 17:57:48 +00:00
|
|
|
# build_libretro_generic_makefile
|
|
|
|
#
|
2015-02-19 06:31:02 +00:00
|
|
|
# $1 Name of the core
|
2015-02-18 17:57:48 +00:00
|
|
|
# $2 Subdirectory of makefile (use "." for none)
|
|
|
|
# $3 Name of makefile
|
|
|
|
# $4 Either FORMAT_COMPILER_TARGET or an alternative
|
|
|
|
# $5 Skip copying (for cores that don't produce exactly one core)
|
2015-02-13 03:13:25 +00:00
|
|
|
build_libretro_generic_makefile() {
|
2015-02-18 06:32:27 +00:00
|
|
|
build_dir="$WORKDIR/libretro-$1"
|
2015-02-19 06:31:02 +00:00
|
|
|
|
|
|
|
if build_should_skip $1 "$build_dir"; then
|
|
|
|
echo "Core $1 is already built, skipping..."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2015-02-17 03:19:30 +00:00
|
|
|
if [ -d "$build_dir" ]; then
|
2015-02-18 06:32:27 +00:00
|
|
|
echo "=== Building $1 ==="
|
|
|
|
build_libretro_generic $1 "$2" "$3" $4 "$build_dir"
|
2015-02-18 17:57:48 +00:00
|
|
|
if [ -z "$5" ]; then
|
|
|
|
copy_core_to_dist $1
|
2015-02-19 06:31:02 +00:00
|
|
|
build_save_revision $? $1
|
2015-02-18 17:57:48 +00:00
|
|
|
fi
|
2015-02-17 03:19:30 +00:00
|
|
|
else
|
2015-02-18 06:32:27 +00:00
|
|
|
echo "$1 not fetched, skipping ..."
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
2015-02-13 03:13:25 +00:00
|
|
|
}
|
|
|
|
|
2015-02-26 22:43:29 +00:00
|
|
|
# build_makefile
|
|
|
|
#
|
2015-03-12 12:13:57 +00:00
|
|
|
# $core_build_subdir Subdir of the makefile (if any)
|
|
|
|
# $core_build_makefile Name of the makefile (if not {GNUm,m,M}akefile)
|
2015-03-12 13:53:41 +00:00
|
|
|
# $core_build_args Extra arguments to make
|
2015-03-12 12:13:57 +00:00
|
|
|
# $core_build_platform Usually some variant of $FORMAT_COMPILER_TARGET
|
2015-03-12 13:09:49 +00:00
|
|
|
# $core_build_cores A list of cores produced by the builds
|
2015-02-26 22:43:29 +00:00
|
|
|
build_makefile() {
|
|
|
|
[ -n "$core_build_subdir" ] && core_build_subdir="/$core_build_subdir"
|
|
|
|
|
|
|
|
make_cmdline="$MAKE"
|
|
|
|
if [ -n "$core_build_makefile" ]; then
|
|
|
|
make_cmdline="$make_cmdline -f $core_build_makefile"
|
|
|
|
fi
|
|
|
|
|
2015-03-26 03:09:06 +00:00
|
|
|
# TODO: Do $platform type stuff better (requires modding each core)
|
2015-03-01 22:46:25 +00:00
|
|
|
make_cmdline="$make_cmdline platform=\"$core_build_platform\""
|
2015-02-26 22:43:29 +00:00
|
|
|
|
|
|
|
[ -n "$JOBS" ] && make_cmdline="$make_cmdline -j$JOBS"
|
|
|
|
|
|
|
|
build_dir="$WORKDIR/$core_dir$core_build_subdir"
|
|
|
|
|
|
|
|
if build_should_skip $1 "$build_dir"; then
|
|
|
|
echo "Core $1 is already built, skipping..."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -d "$build_dir" ]; then
|
|
|
|
echo_cmd "cd \"$build_dir\""
|
|
|
|
|
2015-03-12 14:41:03 +00:00
|
|
|
$core_build_configure
|
2015-03-12 14:29:09 +00:00
|
|
|
|
2015-02-26 22:43:29 +00:00
|
|
|
if [ -z "$NOCLEAN" ]; then
|
2015-03-12 14:29:09 +00:00
|
|
|
$core_build_preclean
|
2015-03-12 13:53:41 +00:00
|
|
|
echo_cmd "$make_cmdline $core_build_args clean"
|
2015-02-26 22:43:29 +00:00
|
|
|
fi
|
|
|
|
make_cmdline="$make_cmdline $COMPILER"
|
2015-03-12 14:29:09 +00:00
|
|
|
|
2015-03-12 14:41:03 +00:00
|
|
|
$core_build_prebuild
|
2015-03-12 13:53:41 +00:00
|
|
|
echo_cmd "$make_cmdline $core_build_args"
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2015-03-12 14:41:03 +00:00
|
|
|
# TODO: Make this a separate stage/package rule
|
|
|
|
$core_build_prepkg
|
2015-03-12 13:09:49 +00:00
|
|
|
for a in $core_build_cores; do
|
2015-03-12 13:53:41 +00:00
|
|
|
copy_core_to_dist ${core_build_products:+$core_build_products/}$a $a
|
2015-03-12 13:09:49 +00:00
|
|
|
done
|
2015-02-26 22:43:29 +00:00
|
|
|
else
|
|
|
|
echo "$1 not fetched, skipping ..."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# libretro_build_core: Build the given core using its build rules
|
|
|
|
#
|
|
|
|
# $1 Name of the core to build
|
|
|
|
libretro_build_core() {
|
2015-03-01 22:46:25 +00:00
|
|
|
local opengl_type
|
|
|
|
|
2015-03-28 01:31:51 +00:00
|
|
|
# Set log_core only if LIBRETRO_LOG_CORE is set
|
|
|
|
printf -v log_core "${LIBRETRO_LOG_CORE:+$LIBRETRO_LOG_DIR/$LIBRETRO_LOG_CORE}" "$1"
|
|
|
|
|
2015-03-27 23:54:35 +00:00
|
|
|
eval "core_name=\${libretro_${1}_name:-$1}"
|
2015-03-03 08:13:02 +00:00
|
|
|
echo "$(color 34)=== $(color 1)$core_name$(color)"
|
2015-03-28 01:31:51 +00:00
|
|
|
lecho "=== $core_name"
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2015-03-27 23:54:35 +00:00
|
|
|
eval "core_build_rule=\${libretro_${1}_build_rule:-generic_makefile}"
|
|
|
|
eval "core_dir=\${libretro_${1}_dir:-libretro-$1}"
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2015-03-01 22:46:25 +00:00
|
|
|
eval "core_build_opengl=\$libretro_${1}_build_opengl"
|
|
|
|
if [ -n "$core_build_opengl" ]; then
|
|
|
|
if [[ "$core_build_opengl" = "yes" || "$core_build_opengl" = "optional" ]]; then
|
|
|
|
if [ -n "$BUILD_LIBRETRO_GL" ]; then
|
|
|
|
if [ -n "$ENABLE_GLES" ]; then
|
|
|
|
opengl_type="-gles"
|
|
|
|
else
|
|
|
|
opengl_type="-opengl"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [ "$core_build_opengl" = "yes" ]; then
|
|
|
|
echo "$1 requires OpenGL (which is disabled), skipping..."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "libretro_build_core:Unknown OpenGL setting for $1: \"$core_build_opengl\"."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-03-28 01:31:51 +00:00
|
|
|
echo "Building ${1}..."
|
|
|
|
lecho "Building ${1}..."
|
|
|
|
if [ -n "$log_core" ]; then
|
|
|
|
exec 6>&1
|
|
|
|
echo "Building ${1}..." >> $log_core
|
|
|
|
|
|
|
|
# TODO: Possibly a shell function for tee?
|
|
|
|
if [[ -n "$LIBRETRO_DEVELOPER" && -n "${cmd_tee:=$(find_tool "tee")}" ]]; then
|
|
|
|
exec > >($cmd_tee -a $log_core)
|
|
|
|
else
|
|
|
|
exec > $log_core
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-02-26 22:43:29 +00:00
|
|
|
case "$core_build_rule" in
|
2015-03-04 11:46:21 +00:00
|
|
|
generic_makefile)
|
2015-03-12 14:54:52 +00:00
|
|
|
for a in configure preclean prebuild prepkg; do
|
2015-03-13 18:53:56 +00:00
|
|
|
if [ "$(type -t libretro_${1}_build_$a 2> /dev/null)" = "function" ]; then
|
2015-03-12 14:54:52 +00:00
|
|
|
eval "core_build_$a=libretro_${1}_build_$a"
|
|
|
|
else
|
|
|
|
eval "core_build_$a="
|
|
|
|
fi
|
|
|
|
done
|
2015-02-26 22:43:29 +00:00
|
|
|
eval "core_build_makefile=\$libretro_${1}_build_makefile"
|
|
|
|
eval "core_build_subdir=\$libretro_${1}_build_subdir"
|
2015-03-12 13:53:41 +00:00
|
|
|
eval "core_build_args=\$libretro_${1}_build_args"
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2015-03-27 23:54:35 +00:00
|
|
|
# TODO: Really, change how all of this is done...
|
|
|
|
eval "core_build_platform=\${libretro_${1}_build_platform:-$FORMAT_COMPILER_TARGET}$opengl_type"
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2015-03-12 13:09:49 +00:00
|
|
|
eval "core_build_cores=\${libretro_${1}_build_cores:-$1}"
|
2015-03-12 13:53:41 +00:00
|
|
|
eval "core_build_products=\$libretro_${1}_build_products"
|
2015-03-28 01:31:51 +00:00
|
|
|
build_makefile $1 2>&1
|
2015-03-12 06:24:09 +00:00
|
|
|
;;
|
2015-02-26 22:43:29 +00:00
|
|
|
|
2015-03-12 06:24:09 +00:00
|
|
|
legacy)
|
|
|
|
eval "core_build_legacy=\$libretro_${1}_build_legacy"
|
|
|
|
if [ -n "$core_build_legacy" ]; then
|
|
|
|
echo "Warning: $1 hasn't been ported to a modern build rule yet."
|
|
|
|
echo " Will build it using legacy \"$core_build_legacy\"..."
|
2015-03-28 01:31:51 +00:00
|
|
|
$core_build_legacy 2>&1
|
2015-03-12 06:24:09 +00:00
|
|
|
fi
|
2015-03-04 11:46:21 +00:00
|
|
|
;;
|
|
|
|
none)
|
|
|
|
echo "Don't have a build rule for $1, skipping..."
|
2015-02-26 22:43:29 +00:00
|
|
|
;;
|
|
|
|
*)
|
2015-03-28 01:31:51 +00:00
|
|
|
echo "libretro_build_core:Unknown build rule for $1: \"$core_build_rule\"." >&2
|
2015-02-26 22:43:29 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2015-03-28 01:31:51 +00:00
|
|
|
if [ -n "$log_core" ]; then
|
|
|
|
exec 1>&6 6>&-
|
|
|
|
fi
|
2015-02-26 22:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-24 08:21:22 +00:00
|
|
|
build_libretro_test() {
|
2015-03-10 18:21:54 +00:00
|
|
|
build_dir="$WORKDIR/retroarch"
|
2015-02-19 06:31:02 +00:00
|
|
|
|
2015-02-24 08:21:22 +00:00
|
|
|
if build_should_skip "test" "$build_dir"; then
|
|
|
|
echo "Core test is already built, skipping..."
|
2015-02-19 06:31:02 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2015-02-17 03:19:30 +00:00
|
|
|
if [ -d "$build_dir" ]; then
|
2015-02-24 08:21:22 +00:00
|
|
|
echo "=== Building RetroArch test cores ==="
|
2015-02-26 03:38:52 +00:00
|
|
|
if check_opengl; then
|
|
|
|
build_libretro_generic "retroarch" "libretro-test-gl" "Makefile" $FORMAT_COMPILER_TARGET "$build_dir"
|
|
|
|
copy_core_to_dist "testgl"
|
|
|
|
fi
|
2015-02-24 08:21:22 +00:00
|
|
|
build_libretro_generic "retroarch" "libretro-test" "Makefile" $FORMAT_COMPILER_TARGET "$build_dir"
|
|
|
|
copy_core_to_dist "test"
|
|
|
|
|
|
|
|
# TODO: Check for more than test here...
|
|
|
|
build_save_revision $? "test"
|
2015-02-17 03:19:30 +00:00
|
|
|
else
|
2015-02-18 06:32:27 +00:00
|
|
|
echo "$1 not fetched, skipping ..."
|
2015-02-17 03:19:30 +00:00
|
|
|
fi
|
2015-02-13 03:13:25 +00:00
|
|
|
}
|
|
|
|
|
2015-03-27 23:45:38 +00:00
|
|
|
summary() {
|
2015-03-28 01:31:51 +00:00
|
|
|
# fmt is external and may not be available
|
|
|
|
fmt_output="$(find_tool "fmt")"
|
|
|
|
local num_success="$(numwords $build_success)"
|
|
|
|
local fmt_success="${fmt_output:+$(echo " $build_success" | $fmt_output)}"
|
|
|
|
local num_fail="$(numwords $build_fail)"
|
|
|
|
local fmt_fail="${fmt_output:+$(echo " $build_fail" | $fmt_output)}"
|
2015-03-26 03:09:06 +00:00
|
|
|
|
2015-03-27 23:45:38 +00:00
|
|
|
for output in "" ${LIBRETRO_LOG_SUPER:+$super_log}; do
|
|
|
|
if [ -n "$output" ]; then
|
|
|
|
exec 6>&1
|
|
|
|
exec > $output
|
|
|
|
use_color=""
|
|
|
|
fi
|
2015-03-26 03:09:06 +00:00
|
|
|
{
|
2015-03-27 23:45:38 +00:00
|
|
|
echo ""
|
|
|
|
if [[ -z "$build_success" && -z "$build_fail" ]]; then
|
|
|
|
echo "No build actions performed."
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2015-03-26 03:09:06 +00:00
|
|
|
if [ -n "$build_success" ]; then
|
2015-03-27 23:45:38 +00:00
|
|
|
echo "$(color 32)$num_success core(s)$(color) successfully processed:"
|
2015-03-26 03:09:06 +00:00
|
|
|
echo "$fmt_success"
|
2015-02-21 04:57:20 +00:00
|
|
|
fi
|
2015-03-26 03:09:06 +00:00
|
|
|
if [ -n "$build_fail" ]; then
|
2015-03-27 23:45:38 +00:00
|
|
|
echo "$(color 31)$num_fail core(s)$(color) failed:"
|
2015-03-26 03:09:06 +00:00
|
|
|
echo "$fmt_fail"
|
2015-02-21 04:57:20 +00:00
|
|
|
fi
|
2015-03-27 23:45:38 +00:00
|
|
|
}
|
|
|
|
if [ -n "$output" ]; then
|
|
|
|
exec 1>&6 6>&-
|
|
|
|
use_color="$want_color"
|
|
|
|
fi
|
|
|
|
done
|
2015-03-26 03:09:06 +00:00
|
|
|
}
|
|
|
|
|
2013-10-09 00:52:48 +00:00
|
|
|
create_dist_dir() {
|
2015-02-18 06:32:27 +00:00
|
|
|
mkdir -p "$RARCH_DIST_DIR"
|
2013-04-30 02:45:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
create_dist_dir
|
2015-02-26 23:12:14 +00:00
|
|
|
|
|
|
|
|
2015-03-12 08:14:21 +00:00
|
|
|
########## LEGACY RULES
|
|
|
|
# TODO: Port these to modern rules
|
|
|
|
|
|
|
|
build_libretro_mame_prerule() {
|
|
|
|
build_dir="$WORKDIR/libretro-mame"
|
|
|
|
|
|
|
|
if build_should_skip mame "$build_dir"; then
|
|
|
|
echo "Core mame is already built, skipping..."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2015-03-23 06:25:52 +00:00
|
|
|
ret=0
|
2015-03-12 08:14:21 +00:00
|
|
|
if [ -d "$build_dir" ]; then
|
|
|
|
echo ''
|
|
|
|
echo "=== Building MAME ==="
|
|
|
|
echo_cmd "cd \"$build_dir\""
|
|
|
|
|
|
|
|
local extra_args
|
2015-03-23 21:41:09 +00:00
|
|
|
[ "${MAME_GIT_TINY:=0}" -eq 1 ] && extra_args="$extra_args SUBTARGET=tiny"
|
2015-03-12 08:14:21 +00:00
|
|
|
|
|
|
|
if [ -z "$NOCLEAN" ]; then
|
2015-03-23 06:25:52 +00:00
|
|
|
echo_cmd "$MAKE -f Makefile.libretro $extra_args platform=\"$FORMAT_COMPILER_TARGET\" \"-j$JOBS\" clean"
|
2015-03-12 08:14:21 +00:00
|
|
|
ret=$?
|
2015-03-23 06:25:52 +00:00
|
|
|
|
|
|
|
if [ "$ret" != 0 ]; then
|
|
|
|
die 'Failed to clean MAME'
|
|
|
|
return $ret
|
2015-03-12 08:14:21 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-03-23 06:25:52 +00:00
|
|
|
# For mame platforms that are CROSS_BUILD's (iOS/Android), we must make buildtools natively
|
|
|
|
if [ "$platform" = "ios" ]; then
|
|
|
|
echo_cmd "$MAKE -f Makefile.libretro platform=\"\" buildtools" || die 'Failed to build MAME buildtools'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# This hack is because mame uses $(CC) to comiple C++ code because "historical reasons"
|
|
|
|
# It can/should be removed when upstream MAME fixes it on their end.
|
|
|
|
MAME_COMPILER="REALCC=\"${CC:-cc}\" CC=\"${CXX:-c++}\""
|
|
|
|
|
|
|
|
# mame's tiny subtarget doesn't support UME
|
|
|
|
mame_targets="mame mess ume"
|
|
|
|
[ "$MAME_GIT_TINY" -eq 1 ] && mame_targets="mame mess"
|
|
|
|
|
|
|
|
for target in $mame_targets; do
|
2015-03-24 16:43:50 +00:00
|
|
|
echo_cmd "$MAKE -f Makefile.libretro $extra_args platform=\"$FORMAT_COMPILER_TARGET\" \"-j$JOBS\" clean-osd" || die 'Failed to clean MAME OSD'
|
2015-03-23 06:25:52 +00:00
|
|
|
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=$?
|
|
|
|
|
|
|
|
# If a target fails, stop here...
|
|
|
|
[ $ret -eq 0 ] || break
|
|
|
|
done
|
|
|
|
|
2015-03-12 08:14:21 +00:00
|
|
|
else
|
|
|
|
echo 'MAME not fetched, skipping ...'
|
|
|
|
fi
|
|
|
|
|
|
|
|
build_save_revision $ret mame
|
|
|
|
}
|