common.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash -e
  2. # Linux build only
  3. install_linux_deps() {
  4. local pkgs=(
  5. cmake gettext postgresql
  6. libpng-dev libjpeg-dev libgl1-mesa-dev libxi-dev libfreetype-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. sudo apt-get update
  11. sudo apt-get install -y --no-install-recommends "${pkgs[@]}" "$@"
  12. # set up Postgres for unit tests
  13. if [ -n "$MINETEST_POSTGRESQL_CONNECT_STRING" ]; then
  14. sudo systemctl start postgresql.service
  15. sudo -u postgres psql <<<"
  16. CREATE USER minetest WITH PASSWORD 'minetest';
  17. CREATE DATABASE minetest;
  18. \c minetest
  19. GRANT ALL ON SCHEMA public TO minetest;
  20. "
  21. fi
  22. }
  23. # macOS build only
  24. install_macos_deps() {
  25. local pkgs=(
  26. cmake gettext freetype gmp jpeg-turbo jsoncpp leveldb
  27. libogg libpng libvorbis luajit zstd
  28. )
  29. export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
  30. export HOMEBREW_NO_INSTALL_CLEANUP=1
  31. # contrary to how it may look --auto-update makes brew do *less*
  32. brew update --auto-update
  33. brew install --display-times "${pkgs[@]}"
  34. brew unlink $(brew ls --formula)
  35. brew link "${pkgs[@]}"
  36. }