You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.9 KiB
Bash

1 year ago
#!/bin/bash
# Fanta <fanta@56k.es>
# Script para compilar mednafen en diferentes distros GNU Linux.
d="/tmp/mednafen"
if [ "$(whoami)" != "root" ]; then
echo "[+] Checking root user"
echo -e "\e[31m\e[1m[NOT OK]\e[0m Run it with root please" && exit
fi
rm -rf $d ; mkdir -p $d
# Debian GNU/Linux 9
cat /etc/issue | grep "Debian GNU/Linux 9" 1>/dev/null ; if [ "$?" -ne 1 ]; then
apt install -y libasound2-dev libflac-dev libsdl2-dev gcc make zlib1g-dev build-essential pkg-config
lastVersion=$(wget -q "https://mednafen.github.io/releases" -O - | tr "<" "\n" | grep -i "tar.xz" | grep -v "server" | grep -iv "unstable" | head -1 | cut -d "\"" -f 2)
lastVersionNameFile=$(echo "$lastVersion" | cut -d "/" -f 4)
lastVersionUrl="https://mednafen.github.io$lastVersion"
wget -q "$lastVersionUrl" -O $d/$lastVersionNameFile
cd $d
tar xfvJ $lastVersionNameFile
cd mednafen
./configure --enable-debugger
make -j$(nproc)
make install
fi
# Debian GNU/Linux 11
cat /etc/issue | grep "Debian GNU/Linux 11" 1>/dev/null ; if [ "$?" -ne 1 ]; then
apt install -y libasound2-dev libflac-dev libsdl2-dev gcc make zlib1g-dev build-essential pkg-config
lastVersion=$(wget -q "https://mednafen.github.io/releases" -O - | tr "<" "\n" | grep -i "tar.xz" | grep -v "server" | grep -iv "unstable" | head -1 | cut -d "\"" -f 2)
lastVersionNameFile=$(echo "$lastVersion" | cut -d "/" -f 4)
lastVersionUrl="https://mednafen.github.io$lastVersion"
wget -q "$lastVersionUrl" -O $d/$lastVersionNameFile
cd $d
tar xfvJ $lastVersionNameFile
cd mednafen
./configure --enable-debugger
make -j$(nproc)
make install
fi
# Debian GNU/Linux 12
cat /etc/issue | grep "Debian GNU/Linux 12" 1>/dev/null ; if [ "$?" -ne 1 ]; then
apt install -y libasound2-dev libflac-dev libsdl2-dev gcc make zlib1g-dev build-essential pkg-config
lastVersion=$(wget -q "https://mednafen.github.io/releases" -O - | tr "<" "\n" | grep -i "tar.xz" | grep -v "server" | grep -iv "unstable" | head -1 | cut -d "\"" -f 2)
lastVersionNameFile=$(echo "$lastVersion" | cut -d "/" -f 4)
lastVersionUrl="https://mednafen.github.io$lastVersion"
wget -q "$lastVersionUrl" -O $d/$lastVersionNameFile
cd $d
tar xfvJ $lastVersionNameFile
cd mednafen
./configure --enable-debugger
make -j$(nproc)
make install
fi
# Ubuntu 22.04.1 LTS
cat /etc/issue | grep "Ubuntu 22.04.1 LTS" 1>/dev/null ; if [ "$?" -ne 1 ]; then
apt install -y libasound2-dev libflac-dev libsdl2-dev gcc make zlib1g-dev build-essential pkg-config
lastVersion=$(wget -q "https://mednafen.github.io/releases" -O - | tr "<" "\n" | grep -i "tar.xz" | grep -v "server" | grep -iv "unstable" | head -1 | cut -d "\"" -f 2)
lastVersionNameFile=$(echo "$lastVersion" | cut -d "/" -f 4)
lastVersionUrl="https://mednafen.github.io$lastVersion"
wget -q "$lastVersionUrl" -O $d/$lastVersionNameFile
cd $d
tar xfvJ $lastVersionNameFile
cd mednafen
./configure --enable-debugger
make -j$(nproc)
make install
fi