2015-02-14 01:55:27 +00:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
# vim: set ts=3 sw=3 noet ft=sh : bash
|
2011-11-02 15:27:23 +00:00
|
|
|
|
2015-02-14 02:05:50 +00:00
|
|
|
SCRIPT="${0#./}"
|
|
|
|
BASE_DIR="${SCRIPT%/*}"
|
2015-02-22 00:55:31 +00:00
|
|
|
WORKDIR="$PWD"
|
2015-02-02 17:33:50 +00:00
|
|
|
|
2015-02-14 02:05:50 +00:00
|
|
|
if [ "$BASE_DIR" = "$SCRIPT" ]; then
|
|
|
|
BASE_DIR="$WORKDIR"
|
|
|
|
else
|
2015-02-15 22:34:42 +00:00
|
|
|
if [[ "$0" != /* ]]; then
|
|
|
|
# Make the path absolute
|
|
|
|
BASE_DIR="$WORKDIR/$BASE_DIR"
|
|
|
|
fi
|
2015-02-14 02:05:50 +00:00
|
|
|
fi
|
2015-02-02 17:33:50 +00:00
|
|
|
|
2015-02-22 00:55:31 +00:00
|
|
|
. "$BASE_DIR/libretro-config.sh"
|
2015-02-26 08:14:05 +00:00
|
|
|
. "$BASE_DIR/script-modules/util.sh"
|
2015-02-22 00:55:31 +00:00
|
|
|
. "$BASE_DIR/script-modules/fetch-rules.sh"
|
2013-05-01 02:11:22 +00:00
|
|
|
|
2015-03-01 11:42:45 +00:00
|
|
|
# Rules for fetching things are in these files:
|
|
|
|
. "$BASE_DIR/rules.d/core-rules.sh"
|
|
|
|
. "$BASE_DIR/rules.d/player-rules.sh"
|
|
|
|
. "$BASE_DIR/rules.d/devkit-rules.sh"
|
|
|
|
# TODO: Read these programmatically
|
|
|
|
|
2015-02-02 04:24:14 +00:00
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
# libretro_fetch: Download the given core using its fetch rules
|
2015-02-21 08:55:22 +00:00
|
|
|
#
|
|
|
|
# $1 Name of the core to fetch
|
2015-03-01 10:25:06 +00:00
|
|
|
libretro_fetch() {
|
|
|
|
local module_name
|
|
|
|
local module_dir
|
|
|
|
local fetch_rule
|
|
|
|
local post_fetch_cmd
|
2015-02-21 08:55:22 +00:00
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
eval "module_name=\$libretro_${1}_name"
|
|
|
|
[ -z "$module_name" ] && module_name="$1"
|
|
|
|
echo "=== $module_name"
|
2015-02-21 08:55:22 +00:00
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
eval "fetch_rule=\$libretro_${1}_fetch_rule"
|
2015-03-01 20:34:02 +00:00
|
|
|
[ -z "$fetch_rule" ] && fetch_rule=git
|
2015-02-21 08:55:22 +00:00
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
eval "module_dir=\$libretro_${1}_dir"
|
|
|
|
[ -z "$module_dir" ] && module_dir="libretro-$1"
|
|
|
|
|
|
|
|
case "$fetch_rule" in
|
2015-03-01 11:42:45 +00:00
|
|
|
git)
|
2015-03-01 10:25:06 +00:00
|
|
|
local git_url
|
|
|
|
local git_submodules
|
|
|
|
eval "git_url=\$libretro_${1}_git_url"
|
|
|
|
if [ -z "$git_url" ]; then
|
|
|
|
echo "libretro_fetch:No URL set to fetch $1 via git."
|
2015-02-21 08:55:22 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
eval "git_submodules=\$libretro_${1}_git_submodules"
|
2015-02-21 08:55:22 +00:00
|
|
|
|
2015-02-26 08:14:05 +00:00
|
|
|
# TODO: Don't depend on fetch_rule being git
|
2015-02-21 08:55:22 +00:00
|
|
|
echo "Fetching ${1}..."
|
2015-03-01 11:42:45 +00:00
|
|
|
fetch_git "$git_url" "$module_dir" "$git_submodules"
|
2015-02-21 08:55:22 +00:00
|
|
|
;;
|
2015-03-01 11:42:45 +00:00
|
|
|
|
|
|
|
multi_git)
|
|
|
|
local num_git_urls
|
|
|
|
local git_url
|
|
|
|
local git_subdir
|
|
|
|
local git_submodules
|
|
|
|
local i
|
|
|
|
|
|
|
|
eval "num_git_urls=\$libretro_${1}_mgit_urls"
|
|
|
|
if [ "$num_git_urls" -lt 1 ]; then
|
|
|
|
echo "Cannot fetch \"$num_git_urls\" multiple git URLs"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ "$module_dir" != "." ] && echo_cmd "mkdir -p \"$WORKDIR/$module_dir\""
|
|
|
|
for (( i=0; i < $num_git_urls; ++i )); do
|
|
|
|
eval "git_url=\$libretro_${1}_mgit_url_$i"
|
|
|
|
eval "git_subdir=\$libretro_${1}_mgit_dir_$i"
|
|
|
|
eval "git_submodules=\$libretro_${1}_mgit_dir_$i"
|
|
|
|
fetch_git "$git_url" "$module_dir/$git_subdir" "$git_submodules"
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
|
2015-02-21 08:55:22 +00:00
|
|
|
*)
|
2015-03-01 10:25:06 +00:00
|
|
|
echo "libretro_fetch:Unknown fetch rule for $1: \"$fetch_rule\"."
|
2015-02-21 08:55:22 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
eval "post_fetch_cmd=\$libretro_${1}_post_fetch_cmd"
|
|
|
|
if [ -n "$post_fetch_cmd" ]; then
|
|
|
|
echo_cmd "cd \"$WORKDIR/$module_dir\""
|
|
|
|
echo_cmd "$post_fetch_cmd"
|
|
|
|
fi
|
2015-02-02 04:24:14 +00:00
|
|
|
}
|
|
|
|
|
2015-02-18 07:17:47 +00:00
|
|
|
if [ -n "$1" ]; then
|
2015-03-01 20:34:02 +00:00
|
|
|
no_more_args=""
|
2015-02-18 07:17:47 +00:00
|
|
|
while [ -n "$1" ]; do
|
2015-03-01 11:42:45 +00:00
|
|
|
if [ -z "$no_more_args" ]; then
|
|
|
|
case "$1" in
|
|
|
|
--)
|
|
|
|
no_more_args="1"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
# New style (just cores for now)
|
|
|
|
libretro_fetch $1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
libretro_fetch $1
|
|
|
|
fi
|
2015-02-14 01:27:24 +00:00
|
|
|
shift
|
|
|
|
done
|
2015-02-02 04:35:22 +00:00
|
|
|
else
|
2015-03-01 10:25:06 +00:00
|
|
|
libretro_fetch retroarch
|
2015-03-01 11:42:45 +00:00
|
|
|
libretro_fetch devkit
|
2015-03-01 06:12:30 +00:00
|
|
|
|
2015-03-01 10:25:06 +00:00
|
|
|
libretro_fetch bsnes
|
|
|
|
libretro_fetch snes9x
|
|
|
|
libretro_fetch snes9x_next
|
|
|
|
libretro_fetch genesis_plus_gx
|
|
|
|
libretro_fetch fb_alpha
|
|
|
|
libretro_fetch vba_next
|
|
|
|
libretro_fetch vbam
|
|
|
|
libretro_fetch handy
|
|
|
|
libretro_fetch bnes
|
|
|
|
libretro_fetch fceumm
|
|
|
|
libretro_fetch gambatte
|
|
|
|
libretro_fetch meteor
|
|
|
|
libretro_fetch nxengine
|
|
|
|
libretro_fetch prboom
|
|
|
|
libretro_fetch stella
|
|
|
|
libretro_fetch desmume
|
|
|
|
libretro_fetch quicknes
|
|
|
|
libretro_fetch nestopia
|
|
|
|
libretro_fetch tyrquake
|
|
|
|
libretro_fetch pcsx_rearmed
|
|
|
|
libretro_fetch mednafen_gba
|
|
|
|
libretro_fetch mednafen_lynx
|
|
|
|
libretro_fetch mednafen_ngp
|
|
|
|
libretro_fetch mednafen_pce_fast
|
|
|
|
libretro_fetch mednafen_supergrafx
|
|
|
|
libretro_fetch mednafen_psx
|
|
|
|
libretro_fetch mednafen_pcfx
|
|
|
|
libretro_fetch mednafen_snes
|
|
|
|
libretro_fetch mednafen_vb
|
|
|
|
libretro_fetch mednafen_wswan
|
|
|
|
libretro_fetch scummvm
|
|
|
|
libretro_fetch yabause
|
|
|
|
libretro_fetch dosbox
|
|
|
|
libretro_fetch virtualjaguar
|
|
|
|
libretro_fetch mame078
|
|
|
|
libretro_fetch mame139
|
|
|
|
libretro_fetch mame
|
|
|
|
libretro_fetch ffmpeg
|
|
|
|
libretro_fetch bsnes_cplusplus98
|
|
|
|
libretro_fetch bsnes_mercury
|
|
|
|
libretro_fetch picodrive
|
|
|
|
libretro_fetch tgbdual
|
|
|
|
libretro_fetch mupen64plus
|
|
|
|
libretro_fetch dinothawr
|
|
|
|
libretro_fetch uae
|
|
|
|
libretro_fetch 3dengine
|
|
|
|
libretro_fetch remotejoy
|
|
|
|
libretro_fetch bluemsx
|
|
|
|
libretro_fetch fmsx
|
|
|
|
libretro_fetch 2048
|
|
|
|
libretro_fetch vecx
|
|
|
|
libretro_fetch ppsspp
|
|
|
|
libretro_fetch prosystem
|
|
|
|
libretro_fetch o2em
|
|
|
|
libretro_fetch 4do
|
|
|
|
libretro_fetch catsfc
|
|
|
|
libretro_fetch stonesoup
|
|
|
|
libretro_fetch hatari
|
|
|
|
libretro_fetch tempgba
|
|
|
|
libretro_fetch gpsp
|
|
|
|
libretro_fetch emux
|
|
|
|
libretro_fetch fuse
|
2015-02-02 04:35:22 +00:00
|
|
|
fi
|