RetroArch/dist-scripts/dist-cores.sh

341 lines
12 KiB
Bash
Raw Normal View History

#!/bin/sh
. ../version.all
PLATFORM=$1
2015-09-01 17:31:34 +02:00
SALAMANDER=no
MAKEFILE_GRIFFIN=no
2015-09-01 17:14:14 +02:00
# PSP
if [ $PLATFORM = "unix" ] ; then
platform=unix
SALAMANDER=no
EXT=a
mkdir -p ../pkg/${platform}/
# For statically linked cores, we need to configure once
cd ..
LDFLAGS=-L. ./configure --disable-dynamic
cd dist-scripts
2016-10-10 10:49:09 +02:00
2018-12-31 13:47:58 +01:00
elif [ $PLATFORM = "ps2" ] ; then
platform=ps2
SALAMANDER=yes
2018-12-31 13:47:58 +01:00
EXT=a
2020-07-01 17:51:16 +02:00
OPTS=release
2018-12-31 13:47:58 +01:00
mkdir -p ../pkg/${platform}/cores/
elif [ $PLATFORM = "psp1" ] ; then
2015-09-01 17:14:14 +02:00
platform=psp1
2015-09-01 17:31:34 +02:00
SALAMANDER=yes
2015-09-02 12:34:05 +02:00
EXT=a
2015-09-01 17:14:14 +02:00
mkdir -p ../pkg/${platform}/cores/
2019-11-19 09:58:58 +01:00
make -C ../bootstrap/${platform}/kernel_functions_prx/ clean || exit 1
make -C ../bootstrap/${platform}/kernel_functions_prx/ || exit 1
2015-09-01 17:14:14 +02:00
cp -f ../kernel_functions.prx ../pkg/${platform}/kernel_functions.prx
2015-09-01 17:31:34 +02:00
# Vita
elif [ $PLATFORM = "vita" ] ; then
platform=vita
2016-10-10 10:49:09 +02:00
SALAMANDER=yes
2015-09-02 12:34:05 +02:00
EXT=a
2016-08-02 00:57:00 +02:00
mkdir -p ../pkg/vita/vpk
2018-09-28 01:10:25 +02:00
# Nintendo Switch (libnx)
elif [ $PLATFORM = "libnx" ] ; then
platform=libnx
EXT=a
# CTR/3DS
elif [ $PLATFORM = "ctr" ] ; then
platform=ctr
SALAMANDER=yes
EXT=a
2018-05-19 09:59:47 -07:00
mkdir -p ../pkg/${platform}/build/cia
mkdir -p ../pkg/${platform}/build/3dsx
mkdir -p ../pkg/${platform}/build/rom
# Emscripten
elif [ $PLATFORM = "emscripten" ] ; then
platform=emscripten
EXT=bc
if [ -z "$EMSCRIPTEN" ] ; then
echo "run this script with emmake. Ex: emmake $0"
2019-11-11 15:05:18 +01:00
exit 1
fi
# Wii
elif [ $PLATFORM = "wii" ] ; then
platform=wii
MAKEFILE_GRIFFIN=yes
SALAMANDER=yes
2015-09-02 12:34:05 +02:00
EXT=a
# NGC
elif [ $PLATFORM = "ngc" ] ; then
platform=ngc
MAKEFILE_GRIFFIN=yes
2015-09-02 12:34:05 +02:00
EXT=a
# PSL1GHT
elif [ $PLATFORM = "psl1ght" ] ; then
platform=psl1ght
SALAMANDER=yes
EXT=a
ps3appid=SSNE10001
2020-05-11 19:15:01 +02:00
elif [ $PLATFORM = "dos" ]; then
platform=dos
MAKEFILE_GRIFFIN=yes
EXT=a
2020-05-12 17:39:04 +02:00
SALAMANDER=yes
2015-09-01 17:07:13 +02:00
fi
# Cleanup Salamander core if it exists
2015-09-01 17:31:34 +02:00
if [ $SALAMANDER = "yes" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform}.salamander clean || exit 1
2015-09-01 17:31:34 +02:00
fi
# Cleanup existing core if it exists
if [ $MAKEFILE_GRIFFIN = "yes" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
elif [ $PLATFORM = "unix" ]; then
2019-11-19 09:58:58 +01:00
LINK=g++ make -C ../ -f Makefile clean || exit 1
2015-09-01 17:07:13 +02:00
else
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} clean || exit 1
2015-09-01 17:07:13 +02:00
fi
2015-09-01 17:31:34 +02:00
# Compile Salamander core
if [ $SALAMANDER = "yes" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform}.salamander $OPTS || exit 1
if [ $PLATFORM = "ps2" ] ; then
2020-07-06 10:22:19 +02:00
mv -f ../raboot.elf ../pkg/${platform}/raboot.elf
fi
if [ $PLATFORM = "psp1" ] ; then
mv -f ../EBOOT.PBP ../pkg/${platform}/EBOOT.PBP
fi
2020-05-12 17:39:04 +02:00
if [ $platform = "dos" ] ; then
mkdir -p ../pkg/${platform}
mv -f ../retrodos_salamander.exe ../pkg/${platform}/RETRODOS.EXE
fi
2016-10-10 10:49:09 +02:00
if [ $PLATFORM = "vita" ] ; then
mkdir -p ../pkg/${platform}/retroarch.vpk/vpk/sce_sys/livearea/contents
2017-04-28 08:29:58 +02:00
vita-make-fself -c -s ../retroarchvita_salamander.velf ../pkg/${platform}/retroarch.vpk/vpk/eboot.bin
2019-10-03 13:58:23 +02:00
vita-mksfoex -s TITLE_ID=RETROVITA "RetroArch" -d ATTRIBUTE2=12 ../pkg/${platform}/retroarch.vpk/vpk/sce_sys/param.sfo
2016-10-10 10:49:09 +02:00
cp ../pkg/${platform}/assets/ICON0.PNG ../pkg/${platform}/retroarch.vpk/vpk/sce_sys/icon0.png
cp -R ../pkg/${platform}/assets/livearea ../pkg/${platform}/retroarch.vpk/vpk/sce_sys/
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform}.salamander clean || exit 1
2016-10-10 10:49:09 +02:00
fi
if [ $PLATFORM = "ctr" ] ; then
2018-05-19 09:59:47 -07:00
mv -f ../retroarch_3ds_salamander.cia ../pkg/${platform}/build/cia/retroarch_3ds.cia
2018-05-19 11:35:12 -07:00
mkdir -p ../pkg/${platform}/build/3dsx/3ds/RetroArch
mv -f ../retroarch_3ds_salamander.3dsx ../pkg/${platform}/build/3dsx/3ds/RetroArch/RetroArch.3dsx
mv -f ../retroarch_3ds_salamander.smdh ../pkg/${platform}/build/3dsx/3ds/RetroArch/RetroArch.smdh
2018-05-19 09:59:47 -07:00
# the .3ds port cant use salamander since you can only have one ROM on a cartridge at once
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform}.salamander clean || exit 1
fi
2015-09-28 03:05:11 +02:00
if [ $PLATFORM = "wii" ] ; then
mv -f ../retroarch-salamander_wii.dol ../pkg/${platform}/boot.dol
fi
2015-09-01 17:31:34 +02:00
fi
2016-08-01 23:28:23 -05:00
COUNTER=0
2016-08-02 00:57:00 +02:00
2018-09-29 12:20:43 -05:00
if [ $PLATFORM = "libnx" ]; then
2018-09-29 12:46:19 -05:00
echo Buildbot: building static core for ${platform}
mkdir -p ../pkg/${platform}/switch
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} HAVE_STATIC_DUMMY=1 -j3 || exit 1
2018-09-29 12:20:43 -05:00
mv -f ../retroarch_switch.nro ../pkg/${platform}/switch/retroarch_switch.nro
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} clean || exit 1
2018-09-29 12:20:43 -05:00
fi
#for f in *_${platform}.${EXT} ; do
for f in `ls -v *_${platform}.${EXT}`; do
2018-09-29 12:46:19 -05:00
echo Buildbot: building ${name} for ${platform}
2015-09-02 12:34:05 +02:00
name=`echo "$f" | sed "s/\(_libretro_${platform}\|\).${EXT}$//"`
2016-09-28 19:43:39 -05:00
async=0
pthread=0
lto=0
whole_archive=
2015-09-01 18:27:49 +02:00
big_stack=
2016-10-10 10:49:09 +02:00
if [ $name = "nxengine" ] ; then
echo "Applying whole archive linking..."
whole_archive="WHOLE_ARCHIVE_LINK=1"
2015-09-01 17:31:34 +02:00
elif [ $name = "tyrquake" ] ; then
echo "Applying big stack..."
lto=0
big_stack="BIG_STACK=1"
2016-09-21 14:10:05 -06:00
elif [ $name = "mupen64plus" ] ; then
async=1
elif [ $name = "dosbox" ] ; then
async=0
fi
echo "-- Building core: $name --"
if [ $PLATFORM = "unix" ]; then
cp -f "$f" ../libretro.${EXT}
else
cp -f "$f" ../libretro_${platform}.${EXT}
fi
2016-09-28 19:43:39 -05:00
echo NAME: $name
echo ASYNC: $async
echo LTO: $lto
2015-09-01 17:14:14 +02:00
2015-09-01 17:31:34 +02:00
# Do cleanup if this is a big stack core
if [ "$big_stack" = "BIG_STACK=1" ] ; then
2015-09-01 17:31:34 +02:00
if [ $MAKEFILE_GRIFFIN = "yes" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
elif [ $PLATFORM = "emscripten" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.emscripten PTHREAD=$pthread ASYNC=$async LTO=$lto -j7 clean || exit 1
elif [ $PLATFORM = "unix" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile LINK=g++ LTO=$lto -j7 clean || exit 1
2015-09-01 17:31:34 +02:00
else
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} clean || exit 1
2015-09-01 17:31:34 +02:00
fi
2015-09-01 17:14:14 +02:00
fi
2015-09-01 17:31:34 +02:00
# Compile core
2016-08-09 19:47:29 +02:00
if [ $MAKEFILE_GRIFFIN = "yes" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.griffin $OPTS platform=${platform} $whole_archive $big_stack -j3 || exit 1
elif [ $PLATFORM = "emscripten" ]; then
2016-09-28 19:26:15 -05:00
echo "BUILD COMMAND: make -C ../ -f Makefile.emscripten PTHREAD=$pthread ASYNC=$async LTO=$lto -j7 TARGET=${name}_libretro.js"
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.emscripten $OPTS PTHREAD=$pthread ASYNC=$async LTO=$lto -j7 TARGET=${name}_libretro.js || exit 1
elif [ $PLATFORM = "unix" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile LINK=g++ $whole_archive $big_stack -j3 || exit 1
elif [ $PLATFORM = "ctr" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} $OPTS LIBRETRO=$name $whole_archive $big_stack -j3 || exit 1
2018-09-28 01:10:25 +02:00
elif [ $PLATFORM = "libnx" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} $OPTS APP_TITLE="$name" LIBRETRO=$name $whole_archive $big_stack -j3 || exit 1
elif [ $PLATFORM = "ps2" ]; then
# TODO PS2 should be able to compile in parallel
2020-07-01 17:51:16 +02:00
make -C ../ -f Makefile.${platform} $OPTS || exit 1
2015-09-01 17:07:13 +02:00
else
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} $OPTS $whole_archive $big_stack -j3 || exit 1
2015-09-01 17:07:13 +02:00
fi
2015-09-01 17:31:34 +02:00
# Move executable files
if [ $platform = "psl1ght" ] ; then
mv -fv ../retroarch_psl1ght.self ../pkg/psl1ght/pkg/USRDIR/cores/"${name}_libretro_${platform}.SELF"
if [ -d ../../dist/info ]; then
2020-05-04 11:43:47 +02:00
mkdir -p ../pkg/psl1ght/pkg/USRDIR/cores/info
cp -fv ../../dist/info/"${name}_libretro.info" ../pkg/psl1ght/pkg/USRDIR/cores/info/"${name}_libretro.info"
fi
2018-12-31 13:47:58 +01:00
elif [ $PLATFORM = "ps2" ] ; then
mv -f ../retroarchps2.elf ../pkg/${platform}/cores/${name}_libretro_${platform}.elf
2015-09-01 17:31:34 +02:00
elif [ $PLATFORM = "psp1" ] ; then
mv -f ../EBOOT.PBP ../pkg/${platform}/cores/${name}_libretro.PBP
elif [ $PLATFORM = "vita" ] ; then
2016-08-01 23:28:23 -05:00
COUNTER=$((COUNTER + 1))
2016-08-02 18:45:41 -05:00
COUNTER_ID=`printf "%05d" ${COUNTER}`
2017-11-13 21:11:51 +01:00
cp ../retroarch_${platform}.self ../pkg/${platform}/retroarch.vpk/vpk/${name}_libretro.self
2016-10-10 11:43:05 +02:00
if [ -d ../../dist/info ]; then
mkdir -p ../pkg/${platform}/retroarch.vpk/vpk/info
2017-11-14 19:52:45 +01:00
cp -fv ../../dist/info/"${name}_libretro.info" ../pkg/${platform}/retroarch.vpk/vpk/info/"${name}_libretro.info"
2016-10-10 11:43:05 +02:00
fi
elif [ $PLATFORM = "ctr" ] ; then
2018-05-19 09:59:47 -07:00
mv -f ../retroarch_3ds.cia ../pkg/${platform}/build/cia/${name}_libretro.cia
2018-05-19 10:03:57 -07:00
mv -f ../retroarch_3ds.3dsx ../pkg/${platform}/build/3dsx/${name}_libretro.3dsx
2018-05-19 09:59:47 -07:00
mv -f ../retroarch_3ds.3ds ../pkg/${platform}/build/rom/${name}_libretro.3ds
2018-09-28 01:10:25 +02:00
elif [ $PLATFORM = "libnx" ] ; then
2018-09-29 12:20:43 -05:00
mkdir -p ../pkg/${platform}/retroarch/cores/
mv -f ../retroarch_switch.nro ../pkg/${platform}/retroarch/cores/${name}_libretro_${platform}.nro
elif [ $PLATFORM = "unix" ] ; then
mv -f ../retroarch ../pkg/${platform}/${name}_libretro.elf
elif [ $PLATFORM = "ngc" ] ; then
mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
elif [ $PLATFORM = "wii" ] ; then
2020-05-11 19:15:01 +02:00
mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
elif [ $PLATFORM = "dos" ] ; then
2020-05-12 17:39:04 +02:00
mkdir -p ../pkg/${platform}/cores
mv -f ../retrodos.exe ../pkg/${platform}/cores/${name}.exe
elif [ $PLATFORM = "emscripten" ] ; then
mkdir -p ../pkg/emscripten/
mv -f ../${name}_libretro.js ../pkg/emscripten/${name}_libretro.js
mv -f ../${name}_libretro.wasm ../pkg/emscripten/${name}_libretro.wasm
if [ $pthread != 0 ] ; then
mv -f ../pthread-main.js ../pkg/emscripten/pthread-main.js
fi
2015-09-01 17:31:34 +02:00
fi
# Remove executable files
if [ $platform = "psl1ght" ] ; then
rm -f ../retroarch_${platform}.elf ../retroarch_${platform}.self ../CORE.SELF
2018-12-31 13:47:58 +01:00
elif [ $PLATFORM = "ps2" ] ; then
rm -f ../retroarchps2.elf
rm -f ../retroarchps2-debug.elf
2015-09-01 17:31:34 +02:00
elif [ $PLATFORM = "psp1" ] ; then
rm -f ../retroarchpsp.elf
elif [ $PLATFORM = "vita" ] ; then
2016-08-02 00:57:00 +02:00
rm -f ../retroarch_${platform}.velf ../retroarch_${platform}.elf ../eboot.bin
elif [ $PLATFORM = "ctr" ] ; then
rm -f ../retroarch_3ds.elf
rm -f ../retroarch_3ds.bnr
rm -f ../retroarch_3ds.icn
2018-09-28 01:10:25 +02:00
elif [ $PLATFORM = "libnx" ] ; then
rm -f ../retroarch_switch.elf
rm -f ../retroarch_switch.nacp
rm -f ../retroarch_switch.nso
elif [ $PLATFORM = "unix" ] ; then
rm -f ../retroarch
elif [ $PLATFORM = "ngc" ] ; then
rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
elif [ $PLATFORM = "wii" ] ; then
rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
elif [ $platform = "emscripten" ] ; then
rm -f ../${name}_libretro.js
fi
2015-09-01 17:14:14 +02:00
2015-09-01 17:31:34 +02:00
# Do cleanup if this is a big stack core
if [ "$big_stack" = "BIG_STACK=1" ] ; then
2015-09-01 17:31:34 +02:00
if [ $MAKEFILE_GRIFFIN = "yes" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
elif [ $PLATFORM = "emscripten" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.emscripten PTHREAD=$pthread ASYNC=$async LTO=$lto -j7 clean || exit 1
elif [ $PLATFORM = "unix" ]; then
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile LTO=$lto -j7 clean || exit 1
2015-09-01 17:31:34 +02:00
else
2019-11-19 09:58:58 +01:00
make -C ../ -f Makefile.${platform} clean || exit 1
2015-09-01 17:31:34 +02:00
fi
2015-09-01 17:14:14 +02:00
fi
done
2015-09-01 17:31:34 +02:00
# Additional build step
if [ $platform = "psl1ght" ] ; then
ps3pkgdir=pkg/psl1ght/pkg
echo Deploy : Assets...
2016-08-09 19:05:38 -05:00
if [ -d ../media/assets ]; then
mkdir -p ../${ps3pkgdir}/USRDIR/cores/assets
cp -r ../media/assets/* ../${ps3pkgdir}/USRDIR/cores/assets
2016-08-09 19:05:38 -05:00
fi
echo Deploy : Databases...
2016-08-09 19:05:38 -05:00
if [ -d ../media/libretrodb/rdb ]; then
mkdir -p ../${ps3pkgdir}/USRDIR/cores/database/rdb
cp -r ../media/libretrodb/rdb/* ../${ps3pkgdir}/USRDIR/cores/database/rdb
2016-08-10 07:40:21 +02:00
fi
if [ -d ../media/libretrodb/cursors ]; then
mkdir -p ../${ps3pkgdir}/USRDIR/cores/database/cursors
cp -r ../media/libretrodb/cursors/* ../${ps3pkgdir}/USRDIR/cores/database/cursors
2016-08-09 19:05:38 -05:00
fi
echo Deploy : Overlays...
2016-08-09 19:05:38 -05:00
if [ -d ../media/overlays ]; then
mkdir -p ../${ps3pkgdir}/USRDIR/cores/overlays
cp -r ../media/overlays/* ../${ps3pkgdir}/USRDIR/cores/overlays
2016-08-09 19:05:38 -05:00
fi
echo Deploy : Shaders...
2016-08-09 19:05:38 -05:00
if [ -d ../media/shaders_cg ]; then
mkdir -p ../${ps3pkgdir}/USRDIR/cores/shaders_cg
cp -r ../media/shaders_cg/* ../${ps3pkgdir}/USRDIR/cores/shaders_cg
2016-08-09 19:05:38 -05:00
fi
2016-08-09 19:17:55 -05:00
fi
fi
2015-09-01 17:31:34 +02:00
# Packaging
if [ $PLATFORM = "psl1ght" ] ; then
${PS3DEV}/bin/pkg.py --contentid UP0001-SSNE10001_00-0000000000000001 ../pkg/psl1ght/pkg/ ../pkg/psl1ght/RetroArch.PSL1GHT.pkg
2015-09-01 17:07:13 +02:00
fi