diff --git a/libretro-build-common.sh b/libretro-build-common.sh index e65bf9df..d07afad1 100755 --- a/libretro-build-common.sh +++ b/libretro-build-common.sh @@ -218,7 +218,7 @@ build_makefile() { fi # TODO: Do this better - make_cmdline="$make_cmdline platform=\"${core_build_platform:-$FORMAT_COMPILER_TARGET}\"" + make_cmdline="$make_cmdline platform=\"$core_build_platform\"" [ -n "$JOBS" ] && make_cmdline="$make_cmdline -j$JOBS" @@ -251,6 +251,8 @@ build_makefile() { # # $1 Name of the core to build libretro_build_core() { + local opengl_type + eval "core_name=\$libretro_${1}_name" [ -z "$core_name" ] && core_name="$1" echo "=== $core_name" @@ -261,16 +263,36 @@ libretro_build_core() { eval "core_dir=\$libretro_${1}_dir" [ -z "$core_dir" ] && core_dir="libretro-$1" + eval "core_build_opengl=\$libretro_${1}_build_opengl" + if [ -n "$core_build_opengl" ]; then + if [[ "$core_build_opengl" = "yes" || "$core_build_opengl" = "optional" ]]; then + if [ -n "$BUILD_LIBRETRO_GL" ]; then + if [ -n "$ENABLE_GLES" ]; then + opengl_type="-gles" + else + opengl_type="-opengl" + fi + else + if [ "$core_build_opengl" = "yes" ]; then + echo "$1 requires OpenGL (which is disabled), skipping..." + return 0 + fi + fi + else + echo "libretro_build_core:Unknown OpenGL setting for $1: \"$core_build_opengl\"." + return 1 + fi + fi + case "$core_build_rule" in build_makefile) eval "core_build_makefile=\$libretro_${1}_build_makefile" - eval echo "core_build_makefile=\$libretro_${1}_build_makefile" - eval "core_build_subdir=\$libretro_${1}_build_subdir" - eval echo "core_build_subdir=\$libretro_${1}_build_subdir" + # TODO: Really, clean this up... eval "core_build_platform=\$libretro_${1}_build_platform" - eval echo "core_build_platform=\$libretro_${1}_build_platform" + core_build_platform="${core_build_platform:-$FORMAT_COMPILER_TARGET}$opengl_type" + eval echo "core_build_platform=\$libretro_${1}_build_platform$opengl_type" echo "Building ${1}..." $core_build_rule $1 @@ -326,27 +348,6 @@ build_libretro_emux() { build_save_revision $? "emux" } -build_libretro_ffmpeg() { - if check_opengl; then - build_libretro_generic_makefile "ffmpeg" "libretro" "Makefile" $FORMAT_COMPILER_TARGET - reset_compiler_targets - fi -} - -build_libretro_3dengine() { - if check_opengl; then - build_libretro_generic_makefile "3dengine" "." "Makefile" $FORMAT_COMPILER_TARGET - reset_compiler_targets - fi -} - -build_libretro_ppsspp() { - if check_opengl; then - build_libretro_generic_makefile "ppsspp" "libretro" "Makefile" $FORMAT_COMPILER_TARGET - reset_compiler_targets - fi -} - build_libretro_mame_modern() { build_dir="$WORKDIR/libretro-mame" if [ -d "$build_dir" ]; then @@ -599,6 +600,9 @@ create_dist_dir build_libretro_2048() { libretro_build_core 2048 } +build_libretro_3dengine() { + libretro_build_core 3dengine +} build_libretro_4do() { libretro_build_core 4do } @@ -653,6 +657,9 @@ build_libretro_fb_alpha() { build_libretro_fceumm() { libretro_build_core fceumm } +build_libretro_ffmpeg() { + libretro_build_core ffmpeg +} build_libretro_fmsx() { libretro_build_core fmsx } @@ -698,6 +705,9 @@ build_libretro_pcsx_rearmed() { build_libretro_picodrive() { libretro_build_core picodrive } +build_libretro_ppsspp() { + libretro_build_core ppsspp +} build_libretro_prboom() { libretro_build_core prboom } diff --git a/libretro-build.sh b/libretro-build.sh index ebc7fe46..c73d582a 100755 --- a/libretro-build.sh +++ b/libretro-build.sh @@ -165,12 +165,12 @@ else libretro_build_core dinothawr libretro_build_core virtualjaguar build_libretro_mupen64 - build_libretro_3dengine + libretro_build_core 3dengine if [ $FORMAT_COMPILER_TARGET != "ios" ]; then # These don't currently build on iOS build_libretro_bnes - build_libretro_ffmpeg - build_libretro_ppsspp + build_libretro_core ffmpeg + build_libretro_core ppsspp fi libretro_build_core o2em libretro_build_core hatari diff --git a/rules.d/core-rules.sh b/rules.d/core-rules.sh index ff9c10c9..0c2d1e59 100644 --- a/rules.d/core-rules.sh +++ b/rules.d/core-rules.sh @@ -158,7 +158,8 @@ libretro_mame_git_url="https://github.com/libretro/mame.git" libretro_ffmpeg_name="FFmpeg" libretro_ffmpeg_git_url="https://github.com/libretro/FFmpeg.git" -# NEED OPENGL CHECK: ffmpeg +libretro_ffmpeg_build_subdir="libretro" +libretro_ffmpeg_build_opengl="optional" libretro_bsnes_cplusplus98_name="bsnes C++98 (v0.85)" libretro_bsnes_cplusplus98_git_url="https://github.com/libretro/bsnes-libretro-cplusplus98.git" @@ -191,7 +192,7 @@ libretro_uae_git_url="https://github.com/libretro/libretro-uae.git" libretro_3dengine_name="3DEngine" libretro_3dengine_git_url="https://github.com/libretro/libretro-3dengine.git" -# NEED OPENGL CHECK: 3dengine +libretro_3dengine_build_opengl=yes libretro_remotejoy_name="RemoteJoy" libretro_remotejoy_git_url="https://github.com/libretro/libretro-remotejoy.git" @@ -214,7 +215,8 @@ libretro_vecx_build_makefile="Makefile.libretro" libretro_ppsspp_name="PPSSPP" libretro_ppsspp_git_url="https://github.com/libretro/ppsspp.git" libretro_ppsspp_git_submodules="yes" -# NEED OPENGL CHECK: ppsspp +libretro_ppsspp_build_subdir="libretro" +libretro_ppsspp_build_opengl="yes" libretro_prosystem_name="ProSystem" libretro_prosystem_git_url="https://github.com/libretro/prosystem-libretro.git" @@ -291,6 +293,9 @@ libretro_fuse_build_platform="$FORMAT_COMPILER_TARGET_ALT" # build_platform Set to override the default platform # (e.g., $FORMAT_COMPILER_TARGET_ALT) # +# build_opengl Set to "optional" to use OpenGL/GLES if available +# Set to "yes" if the core requires it +# # Example: # # libretro_dinothawr_git_url="https://github.com/libretro/Dinothawr.git"