[macOS & MacPorts] build your minetest port

User avatar
snoopy
Member
 
Posts: 84
Joined: Thu Oct 20, 2016 16:49
Location: DE, European Union
GitHub: Zweihorn

[macOS & MacPorts] build your minetest port

by snoopy » Wed May 08, 2019 09:29

Quickstart

  1. Build and install MT on your Mac via the comman line: sudo port install minetest
  2. Afterwards run the MT game from any normal user account by calling the minetest.app in the /Applications/MacPorts folder.

Building and installing MT by the help of MacPorts

For MacOS X and macOS users with some development skills there is the opportunity to compile your own builds of the Minetest game by the help of MacPorts. The package is available since 0.4.17 and the current minetest port provides the 5.0.1 code and game comprised as one package.

Please start by consulting the documentation and the different downloads at:

To enjoy the Minetest game by the means of this package one has to login as an admin and could consider the following procedure:
  1. Install Xcode and the Xcode Command Line Tools for your version of the Mac operating system.
  2. Agree to the Xcode license in Terminal: sudo xcodebuild -license
  3. Install MacPorts for your version of the Mac operating system as applicable.
  4. Install the Xcode Command Line Tools by help of the command line: xcode-select --install
  5. Setup your MacPorts environment on the command line:
    • sudo port sync
    • sudo port reclaim
  6. Install some basic packages first. This is optionial but may be helpful to build this port and to support other builds in the future.
    Commandline: sudo port install autoconf automake bzip2 unzip libressl libtool coreutils cmake
    Please say 'Y' i.e. yes to all of the dependencies to build the tool chain. You may drop the libressl option if you want to stick with openssl instead.
  7. Install a more current X11 server as the XQuartz package may be rather outdated: sudo port install xorg-server
  8. Install the minetest port by help of the command line: sudo port install minetest
The resulting minetest.app is compliant to the Mac OS X / macOS operating system and will reside in the /Applications/MacPorts folder. Afterwards the Minetest game should be run from any normal user account.

Enjoy!

Obviously, this takes some effort and time. However, IMHO it is worth the effort. My family and me are enjoying the results as centrally administered client apps on several Macs in our local network at home for a long time. The local users can enjoy the Minetest game via a stable client and have full access to their preferences and local Minetest client mods but cannot tweak the code. Voila.

The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac operating system. Similar efforts are Fink and Homebrew.

Please note that I am not the maintainer of the a.m. package.
Last edited by snoopy on Sun May 19, 2019 12:03, edited 5 times in total.
Enjoying Minetest by MacPorts and/or Neoascetic's builds on Mac OS X with a local server and several modifications.
 

User avatar
snoopy
Member
 
Posts: 84
Joined: Thu Oct 20, 2016 16:49
Location: DE, European Union
GitHub: Zweihorn

FOSS - Re: [macOS & MacPorts] build your minetest port

by snoopy » Fri May 10, 2019 07:49

FOSS starts with "Free" and one should have the liberty of choice.

MacPorts and Homebrew as well as Fink are similar efforts and are optionial. One may consider MacPorts vs Homebrew or other discussions before chosing just either of these or none.
Enjoying Minetest by MacPorts and/or Neoascetic's builds on Mac OS X with a local server and several modifications.
 

User avatar
snoopy
Member
 
Posts: 84
Joined: Thu Oct 20, 2016 16:49
Location: DE, European Union
GitHub: Zweihorn

[macOS & MacPorts] the 'minetest_game' is useful

by snoopy » Fri May 17, 2019 12:33

I got some minor advice to avoid 'minetest_game' as it was called out-dated. IMHO a poor misunderstanding.

Please have a look at my [macOS server] bundling of mods forum topic.

Keep it running, keep it simple...

Enjoy!
Last edited by snoopy on Sun May 19, 2019 09:02, edited 2 times in total.
Enjoying Minetest by MacPorts and/or Neoascetic's builds on Mac OS X with a local server and several modifications.
 

User avatar
snoopy
Member
 
Posts: 84
Joined: Thu Oct 20, 2016 16:49
Location: DE, European Union
GitHub: Zweihorn

[macOS & MacPorts] reduce the size of PNG files for textures

by snoopy » Sat May 18, 2019 14:02

