vcmiinstall.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. function errorcheck(){
  3. if [ "$?" -gt 0 ]; then
  4. echo "Error during $1"
  5. exit
  6. else
  7. echo "$1 successful"
  8. fi
  9. }
  10. function incusage(){
  11. echo "Incorrect usage; use --help for more info."
  12. exit
  13. }
  14. if [ "$1" = "--install" ]; then
  15. if [ $# -lt 2 ]; then
  16. incusage
  17. fi
  18. svn co https://vcmi.svn.sourceforge.net/svnroot/vcmi/branches/programmingChallenge/ vcmi
  19. errorcheck "fetching sources"
  20. cd vcmi
  21. autoreconf -i
  22. errorcheck "autoreconf -i"
  23. cd ..
  24. vcmi/configure --datadir=`pwd` --bindir=`pwd`vcmi --libdir=`pwd`
  25. errorcheck "configure"
  26. make
  27. errorcheck "make"
  28. unzip vcmi/vcmipack.zip -d vcmi
  29. errorcheck "pack unzip"
  30. ln -s "vcmi/b1.json"
  31. errorcheck "b1.json symlink"
  32. ln -s ../../AI/StupidAI/.libs/libStupidAI.so -t vcmi/AI
  33. errorcheck "StupidAI symlink"
  34. ln -s "Odpalarka/odpalarka"
  35. errorcheck "Odpalarka symlink"
  36. ln -s "VCMI_BattleAiHost/vcmirunner"
  37. errorcheck "runner symlink"
  38. ln -s "server/vcmiserver"
  39. errorcheck "server symlink"
  40. elif [ "$1" = "--clean" ]; then
  41. find . -name "*" -exec bash -c "if [[ {} != './vcmiinstall.sh' ]] && [[ {} != './vcmipack.zip' ]] && [[ {} != '.' ]] && [[ {} != '..' ]]; then rm -rf {} ; fi" \;
  42. elif [ "$1" = "--help" ]; then
  43. echo "VCMI programming challenge installation script"
  44. echo
  45. echo "Available commands: "
  46. echo "--clean removes all created files except this script."
  47. echo "--help displays this info."
  48. echo "--install full downloads and compiles full VCMI with graphical client; requires ffmpeg."
  49. echo "--install lean downloads and compiles most of VCMI (without graphical client)."
  50. else
  51. incusage
  52. fi