mirror of
https://github.com/libretro/libretro-super
synced 2025-02-28 16:11:33 +00:00
Fetch only the cores we can build with --cores option
This commit is contained in:
parent
f494a26f81
commit
90d8054990
@ -25,7 +25,6 @@ fi
|
||||
. "$BASE_DIR/rules.d/devkit-rules.sh"
|
||||
# TODO: Read these programmatically
|
||||
|
||||
|
||||
# libretro_fetch: Download the given core using its fetch rules
|
||||
#
|
||||
# $1 Name of the core to fetch
|
||||
@ -97,30 +96,49 @@ libretro_fetch() {
|
||||
fi
|
||||
}
|
||||
|
||||
libretro_players="retroarch"
|
||||
libretro_devkits="devkit"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
fetch_devel=""
|
||||
no_more_args=""
|
||||
while [ -n "$1" ]; do
|
||||
if [ -z "$no_more_args" ]; then
|
||||
if [[ "$1" = -* && -z "$no_more_args" ]]; then
|
||||
case "$1" in
|
||||
--)
|
||||
no_more_args="1"
|
||||
;;
|
||||
|
||||
*)
|
||||
# New style (just cores for now)
|
||||
libretro_fetch $1
|
||||
;;
|
||||
--) no_more_args=1 ;;
|
||||
--devel) fetch_devel=1 ;;
|
||||
--cores) fetch_cores="$libretro_cores" ;;
|
||||
--devkit) fetch_devkits="$libretro_devkits" ;;
|
||||
--players) fetch_players="$libretro_players" ;;
|
||||
--retroarch) fetch_players="retroarch" ;;
|
||||
*) ;;
|
||||
esac
|
||||
else
|
||||
libretro_fetch $1
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
fetch_cores="$fetch_cores $1"
|
||||
# Handle non-commands
|
||||
shift
|
||||
done
|
||||
else
|
||||
libretro_fetch retroarch
|
||||
libretro_fetch devkit
|
||||
|
||||
for a in $libretro_cores; do
|
||||
libretro_fetch "${a%%:*}"
|
||||
done
|
||||
# Make libretro-fetch.sh with no args behave traditionally by default
|
||||
fetch_devel=1
|
||||
fetch_cores="$libretro_cores"
|
||||
fetch_players="retroarch"
|
||||
fetch_devkit="devkit"
|
||||
fi
|
||||
|
||||
for a in $fetch_players; do
|
||||
libretro_fetch $a
|
||||
done
|
||||
|
||||
for a in $fetch_devkits; do
|
||||
libretro_fetch $a
|
||||
done
|
||||
|
||||
for a in $fetch_cores; do
|
||||
if [ -n "$fetch_devel" ] || can_build_module "$a"; then
|
||||
libretro_fetch "${a%%:*}"
|
||||
fi
|
||||
done
|
||||
|
@ -1,17 +1,35 @@
|
||||
# vim: set ts=3 sw=3 noet ft=sh : bash
|
||||
|
||||
register_module() {
|
||||
case "$1" in
|
||||
mod_type="$1"
|
||||
mod_name="$2"
|
||||
shift 2
|
||||
|
||||
case "$mod_type" in
|
||||
core|devkit|player)
|
||||
if [ -n "$2" ]; then
|
||||
eval "libretro_${1}s=\"\$libretro_${1}s $2::\""
|
||||
if [ -n "$mod_name" ]; then
|
||||
build_plats=""
|
||||
skip_plats=""
|
||||
while [ -n "$1" ]; do
|
||||
if [[ "$1" = -* ]]; then
|
||||
skip_plats="$skip_plats,$1"
|
||||
else
|
||||
echo "register_module:Trying to register a $1 without a name"
|
||||
build_plats="$build_plats,$1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
build_plats="${build_plats#,}"
|
||||
skip_plats="${skip_plats#,}"
|
||||
|
||||
eval "libretro_${mod_type}s=\"\$libretro_${mod_type}s $mod_name:${build_plats:-any}:$skip_plats\""
|
||||
else
|
||||
echo "register_module:Trying to register a $mod_type without a name"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "register_module:Unknown module type \"$1\""
|
||||
echo "register_module:Unknown module type \"$mod_type\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@ -20,3 +38,29 @@ register_module() {
|
||||
register_core() {
|
||||
register_module core $@
|
||||
}
|
||||
|
||||
can_build_module() {
|
||||
if [[ "$1" != *:*:* ]]; then
|
||||
# Not in <name>:<build>:<skip> format, assume developer mode
|
||||
return 0
|
||||
fi
|
||||
|
||||
build_plats="${1#*:}"
|
||||
build_plats="${build_plats%:*}"
|
||||
skip_plats="${1##*:}"
|
||||
|
||||
if [ "$build_plats" != "any" ]; then
|
||||
# Module is exclusive to certain platforms
|
||||
if [[ "$platform" != *${build_plats}* ]]; then
|
||||
# And this isn't one of them.
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$skip_plats" = *${platform}* ]]; then
|
||||
# Module is disabled on this particular platform
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user