Tinkering around with Lua and the MT mods one may notice the PNG files in the textures folder.

Quickstart

At least on a Mac the MacPorts environment should be ready.

  1. Install your OptiPNG tool by: sudo port install optipng
  2. Afterwards, always use the command line: optipng -o2 -strip all <image>
    to compress any applicable image file (PNG, BMP, GIF, PNM and TIFF) to the appropriate optimised PNG file.

Please note: The compression acts on the "<image>" file (e.g., "sword_crystal_magic.png") in place and does not produce a new copy certainly for a PNG file.

N.B. Obviously, you may install and use the OptiPNG tool by other means or use alternative tools at your consideration.

Install the OptiPNG tool to reduce the size of PNG files for MT textures

The visual appearance of any node in the MT world depends heavily on the mods and their applicable PNG files in the respective textures folder. Contributions to the MT game by introduction of improved and additional textures seems to be welcome and a worthwhile task. There are even complete texture packs available to change most if not any world visual appearance to your liking.

As a Mac user and user of Mac OS X i.e. macOS you may use graphic tools (sorry: graphic Apps) like 'Pixelmator' or other. Please note the GNU Image Manipulation Program i.e. GIMP graphic tool which is open source and a quite powerful tool for many platforms including but not limited to Linux and Mac OS X or Windows.

After using Pixelmator to produce new textures i.e. Portable Network Graphics (PNG) files or just changing copies of original texture files one may notice that the original MT textures are quite small but the export from'Pixelmator' produces much bigger files, unfortunately. This is coming from metadata added and embedded to the image file.

The obvious task is to reduce the size of PNG files for MT textures. This is where a tool like OptiPNG can be quite helpful.
OptiPNG: Advanced PNG Optimizer
OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections.

OptiPNG is an open source tool for many platforms including but not limited to Linux and Mac OS X or Windows.
However, on a Mac you may install your OptiPNG tool by help of MacPorts and the sudo port install optipng command line.

OptiPNG reducing PNG files and some results from realistic examples:

  1. PNG export file by 'Pixelmator' produced from a 'Grab' screen copy
    • original Zweihorn_MT-firefly64.png -- 7.027 bytes (7 KB)
    • compressed Zweihorn_MT-firefly64.png -- 4.901 bytes (reduction by 2.126 bytes = 30.25% decrease)
  2. PNG export file by 'Pixelmator' from an original MT texture file copy
    • original file protector_logo.png -- 138 Byte (the original MT texture used in the 'protector' mod)
    • inflated copy protector_logo_ray.png -- 1.249 bytes (the new file before reduction)
    • compressed protector_logo_ray.png -- 125 bytes (reduction by 1.124 bytes = 89.99% decrease)

N.B.: The 'Grab' app can be found in the /Applications/Utilities system path of Mac OS X and is e.g., named 'Bildschirmfoto' in the /Programme/Dienstprogramme path of the DE locale.

Application of OptiPNG and the output from the command line:

Code: Select all
$ optipng -o2 -strip all Zweihorn_MT-firefly64.png
** Processing: Zweihorn_MT-firefly64.png
64x64 pixels, 3x8 bits/pixel, RGB
Stripping metadata...
Input IDAT size = 5698 bytes
Input file size = 7027 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 5      IDAT size = 5154
  zc = 9  zm = 8  zs = 1  f = 5      IDAT size = 4844
                               
Selecting parameters:
  zc = 9  zm = 8  zs = 1  f = 5      IDAT size = 4844

Output IDAT size = 4844 bytes (854 bytes decrease)
Output file size = 4901 bytes (2126 bytes = 30.25% decrease)


$ optipng -o2 -strip all protector_logo_ray.png
** Processing: protector_logo_ray.png
16x16 pixels, 4x8 bits/pixel, RGB+alpha
Reducing image to 2 bits/pixel, 4 colors (1 transparent) in palette
Stripping metadata...
Input IDAT size = 86 bytes
Input file size = 1249 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0      IDAT size = 31
                               
Selecting parameters:
  zc = 9  zm = 8  zs = 0  f = 0      IDAT size = 31

Output IDAT size = 31 bytes (55 bytes decrease)
Output file size = 125 bytes (1124 bytes = 89.99% decrease)



