added script to fetch dependencies
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 2 Dec 2017 05:39:11 +0000 (07:39 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 2 Dec 2017 05:39:11 +0000 (07:39 +0200)
fetchlibs [new file with mode: 0755]

diff --git a/fetchlibs b/fetchlibs
new file mode 100755 (executable)
index 0000000..201289d
--- /dev/null
+++ b/fetchlibs
@@ -0,0 +1,64 @@
+#!/bin/sh\r
+\r
+mkdir -p libs && cd libs\r
+\r
+msys2_libs='mingw-w64-i686-libpng mingw-w64-i686-libjpeg-turbo\r
+       mingw-w64-i686-freetype mingw-w64-i686-zlib mingw-w64-i686-libogg\r
+       mingw-w64-i686-libvorbis mingw-w64-i686-SDL2 mingw-w64-i686-glew\r
+       mingw-w64-i686-assimp'\r
+\r
+debian_libs='libpng-dev libjpeg-dev libfreetype6-dev libogg-dev libvorbis-dev\r
+       libsdl2-dev libglew-dev libassimp-dev'\r
+\r
+github_libs='gph-math libvmath libimago libresman libdrawtext libtreestore\r
+       libgoatvr'\r
+\r
+\r
+if [ `uname -s | sed 's/MINGW32.*/mingw/'` = mingw ]; then\r
+       for i in $msys2_libs; do\r
+               if ! pacman -S $i --needed; then\r
+                       echo "Failed to install prerequisite $i ... aborting."\r
+                       exit 1\r
+               fi\r
+       done\r
+elif [ `uname -s` = Linux ]; then\r
+       SUDO=sudo\r
+       for i in $debian_libs; do\r
+               if ! $SUDO apt-get install $i; then\r
+                       echo "Failed to install prerequisite: $i ... aborting."\r
+                       exit 1\r
+               fi\r
+       done\r
+else\r
+       echo "Unknown system, please make sure you have the following prerequisites installed: $debian_libs"\r
+fi\r
+\r
+echo "Fetching github libs"\r
+for i in $github_libs; do\r
+       if [ -d $i ]; then\r
+               echo "Updating: $i ..."\r
+               cd $i && git pull && cd ..\r
+       else\r
+               echo "Cloning: $i ..."\r
+               git clone git@github.com:jtsiomb/$i.git\r
+       fi\r
+done\r
+\r
+echo "Building libs"\r
+for i in $github_libs; do\r
+       echo "Building: $i ..."\r
+       cd $i\r
+       if [ -f CMakeLists.txt ]; then\r
+               mkdir -p build\r
+               cd build\r
+               if ! cmake .. -DCMAKE_BUILD_TYPE=Release && make && $SUDO make install; then\r
+                       exit 1\r
+               fi\r
+               cd ..\r
+       else\r
+               if ! ./configure --enable-opt && make && $SUDO make install; then\r
+                       exit 1\r
+               fi\r
+       fi\r
+       cd ..\r
+done\r