1. #!/bin/bash
  2.  
  3. #get and compile latest version of DCSS for OSX
  4.  
  5. #YOU NEED TO HAVE XCODE AND COMMAND LINE TOOLS INSTALLED!
  6.  
  7. #You may need to add "tile_full_screen = false" to crawls init.txt
  8.  
  9. #crawl source directory.  this is where the files are downloaded to
  10. #change this to whatever you want
  11. dldir="$HOME/code/downloads/crawl"
  12.  
  13. disable_wizard_mode="y"
  14. build_tiles="y"
  15. build_console="y"
  16.  
  17. mastersource="git://gitorious.org/crawl/crawl.git"
  18.  
  19. #check dependancies
  20. type -t git 2>&1 >/dev/null
  21. GIT_IS_NOT_SETUP=$?
  22. if [ $GIT_IS_NOT_SETUP != 0 ]; then
  23.   echo "ERROR:  git not installed"
  24.   echo "Go to https://help.github.com/articles/set-up-git for directions to install Git"
  25.   exit 1
  26. fi
  27.  
  28. type -t xcode-select 2>&1 >/dev/null
  29. XCODE_IS_NOT_INSTALLED=$?
  30. if [ $XCODE_IS_NOT_INSTALLED != 0 ]; then
  31.   echo "ERROR:  xcode not installed"
  32.   echo "Please install XCODE from the app store"
  33.   exit 1
  34. fi
  35.  
  36. # double check xcode
  37. type -t gcc 2>&1 >/dev/null
  38. XCODE_IS_NOT_INSTALLED=$?
  39. if [ $XCODE_IS_NOT_INSTALLED != 0 ]; then
  40.   echo "ERROR:  xcode not installed (gcc not found)"
  41.   echo "Please install XCODE from the app store"
  42.   exit 1
  43. fi
  44.  
  45.  
  46. echo "\nSource will downloaded to $dldir\n"
  47.  
  48. #if source directory doesn't exist, create it and do initial git pull
  49. if [ ! -d "$dldir" ]; then
  50.   echo "\nThis is the first time the script is run.  Creating directory $dldir"
  51.   mkdir -p -v $dldir
  52.   cd $dldir
  53.   git clone "$mastersource"
  54. fi
  55.  
  56.  
  57. echo "\nDownloading crawl updates\n"
  58. cd $dldir
  59. git pull
  60. git submodule update --init
  61. cd crawl-ref/source
  62.  
  63. if [ $build_tiles == "y" ]; then
  64.   echo "Compiling Crawl tiles version\n"
  65.   make clean
  66.   #make APPLE_GCC=y NO_PKGCONFIG=y CONTRIB_SDL=y TILES=y NOWIZARD=$disable_wizard_mode mac-app-tiles
  67.   make APPLE_GCC=y NO_PKGCONFIG=y CONTRIB_SDL=y TILES=y mac-app-tiles
  68.   # sometimes the above doesn't work, and you need this one instead
  69.   #make BUILD_ALL=y APPLE_GCC=y NO_PKGCONFIG=y CONTRIB_SDL=y TILES=y NOWIZARD=$disable_wizard_mode mac-app-tiles
  70.   rm -rf ~/Applications/Crawl.app
  71.   mv -f $dldir/crawl-ref/source/build/app-bundle-stage/Dungeon\ Crawl\ Stone\ Soup\ -\ Tiles.app ~/Applications/Crawl.app
  72. fi
  73.  
  74. if [ $build_console == "y" ]; then
  75.   echo "Compiling Crawl console version\n"
  76.   make clean
  77.   make
  78.   #make NOWIZARD=$disable_wizard_mode
  79.   # sometimes the above doesn't work, and you need this one instead
  80.   #make BUILD_ALL=y NOWIZARD=$disable_wizard_mode
  81. fi