libretro-super/libretro-build.sh

462 lines
13 KiB
Bash
Raw Normal View History

2011-11-02 15:27:23 +00:00
#!/bin/sh
2013-05-08 10:39:37 +00:00
UNAME=$(uname)
if [ "`echo $UNAME | grep Linux`" ]; then
EXE="so"
elif [ "`echo $UNAME | grep BSD`" ]; then
EXE="so"
elif [ "`echo $UNAME | grep Darwin`" ]; then
EXE="dylib"
elif [ "`echo $UNAME | grep -i MINGW`" ]; then
EXE="dll"
else
EXE="so"
fi
2013-05-08 11:00:38 +00:00
# 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"
2013-05-08 10:39:37 +00:00
BASE_DIR=$(dirname "$SCRIPT")
RARCH_DIR=""$BASE_DIR"/dist"
RARCH_DIST_DIR="$RARCH_DIR/pc"
if [ -z "$JOBS" ]; then
JOBS=4
fi
2011-11-02 15:27:23 +00:00
die()
{
echo $1
2012-04-16 17:33:18 +00:00
#exit 1
2011-11-02 15:27:23 +00:00
}
2013-05-08 10:39:37 +00:00
ARCH=$(uname -m)
X86=false
X86_64=false
ARM=false
ARMV5=false
ARMV6=false
ARMV7=false
if [ $ARCH = x86_64 ]; then
echo "x86_64 CPU detected"
X86=true
X86_64=true
elif [ $ARCH = i686 ]; then
echo "x86_32 CPU detected"
X86=true
elif [ $ARCH = armv5tel ]; then
echo "ARMv5 CPU detected"
ARM=true
ARMV5=true
elif [ $ARCH = armv6l ]; then
echo "ARMv6 CPU detected"
ARM=true
ARMV6=true
elif [ $ARCH = armv7l ]; then
echo "ARMv7 CPU detected"
ARM=true
ARMV7=true
fi
2013-05-08 11:00:38 +00:00
if [ -z "$CC" ]; then
CC=gcc
fi
2012-04-16 17:33:18 +00:00
build_libretro_bsnes()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-bsnes/perf" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building bSNES performance ==="
2013-01-15 11:24:05 +00:00
cd libretro-bsnes/perf/higan
2013-04-30 01:26:46 +00:00
make compiler="$CC" ui=target-libretro profile=performance -j$JOBS clean || die "Failed to clean bSNES performance core"
make compiler="$CC" ui=target-libretro profile=performance -j$JOBS || die "Failed to build bSNES performance core"
2013-05-08 10:39:37 +00:00
cp -f out/libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bsnes-performance.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "bSNES performance not fetched, skipping ..."
fi
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2013-01-15 11:24:05 +00:00
if [ -d "libretro-bsnes/balanced" ]; then
echo "=== Building bSNES balanced ==="
cd libretro-bsnes/balanced/higan
2013-04-30 01:26:46 +00:00
make compiler="$CC" ui=target-libretro profile=balanced -j$JOBS clean || die "Failed to clean bSNES balanced core"
make compiler="$CC" ui=target-libretro profile=balanced -j$JOBS || die "Failed to build bSNES balanced core"
2013-05-08 10:39:37 +00:00
cp -f out/libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bsnes-balanced.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "bSNES compat not fetched, skipping ..."
fi
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-bsnes" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building bSNES accuracy ==="
2013-01-15 11:24:05 +00:00
cd libretro-bsnes/higan
2013-04-30 01:26:46 +00:00
make compiler="$CC" ui=target-libretro profile=accuracy -j$JOBS clean || die "Failed to clean bSNES accuracy core"
make compiler="$CC" ui=target-libretro profile=accuracy -j$JOBS || die "Failed to build bSNES accuracy core"
2013-05-08 10:39:37 +00:00
cp -f out/libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bsnes-accuracy.${EXE}
2011-11-02 15:27:23 +00:00
fi
}
2012-11-08 21:55:59 +00:00
build_libretro_mednafen()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-11-08 21:55:59 +00:00
if [ -d "libretro-mednafen" ]; then
echo "=== Building Mednafen ==="
cd libretro-mednafen
2012-11-25 02:47:40 +00:00
for core in psx pce-fast wswan ngp gba snes vb
2012-11-08 21:55:59 +00:00
do
2013-04-30 01:26:46 +00:00
make core=${core} -j$JOBS clean || die "Failed to clean mednafen/${core}"
make core=${core} -j$JOBS || die "Failed to build mednafen/${core}"
2013-05-08 10:39:37 +00:00
cp mednafen_$(echo ${core} | tr '[\-]' '[_]')_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-mednafen-${core}.${EXE}
2012-11-08 21:55:59 +00:00
done
else
echo "Mednafen not fetched, skipping ..."
fi
}
2013-05-05 12:58:55 +00:00
build_libretro_mame078()
{
cd $BASE_DIR
if [ -d "libretro-mame078" ]; then
echo "=== Building MAME 0.78 ==="
cd libretro-mame078
make -j$JOBS clean || die "Failed to clean MAME 0.78"
make -j$JOBS || die "Failed to build MAME 0.78"
2013-05-10 08:50:08 +00:00
cp mame078_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-mame078.${EXE}
2013-05-05 12:58:55 +00:00
else
echo "MAME 0.78 not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_s9x()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-s9x" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building SNES9x ==="
2012-04-16 17:33:18 +00:00
cd libretro-s9x/libretro
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean SNES9x"
make -j$JOBS || die "Failed to build SNES9x"
2013-05-08 10:39:37 +00:00
cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-snes9x.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "SNES9x not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_s9x_next()
2011-11-08 20:20:44 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-s9x-next" ]; then
2011-11-08 20:20:44 +00:00
echo "=== Building SNES9x-Next ==="
2012-04-16 17:33:18 +00:00
cd libretro-s9x-next/
2013-04-30 01:26:46 +00:00
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean SNES9x-Next"
make -f Makefile.libretro -j$JOBS || die "Failed to build SNES9x-Next"
2013-05-08 10:39:37 +00:00
cp snes9x_next_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-snes9x-next.${EXE}
2011-11-08 20:20:44 +00:00
else
echo "SNES9x-Next not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_genplus()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-genplus" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building Genplus GX ==="
2012-04-16 17:33:18 +00:00
cd libretro-genplus/
2013-04-30 01:26:46 +00:00
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Genplus GX"
make -f Makefile.libretro -j$JOBS || die "Failed to build Genplus GX"
2013-05-08 10:39:37 +00:00
cp genesis_plus_gx_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-genplus.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "Genplus GX not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_fba()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-fba" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building Final Burn Alpha ==="
2012-04-16 17:33:18 +00:00
cd libretro-fba/
2013-04-30 01:26:46 +00:00
cd svn-current/trunk
make -f makefile.libretro clean || die "Failed to clean Final Burn Alpha"
make -f makefile.libretro -j$JOBS || die "Failed to build Final Burn Alpha"
2013-05-08 10:39:37 +00:00
cp fb_alpha_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-fba.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "Final Burn Alpha not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_vba()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-vba" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building VBA-Next ==="
2012-04-16 17:33:18 +00:00
cd libretro-vba/
2013-04-30 01:26:46 +00:00
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean VBA-Next"
make -f Makefile.libretro -j$JOBS || die "Failed to build VBA-Next"
2013-05-08 10:39:37 +00:00
cp vba_next_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-vba.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "VBA-Next not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_bnes()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-bnes" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building bNES ==="
2012-04-16 17:33:18 +00:00
cd libretro-bnes
2011-11-02 15:27:23 +00:00
mkdir -p obj
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean bNES"
make -j$JOBS || die "Failed to build bNES"
2013-05-08 10:39:37 +00:00
cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bnes.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "bNES not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_fceu()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-fceu" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building FCEU ==="
2012-04-16 17:33:18 +00:00
cd libretro-fceu
2013-04-30 01:26:46 +00:00
make -C fceumm-code -f Makefile.libretro -j$JOBS clean || die "Failed to clean FCEU"
make -C fceumm-code -f Makefile.libretro -j$JOBS || die "Failed to build FCEU"
2013-05-08 10:39:37 +00:00
cp fceumm-code/fceumm_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-fceu.${EXE}
2011-11-02 15:27:23 +00:00
else
2011-11-19 19:53:53 +00:00
echo "FCEU not fetched, skipping ..."
2011-11-02 15:27:23 +00:00
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_gambatte()
2011-11-02 15:27:23 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-gambatte" ]; then
2011-11-02 15:27:23 +00:00
echo "=== Building Gambatte ==="
2012-04-16 17:33:18 +00:00
cd libretro-gambatte/libgambatte
2013-04-30 01:26:46 +00:00
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Gambatte"
make -f Makefile.libretro -j$JOBS || die "Failed to build Gambatte"
2013-05-08 10:39:37 +00:00
cp gambatte_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-gambatte.${EXE}
2011-11-02 15:27:23 +00:00
else
echo "Gambatte not fetched, skipping ..."
fi
}
2012-04-16 17:33:18 +00:00
build_libretro_meteor()
2012-01-03 14:15:33 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-16 17:33:18 +00:00
if [ -d "libretro-meteor" ]; then
2012-01-03 14:15:33 +00:00
echo "=== Building Meteor ==="
2012-04-16 17:33:18 +00:00
cd libretro-meteor/libretro
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean Meteor"
make -j$JOBS || die "Failed to build Meteor"
2013-05-08 10:39:37 +00:00
cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-meteor.${EXE}
2012-01-03 14:15:33 +00:00
else
echo "Meteor not fetched, skipping ..."
fi
}
2012-04-22 18:45:51 +00:00
build_libretro_nx()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-04-22 18:45:51 +00:00
if [ -d "libretro-nx" ]; then
echo "=== Building NXEngine ==="
2013-01-16 18:29:34 +00:00
cd libretro-nx
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean NXEngine"
make -j$JOBS || die "Failed to build NXEngine"
2013-05-08 10:39:37 +00:00
cp nxengine_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-nx.${EXE}
2012-04-22 18:45:51 +00:00
else
echo "NXEngine not fetched, skipping ..."
fi
}
2011-11-02 15:27:23 +00:00
2012-05-16 21:22:42 +00:00
build_libretro_prboom()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-05-16 21:22:42 +00:00
if [ -d "libretro-prboom" ]; then
echo "=== Building PRBoom ==="
cd libretro-prboom
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean PRBoom"
make -j$JOBS || die "Failed to build PRBoom"
2013-05-08 10:39:37 +00:00
cp prboom_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-prboom.${EXE}
2012-05-16 21:22:42 +00:00
else
echo "PRBoom not fetched, skipping ..."
fi
}
2012-08-28 08:07:58 +00:00
build_libretro_stella()
2012-08-28 07:49:17 +00:00
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-08-28 08:07:58 +00:00
if [ -d "libretro-stella" ]; then
echo "=== Building Stella ==="
cd libretro-stella
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean Stella"
make -j$JOBS || die "Failed to build Stella"
2013-05-08 10:39:37 +00:00
cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-stella.${EXE}
2012-08-28 07:49:17 +00:00
else
2012-08-28 08:07:58 +00:00
echo "Stella not fetched, skipping ..."
fi
}
2012-10-31 20:05:58 +00:00
build_libretro_desmume()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2012-10-31 20:05:58 +00:00
if [ -d "libretro-desmume" ]; then
echo "=== Building Desmume ==="
cd libretro-desmume
if [ $X86 = true ]; then
echo "=== Building Desmume with x86 JIT recompiler ==="
make -f Makefile.libretro DESMUME_JIT=1 -j$JOBS clean || die "Failed to clean Desmume"
make -f Makefile.libretro DESMUME_JIT=1 -j$JOBS || die "Failed to build Desmume"
elif [ $ARMV7 = true ]; then
echo "=== Building Desmume with ARMv7 JIT recompiler ==="
make -f Makefile.libretro platform=arm DESMUME_JIT=1 -j$JOBS clean || die "Failed to clean Desmume"
make -f Makefile.libretro platform=arm DESMUME_JIT=1 -j$JOBS || die "Failed to build Desmume"
else
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Desmume"
make -f Makefile.libretro -j$JOBS || die "Failed to build Desmume"
fi
2013-05-08 10:39:37 +00:00
cp desmume_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-desmume.${EXE}
2012-10-31 20:05:58 +00:00
else
echo "Desmume not fetched, skipping ..."
fi
}
2012-08-28 08:07:58 +00:00
build_libretro_pcsx_rearmed()
{
cd $BASE_DIR
pwd
if [ -d "libretro-pcsx-rearmed" ]; then
echo "=== Building PCSX ReARMed ==="
cd libretro-pcsx-rearmed
if [ $ARMV7 = true ]; then
echo "=== Building PCSX ReARMed (ARMV7 NEON) ==="
make -f Makefile.libretro platform=arm -j$JOBS clean || die "Failed to clean PCSX ReARMed"
make -f Makefile.libretro platform=arm -j$JOBS || die "Failed to build PCSX ReARMed"
else
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean PCSX ReARMed"
make -f Makefile.libretro -j$JOBS || die "Failed to build PCSX ReARMed"
fi
2013-05-10 08:50:08 +00:00
cp pcsx_rearmed_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-pcsx-rearmed.${EXE}
else
echo "PCSX ReARMed not fetched, skipping ..."
fi
}
2013-01-10 13:33:48 +00:00
build_libretro_quicknes()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2013-01-10 13:33:48 +00:00
if [ -d "libretro-quicknes" ]; then
echo "=== Building QuickNES ==="
cd libretro-quicknes/libretro
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean QuickNES"
make -j$JOBS || die "Failed to build QuickNES"
2013-05-08 10:39:37 +00:00
cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-quicknes.${EXE}
2013-01-10 13:33:48 +00:00
else
echo "QuickNES not fetched, skipping ..."
fi
}
2013-01-16 08:08:42 +00:00
build_libretro_nestopia()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
2013-01-16 08:08:42 +00:00
if [ -d "libretro-nestopia" ]; then
echo "=== Building Nestopia ==="
cd libretro-nestopia/libretro
2013-04-30 01:26:46 +00:00
make -j$JOBS clean || die "Failed to clean Nestopia"
make -j$JOBS || die "Failed to build Nestopia"
2013-05-08 10:39:37 +00:00
cp nestopia_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-nestopia.${EXE}
2013-01-16 08:08:42 +00:00
else
echo "Nestopia not fetched, skipping ..."
fi
}
2013-01-10 13:33:48 +00:00
build_libretro_tyrquake()
{
2013-05-08 10:39:37 +00:00
cd "$BASE_DIR"
if [ -d "libretro-tyrquake" ]; then
echo "=== Building Tyr Quake ==="
cd libretro-tyrquake
2013-04-30 01:26:46 +00:00
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Tyr Quake"
make -f Makefile.libretro -j$JOBS || die "Failed to build Tyr Quake"
2013-05-08 10:39:37 +00:00
cp tyrquake_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-tyrquake.${EXE}
else
echo "Tyr Quake not fetched, skipping ..."
fi
}
build_libretro_dosbox()
{
cd $BASE_DIR
if [ -d "libretro-dosbox" ]; then
echo "=== Building DOSbox ==="
cd libretro-dosbox
make -f Makefile.libretro -j$JOBS clean || die "Failed to clean DOSbox"
make -f Makefile.libretro -j$JOBS || die "Failed to build DOSbox"
2013-05-10 08:50:08 +00:00
cp dosbox_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-dosbox.${EXE}
else
echo "DOSbox not fetched, skipping ..."
fi
}
2013-05-06 09:11:17 +00:00
build_libretro_scummvm()
{
cd $BASE_DIR
if [ -d "libretro-scummvm" ]; then
echo "=== Building ScummVM ==="
cd libretro-scummvm/backends/platform/libretro/build
make -f Makefile -j$JOBS clean || die "Failed to clean ScummVM"
make -f Makefile -j$JOBS || die "Failed to build ScummVM"
2013-05-10 08:50:08 +00:00
cp scummvm_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-scummvm.${EXE}
2013-05-06 09:11:17 +00:00
else
echo "ScummVM not fetched, skipping ..."
fi
}
2013-05-03 09:32:01 +00:00
mkdir -p "$RARCH_DIST_DIR"
if [ $1 ]; then
$1
else
build_libretro_desmume
build_libretro_bsnes
build_libretro_mednafen
build_libretro_s9x
build_libretro_s9x_next
build_libretro_genplus
build_libretro_fba
build_libretro_vba
build_libretro_bnes
build_libretro_fceu
build_libretro_gambatte
build_libretro_meteor
build_libretro_nx
build_libretro_prboom
build_libretro_stella
build_libretro_quicknes
build_libretro_nestopia
build_libretro_tyrquake
build_libretro_pcsx_rearmed
build_libretro_mame078
build_libretro_dosbox
2013-05-06 09:11:17 +00:00
build_libretro_scummvm
fi