This was originally made to be an update of Calinou's 1-line script but I think there is a need to make a detailed tutorial about compilation on Linux, especially with the new Irrlicht fork.
See at the bottom for the 1-line script.
This procedure downloads and builds latest git Minetest in the directory you are in (change with cd), creating a portable install (all data is kept in the folder). I have tested it on my Ubuntu Mate 20.04, and it will probably work on others Debian-based systems. For the earlier or later versions, there is possibility that some package names differ.
In general, the concepts would be the same for every Linux-based systems, but equivalent libraries have to be found.
1. Install libraries
To install all recommended libraries:Code: Select all
sudo apt-get install git g++ make cmake build-essential libjpeg8-dev libpng-dev zlib1g-dev libopengl-dev libglx-dev libgl1-mesa-dev libx11-dev libxxf86vm-dev libvorbis-dev libopenal-dev libsqlite3-dev libzstd-dev libluajit-5.1-dev libjsoncpp-dev libgmp-dev libcurl4-gnutls-dev libfreetype6-dev
- git (for downloading)
- g++
- make
- cmake
- build-essential
- libjpeg8-dev
- libpng-dev
- zlib1g-dev
- libopengl-dev
- libglx-dev
- libgl1-mesa-dev
- libx11-dev
- libxxf86vm-dev
- libvorbis-dev
- libopenal-dev
- libsqlite3-dev
- libzstd-dev
- LuaJIT: libluajit-5.1-dev
- JSON: libjsoncpp-dev
- GMP: libgmp-dev
- cURL: libcurl4-gnutls-dev
- FreeType: libfreetype6-dev
- For PostgreSQL backend: libpq-dev and postgresql-server-dev-12
- For LevelDB backend: libleveldb-dev
- For Redis backend: libhiredis-dev
- For NCurses: libncurses-dev
- For SpatialIndex: libspatialindex-dev
2. Download Minetest, Minetest Game and Minetest's Irrlicht
Minetest is now based on a custom fork of Irrlicht (IrrlichtMt) that needs to be downloaded separately. Here I propose to install it as a symlink. This is a way to keep the repo accessible from the main directory, while still installing it where Minetest will expect to find it. Cloning irrlicht directly into minetest/lib is possible too, of course (but rename it irrlichtmt).Code: Select all
git clone --depth=1 https://github.com/minetest/minetest
git clone --depth=1 https://github.com/minetest/irrlicht
ln -s ../../irrlicht minetest/lib/irrlichtmt
Code: Select all
git clone --depth=1 https://github.com/minetest/minetest_game
ln -s ../../minetest_game minetest/games/minetest_game
3. Build Minetest
IrrlichtMt should now build automatically with Minetest.Code: Select all
cd minetest
cmake . -DRUN_IN_PLACE=1
make -j$(nproc)
4. Run it and enjoy :)
Code: Select all
bin/minetest
TL;DR: All-in-one install script
This script should do all the above steps, and run Minetest at the end. Just copy-paste it in a terminal.Code: Select all
echo -e "\nInstalling required packages\n" && sudo apt-get install -y git g++ make cmake build-essential libjpeg8-dev libpng-dev zlib1g-dev libopengl-dev libglx-dev libgl1-mesa-dev libx11-dev libxxf86vm-dev libvorbis-dev libopenal-dev libsqlite3-dev libzstd-dev libluajit-5.1-dev libjsoncpp-dev libgmp-dev libcurl4-gnutls-dev libfreetype6-dev && echo -e "\nDownloading content\n" && git clone --depth=1 https://github.com/minetest/minetest && git clone --depth=1 https://github.com/minetest/minetest_game && git clone --depth=1 https://github.com/minetest/irrlicht && ln -s ../../minetest_game minetest/games/minetest_game && ln -s ../../irrlicht minetest/lib/irrlichtmt && echo -e "\nBuilding Minetest\n" && cd minetest && cmake . -DRUN_IN_PLACE=1 && make -j$(nproc) && echo -e "\nLaunching the game, just for you.\nEnjoy\n" && bin/minetest