From 8e471f85193c89fd3ee32511b19798b5b3a2113b Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Sun, 1 Mar 2015 03:42:45 -0800 Subject: [PATCH] Rules based fetch = DONE. Twinaphex read devkit-rules.sh --- libretro-build-common.sh | 2 +- libretro-fetch.sh | 76 ++++++++----- core-rules.sh => rules.d/core-rules.sh | 141 +++++++++++++------------ rules.d/devkit-rules.sh | 15 +++ rules.d/player-rules.sh | 7 ++ 5 files changed, 145 insertions(+), 96 deletions(-) rename core-rules.sh => rules.d/core-rules.sh (95%) create mode 100644 rules.d/devkit-rules.sh create mode 100644 rules.d/player-rules.sh diff --git a/libretro-build-common.sh b/libretro-build-common.sh index 98f2241b..e65bf9df 100755 --- a/libretro-build-common.sh +++ b/libretro-build-common.sh @@ -4,7 +4,7 @@ . "$BASE_DIR/script-modules/fetch-rules.sh" . "$BASE_DIR/script-modules/cpu.sh" -. "$BASE_DIR/core-rules.sh" +. "$BASE_DIR/rules.d/core-rules.sh" die() { echo $1 diff --git a/libretro-fetch.sh b/libretro-fetch.sh index 35ace55a..6e8468d1 100755 --- a/libretro-fetch.sh +++ b/libretro-fetch.sh @@ -18,8 +18,12 @@ fi . "$BASE_DIR/script-modules/util.sh" . "$BASE_DIR/script-modules/fetch-rules.sh" -# Rules for fetching cores are in this file: -. "$BASE_DIR/core-rules.sh" +# 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 + # libretro_fetch: Download the given core using its fetch rules # @@ -41,7 +45,7 @@ libretro_fetch() { [ -z "$module_dir" ] && module_dir="libretro-$1" case "$fetch_rule" in - fetch_git) + git) local git_url local git_submodules eval "git_url=\$libretro_${1}_git_url" @@ -54,8 +58,31 @@ libretro_fetch() { # TODO: Don't depend on fetch_rule being git echo "Fetching ${1}..." - $fetch_rule "$git_url" "$module_dir" $git_submodules + fetch_git "$git_url" "$module_dir" "$git_submodules" ;; + + 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 + ;; + *) echo "libretro_fetch:Unknown fetch rule for $1: \"$fetch_rule\"." exit 1 @@ -69,37 +96,28 @@ libretro_fetch() { fi } -fetch_devkit() { - 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 + local no_more_args="" while [ -n "$1" ]; do - case "$1" in - fetch_devkit) - # These don't have rule-based fetch yet. - $1 - ;; - fetch_libretro_*) - # "Old"-style - $1 - ;; - *) - # New style (just cores for now) - libretro_fetch $1 - ;; - esac + 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 shift done else libretro_fetch retroarch - fetch_devkit + libretro_fetch devkit libretro_fetch bsnes libretro_fetch snes9x diff --git a/core-rules.sh b/rules.d/core-rules.sh similarity index 95% rename from core-rules.sh rename to rules.d/core-rules.sh index 79e6983f..ff9c10c9 100644 --- a/core-rules.sh +++ b/rules.d/core-rules.sh @@ -1,202 +1,208 @@ # vim: set ts=3 sw=3 noet ft=sh : bash -libretro_retroarch_name="RetroArch" -libretro_retroarch_dir="retroarch" -libretro_retroarch_git_url="https://github.com/libretro/RetroArch.git" -libretro_retroarch_post_fetch_cmd="./fetch-submodules.sh" - -libretro_bsnes_git_url="https://github.com/libretro/bsnes-libretro.git" libretro_bsnes_name="bsnes/higan" +libretro_bsnes_git_url="https://github.com/libretro/bsnes-libretro.git" +# NEED CUSTOM RULE: bsnes -libretro_snes9x_git_url="https://github.com/libretro/snes9x.git" libretro_snes9x_name="SNES9x" +libretro_snes9x_git_url="https://github.com/libretro/snes9x.git" libretro_snes9x_build_subdir="libretro" -libretro_snes9x_next_git_url="https://github.com/libretro/snes9x-next.git" libretro_snes9x_next_name="SNES9x Next" +libretro_snes9x_next_git_url="https://github.com/libretro/snes9x-next.git" libretro_snes9x_next_build_makefile="Makefile.libretro" libretro_snes9x_next_build_platform="$FORMAT_COMPILER_TARGET_ALT" -libretro_genesis_plus_gx_git_url="https://github.com/libretro/Genesis-Plus-GX.git" libretro_genesis_plus_gx_name="Genesis Plus GX" +libretro_genesis_plus_gx_git_url="https://github.com/libretro/Genesis-Plus-GX.git" libretro_genesis_plus_gx_build_makefile="Makefile.libretro" -libretro_fb_alpha_git_url="https://github.com/libretro/fba-libretro.git" libretro_fb_alpha_name="Final Burn Alpha" +libretro_fb_alpha_git_url="https://github.com/libretro/fba-libretro.git" libretro_fb_alpha_build_subdir="svn-current/trunk" libretro_fb_alpha_build_makefile="makefile.libretro" -libretro_vba_next_git_url="https://github.com/libretro/vba-next.git" libretro_vba_next_name="VBA Next" +libretro_vba_next_git_url="https://github.com/libretro/vba-next.git" libretro_vba_next_build_makefile="Makefile.libretro" libretro_vba_next_build_platform="$FORMAT_COMPILER_TARGET_ALT" -libretro_vbam_git_url="https://github.com/libretro/vbam-libretro.git" libretro_vbam_name="VBA-M" +libretro_vbam_git_url="https://github.com/libretro/vbam-libretro.git" libretro_vbam_build_subdir="src/libretro" libretro_vbam_build_makefile="Makefile" libretro_vbam_build_platform="$FORMAT_COMPILER_TARGET_ALT" -libretro_handy_git_url="https://github.com/libretro/libretro-handy.git" libretro_handy_name="Handy" +libretro_handy_git_url="https://github.com/libretro/libretro-handy.git" # IMPLICIT -libretro_bnes_git_url="https://github.com/libretro/bnes-libretro.git" libretro_bnes_name="bnes/higan" +libretro_bnes_git_url="https://github.com/libretro/bnes-libretro.git" +# NEED CUSTOM RULE: bnes -libretro_fceumm_git_url="https://github.com/libretro/libretro-fceumm.git" libretro_fceumm_name="FCEUmm" +libretro_fceumm_git_url="https://github.com/libretro/libretro-fceumm.git" libretro_fceumm_build_makefile="Makefile.libretro" -libretro_gambatte_git_url="https://github.com/libretro/gambatte-libretro.git" libretro_gambatte_name="Gambatte" +libretro_gambatte_git_url="https://github.com/libretro/gambatte-libretro.git" libretro_gambatte_build_subdir="libgambatte" libretro_gambatte_build_makefile="Makefile.libretro" libretro_gambatte_build_platform="$FORMAT_COMPILER_TARGET_ALT" -libretro_meteor_git_url="https://github.com/libretro/meteor-libretro.git" libretro_meteor_name="Meteor" +libretro_meteor_git_url="https://github.com/libretro/meteor-libretro.git" libretro_meteor_build_subdir="libretro" -libretro_nxengine_git_url="https://github.com/libretro/nxengine-libretro.git" libretro_nxengine_name="NXEngine" +libretro_nxengine_git_url="https://github.com/libretro/nxengine-libretro.git" # IMPLICIT -libretro_prboom_git_url="https://github.com/libretro/libretro-prboom.git" libretro_prboom_name="PrBoom" +libretro_prboom_git_url="https://github.com/libretro/libretro-prboom.git" libretro_prboom_build_platform="$FORMAT_COMPILER_TARGET_ALT" -libretro_stella_git_url="https://github.com/libretro/stella-libretro.git" libretro_stella_name="Stella" +libretro_stella_git_url="https://github.com/libretro/stella-libretro.git" # IMPLICIT -libretro_desmume_git_url="https://github.com/libretro/desmume.git" libretro_desmume_name="DeSmuME" +libretro_desmume_git_url="https://github.com/libretro/desmume.git" libretro_desmume_build_subdir="desmume" libretro_desmume_build_makefile="Makefile.libretro" -libretro_quicknes_git_url="https://github.com/libretro/QuickNES_Core.git" libretro_quicknes_name="QuickNES" +libretro_quicknes_git_url="https://github.com/libretro/QuickNES_Core.git" libretro_quicknes_build_subdir="libretro" -libretro_nestopia_git_url="https://github.com/libretro/nestopia.git" libretro_nestopia_name="Nestopia" +libretro_nestopia_git_url="https://github.com/libretro/nestopia.git" libretro_nestopia_build_subdir="libretro" -libretro_tyrquake_git_url="https://github.com/libretro/tyrquake.git" libretro_tyrquake_name="TyrQuake" +libretro_tyrquake_git_url="https://github.com/libretro/tyrquake.git" libretro_tyrquake_build_makefile="Makefile.libretro" -libretro_pcsx_rearmed_git_url="https://github.com/libretro/pcsx_rearmed.git" libretro_pcsx_rearmed_name="PCSX ReARMed" +libretro_pcsx_rearmed_git_url="https://github.com/libretro/pcsx_rearmed.git" libretro_pcsx_rearmed_build_makefile="Makefile.libretro" -libretro_mednafen_gba_git_url="https://github.com/libretro/beetle-gba-libretro.git" libretro_mednafen_gba_name="Mednafen/Beetle GBA" +libretro_mednafen_gba_git_url="https://github.com/libretro/beetle-gba-libretro.git" # IMPLICIT -libretro_mednafen_lynx_git_url="https://github.com/libretro/beetle-lynx-libretro.git" libretro_mednafen_lynx_name="Mednafen/Beetle Lynx" +libretro_mednafen_lynx_git_url="https://github.com/libretro/beetle-lynx-libretro.git" # IMPLICIT -libretro_mednafen_ngp_git_url="https://github.com/libretro/beetle-ngp-libretro.git" libretro_mednafen_ngp_name="Mednafen/Beetle NeoPop" +libretro_mednafen_ngp_git_url="https://github.com/libretro/beetle-ngp-libretro.git" # IMPLICIT -libretro_mednafen_pce_fast_git_url="https://github.com/libretro/beetle-pce-fast-libretro.git" libretro_mednafen_pce_fast_name="Mednafen/Beetle PCE FAST" +libretro_mednafen_pce_fast_git_url="https://github.com/libretro/beetle-pce-fast-libretro.git" # IMPLICIT -libretro_mednafen_supergrafx_git_url="https://github.com/libretro/beetle-supergrafx-libretro.git" libretro_mednafen_supergrafx_name="Mednafen/Beetle SuperGrafx" +libretro_mednafen_supergrafx_git_url="https://github.com/libretro/beetle-supergrafx-libretro.git" # IMPLICIT -libretro_mednafen_psx_git_url="https://github.com/libretro/mednafen-psx-libretro.git" libretro_mednafen_psx_name="Mednafen PSX" +libretro_mednafen_psx_git_url="https://github.com/libretro/mednafen-psx-libretro.git" # IMPLICIT -libretro_mednafen_pcfx_git_url="https://github.com/libretro/beetle-pcfx-libretro.git" libretro_mednafen_pcfx_name="Mednafen/Beetle PC-FX" +libretro_mednafen_pcfx_git_url="https://github.com/libretro/beetle-pcfx-libretro.git" # IMPLICIT -libretro_mednafen_snes_git_url="https://github.com/libretro/beetle-bsnes-libretro.git" libretro_mednafen_snes_name="Mednafen/Beetle bsnes" +libretro_mednafen_snes_git_url="https://github.com/libretro/beetle-bsnes-libretro.git" # IMPLICIT -libretro_mednafen_vb_git_url="https://github.com/libretro/beetle-vb-libretro.git" libretro_mednafen_vb_name="Mednafen/Beetle VB" +libretro_mednafen_vb_git_url="https://github.com/libretro/beetle-vb-libretro.git" # IMPLICIT -libretro_mednafen_wswan_git_url="https://github.com/libretro/beetle-wswan-libretro.git" libretro_mednafen_wswan_name="Mednafen/Beetle WonderSwan" +libretro_mednafen_wswan_git_url="https://github.com/libretro/beetle-wswan-libretro.git" # IMPLICIT -libretro_scummvm_git_url="https://github.com/libretro/scummvm.git" libretro_scummvm_name="ScummVM" +libretro_scummvm_git_url="https://github.com/libretro/scummvm.git" libretro_scummvm_build_subdir="backends/platform/libretro/build" -libretro_yabause_git_url="https://github.com/libretro/yabause.git" libretro_yabause_name="Yabause" +libretro_yabause_git_url="https://github.com/libretro/yabause.git" libretro_yabause_build_subdir="libretro" -libretro_dosbox_git_url="https://github.com/libretro/dosbox-libretro.git" libretro_dosbox_name="DOSBox" +libretro_dosbox_git_url="https://github.com/libretro/dosbox-libretro.git" libretro_dosbox_makefile="Makefile.libretro" -libretro_virtualjaguar_git_url="https://github.com/libretro/virtualjaguar-libretro.git" libretro_virtualjaguar_name="Virtual Jaguar" +libretro_virtualjaguar_git_url="https://github.com/libretro/virtualjaguar-libretro.git" # IMPLICIT -libretro_mame078_git_url="https://github.com/libretro/mame2003-libretro.git" libretro_mame078_name="MAME 2003 (0.78)" +libretro_mame078_git_url="https://github.com/libretro/mame2003-libretro.git" # IMPLICIT -libretro_mame139_git_url="https://github.com/libretro/mame2010-libretro.git" libretro_mame139_name="MAME 2010 (0.139)" +libretro_mame139_git_url="https://github.com/libretro/mame2010-libretro.git" +# NEED A BUILD RULE: mame139 -libretro_mame_git_url="https://github.com/libretro/mame.git" libretro_mame_name="MAME (git)" +libretro_mame_git_url="https://github.com/libretro/mame.git" +# NEED CUSTOM RULE: mame -libretro_ffmpeg_git_url="https://github.com/libretro/FFmpeg.git" libretro_ffmpeg_name="FFmpeg" +libretro_ffmpeg_git_url="https://github.com/libretro/FFmpeg.git" +# NEED OPENGL CHECK: ffmpeg -libretro_bsnes_cplusplus98_git_url="https://github.com/libretro/bsnes-libretro-cplusplus98.git" libretro_bsnes_cplusplus98_name="bsnes C++98 (v0.85)" +libretro_bsnes_cplusplus98_git_url="https://github.com/libretro/bsnes-libretro-cplusplus98.git" +# NEED CUSTOM RULE: bsnes_cplusplus98 -libretro_bsnes_mercury_git_url="https://github.com/libretro/bsnes-mercury.git" libretro_bsnes_mercury_name="bsnes-mercury" +libretro_bsnes_mercury_git_url="https://github.com/libretro/bsnes-mercury.git" +# NEED CUSTOM RULE: bsnes_mercury -libretro_picodrive_git_url="https://github.com/libretro/picodrive.git" libretro_picodrive_name="Picodrive" +libretro_picodrive_git_url="https://github.com/libretro/picodrive.git" libretro_picodrive_git_submodules="yes" libretro_picodrive_build_makefile="Makefile.libretro" -libretro_tgbdual_git_url="https://github.com/libretro/tgbdual-libretro.git" libretro_tgbdual_name="TGB Dual" +libretro_tgbdual_git_url="https://github.com/libretro/tgbdual-libretro.git" # IMPLICIT -libretro_mupen64plus_git_url="https://github.com/libretro/mupen64plus-libretro.git" libretro_mupen64plus_name="Mupen64Plus" +libretro_mupen64plus_git_url="https://github.com/libretro/mupen64plus-libretro.git" +# NEED CUSTOM RULE: mupen64plus -libretro_dinothawr_git_url="https://github.com/libretro/Dinothawr.git" libretro_dinothawr_name="Dinothawr" +libretro_dinothawr_git_url="https://github.com/libretro/Dinothawr.git" libretro_dinothawr_build_platform="$FORMAT_COMPILER_TARGET_ALT" -libretro_uae_git_url="https://github.com/libretro/libretro-uae.git" libretro_uae_name="UAE" +libretro_uae_git_url="https://github.com/libretro/libretro-uae.git" +# NEED A BUILD RULE: uae -libretro_3dengine_git_url="https://github.com/libretro/libretro-3dengine.git" libretro_3dengine_name="3DEngine" +libretro_3dengine_git_url="https://github.com/libretro/libretro-3dengine.git" +# NEED OPENGL CHECK: 3dengine -libretro_remotejoy_git_url="https://github.com/libretro/libretro-remotejoy.git" libretro_remotejoy_name="RemoteJoy" +libretro_remotejoy_git_url="https://github.com/libretro/libretro-remotejoy.git" +# NEED A BUILD RULE: remotejoy -libretro_bluemsx_git_url="https://github.com/libretro/blueMSX-libretro.git" libretro_bluemsx_name="blueMSX" +libretro_bluemsx_git_url="https://github.com/libretro/blueMSX-libretro.git" libretro_bluemsx_build_makefile="Makefile.libretro" -libretro_fmsx_git_url="https://github.com/libretro/fmsx-libretro.git" libretro_fmsx_name="fMSX" +libretro_fmsx_git_url="https://github.com/libretro/fmsx-libretro.git" # IMPLICIT libretro_2048_git_url="https://github.com/libretro/libretro-2048.git" @@ -205,48 +211,51 @@ libretro_2048_build_makefile="Makefile.libretro" libretro_vecx_git_url="https://github.com/libretro/libretro-vecx.git" libretro_vecx_build_makefile="Makefile.libretro" -libretro_ppsspp_git_url="https://github.com/libretro/ppsspp.git" libretro_ppsspp_name="PPSSPP" +libretro_ppsspp_git_url="https://github.com/libretro/ppsspp.git" libretro_ppsspp_git_submodules="yes" +# NEED OPENGL CHECK: ppsspp -libretro_prosystem_git_url="https://github.com/libretro/prosystem-libretro.git" libretro_prosystem_name="ProSystem" +libretro_prosystem_git_url="https://github.com/libretro/prosystem-libretro.git" # IMPLICIT -libretro_o2em_git_url="https://github.com/libretro/libretro-o2em.git" libretro_o2em_name="O2EM" +libretro_o2em_git_url="https://github.com/libretro/libretro-o2em.git" # IMPLICIT -libretro_4do_git_url="https://github.com/libretro/4do-libretro.git" libretro_4do_name="4DO" +libretro_4do_git_url="https://github.com/libretro/4do-libretro.git" # IMPLICIT -libretro_catsfc_git_url="https://github.com/libretro/CATSFC-libretro.git" libretro_catsfc_name="CATSFC" +libretro_catsfc_git_url="https://github.com/libretro/CATSFC-libretro.git" # IMPLICIT -libretro_stonesoup_git_url="https://github.com/libretro/crawl-ref.git" libretro_stonesoup_name="Dungeon Crawl Stone Soup" +libretro_stonesoup_git_url="https://github.com/libretro/crawl-ref.git" libretro_stonesoup_git_submodules="clone" libretro_stonesoup_build_subdir="crawl-ref" libretro_stonesoup_build_makefile="Makefile.libretro" -libretro_hatari_git_url="https://github.com/libretro/hatari.git" libretro_hatari_name="Hatari" +libretro_hatari_git_url="https://github.com/libretro/hatari.git" libretro_hatari_build_makefile="Makefile.libretro" -libretro_tempgba_git_url="https://github.com/libretro/TempGBA-libretro.git" libretro_tempgba_name="TempGBA" +libretro_tempgba_git_url="https://github.com/libretro/TempGBA-libretro.git" +# NEED A BUILD RULE: tempgba -libretro_gpsp_git_url="https://github.com/libretro/gpsp.git" libretro_gpsp_name="gpSP" +libretro_gpsp_git_url="https://github.com/libretro/gpsp.git" # IMPLICIT -libretro_emux_git_url="https://github.com/libretro/emux.git" libretro_emux_name="Emux" +libretro_emux_git_url="https://github.com/libretro/emux.git" +# NEED CUSTOM RULE: emux -libretro_fuse_git_url="https://github.com/libretro/fuse-libretro.git" libretro_fuse_name="Fuse" +libretro_fuse_git_url="https://github.com/libretro/fuse-libretro.git" libretro_fuse_build_makefile="Makefile.libretro" libretro_fuse_build_platform="$FORMAT_COMPILER_TARGET_ALT" @@ -265,7 +274,7 @@ libretro_fuse_build_platform="$FORMAT_COMPILER_TARGET_ALT" # Defaults to "libretro-" # # fetch_rule Name of the core's fetch rule -# Always fetch_git for the time being +# Currently "git" (default) or "multi_git" # # git_url Source to fetch via git # REQUIRED for fetch actions diff --git a/rules.d/devkit-rules.sh b/rules.d/devkit-rules.sh new file mode 100644 index 00000000..a9eb3f74 --- /dev/null +++ b/rules.d/devkit-rules.sh @@ -0,0 +1,15 @@ +# vim: set ts=3 sw=3 noet ft=sh : bash + +libretro_devkit_name="libretro Developer's Kit" +# FIXME: Twinaphex, uncomment next line for libretro-super/libretrodb etc or delete, your choice +#libretro_devkit_dir="." +libretro_devkit_fetch_rule=multi_git +libretro_devkit_mgit_urls=4 +libretro_devkit_mgit_dir_0="libretro-manifest" +libretro_devkit_mgit_url_0="https://github.com/libretro/libretro-manifest.git" +libretro_devkit_mgit_dir_1="libretrodb" +libretro_devkit_mgit_url_1="https://github.com/libretro/libretrodb.git" +libretro_devkit_mgit_dir_2="libretro-dat-pull" +libretro_devkit_mgit_url_2="https://github.com/libretro/libretro-dat-pull.git" +libretro_devkit_mgit_dir_3="libretro-common" +libretro_devkit_mgit_url_3="https://github.com/libretro/libretro-common.git" diff --git a/rules.d/player-rules.sh b/rules.d/player-rules.sh new file mode 100644 index 00000000..00b4d669 --- /dev/null +++ b/rules.d/player-rules.sh @@ -0,0 +1,7 @@ +# vim: set ts=3 sw=3 noet ft=sh : bash + +libretro_retroarch_name="RetroArch" +libretro_retroarch_dir="retroarch" +libretro_retroarch_git_url="https://github.com/libretro/RetroArch.git" +libretro_retroarch_post_fetch_cmd="./fetch-submodules.sh" +