From 72bbee37d2c69e1166c89c9d2e6f17a2d839df2b Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 18 Jan 2020 20:29:58 -0300 Subject: [PATCH] Adapts setup_lnx.sh --- setup_lnx.sh | 136 +++++++++++++-------------------------------------- 1 file changed, 34 insertions(+), 102 deletions(-) diff --git a/setup_lnx.sh b/setup_lnx.sh index a41a3d979..f44be22aa 100755 --- a/setup_lnx.sh +++ b/setup_lnx.sh @@ -1,10 +1,6 @@ #!/bin/bash #QB64 Installer -- Shell Script -- Matt Kilgore 2013 -#Version 4 -- April 4, 2013 -#Compiles: -# GL : .978 -# SDL: .954 - +#Version 5 -- January 2020 #This checks the currently installed packages for the one's QB64 needs #And runs the package manager to install them if that is the case @@ -17,18 +13,12 @@ pkg_install() { fi done if [ -n "$packages_to_install" ]; then - echo "Installing required packages. If Prompted to, please enter your password" + echo "Installing required packages. If prompted to, please enter your password." $installer_command $packages_to_install fi } -#Set this to 1 to make it download everything -DOWNLOAD= - - -#Set this to 1 to compile SDL instead (Only works if DOWNLOAD=1) -SDL= #Make sure we're not running as root @@ -38,36 +28,16 @@ if [ $EUID == "0" ]; then exit 1 fi -if [ "$DOWNLOAD" == "1" ]; then - #Various URL's for downloads - QB64_URL="http://www.qb64.net/qb64v0978-lnx.tar.gz" - QB64_SDL_URL="http://www.qb64.net/qb64v0954-lnx.tar.gz" - QB64_ICON_URL="http://www.qb64.net/qb64icon32.png" - - #Name for download QB64 - QB64_ZIP_NAME=qb64.tar.gz - #Will be downloaded to current directory - QB64_ICON_PATH="." - GET_WGET="wget" -else - GET_WGET= - #Path to Icon - #Relative Path to icon -- Don't include beginning or trailing '/' - QB64_ICON_PATH="internal/source" -fi +GET_WGET= +#Path to Icon +#Relative Path to icon -- Don't include beginning or trailing '/' +QB64_ICON_PATH="internal/source" #Name of the Icon picture QB64_ICON_NAME="qb64icon32.png" DISTRO= -if [ -f ./qb64 ] && [ "$DOWNLOAD" == "1" ]; then - echo "Removing old QB64 files in preperation for installing new version..." - rm ./qb64 - rm -fr ./internal - echo "Done. Installing QB64 now." -fi - lsb_command=`which lsb_release 2> /dev/null` if [ -z "$lsb_command" ]; then lsb_command=`which lsb_release 2> /dev/null` @@ -102,31 +72,19 @@ fi #Find and install packages if [ "$DISTRO" == "arch" ]; then echo "ArchLinux detected." - if [ "$SDL" == "1" ]; then - pkg_list="gcc sdl sdl_image sdl_mixer sdl_net sdl_ttf $GET_WGET" - else - pkg_list="gcc $GET_WGET" - fi + pkg_list="gcc zlib1g-dev $GET_WGET" installed_packages=`pacman -Q` installer_command="sudo pacman -S " pkg_install elif [ "$DISTRO" == "linuxmint" ] || [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "zorin" ]; then echo "Debian based distro detected." - if [ "$SDL" == "1" ]; then - pkg_list="g++ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev $GET_WGET" - else - pkg_list="g++ mesa-common-dev libglu1-mesa-dev libasound2-dev $GET_WGET" - fi + pkg_list="g++ mesa-common-dev libglu1-mesa-dev libasound2-dev zlib1g-dev $GET_WGET" installed_packages=`dpkg -l` installer_command="sudo apt-get -y install " pkg_install elif [ "$DISTRO" == "fedora" ] || [ "$DISTRO" == "redhat" ] || [ "$DISTRO" == "centos" ]; then echo "Fedora/Redhat based distro detected." - if [ "$SDL" == "1" ]; then - pkg_list="gcc-c++ SDL-devel SDL_image-devel SDL_mixer-devel SDL_net-devel SDL_ttf-devel $GET_WGET" - else - pkg_list="gcc-c++ mesa-libGLU-devel alsa-lib-devel $GET_WGET" - fi + pkg_list="gcc-c++ mesa-libGLU-devel alsa-lib-devel zlib1g-dev $GET_WGET" installed_packages=`yum list installed` installer_command="sudo yum install " pkg_install @@ -138,63 +96,37 @@ elif [ -z "$DISTRO" ]; then echo " GNU C++ Compiler (g++)" fi -if [ "$DOWNLOAD" == "1" ]; then - echo "Downloading QB64..." - if [ "$SDL" == "1" ]; then - wget $QB64_SDL_URL -O $QB64_ZIP_NAME - else - wget $QB64_URL -O $QB64_ZIP_NAME - fi - if [ ! -f $QB64_ICON_NAME ]; then - echo "Grabbing QB64 Icon..." - wget $QB64_ICON_URL - fi - echo "Uncompressing to directory..." - #strip-components=1 removes the leading ./qb64 directory from the archive - tar --strip-components=1 -zxvf $QB64_ZIP_NAME >/dev/null -fi - echo "Compiling and installing QB64..." -if [ "$SDL" == "1" ]; then - ### SDL Installation process - cp ./internal/source/* ./internal/temp/ - cd ./internal/c - g++ -c -w -Wall libqbx.cpp -o libqbx_lnx.o `sdl-config --cflags` - g++ -w libqbx_lnx.o qbx.cpp `sdl-config --cflags --libs` -lSDL_mixer -lSDL_ttf -lSDL_net -lSDL_image -lX11 -o ../../qb64 - cd ../.. -else +### GL installation process +find . -name "*.sh" -exec chmod +x {} \; +find . -type f -iname "*.a" -exec rm -f {} \; +find . -type f -iname "*.o" -exec rm -f {} \; +rm ./internal/temp/* - ### GL installation process - find . -name "*.sh" -exec chmod +x {} \; - find . -type f -iname "*.a" -exec rm -f {} \; - find . -type f -iname "*.o" -exec rm -f {} \; - rm ./internal/temp/* +echo "Building library 'LibQB'" +pushd internal/c/libqb/os/lnx >/dev/null +rm -f libqb_setup.o +./setup_build.sh +popd >/dev/null - echo "Building library 'LibQB'" - cd internal/c/libqb/os/lnx - rm -f libqb_setup.o - ./setup_build.sh - cd ../../../../.. +echo "Building library 'FreeType'" +pushd internal/c/parts/video/font/ttf/os/lnx >/dev/null +rm -f src.o +./setup_build.sh +popd >/dev/null - echo "Building library 'FreeType'" - cd internal/c/parts/video/font/ttf/os/lnx - rm -f src.o - ./setup_build.sh - cd ../../../../../../../.. +echo "Building library 'Core:FreeGLUT'" +pushd internal/c/parts/core/os/lnx >/dev/null +rm -f src.a +./setup_build.sh +popd >/dev/null - echo "Building library 'Core:FreeGLUT'" - cd internal/c/parts/core/os/lnx - rm -f src.a - ./setup_build.sh - cd ../../../../../.. - - echo "Building 'QB64'" - cp -r ./internal/source/* ./internal/temp/ - cd internal/c - g++ -no-pie -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64 - cd ../.. -fi +echo "Building 'QB64'" +cp -r ./internal/source/* ./internal/temp/ +pushd internal/c >/dev/null +g++ -no-pie -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64 +popd if [ -e "./qb64" ]; then echo "Done compiling!!"