vcmiinstall.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. if [ "$2" = "lean" ]; then
  22. mv "Makefile without client.am" Makefile.am
  23. mv "configure without client.ac" configure.ac
  24. rm client/Makefile.am
  25. echo "SUBDIRS = StupidAI" > AI/Makefile.am
  26. rm -rf AI/EmptyAI
  27. rm -rf AI/GeniusAI
  28. find . -name ".svn" -exec rm -rf {} \;
  29. elif [ "$2" = "full" ]; then
  30. mv "Makefile with client.am" Makefile.am
  31. mv "configure with client.ac" configure.ac
  32. else
  33. incusage
  34. fi
  35. autoreconf -i
  36. errorcheck "autoreconf -i"
  37. cd ..
  38. vcmi/configure --datadir=`pwd` --bindir=`pwd`vcmi --libdir=`pwd`
  39. errorcheck "configure"
  40. make
  41. errorcheck "make"
  42. unzip vcmi/vcmipack.zip -d vcmi
  43. errorcheck "pack unzip"
  44. ln -s "vcmi/b1.json"
  45. errorcheck "b1.json symlink"
  46. ln -s ../../AI/StupidAI/.libs/libStupidAI.so -t vcmi/AI
  47. errorcheck "StupidAI symlink"
  48. ln -s "Odpalarka/odpalarka"
  49. errorcheck "Odpalarka symlink"
  50. ln -s "VCMI_BattleAiHost/vcmirunner"
  51. errorcheck "runner symlink"
  52. ln -s "server/vcmiserver"
  53. errorcheck "server symlink"
  54. elif [ "$1" = "--clean" ]; then
  55. find . -name "*" -exec bash -c "if [[ {} != './vcmiinstall.sh' ]] && [[ {} != './vcmipack.zip' ]] && [[ {} != '.' ]] && [[ {} != '..' ]]; then rm -rf {} ; fi" \;
  56. elif [ "$1" = "--help" ]; then
  57. echo "VCMI programming challenge installation script"
  58. echo
  59. echo "Available commands: "
  60. echo "--clean removes all created files except this script."
  61. echo "--help displays this info."
  62. echo "--install full downloads and compiles full VCMI with graphical client; requires ffmpeg."
  63. echo "--install lean downloads and compiles most of VCMI (without graphical client)."
  64. else
  65. incusage
  66. fi