From 22d5895162331ac4deac328568f31435d7d81593 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Wed, 25 Feb 2015 21:59:18 -0800 Subject: [PATCH 1/2] fetch the libretro devkit and retroarch last --- libretro-fetch.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libretro-fetch.sh b/libretro-fetch.sh index b1b42077..0b01261f 100755 --- a/libretro-fetch.sh +++ b/libretro-fetch.sh @@ -88,9 +88,6 @@ if [ -n "$1" ]; then shift done else - fetch_retroarch - fetch_devkit - libretro_fetch_core bsnes libretro_fetch_core snes9x libretro_fetch_core snes9x_next @@ -153,4 +150,7 @@ else libretro_fetch_core gpsp libretro_fetch_core emux libretro_fetch_core fuse + + fetch_devkit + fetch_retroarch fi From 82a87696d4c5ed5c1898c9e46b09edd3afa1fda8 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Thu, 26 Feb 2015 00:14:05 -0800 Subject: [PATCH 2/2] Some cleanups of the fetch rules a bit, move echo_cmd to script-modules --- libretro-build-common.sh | 12 +++--------- libretro-fetch.sh | 30 ++++++++++++++++++------------ script-modules/fetch-rules.sh | 30 +++++++++++------------------- script-modules/util.sh | 7 +++++++ 4 files changed, 39 insertions(+), 40 deletions(-) create mode 100644 script-modules/util.sh diff --git a/libretro-build-common.sh b/libretro-build-common.sh index 2d4385cc..014438bc 100755 --- a/libretro-build-common.sh +++ b/libretro-build-common.sh @@ -1,20 +1,14 @@ # vim: set ts=3 sw=3 noet ft=sh : bash -. "${BASE_DIR}/script-modules/fetch-rules.sh" -. "${BASE_DIR}/script-modules/cpu.sh" +. "$BASE_DIR/script-modules/util.sh" +. "$BASE_DIR/script-modules/fetch-rules.sh" +. "$BASE_DIR/script-modules/cpu.sh" die() { echo $1 #exit 1 } -echo_cmd() { - eval 'echo "$@"' - eval "$@" - return $? -} - - # # 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 diff --git a/libretro-fetch.sh b/libretro-fetch.sh index 0b01261f..0c7264f3 100755 --- a/libretro-fetch.sh +++ b/libretro-fetch.sh @@ -15,6 +15,7 @@ else fi . "$BASE_DIR/libretro-config.sh" +. "$BASE_DIR/script-modules/util.sh" . "$BASE_DIR/script-modules/fetch-rules.sh" # Rules for fetching cores are in this file: @@ -45,8 +46,9 @@ libretro_fetch_core() { eval "core_git_submodules=\$libretro_${1}_git_submodules" eval "core_git_submodules_update=\$libretro_${1}_git_submodules_update" + # TODO: Don't depend on fetch_rule being git echo "Fetching ${1}..." - $core_fetch_rule "$core_fetch_url" "$core_dir" "" $core_git_submodules $core_git_submodules_update + $core_fetch_rule "$core_fetch_url" "$core_dir" $core_git_submodules $core_git_submodules_update ;; *) echo "libretro_fetch_core:Unknown fetch rule for $1: \"$core_fetch_rule\"." @@ -56,26 +58,30 @@ libretro_fetch_core() { } fetch_retroarch() { - echo "=== Fetching RetroArch ===" - fetch_git "https://github.com/libretro/RetroArch.git" "retroarch" "" - fetch_git "https://github.com/libretro/common-shaders.git" "retroarch/media/shaders_cg" "" - fetch_git "https://github.com/libretro/common-overlays.git" "retroarch/media/overlays" "" - fetch_git "https://github.com/libretro/retroarch-assets.git" "retroarch/media/assets" "" - fetch_git "https://github.com/libretro/retroarch-joypad-autoconfig.git" "retroarch/media/autoconfig" "" - fetch_git "https://github.com/libretro/libretro-database.git" "retroarch/media/libretrodb" "" + echo "=== RetroArch" + echo "Fetching retroarch..." + fetch_git "https://github.com/libretro/RetroArch.git" "retroarch" + echo_cmd "cd \"$WORKDIR/retroarch\"" + echo_cmd "./fetch-submodules.sh" } fetch_devkit() { - fetch_git "https://github.com/libretro/libretro-manifest.git" "libretro-manifest" "libretro/libretro-manifest" - fetch_git "https://github.com/libretro/libretrodb.git" "libretrodb" "libretro/libretrodb" - fetch_git "https://github.com/libretro/libretro-dat-pull.git" "libretro-dat-pull" "libretro/libretro-dat-pull" - fetch_git "https://github.com/libretro/libretro-common.git" "libretro-common" "libretro/common" + echo "=== libretro Developer's Kit" + echo "Fetching the libretro devkit..." + fetch_git "https://github.com/libretro/libretro-manifest.git" "libretro-manifest" + fetch_git "https://github.com/libretro/libretrodb.git" "libretrodb" + fetch_git "https://github.com/libretro/libretro-dat-pull.git" "libretro-dat-pull" + fetch_git "https://github.com/libretro/libretro-common.git" "libretro-common" } if [ -n "$1" ]; then while [ -n "$1" ]; do case "$1" in + fetch_retroarch|fetch_devkit) + # These don't have rule-based fetch yet. + $1 + ;; fetch_libretro_*) # "Old"-style $1 diff --git a/script-modules/fetch-rules.sh b/script-modules/fetch-rules.sh index 31a2ceb3..65940712 100644 --- a/script-modules/fetch-rules.sh +++ b/script-modules/fetch-rules.sh @@ -4,35 +4,27 @@ # # $1 The URI to fetch # $2 The local directory to fetch to (relative) -# $3 The pretty name for the === Fetching line ("" to print nothing) -# $4 Set to clone --recursive -# $5 Set to pull --recursive +# $3 Set to clone --recursive +# $4 Set to pull --recursive # # NOTE: git _now_ has a -C argument that would replace the cd commands in # this rule, but this is a fairly recent addition to git, so we can't # use it here. --iKarith fetch_git() { fetch_dir="$WORKDIR/$2" - [ -n "$3" ] && echo "=== Fetching $3 ===" if [ -d "$fetch_dir/.git" ]; then - echo "cd \"$fetch_dir\"" - cd "$fetch_dir" - echo "git pull" - git pull - if [ -n "$5" ]; then - echo "git submodule foreach git pull origin master" - git submodule foreach git pull origin master + echo_cmd "cd \"$fetch_dir\"" + echo_cmd "git pull" + if [ -n "$4" ]; then + echo_cmd "git submodule foreach git pull origin master" fi else clone_type= - [ -n "$SHALLOW_CLONE" ] && depth="--depth 1" - echo "git clone $depth \"$1\" \"$WORKDIR/$2\"" - git clone $depth "$1" "$WORKDIR/$2" - if [ -n "$4" ]; then - echo "cd \"$fetch_dir\"" - cd "$fetch_dir" - echo "git submodule update --init" - git submodule update --init + [ -n "$SHALLOW_CLONE" ] && depth="--depth 1 " + echo_cmd "git clone $depth\"$1\" \"$WORKDIR/$2\"" + if [ -n "$3" ]; then + echo_cmd "cd \"$fetch_dir\"" + echo_cmd "git submodule update --init" fi fi } diff --git a/script-modules/util.sh b/script-modules/util.sh new file mode 100644 index 00000000..c7fc9e8b --- /dev/null +++ b/script-modules/util.sh @@ -0,0 +1,7 @@ +# vim: set ts=3 sw=3 noet ft=sh : bash + +echo_cmd() { + eval 'echo "$@"' + eval "$@" + return $? +}