1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
. ./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
FORMAT_EXT=so
die()
{
echo $1
#exit 1
}
# $1 is core name
# $2 is subdir (if there's no subdir, put "." here)
# $3 is appendage to core name for output JNI file
build_libretro_generic_makefile()
{
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${3}.${FORMAT_EXT} $RARCH_DIST_DIR/${a}/${1}_libretro${FORMAT}.${FORMAT_EXT}
done
else
echo "${1} not fetched, skipping ..."
fi
}
#same as above for armv7 with neon since android ndk does not see it as as its own architecture
build_libretro_generic_makefile_armv7neon()
{
cd $BASE_DIR
if [ -d "libretro-${1}" ]; then
echo "=== Attempting armv7-neon Build ==="
cd libretro-${1}
cd ${2}
if [ -z "${NOCLEAN}" ]; then
ndk-build clean APP_ABI="armeabi-v7a" NDK_OUT="../obj/local/armeabi-v7a-neon" NDK_LIBS_OUT="../libs/armeabi-v7a-neon" V7NEONOPTIMIZATION="1" || die "Failed to clean armeabi_v7a_neon ${1}"
fi
ndk-build -j$JOBS APP_ABI="armeabi-v7a" NDK_OUT="../obj/local/armeabi-v7a-neon" NDK_LIBS_OUT="../libs/armeabi-v7a-neon" V7NEONOPTIMIZATION="1" || die "Failed to build armeabi_v7a_neon ${1}"
mkdir -p $RARCH_DIST_DIR/armeabi-v7a-neon
cp ../libs/armeabi-v7a-neon/armeabi-v7a/libretro${3}.${FORMAT_EXT} $RARCH_DIST_DIR/armeabi-v7a-neon/${1}_libretro${FORMAT}.${FORMAT_EXT}
else
echo "${1} not fetched, skipping ..."
fi
}
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
}
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 \
pcsx_rearmed \
mupen64plus \
vecx \
nestopia \
tgbdual \
quicknes \
handy \
gambatte \
prboom \
tyrquake \
vba_next \
vbam \
fceumm \
dinothawr \
desmume \
fb_alpha \
fb_alpha_new \
bsnes_mercury_performance \
bsnes_performance \
mame2000 \
mame2003 \
pocketsnes"
fi
for core in $WANT_CORES; do
path="jni"
append=""
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
if [ $core = "desmume" ]; then
path="desmume/src/libretro/jni"
fi
if [ $core = "fb_alpha" ]; then
path="svn-current/trunk/projectfiles/libretro-android/jni"
fi
if [ $core = "bsnes_mercury_performance" ] || [ $core = "bsnes_performance" ]; then
path="target-libretro/jni"
append="_$core"
fi
build_libretro_generic_makefile $core $path $append
build_libretro_generic_makefile_armv7neon $core $path $append
done
|