Linux Final Minetest Build Kit Release: 220509 ---------------------------------------------------------------------- 1. Final Minetest is an improved version of trollstream Minetest and MultiCraft. For more about what Final Minetest is and does, see the following file: features.txt See also: changes.txt # Change-log license.txt # License information quickstart.txt # Quickstart instructions ---------------------------------------------------------------------- 2. This is the Linux build kit for the server-client part of Final Minetest release 220509. Note: This kit is intended for Linux CLI developers and power users [not end users]. This release can build Minetest and/or MultiCraft clients and/or ser- vers of different types. Two sample worlds are included. Instructions for adding new worlds are in part 14 below. There are two installation modes: system-wide [requires superuser ac- access] and regular user [everything is stored in a subdirectory of $HOME]. ---------------------------------------------------------------------- This release can build any or all of the following: * A Minetest server derived from MultiCraft 2. This server is referred to as Finetest Server. The executable file is usually named "finetest- server". It's compatible with the following clients or protocols: Minetest 4, Minetest 5 through 5.3.X, MultiCraft 1 and 2, and clients from older releases of Final Minetest. This is presently the recommended server to use. It supports almost all clients. Associated "mtcompile-program.pl" switches: --build --server --finetest * A Minetest server derived from Minetest 4. This server is referred to as Classic Server. The executable file is usually named "minetest- server". It's compatible with clients from Minetest 4 and older rele- ases of Final Minetest. This server also supports numerous Minetest 5 bug fixes and features through circa 2020. The Finetest Server should be used instead except in two cases: (a) if there's a need for high compatibility with Minetest 4 or (b) if there's an interest in speed and there's no need to support Minetest 5 clients. Associated "mtcompile-program.pl" switches: --build --server --classic * A Minetest client derived from Minetest 4. This client is referred to as Classic Client. The executable file is usually named "minetest". It's compatible with servers from Minetest 4, MultiCraft 2, and all releases of Final Minetest. This is presently the recommended client to use. It's faster than the MT 5 client, includes more features, and works with most servers other than trollstream MT 5 and MultiCraft 1. Associated "mtcompile-program.pl" switches: --build --client --classic * A trollstream Minetest 5 client. This client is referred to as MT 5 Client. The executable file is usually named "finetest". It's compati- ble with servers from Minetest 5.X through Minetest 5.3, MultiCraft 2, and newer releases of Final Minetest. The Classic Client should be used instead except when there's a need to connect to trollstream Minetest 5 worlds. Associated "mtcompile-program.pl" switches: --build --client --finetest * Build Classic server and client together. Associated switches: --build --classic --client --server * Build Finetest Server and Classic Client together. This mode requir- es multiple commands. For more information, see part 11. * Build Finetest Server and MT 5 Client together. This mode requir- es multiple commands. For more information, see part 11. ---------------------------------------------------------------------- 3. For an overview of two sample "build" procedures [Finetest Server as superuser or regular user], see "quickstart.txt". The rest of this document [linux-minetest-kit.txt] fills in details. The programs are intended to run on the same machine that they were compiled on. If you'd like to build a package for distribution to dif- ferent machines, see Appendix C. Additional documentation is online at: https://minetest.org/ ---------------------------------------------------------------------- 4. Requirements: * OS: A 64-bit Linux. * CPU: For building, a quad-core or 8-thread processor or better is recommended. Dual-core or 4 threads might work, but this isn't guar- anteed. * RAM: For building, 8GB or better is recommended. 4GB might work, but this isn't guaranteed. * About 4 GB of free disk space. * Development tools: gcc and g++ compilers. Compiler releases from 6 to 8 should work. Releases 4, 5, and 9 might work. autoconf, lib- tool, and related autohell tools. pkgconf. A semi-recent copy of cmake. * Development libraries for bzip2, curl, expat, freetype2, jpeg, libedit, libgmp, libogg, libpng, libvorbis, ncurses, openal, open- ssl, readline, xorg, and zlib. * perl, python2, python3, ruby, tcl. This isn't necessarily a complete list. For example, see part 6 below. Final Minetest will build without "curl" development libraries, but they're strongly recommended. If they're not installed, program per- formance on the Internet will be slow. The exact names of the library packages will vary from Linux distro to Linux distro. ---------------------------------------------------------------------- 5. "Development libraries" means that you need distro packages which include 'C' and/or C++ header files as well as ".so" and/or ".a" lib- rary files. ---------------------------------------------------------------------- 6. Initial steps. The initial steps involved in using this "build" kit are as follows: 6.1. Install the development packages discussed in part 4 above. If you're using one of the major Linux distros, try executing: bash -e /opt/minebest/mtkit/builddeps.sh Note: The script may prompt for timezone information, so it should be run interactively. ---------------------------------------------------------------------- Suggested commands for other distros will be listed here in the fu- ture. ---------------------------------------------------------------------- 6.2. Go to a convenient directory. Rename or delete any existing copy there of the directory "linux-minetest-kit.zip". Unpack "linux- minetest-kit.zip". This should create a new directory named "linux- minetest-kit". ---------------------------------------------------------------------- 6.3. "mtkit" directory note: This document assumes that the Linux Minetest Kit will be installed in the following directory tree: /opt/minebest/mtkit/ If you prefer, you can install the kit to the following directory tree instead: /opt/mtkit/ If you elect to do this, replace the 1st directory name above with the 2nd one below and in other Final Minetest documents. Final Minetest programs and worlds will be installed in the following directory tree regardless: /opt/minebest/ ---------------------------------------------------------------------- 6.4. If you're "root" or you can do "sudo bash": * Create a user and group both named "minebest" * Create the following directory: /opt/minebest/ * Rename or delete any existing copy of: /opt/minebest/mtkit/ * Move "linux-minetest-kit" to: /opt/minebest/mtkit/ cd /opt/minebest/ rm -fr mtbin cp -a /opt/minebest/mtkit/mtsrc/mtbin/ . mkdir -p log mtworlds tmp Add the following directory to the default PATH for the "root" ac- count: /opt/minebest/mtbin Log-out. Log-in again as "root" or execute "sudo bash". cd /opt/minebest/mtkit/ rm -fr toolstree ---------------------------------------------------------------------- 6.5. If you're a regular user without "sudo bash" access, try the fol- lowing procedure instead: * Create the following directory: $HOME/opt/minebest/ * Delete or rename any existing copy of: $HOME/opt/minebest/mtkit/ * Unpack the Linux Minetest Kit and move it to: $HOME/opt/minebest/mtkit/ mkdir -p $HOME/opt/minebest/ cd $HOME/opt/minebest/ rm -fr mtbin cp -a $HOME/opt/minebest/mtkit/mtbin/ . cp -p mtbin/hometest-start mtbin/minetest-start mkdir -p log mtworlds tmp # Add the following directory to the default PATH for your account: # # $HOME/opt/minebest/mtbin # Log-out and log-in again. cd $HOME/opt/minebest/mtkit/ rm -fr toolstree ---------------------------------------------------------------------- 7. If you'd like LevelDB, PostgreSQL, and/or Redis support, install distro development libraries for those database systems. Additionally, add one or more of the following switches, as appropri- ate, to the "mtcompile-program.pl" command line that you'll execute in part 11: --enable-leveldb --enable-postgres --enable-redis There's no need to install libraries or header files for SQLite3. This kit builds SQLite3 for you. This kit doesn't build PostgreSQL or Redis because those database sys- tems require external daemons, something that it's beyond the scope of this kit to set up. Additionally, this kit doesn't build LevelDB because we haven't been able to do that in a manner that is backwards-compatible with old MT worlds. ---------------------------------------------------------------------- 8. "Debug" version. If you'd like to build a "debug" version of the program, one suitable for use with "gdb", add the following switch to the "mtcompile-program .pl" command line that you'll execute in part 11: --debug This will make the following changes: * The "--noclean" switch (discussed in part 9.1) is implied * Compile program with lower optimization * Compile program with debug symbols enabled ---------------------------------------------------------------------- 9. Persistent development tree. By default, the Linux MT build kit produces a clean production tree; i.e., a directory tree intended for end users. To this end, it proceeds as follows: * Each time that the programs (*inetest*) are built, delete the output tree (minetest) and start from scratch. * Use core sources that are stored in a bundled tarball. * After each build, tidy up. This includes deleting most of the un- packed sources. If you'd like to have a persistent development tree instead, one that remains after each build, proceed as follows. ---------------------------------------------------------------------- 9.1. If you don't want to have a persistent development tree, skip to part 10. If you'd like to use one of the multi-command build procedures in part 11, skip to part 10 as well. Persistent development trees aren't sup- ported for those build procedures. Add the following switch to the "mtcompile-program.pl" command line that you'll execute in part 11: --noclean By default, the Linux Minetest program build script "mtcompile-program .pl" deletes existing copies of the "minetest" source (and production) tree before proceeding, replaces the tree with the contents of a bun- dled source tarball, and deletes "build" files that are no longer needed after a "build" is completed. The "--noclean" switch suppresses these steps. ---------------------------------------------------------------------- 9.2. Delete the "minetest" output directory in the build tree, if it exists: rm -fr minetest Warning: Anything stored in the "minetest" tree will obviously be lost. ---------------------------------------------------------------------- The "mtcompile-program.pl" script, which you'll run in part 11, will now behave differently: * If the "minetest" output directory is present, the script will reuse the sources in the tree instead of unpacking them from the bundled source tarball. * The script will no longer delete the sources after each build. ---------------------------------------------------------------------- 10. Building libraries. The build kit comes with the source code for the following libraries: luajit, luasocket, irrlicht, and sqlite3. A few patches are included. To build the libraries, go to the "mtkit" directory [wherever you ended up putting it] and execute this command: bash -e mtcompile-libraries.sh build >& libraries.log Note: This command may, or may not, build a copy of gcc 8. For more information about that part, see Appendix D. Allow 15 to 90 minutes. When control returns to the CLI prompt, review the log file. This step creates a "toolstree" directory that contains various lib- raries and possibly a copy of gcc 8. Warning: This step deletes the existing "toolstree" tree, if there is one. ---------------------------------------------------------------------- 11. To build the Final Minetest programs, execute one of the following procedures in the same directory after the preceding step is comple- ted: # Build Final MT Finetest Server perl mtcompile-program.pl --build --server --finetest >& pro.log # Build Final MT Classic Server perl mtcompile-program.pl --build --server --classic >& pro.log # Build Final MT Classic Client perl mtcompile-program.pl --build --client --classic >& pro.log # Build general MT 5 client perl mtcompile-program.pl --build --client --finetest >& pro.log # Build Finetest Server and MT 5 Client together: perl mtcompile-program.pl --build \ --server --client --finetest >& pro.log # Build Finetest Server and Classic Client together: perl mtcompile-program.pl --build --server --finetest >& pro1.log mv minetest/bin/finetestserver $HOME/ perl mtcompile-program.pl --build --client --classic >& pro2.log mv $HOME/finetestserver minetest/bin/ Allow 10 to 45 minutes. When control returns to the CLI prompt, review the log file produced. Warning: By default, this step deletes the existing "minetest" tree, if there is one. If you'd like to reuse the tree, e.g., for develop- ment purposes, see part 9 above. You can mix and/or repeat the procedures shown above. Each build will reuse the libraries built previously. ---------------------------------------------------------------------- 12. To install the sample worlds provided: # If you're supervisor or you can do "sudo bash": # Log-in as "root" or do "sudo bash" cd /opt/minebest/mtworlds/ rm -fr bucketcity bytesize unzip -qo /opt/minebest/mtkit/mtsrc/worlds/bucketcity.zip unzip -qo /opt/minebest/mtkit/mtsrc/worlds/bytesize.zip chown -R minebest.minebest /opt/minebest/ If you're a regular user: # Log-in as the account in question cd $HOME/opt/minebest/mtworlds/ rm -fr bucketcity bytesize unzip -qo $HOME/opt/minebest/mtkit/mtsrc/worlds/bucketcity.zip unzip -qo $HOME/opt/minebest/mtkit/mtsrc/worlds/bytesize.zip There should be subdirectories in the "mtworlds" folder now. In each of the subdirectories, there should be a "world.conf" file. Edit each of the "world.conf" files. Modify all settings appropriately. Especially these: motd, name, port, server_address, server_name ---------------------------------------------------------------------- 13. You should now be able to run the sample worlds: # If you're supervisor or you can do "sudo bash": # Log-in as "root" or do "sudo bash" or "sudo minebest" minetest-restart bucketcity minetest-restart bytesize If you're a regular user: # Log-in as the account in question minetest-restart bucketcity minetest-restart bytesize Other useful commands: minetest-allstart # Start all worlds where not started minetest-allstop # Stop all worlds where not stopped minetest-list # List installed worlds minetest-start bytesize # Start a world if not started minetest-stop bytesize # Stop a world if not stopped ---------------------------------------------------------------------- 14. To add another world, proceed as follows. This can be a new world or a copy of an existing one from another ser- ver. Warning: Not all pre-existing maps and/or modsets will work. If you're supervisor or you can do "sudo bash": # Log-in as "root" or do "sudo bash" cd /opt/minebest/mtworlds/ rm -fr moocow unzip /opt/minebest/mtkit/mtsrc/newline/moocow.tgz If you're a regular user: # Log-in as the account in question cd $HOME/opt/minebest/mtworlds/ rm -fr moocow unzip $HOME/opt/minebest/mtkit/mtsrc/newline/moocow.tgz Rename "moocow" to a short lower-case single-word name for the new world. The name shouldn't include any spaces or punctuation. Go into the new directory. Rename "moocow_game" to "..._game" where "..." is the single-word name selected above. Edit "..._game/game.conf" and "world.mt". Replace "moocow" with the same single-word name. Edit "world.conf". Modify all settings appropriately. Especially these: motd, name, port, server_address, server_name If you have an existing Minetest "map.sqlite" file and/or other world data files such as the following: auth.sqlite map_meta.txt players.sqlite world.mt xban.db copy the files into the directory where "world.conf" is stored. The directory tree in question includes, under "..._game/mods/", a nearly-empty modset containing just the "default" mod. Remove the "default" mod and put the modset that you'd like to use where it was. If you're superuser and the new world is stored under "/opt/minebest/" execute this command: chown -R minebest.minebest /opt/minebest/mtworlds/ ---------------------------------------------------------------------- 15. The "toolstree" and "minetest" directory trees are both needed at runtime. The "mtsrc" directory, which contains source tarballs and patch files, isn't needed after builds are completed. If you build a "portable" copy of the package as discussed in Appendix D, that copy is different. It doesn't need the "toolstree" directory tree at runtime. ---------------------------------------------------------------------- Appendix A. Pre-build special parameters. A.1. If you have a big-endian machine, edit "mtcompile-libraries.sh" and change 0 to 1 in the line indicated below: -DLEVELDB_IS_BIG_ENDIAN=0 \ Note: Presently, this step has no effect, but it may be required in the future. ---------------------------------------------------------------------- A.2. If you encounter crashes that you believe to be due to overheat- ing or to system overload in general, edit the two ".sh" scripts and change the following line: NUMJOBS=`getconf _NPROCESSORS_ONLN 2>&1` to look like this: NUMJOBS=2 Adjust the number upwards until you find the largest number (in the range of 2 to 8) which allows builds to succeed. ---------------------------------------------------------------------- A.3. If you're a distro developer, and you've got equivalents to "/usr/include" and "/usr/lib" located in prefixes other than "/usr", you may need to set one or both of the following parameters in "mtcom- pile-libraries.sh": ALT1_PREFIX= ALT2_PREFIX= If either parameter is set, it should specify the absolute path for a directory that contains "include" and "lib" directories. The directory, or directories, specified are added to "gcc's" internal lists of directories to search. The ALT1_PREFIX directory, if any, takes precedence over the ALT2_ PREFIX directory, if any. ---------------------------------------------------------------------- A.4. Distro developers who have moved the standard startup object files "*crt*.o" to non-standard locations may need to copy those files temporarily to "/lib" or "/usr/lib". ---------------------------------------------------------------------- Appendix B. Post-build adjustments. B.1. If you or the people that you're building Final Minetest for pre- fer to use the arrow keys for movement, add the following settings to "minetest.conf": keymap_forward = KEY_UP keymap_backward = KEY_DOWN keymap_left = KEY_LEFT keymap_right = KEY_RIGHT Remove existing instances of the indicated parameters first. ---------------------------------------------------------------------- B.2. Minetest quirk: Be sure not to store a PNG file named "menu_ header.png" in the system's root directory. Oddly, Minetest checks the root directory for that file. If it's pre- sent there, this may lead to incorrect behavior. ---------------------------------------------------------------------- Appendix C. Building a portable Linux Minetest. By default, this build kit builds Minetest for use on the machine where it's compiled or on an identical machine: same hardware, same Linux distro, and same distro release. If you'd like to build Minetest for distribution, here's how that works. Note: This procedure is presently supported only for 64-bit Linux dis- tros. C.1. First, you need to run "mtcompile-libraries.sh" in "bootstrap" mode. This means edit the file and change the "DOBOOTSTRAP=..." line to: DOBOOTSTRAP=true then run the script. This may take several hours depending on your hardware. C.2. Next, you need to run "mtcompile-program.sh" in "portable" mode. To do this, add the following switch to the command line in part 11: --portable "Portable" mode adds some prebuilt Debian 8 shared-library files to the package. The libraries work on most modern 64-bit Linux distros despite origin- ating in Debian 8. The libraries are FOSS. You can obtain the associated source code using the standard Debian procedures for doing so. ---------------------------------------------------------------------- Appendix D. Bootstrap vs. native compiler. D.1. By default, the Linux build kit works like this: * If the native gcc is older than release 6, the build kit builds gcc 8 and uses that to compile Minetest and some of the required lib- raries. * If the native gcc is release 6 or newer, that compiler is used in- stead. ---------------------------------------------------------------------- D.2. Our theory is that the default mode should work except possibly for clients built on systems with native gcc 4 or 5 compilers. An internal copy of gcc 8 will be built and used on such systems. More work may be needed to debug this approach for client builds. Server builds may work regardless. ---------------------------------------------------------------------- D.3. If you run into compile-time problems, or run-time crashes that seem to be related to C++, you can try overriding the default boot- strap mode. ---------------------------------------------------------------------- D.4. To force the build kit to build its own copy of gcc 8, edit the file "mtcompile-libraries.sh". Look for a line similar to the follow- ing: DOBOOTSTRAP=... Change the part after the "equals" sign, whatever it is, to "true". Save the file and exit. ---------------------------------------------------------------------- D.5. To force the build kit *not* to build its own copy of gcc 8, do the same thing, but specify "false" instead of "true". (end of document)