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