common.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash -e
  2. # Linux build only
  3. install_linux_deps() {
  4. local pkgs=(
  5. cmake gettext postgresql
  6. libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev
  7. libsqlite3-dev libhiredis-dev libogg-dev libgmp-dev libvorbis-dev
  8. libopenal-dev libpq-dev libleveldb-dev libcurl4-openssl-dev libzstd-dev
  9. )
  10. if [[ "$1" == "--no-irr" ]]; then
  11. shift
  12. else
  13. local ver=$(cat misc/irrlichtmt_tag.txt)
  14. wget "https://github.com/minetest/irrlicht/releases/download/$ver/ubuntu-bionic.tar.gz"
  15. sudo tar -xaf ubuntu-bionic.tar.gz -C /usr/local
  16. fi
  17. sudo apt-get update
  18. sudo apt-get install -y --no-install-recommends "${pkgs[@]}" "$@"
  19. sudo systemctl start postgresql.service
  20. sudo -u postgres psql <<<"
  21. CREATE USER minetest WITH PASSWORD 'minetest';
  22. CREATE DATABASE minetest;
  23. "
  24. }
  25. # macOS build only
  26. install_macos_deps() {
  27. local pkgs=(
  28. cmake gettext freetype gmp jpeg-turbo jsoncpp leveldb
  29. libogg libpng libvorbis luajit zstd
  30. )
  31. brew update
  32. brew install "${pkgs[@]}"
  33. brew unlink $(brew ls --formula)
  34. brew link "${pkgs[@]}"
  35. }