The latest Minetest 5.4.0 was released last February 23, 2021. The binary can be downloaded at the official Minetest website at https://www.minetest.net/downloads/. But if you want to impress your friends that you can compile Minetest from the source code, follow this guide 😀

We need to do the following:

  1. Install Pre-requisite for compiling Minetest
  2. Get the 5.4.0 source code on the Minetest Github
  3. Compile Minetest
  4. Play Minetest

Installing Pre-requisite for compiling Minetest

We need to have Microsoft Visual Studio 2015 or higher, cmake, vcpkg and git for windows. I won’t cover the installation of Visual Studio or Git for Windows in this guide. You can get the git for windows at this site: https://gitforwindows.org/.

After installing git for windows, we now need to install of vcpkg:

Create a folder at C:\src\ and right click, select Open GIT Bash/CLI here. You should now be at the C:\src\ directory:

$ git clone https://github.com/microsoft/vcpkg
$ .\vcpkg\bootstrap-vcpkg.bat --disableMetrics

The parameter --disableMetrics will disallow vcpkg from phoning home to Micro$oft.

Installing the required and optional packages to build Minetest:

> vcpkg install irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit gmp jsoncpp --triplet x86-windows
> vcpkg install irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit gmp jsoncpp --triplet x64-windows

This ate about 3 GB of disk space.

Getting the Minetest 5.4.0 Source Code

The official Minetest git repository can be found at: https://github.com/minetest/minetest. I just grabbed a compressed source code at the Releases page: https://github.com/minetest/minetest/archive/5.4.0.zip. Extract the zip file with 7-zip or your favourite application for decompressing zip.

Alternatively you can git clone the stable-5 branch, Open Git Bash/CLI:

$ git clone --branch stable-5 https://github.com/minetest/minetest

Cloning into 'minetest'...
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 71127 (delta 8), reused 10 (delta 4), pack-reused 71102
Receiving objects: 100% (71127/71127), 77.69 MiB | 1.20 MiB/s, done.
Resolving deltas: 100% (51145/51145), done.

Compiling Minetest using CMAKE GUI and vcpkg toolchain

  1. Open the CMAKE GUI at C:\src\vcpkg\downloads\tools\cmake-3.19.2-windows\cmake-3.19.2-win32-x86\bin\cmake-gui.exe

  1. Select Browse Source... and select the directory that contains the minetest source code, eg. DIR/minetest.

  2. Select Browse Build... and select the directory that contains the minetest source code build directory, eg.DIR/minetest-build.

  3. Click Configure.

  4. Choose the visual Studio version that is currently installed and target platform (either x86 or x64 [default]). It needs to match the version of the installed dependencies.

  5. Choose Specify toolchain file for cross-compiling.

  1. Click Next.

  2. Select the vcpkg toolchain file e.g. C:\vcpkg\scripts\buildsystems\vcpkg.cmake.

  1. Click Finish.

  2. Wait until cmake have generated the build files.

  1. If there are any errors, solve them and hit Configure.

  2. Click Generate.

  1. Click Open Project, Visual Studio should launch.

  1. Select target BUILD to Release on Visual Studio and click BUILD > BUILD ALL.

  1. Wait for it to build (mine took around 18 minutes).

  1. After the build, copy the bin/Releases contents to bin and click Build > Clean ALL_BUILD to clean solution and free up around a gigabyte of disk space.

Playing Minetest

Run bin\minetest.exe

Note: The compiled Minetest does not contain the Minetest Game, it is only an engine.

References:

https://github.com/minetest/minetest#compile-minetest

Except where otherwise noted, this work is licensed under Creative Commons Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0/).