|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +function error { |
| 4 | + echo -e "\\e[91m$1\\e[39m" |
| 5 | + exit 1 |
| 6 | +} |
| 7 | + |
| 8 | +sudo apt update |
| 9 | + |
| 10 | +#Installing dependencies |
| 11 | +sudo apt -y install libfontconfig-dev qt5-default automake mercurial libtool libfreeimage-dev \ |
| 12 | +libopenal-dev libpango1.0-dev libsndfile-dev libudev-dev libtiff5-dev libwebp-dev libasound2-dev \ |
| 13 | +libaudio-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxss-dev libesd0-dev \ |
| 14 | +freeglut3-dev libmodplug-dev libsmpeg-dev libjpeg-dev libogg-dev libvorbis-dev libvorbisfile3 libcurl4 cmake aria2 lolcat figlet || error "Failed to install dependencies" |
| 15 | + |
| 16 | +#Downloading SDK libraries |
| 17 | +figlet Downloading SDK libraries | lolcat |
| 18 | +rm -r ~/temp || error "Failed to remove temp folder" |
| 19 | +mkdir ~/temp || error "Failed to create temp folder" |
| 20 | +cd ~/temp || exit |
| 21 | + |
| 22 | +#currently in ~/temp |
| 23 | +hg clone http://hg.libsdl.org/SDL || error "Failed to clone SDL Libraries" #Cloning SDL Libraries |
| 24 | + |
| 25 | +cd ~/temp/SDL || exit |
| 26 | + |
| 27 | +#currently in ~/temp/SDL |
| 28 | +./autogen.sh || error "Failed to execute autogen.sh" |
| 29 | + |
| 30 | +./configure --disable-pulseaudio --disable-esd --disable-video-wayland \ |
| 31 | + --disable-video-opengl --host=arm-raspberry-linux-gnueabihf --prefix=/usr |
| 32 | + |
| 33 | +#Compiling SDK Libraries with make |
| 34 | +figlet Compiling SDK Libraries | lolcat |
| 35 | +make || error "Failed to compile SDK Libraries" |
| 36 | +sudo make install || error "Failed to Compile SDK Libraries" |
| 37 | +cd ~/temp || exit #Coming out of SDL Folder |
| 38 | + |
| 39 | +#Downloading and extracting the 3 addons |
| 40 | +figlet Downloading and extracting the 3 addons | lolcat |
| 41 | + |
| 42 | +sudo rm SDL2_image-2.0.5.tar.gz |
| 43 | +wget http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz || error "Failed to download SDL2_image-2.0.5.tar.gz" |
| 44 | +sudo rm -r ~/temp/SDL2_image-2.0.5 #Removing extracted folder if extracted before |
| 45 | +tar zxvf SDL2_image-2.0.5.tar.gz || error "Failed to extract SDL2_image-2.0.5.tar.gz"#Extracting addons |
| 46 | + |
| 47 | +sudo rm SDL2_mixer-2.0.4.tar.gz |
| 48 | +wget http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz || error "Failed to download SDL2_mixer-2.0.4.tar.gz" |
| 49 | +sudo rm -r SDL2_mixer-2.0.4 #Removing extracted folder if extracted before |
| 50 | +tar zxvf SDL2_mixer-2.0.4.tar.gz || error "Failed to extract SDL2_mixer-2.0.4.tar.gz"#Extracting addons |
| 51 | + |
| 52 | +sudo rm SDL2_ttf-2.0.15.tar.gz |
| 53 | +wget http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.15.tar.gz || error "Failed to download SDL2_ttf-2.0.15.tar.gz " |
| 54 | +sudo rm -r SDL2_ttf-2.0.15 #Removing extracted folder if extracted before |
| 55 | +tar zxvf SDL2_ttf-2.0.15.tar.gz || error "Failed to extract SDL2_ttf-2.0.15.tar.gz "#Extracting addons |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +#Building the 3 addons |
| 60 | +figlet Building the 3 addons | lolcat |
| 61 | + |
| 62 | + |
| 63 | +cd SDL2_image-2.0.5 || exit |
| 64 | +./autogen.sh || error "Failed to build SDL2_image-2.0.5 " |
| 65 | +./configure --prefix=/usr || error "Failed to build SDL2_image-2.0.5" |
| 66 | +make || error "Failed to build SDL2_image-2.0.5" |
| 67 | +sudo make install || error "Failed to build SDL2_image-2.0.5 " |
| 68 | +cd .. || exit |
| 69 | + |
| 70 | +cd SDL2_mixer-2.0.4 || exit |
| 71 | +./autogen.sh || error "Failed to build SDL2_mixer-2.0.4 " |
| 72 | +./configure --prefix=/usr || error "Failed to build SDL2_mixer-2.0.4 " |
| 73 | +make || error "Failed to build SDL2_mixer-2.0.4 " |
| 74 | +sudo make install || error "Failed to build SDL2_mixer-2.0.4 " |
| 75 | +cd .. || exit |
| 76 | + |
| 77 | +cd SDL2_ttf-2.0.15 || exit |
| 78 | +./autogen.sh || error "Failed to build SDL2_ttf-2.0.15" |
| 79 | +./configure --prefix=/usr || error "Failed to build SDL2_ttf-2.0.15" |
| 80 | +make || error "Failed to build SDL2_ttf-2.0.15" |
| 81 | +sudo make install || error "Failed to build SDL2_ttf-2.0.15" |
| 82 | +cd .. || exit |
| 83 | + |
| 84 | + |
| 85 | +figlet Installing dhewm3 | lolcat |
| 86 | + |
| 87 | +sudo rm -r ~/temp/dhewm3 #Removing repository if it is already clone |
| 88 | +git clone https://github.com/dhewm/dhewm3 || error "Failed to clone dhewm3 from github" #Cloning dhewm3 repository |
| 89 | +cd ~/temp/dhewm3/neo/ || exit |
| 90 | + |
| 91 | + |
| 92 | +#currently in ~/temp/dhewm3/neo |
| 93 | + |
| 94 | +sudo rm -r ~/temp/dhewm3/neo/build |
| 95 | +mkdir ~/temp/dhewm3/neo/build || error "Failed to create build folder" |
| 96 | +cd ~/temp/dhewm3/neo/build || exit |
| 97 | +cmake .. || error "Failed to build dhewm3" |
| 98 | +make -j4 || error "Failed to build dhewm3" |
| 99 | + |
| 100 | + |
| 101 | +Yes_Downloading_torrent () { |
| 102 | + figlet Downloading Game Files | lolcat |
| 103 | + git clone https://github.com/techcoder20/RPIDoom3Installation.git ~/RPIDoom3Installation || error "Failed to clone github repository" |
| 104 | + cd ~/RPIDoom3Installation || exit |
| 105 | + wget https://github.com/techcoder20/Doom3DemoGameFiles/releases/download/1.0.0/Doom3DemoGameFiles.zip || error "Failed to download game files" |
| 106 | + unzip Doom3DemoGameFiles.zip || error "Failed to extract game files" |
| 107 | + cd ~/temp/dhewm3/neo/build/ || exit |
| 108 | + cp base.so d3xp.so dhewm3 libidlib.a ~/RPIDoom3Installation/Doom3DemoGameFiles || error "Failed to copy necessary files to Doom3DemoGameFile Folder" |
| 109 | + cp ~/Doom3DemoGameFiles/Doom3Demo.desktop ~/Desktop || error "" |
| 110 | +} |
| 111 | + |
| 112 | +No_Downloading_torrent () { |
| 113 | + mkdir ~/Doom3GameFiles || error "Failed to create Doom3GameFiles Folder" |
| 114 | + figlet -w 90 Please place the game files in ~/Doom3GameFiles | lolcat |
| 115 | + cd ~/temp/dhewm3/neo/build/ || exit |
| 116 | + cp base.so d3xp.so dhewm3 libidlib.a ~/Doom3GameFiles || error "Failed to copy necessary files to Doom3GameFile Folder" |
| 117 | +} |
| 118 | + |
| 119 | +while true; do |
| 120 | + read -p -r "Do you have the game files [Y/n]?" yn |
| 121 | + case $yn in |
| 122 | + [Yy]* ) No_Downloading_torrent; exit;; |
| 123 | + [Nn]* ) Yes_Downloading_torrent; exit;; |
| 124 | + * ) echo "Please answer yes or no.";; |
| 125 | + esac |
| 126 | +done |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
0 commit comments