libretro-super/environment/ps2-env.sh

163 lines
3.5 KiB
Bash
Raw Normal View History

2018-12-31 00:08:39 +00:00
display_usage() {
echo -e "\nSetup a RetroArch PS2 build environment on Debian/Ubuntu"
echo -e "\nUsage: [install] [build] [export]\n"
2018-12-31 09:09:40 +00:00
echo -e "It will install the toolchain in ~/tools\n"
2018-12-31 00:08:39 +00:00
echo -e "Arguments:\n"
echo -e "install:\n install or re(install) the toolchain"
echo -e "prepare-profile:\n update the bash profile with the needed variables"
2018-12-31 09:49:15 +00:00
echo -e "export-variables:\n Export in this bash session the needed variables"
2018-12-31 00:08:39 +00:00
}
update-profile()
{
2018-12-31 09:09:40 +00:00
echo "" >> ~/.profile
echo "#### PS2DEV ####" >> ~/.profile
echo "export PS2DEV=~/tools/ps2dev" >> ~/.profile
echo "export PS2SDK=\$PS2DEV/ps2sdk" >> ~/.profile
echo "export PATH=\$PATH:\$PS2DEV/bin:\$PS2DEV/ee/bin:\$PS2DEV/iop/bin:\$PS2DEV/dvp/bin:\$PS2SDK/bin" >> ~/.profile
2018-12-31 09:49:15 +00:00
#load profile
2018-12-31 00:08:39 +00:00
source ~/.profile
}
2018-12-31 09:49:15 +00:00
export-variables()
{
export PS2DEV=~/tools/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
}
2018-12-31 00:08:39 +00:00
download-ps2toolchain()
{
# PS2Toolchain
cd ~
if [ ! -d ~/ps2tools/ps2toolchain ]; then
mkdir ~/ps2tools
cd ps2tools
git clone https://github.com/ps2dev/ps2toolchain.git
fi
}
download-ps2sdk-ports()
{
#PS2SDK-Ports
cd ~
if [ ! -d ~/ps2tools/ps2sdk-ports ]; then
mkdir ~/ps2tools
cd ps2tools
git clone https://github.com/ps2dev/ps2sdk-ports.git
fi
}
download-gskit()
{
#GSKit
cd ~
if [ ! -d ~/ps2tools/gskit ]; then
mkdir ~/ps2tools
cd ps2tools
git clone https://github.com/ps2dev/gsKit.git
fi
}
download-ps2-packer()
{
#PS2-Packer
cd ~
if [ ! -d ~/ps2tools/ps2-packer ]; then
mkdir ~/ps2tools
cd ps2tools
git clone https://github.com/ps2dev/ps2-packer.git
fi
}
install-ps2toolchain()
{
if [ ! -d ~/ps2tools/ps2toolchain ]; then
echo You need to donwload first the ps2toolchain
fi
cd ~/ps2tools/ps2toolchain
2018-12-31 09:49:15 +00:00
git fetch && git pull
2018-12-31 00:08:39 +00:00
./toolchain.sh
}
install-ps2sdk-ports()
{
if [ ! -d ~/ps2tools/ps2sdk-ports ]; then
echo You need to donwload first the ps2sdk-ports
fi
cd ~/ps2tools/ps2sdk-ports
2018-12-31 09:49:15 +00:00
git fetch && git pull
2018-12-31 00:08:39 +00:00
make clean && make && make install
}
install-gskit()
{
if [ ! -d ~/ps2tools/gskit ]; then
echo You need to donwload first the gskit
fi
cd ~/ps2tools/gskit
2018-12-31 09:49:15 +00:00
git fetch && git pull
2018-12-31 00:08:39 +00:00
make clean && make && make install
}
install-ps2-packer()
{
if [ ! -d ~/ps2tools/ps2-packer ]; then
echo You need to donwload first the ps2-packer
fi
cd ~/ps2tools/ps2-packer
2018-12-31 09:49:15 +00:00
git fetch && git pull
2018-12-31 00:08:39 +00:00
make clean && make && make install
}
#!/bin/bash
platform=ps2
if [ "$1" = "prepare-profile" ]; then
2018-12-31 09:49:15 +00:00
mkdir -p ~/tools/ps2dev
export-variables
fi;
if [ "$1" = "export-variables" ]; then
mkdir -p ~/tools/ps2dev
2018-12-31 00:08:39 +00:00
update-profile
fi;
if [ "$1" = "install" ]; then
2018-12-31 09:49:15 +00:00
#load profile
source ~/.profile
if [ -z ${PS2DEV+x} ]; then
echo $platform variables not found, run first either prepare-profile or export-variables...
else
# Install needed dependencies
sudo apt install -yqqq build-essential git p7zip tar wget patch libucl-dev
sudo apt install -yqqq libucl-dev zlib1g-dev
#Download everything
download-ps2toolchain
download-ps2sdk-ports
download-gskit
download-ps2-packer
#install everything
install-ps2toolchain
install-ps2sdk-ports
install-gskit
install-ps2-packer
echo $platform environment ready...
2018-12-31 00:08:39 +00:00
fi
fi;
if [ $# -le 0 ]; then
display_usage
fi