Compiling on OpenBSD

From Mudlet
Jump to navigation Jump to search

Compiling on OpenBSD

PRELIMINARY, IN PROGRESS

This represents work done by SlySven (his GitHub Mudlet repository is here) a member of the Core Developers of Mudlet. At the time of writing some changes to the Mudlet source code are still required to accommodate this operating system. Only the qmake project build system has been tested/used so far.

This is NOT in itself an official OpenBSD "port" or a "package" (though perhaps it might lead to one), instead it should compile an executable application that can be run by the user who compiles it; however it has not been developed enough yet such that it could be made available and run by any other local machine account holder (user).

1. Install required packages from main repo.

As a normal user install the following packages (using doas pkg_add packageName1 packageName2 ... packageNameN). These will pull in a number of other packages as well, some of them will be required by a Mudlet build and some are optional as indicated:
Package name Notes
boost Mudlet, in particular, uses the boost A* implementation to provide the speedwalk (path-finding) algorithm in its MUD/Game maps.
ccache Optional. however for developers who will be switching between different branches in Git repositories it is beneficial to cache and reuse where possible object (.o) files from branches that have previously been compiled. This will considerably speed up the rebuilding of a previously worked-on branch when it is returned to.
clang The LLVM compiler (which is the default on OpenBSD) rather than the GCC/G++ one; an attempt to use the latter seemed to fail at the link stage with missing elements from what should have been in the C++ standard library.
git Required to obtain the Mudlet (and its third-party git submodules).
gmake GNU make used by qmake-qt5.
hunspell Dictionary files are also needed - see mozilla-dicts-en-GB.
libyajl Required to build at least one Luarock lua-yajl that Mudlet uses and is also used when compiling Mudlet.
libzip Required to build at least one Luarock lua-zip that Mudlet uses.
lua%5.1 Required, the partial version number is also needed to get the "flavor" of Lua that Mudlet needs.
mozilla-dicts-en-GB the Mudlet application normally looks for a (Hunspell compatible) "affix" file called en_US.aff (though the '_' can be a '-' and the second part can be lower-cased) which is used in conjunction with the corresponding American English "dictionary" file en_US.dic to find installed "system" spelling dictionaries. On OpenBSD these type of files are provided for the Mozilla organisation's FireFox web-browser and Thunderbird mail client. However there does not appear to be an external Hunspell dictionary for that language available in this operating system (perhaps it is internalised in those products); so my initial proposed Mudlet changes for this operating system only will look instead for the British English equivalent en_GB.aff instead. It would be useful to install as many of the other mozilla-dicts-* packages as required; however if this British English dictionary is not found when Mudlet is run it will attempt to use a set of dictionaries .
pugixml Required.
qt-creator Optional Integrated Development Environment which is a useful environment to develop and debug Mudlet (and other Qt based applications). Installing it will automatically pull in some of the other items in this list but at this time it is not clear
qtgamepad Optional but Mudlet can use the gamepads that Qt supports with this module.
qtkeychain Optional, Mudlet has a copy within its third party code but better integration with the OS will happen if the OS's package is used (and the environmental variable WITH_OWN_QKEYCHAIN exists and is set to NO during compilation).
qtmultimedia Required but not included by default by installation of qtbase.
qttools Provides qmake-qt5 and other tools needed to build Mudlet from the "qmake" project file (./src/mudlet.pro in the Mudlet source code).
sqlite3 Required to build luasql-sqlite3 and use it for database functions in Mudlet's Lua API.
unzip-- Required for Luarocks to get source files to build some rocks, but not installed as a dependency of that by OpenBSD. The -- is needed to disambiguate between two flavours of the utility, with and without a -iconv suffix, either can be used, and this selects the one without, without asking.

2. Get Mudlet source.

Make a directory in a personal part of the file-system to work from, most simply it would be a sub-directory of the user's home directly (e.g. "src") from which a further project specific directory can be created for mudlet:

mkdir ~/src cd ~/src git clone https://github.com/Mudlet/Mudlet.git ./mudlet cd mudlet

3. Get needed Luarocks

Rockname Notes
lrexlib-pcre
lua-yajl
luafilesystem Not needed on OpenBSD as it is already available as the luafs package
luasql-sqlite3 There is a luasqlite3 OpenBSD package with a compatible interface it
luautf8
lua-zip

In build directory (last two arguments cause a debug type build with the debug information in a separate mudlet.debug file: qmake-qt5 ../src/mudlet.pro -spec openbsd-clang CONFIG-=qml_debug CONFIG-=qtquickcompiler CONFIG+=debug CONFIG+=separate_debug_info