libretro-super/libretro-build-android-mk.sh

182 lines
3.6 KiB
Bash
Raw Normal View History

#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
2013-02-10 12:30:38 -05:00
. ./libretro-config.sh
#split TARGET_ABI string into an array we can iterate over
IFS=' ' read -ra ABIS <<< "$TARGET_ABIS"
# BSDs don't have readlink -f
read_link()
{
TARGET_FILE="$1"
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(readlink "$TARGET_FILE")
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
done
PHYS_DIR=$(pwd -P)
RESULT="$PHYS_DIR/$TARGET_FILE"
echo $RESULT
}
SCRIPT=$(read_link "$0")
echo "Script: $SCRIPT"
BASE_DIR=$(dirname $SCRIPT)
RARCH_DIR=$BASE_DIR/dist
RARCH_DIST_DIR=$RARCH_DIR/android
FORMAT=_android
2013-05-17 20:11:06 -04:00
FORMAT_EXT=so
2013-02-10 12:30:38 -05:00
die()
{
echo $1
#exit 1
2013-02-10 12:30:38 -05:00
}
# $1 is core name
# $2 is subdir (if there's no subdir, put "." here)
build_libretro_generic_makefile()
2014-06-21 12:34:11 -04:00
{
cd $BASE_DIR
if [ -d "libretro-${1}" ]; then
echo "=== Building ${1} ==="
cd libretro-${1}
cd ${2}
for a in "${ABIS[@]}"; do
if [ -z "${NOCLEAN}" ]; then
ndk-build clean APP_ABI=${a} || die "Failed to clean ${a} ${1}"
fi
ndk-build -j$JOBS APP_ABI=${a} || die "Failed to build ${a} ${1}"
cp ../libs/${a}/libretro.${FORMAT_EXT} $RARCH_DIST_DIR/${a}/${1}_libretro${FORMAT}.${FORMAT_EXT}
done
else
echo "${1} not fetched, skipping ..."
fi
2014-06-21 12:34:11 -04:00
}
2015-11-09 08:32:11 -05:00
build_libretro_bsnes()
{
cd $BASE_DIR
if [ -d "libretro-${1}" ]; then
echo "=== Building ${1} ==="
cd libretro-${1}/
cd ${2}
for a in "${ABIS[@]}"; do
if [ -z "${NOCLEAN}" ]; then
ndk-build clean APP_ABI=${a} || die "Failed to clean ${a} ${1}"
fi
ndk-build -j$JOBS APP_ABI=${a} || die "Failed to build ${a} ${1}"
2015-11-09 08:42:28 -05:00
cp ../libs/${a}/libretro_${1}.${FORMAT_EXT} $RARCH_DIST_DIR/${a}/${1}_libretro${FORMAT}.${FORMAT_EXT}
2015-11-09 08:32:11 -05:00
done
else
echo "${1} not fetched, skipping ..."
fi
}
2014-08-22 09:39:20 -04:00
build_libretro_desmume() {
build_libretro_generic_makefile "desmume" "desmume/src/libretro/jni"
}
2014-08-22 09:39:20 -04:00
build_libretro_fb_alpha() {
build_libretro_generic_makefile "fb_alpha" "svn-current/trunk/projectfiles/libretro-android/jni"
2014-08-22 09:39:20 -04:00
}
create_dist_dir()
{
if [ -d $RARCH_DIR ]; then
echo "Directory $RARCH_DIR already exists, skipping creation..."
else
mkdir $RARCH_DIR
fi
if [ -d $RARCH_DIST_DIR ]; then
echo "Directory $RARCH_DIST_DIR already exists, skipping creation..."
else
mkdir $RARCH_DIST_DIR
fi
for a in "${ABIS[@]}"; do
if [ -d $RARCH_DIST_DIR/${a} ]; then
echo "Directory $RARCH_DIST_DIR/${a} already exists, skipping creation..."
else
mkdir $RARCH_DIST_DIR/${a}
fi
done
}
2014-07-12 22:22:50 -04:00
create_dist_dir
if [ $1 ]; then
WANT_CORES="$1"
else
WANT_CORES=" \
2048 \
4do \
bluemsx \
fmsx \
mednafen_lynx \
mednafen_ngp \
mednafen_pce_fast \
mednafen_supergrafx \
mednafen_pcfx \
mednafen_vb \
mednafen_wswan \
mednafen_psx \
catsfc \
snes9x \
snes9x_next \
genesis_plus_gx \
virtualjaguar \
stella \
gpsp \
dosbox \
picodrive \
3dengine \
prosystem \
meteor \
nxengine \
o2em \
2015-11-08 21:28:21 -05:00
pcsx_rearmed \
2015-11-08 21:32:56 -05:00
mupen64plus \
2015-11-08 21:35:46 -05:00
vecx \
nestopia \
2015-11-08 21:38:20 -05:00
tgbdual \
2015-11-08 21:40:55 -05:00
quicknes \
handy \
2015-11-08 21:55:35 -05:00
gambatte \
prboom \
2015-11-08 22:10:18 -05:00
tyrquake \
vba_next \
2015-11-09 07:38:55 -05:00
vbam \
2015-11-09 07:44:16 -05:00
fceumm \
2015-11-09 08:42:28 -05:00
dinothawr \
bsnes_mercury_performance \
bsnes_performance"
fi
for core in $WANT_CORES; do
path="jni"
if [ $core = "snes9x" ] || [ $core = "genesis_plus_gx" ] || [ $core = "meteor" ] || [ $core = "nestopia" ] || [ $core = "yabause" ] || [ $core = "vbam" ] || [ $core = "vba_next" ] || [ $core = "ppsspp" ]; then
path="libretro/jni"
fi
if [ $core = "gambatte" ]; then
path="libgambatte/libretro/jni"
fi
2015-11-09 08:42:28 -05:00
if [ $core = "bsnes_mercury_performance" ] || [ $core = "bsnes_performance" ]; then
path="target-libretro/jni"
build_libretro_bsnes $core $path
else
build_libretro_generic_makefile $core $path
fi
done