IMHO this is an impressive reduction rate and makes OptiPNG a quite helpful tool.

Task accomplished.
Last edited by snoopy on Mon May 20, 2019 11:34, edited 1 time in total.
Enjoying Minetest by MacPorts and/or Neoascetic's builds on Mac OS X with a local server and several modifications.
 

User avatar
snoopy
Member
 
Posts: 84
Joined: Thu Oct 20, 2016 16:49
Location: DE, European Union
GitHub: Zweihorn

[macOS & MacPorts] provide for luacheck

by snoopy » Sun May 19, 2019 16:53

Before a commit to GitHub or during Lua programming you should use a tool called LuaCheck to automatically scan your mod for any mistakes. This tool can be used in combination with your editor to provide alerts to any mistakes.

Quickstart

At least on a Mac the MacPorts environment should be ready.

  1. Install the Luarocks package manager: sudo port install luarocks
  2. Use Luarocks to install the Luacheck code checker: sudo -H luarocks install luacheck
  3. optional: sudo -H luarocks install lanes
Use /opt/local/share/luarocks/bin/luacheck or add the path to your user environment.

Provide a basic Lua development environment

Minetest has a scripting API (Application Programming Interface), which is used to program mods (short for "modifications") for the game, extending its features and adding new items. This API is accessed using an easy-to-use programming language called Lua. The only thing you will need is basic programming knowledge.


How to get involved and further information:


Before a commit to GitHub or during Lua programming you should keep the code clean and avoid mistakes before testing with the MT client already. Use a tool called LuaCheck to automatically scan your code changes or your own mod for any mistakes.

Luacheck is a static analyzer and a linter for Lua. Luacheck detects various issues such as usage of undefined global variables, unused variables and values, accessing uninitialized variables, unreachable code and more. Most aspects of checking are configurable: there are options for defining custom project-related globals, for selecting set of standard globals (version of Lua standard library), for filtering warnings by type and name of related variable, etc. The options can be used on the command line, put into a config or directly into checked files as Lua comments.

Luacheck supports checking Lua files using syntax of Lua 5.1, Lua 5.2, Lua 5.3 and LuaJIT. Luacheck itself is written in Lua and runs on all of mentioned Lua versions.


At least on a Mac the MacPorts environment should be ready.

LuaRocks is the package manager for Lua modules. It allows you to create and install Lua modules as self-contained packages called rocks. You can download and install LuaRocks on Unix, Windows and Mac OS X / macOS.

Login with an admin account for a global install to your machine and go to the home directory on the command line.
  1. Install the cURL tool (optional) if not present: sudo port install curl
    This port i.e. package is providing a library (libcurl) and command-line tool (curl) for transferring data using various protocols.
  2. Install the Luarocks package manager: sudo port install luarocks
    This will install three ports i.e. packages: the Lua programming language (currently Lua 5.3.4), the Lua file system API and the LuaRocks package manager. The "luarocks +curl +openssl" variant will be installed if the cURL tool is available (see above).
  3. Use Luarocks to install the Luacheck code checker: sudo -H luarocks install luacheck
    The "-H" option in sudo -H makes use of the HOME environment variable to set the home directory during the install. This ensures the correct paths for the Luarocks repositiory will be set and found.
  4. optional: sudo -H luarocks install lanes
    Lua Lanes is a portable, message passing multithreading library providing the possibility to run multiple Lua states in parallel.
  5. optional: sudo port install lua-luasocket
    LuaSocket is a Lua extension library that is composed by two parts: a C core that provides support for the TCP and UDP transport layers, and a set of Lua modules that add support for functionality commonly needed by applications that deal with the Internet.

Use /opt/local/share/luarocks/bin/luacheck or add the path to your user environment to use this tool on the command line.

LuaCheck can be both used on the command line and in combination with your editor to provide alerts to any mistakes. Please refer to section Configuring LuaCheck of the The Minetest Modding Book by @rubenwardy for configuring LuaCheck and using LuaCheck with an editor.
Enjoying Minetest by MacPorts and/or Neoascetic's builds on Mac OS X with a local server and several modifications.
 


Return to Builds



Who is online

Users browsing this forum: No registered users and 6 guests