2015-03-05 03:40:22 +00:00
|
|
|
# vim: set ts=3 sw=3 noet ft=sh : bash
|
|
|
|
|
|
|
|
register_module() {
|
2015-03-10 14:20:11 +00:00
|
|
|
mod_type="$1"
|
|
|
|
mod_name="$2"
|
|
|
|
shift 2
|
|
|
|
|
|
|
|
case "$mod_type" in
|
2015-03-05 03:40:22 +00:00
|
|
|
core|devkit|player)
|
2015-03-10 14:20:11 +00:00
|
|
|
if [ -n "$mod_name" ]; then
|
|
|
|
build_plats=""
|
|
|
|
skip_plats=""
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
if [[ "$1" = -* ]]; then
|
|
|
|
skip_plats="$skip_plats,$1"
|
|
|
|
else
|
|
|
|
build_plats="$build_plats,$1"
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
build_plats="${build_plats#,}"
|
|
|
|
skip_plats="${skip_plats#,}"
|
|
|
|
|
2015-04-06 05:47:49 +00:00
|
|
|
eval "libretro_${mod_type}s=\"\$libretro_${mod_type}s $mod_name:${build_plats:=any}:$skip_plats\""
|
|
|
|
libretro_modules="$libretro_modules $mod_name:$build_plats:$skip_plats"
|
2015-03-05 03:40:22 +00:00
|
|
|
else
|
2015-03-10 14:20:11 +00:00
|
|
|
echo "register_module:Trying to register a $mod_type without a name"
|
2015-03-05 03:40:22 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2015-03-10 14:20:11 +00:00
|
|
|
echo "register_module:Unknown module type \"$mod_type\""
|
2015-03-05 03:40:22 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2015-03-10 14:20:11 +00:00
|
|
|
can_build_module() {
|
2015-04-06 05:47:49 +00:00
|
|
|
[ -n "$force" ] && return 0
|
|
|
|
|
2015-03-10 14:20:11 +00:00
|
|
|
if [[ "$1" != *:*:* ]]; then
|
2015-04-06 05:47:49 +00:00
|
|
|
# Not in <name>:<build>:<skip> format, assume error
|
|
|
|
return 1
|
2015-03-10 14:20:11 +00:00
|
|
|
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
|
|
|
|
}
|
2015-04-06 05:47:49 +00:00
|
|
|
|
|
|
|
find_module() {
|
|
|
|
needle="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
for haystack in $@; do
|
|
|
|
if [[ "$needle" == $haystack:* ]]; then
|
|
|
|
echo "$needle"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|