You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

101 lines
2.4 KiB

  1. #!/bin/bash
  2. set -e
  3. #load dep exports
  4. #need to switch to game dir for Dockerfile weirdness
  5. original_dir=$PWD
  6. cd $1
  7. . dependencies.sh
  8. cd $original_dir
  9. #find out what we have (+e is important for this)
  10. set +e
  11. has_git="$(command -v git)"
  12. has_cargo="$(command -v ~/.cargo/bin/cargo)"
  13. has_sudo="$(command -v sudo)"
  14. has_cmake="$(command -v cmake)"
  15. has_gpp="$(command -v g++-6)"
  16. has_grep="$(command -v grep)"
  17. set -e
  18. #install cargo if needful
  19. if ! [ -x "$has_cargo" ]; then
  20. echo "Installing rust..."
  21. curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host i686-unknown-linux-gnu
  22. . ~/.profile
  23. fi
  24. #apt packages
  25. if ! { [ -x "$has_git" ] && [ -x "$has_cmake" ] && [ -x "$has_gpp" ] && [ -f "/usr/lib/i386-linux-gnu/libmariadb.so.2" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] && [ -d "/usr/share/doc/g++-6-multilib" ] && [ -d "/usr/include/mysql" ]; }; then
  26. echo "Installing apt dependencies..."
  27. if ! [ -x "$has_sudo" ]; then
  28. dpkg --add-architecture i386
  29. apt-get update
  30. apt-get install -y git cmake libmariadb-dev:i386 libssl-dev:i386 grep g++-6 g++-6-multilib
  31. ln -s /usr/include/mariadb /usr/include/mysql
  32. rm -rf /var/lib/apt/lists/*
  33. else
  34. sudo dpkg --add-architecture i386
  35. sudo apt-get update
  36. sudo apt-get install -y git cmake libmariadb-dev:i386 libssl-dev:i386 grep g++-6 g++-6-multilib
  37. sudo ln -s /usr/include/mariadb /usr/include/mysql
  38. sudo rm -rf /var/lib/apt/lists/*
  39. fi
  40. fi
  41. #update rust-g
  42. if [ ! -d "rust-g" ]; then
  43. echo "Cloning rust-g..."
  44. git clone https://github.com/tgstation/rust-g
  45. else
  46. echo "Fetching rust-g..."
  47. cd rust-g
  48. git fetch
  49. cd ..
  50. fi
  51. #update BSQL
  52. if [ ! -d "BSQL" ]; then
  53. echo "Cloning BSQL..."
  54. git clone https://github.com/tgstation/BSQL
  55. else
  56. echo "Fetching BSQL..."
  57. cd BSQL
  58. git fetch
  59. cd ..
  60. fi
  61. echo "Deploying rust-g..."
  62. cd rust-g
  63. git checkout $RUST_G_VERSION
  64. ~/.cargo/bin/cargo build --release
  65. mv target/release/librust_g.so $1/rust_g
  66. cd ..
  67. echo "Deploying BSQL..."
  68. cd BSQL
  69. git checkout $BSQL_VERSION
  70. mkdir -p mysql
  71. mkdir -p artifacts
  72. cd artifacts
  73. cmake .. -DCMAKE_CXX_COMPILER=g++-6 -DMARIA_LIBRARY=/usr/lib/i386-linux-gnu/libmariadb.so.2
  74. make
  75. mv src/BSQL/libBSQL.so $1/
  76. #run deploy.sh
  77. echo 'Deploying tgstation compilation...'
  78. cd $1
  79. mkdir build
  80. shopt -s extglob dotglob
  81. mv !(build) build
  82. shopt -u dotglob
  83. chmod +x build/tools/deploy.sh
  84. build/tools/deploy.sh $1 $1/build
  85. rm -rf build