install_prboom-plus.sh 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. $su pacman -Sy --noconfirm --needed cmake
  11. $su pacman -Sy --noconfirm --needed sdl2
  12. $su pacman -Sy --noconfirm --needed fluidsynth glu libmad libvorbis pcre portmidi sdl2_image sdl2_mixer sdl2_net
  13. application=prboom-plus
  14. repository=https://github.com/coelckers/prboom-plus.git
  15. export compile=
  16. mkdir -p ~/src
  17. cd ~/src || return
  18. if [ ! -d $application ]; then
  19. git clone $repository
  20. cd $application || return
  21. export compile=true
  22. else
  23. cd $application || return
  24. #git pull
  25. pwd
  26. git fetch
  27. LOCAL=$(git rev-parse HEAD)
  28. REMOTE=$(git rev-parse @{u})
  29. if [ ! $LOCAL = $REMOTE ]; then
  30. pwd
  31. echo "Need to pull"
  32. git pull
  33. export compile=true
  34. fi
  35. fi
  36. if [ "$compile" = "true" ]; then
  37. cd ~/src/$application || return
  38. cd prboom2 || return
  39. cmake .
  40. make
  41. fi