install_gzdoom.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 apt-get install -y --no-install-recommends g++ make cmake libsdl2-dev git zlib1g-dev libbz2-dev libjpeg-dev libfluidsynth-dev libgme-dev libopenal-dev libmpg123-dev libsndfile1-dev libgtk-3-dev timidity nasm libgl1-mesa-dev tar libsdl1.2-dev libglew-dev libvulkan-dev
  11. application=ZMusic
  12. repository=https://github.com/coelckers/ZMusic.git
  13. export compile=
  14. mkdir -p ~/src
  15. cd ~/src || return
  16. if [ ! -d $application ]; then
  17. git clone $repository
  18. cd $application || return
  19. export compile=true
  20. else
  21. cd $application || return
  22. #git pull
  23. pwd
  24. git fetch
  25. LOCAL=$(git rev-parse HEAD)
  26. REMOTE=$(git rev-parse @{u})
  27. if [ ! $LOCAL = $REMOTE ]; then
  28. pwd
  29. echo "Need to pull"
  30. git pull
  31. export compile=true
  32. fi
  33. fi
  34. if [ "$compile" = "true" ]; then
  35. cd ~/src/$application || return
  36. mkdir -pv build
  37. cd build || return
  38. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
  39. cmake --build .
  40. $su make install
  41. fi
  42. application=gzdoom
  43. repository=https://github.com/coelckers/gzdoom.git
  44. export compile=
  45. mkdir -p ~/src
  46. cd ~/src || return
  47. if [ ! -d $application ]; then
  48. git clone $repository
  49. cd $application || return
  50. if [ "$1" = "stable" ]; then
  51. Tag="$(git tag -l | grep -v 9999 | grep -E '^g[0-9]+([.][0-9]+)*$' | sed 's/^g//' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | tail -n 1 | sed 's/^/g/')"
  52. git checkout --detach refs/tags/$Tag
  53. fi
  54. export compile=true
  55. else
  56. cd $application || return
  57. pwd
  58. git fetch
  59. LOCAL=$(git rev-parse HEAD)
  60. REMOTE=$(git rev-parse @{u})
  61. if [ ! $LOCAL = $REMOTE ]; then
  62. pwd
  63. echo "Need to pull"
  64. git pull
  65. if [ "$1" = "stable" ]; then
  66. Tag="$(git tag -l | grep -v 9999 | grep -E '^g[0-9]+([.][0-9]+)*$' | sed 's/^g//' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | tail -n 1 | sed 's/^/g/')"
  67. git checkout --detach refs/tags/$Tag
  68. fi
  69. export compile=true
  70. fi
  71. fi
  72. if [ "$compile" = "true" ]; then
  73. cd ~/src/$application || return
  74. mkdir -pv build
  75. a='' && [ "$(uname -m)" = x86_64 ] && a=64
  76. c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1
  77. rm -f output_sdl/liboutput_sdl.so
  78. cmake -B build \
  79. -DNO_FMOD=ON -UFMOD_LIBRARY -UFMOD_INCLUDE_DIR \
  80. -D CMAKE_BUILD_TYPE=Release \
  81. -D CMAKE_CXX_FLAGS="$CXXFLAGS -ffile-prefix-map=\"$PWD\"=. -DSHARE_DIR=\\\"/usr/share/gzdoom\\\"" \
  82. -D CMAKE_INSTALL_PREFIX=/usr \
  83. -D SYSTEMINSTALL=ON \
  84. -D INSTALL_PK3_PATH=share/gzdoom \
  85. -D INSTALL_SOUNDFONT_PATH=share/gzdoom \
  86. -D INSTALL_RPATH=/usr/lib \
  87. -D DYN_GTK=OFF \
  88. -D DYN_OPENAL=OFF
  89. make -j$c -C build
  90. cd build || return
  91. $su make install
  92. fi