Difference between revisions of "Talk:Compiling Mudlet"

From Mudlet
Jump to navigation Jump to search
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== MSYS2 ==
+
== Compiling on Windows 7+ (MSYS2 Alternative)==
* Install MSYS2: https://www.msys2.org
 
  
* At the end of installation uncheck '''run msys2 now''' and click '''finish'''
+
''INCOMPLETE, IN PROGRESS''
  
* Run '''MSYS2 MINGW64''' from the start menu
+
Go to http://www.msys2.org/ to download the 64 bit MSYS2 installer (as of 2020/05/24 32 bit hosts - for '''compiling''' software, but ''not'' for using code built with it have been deprecated, the last installer for that 32-bit systems is held at: http://repo.msys2.org/distrib/i686/msys2-i686-20200517.exe) and follow the installation instructions (Steps 1 to 8 on that page), these instructions assume that "C:\msys64" or "C:\msys32" is used depending on the bitness of the system it is being installed on.
  
* Run the following in the opened MSYS2 terminal:
+
Install the following packages (using "pacman -S ''packageName''"), the ones with a '''-i686-''' in the middle are the ones for 32-bit (i686) targets and '''-x86_64-''' are the ones for 64-bit targets - it is possible to install both for building Mudlet for target PCs of both bitnesses on a 64-bit host, it is not clear whether the reverse is true with a 32-bit host. These will pull in a number of other required packages as well (the ''--needed'' option prevents the re-installation of packages that have already been installed by MSYS2/Mingw-w64's own setup/installation process) - as some of the packages, e.g. ''base-devel'' are actually ''groups'' you will be requested to select which members of that group are actually required, it is easiest to just go with the default which is to install ALL of the packages in that group!
pacman --files --refresh
 
pacman --sync git mingw-w64-x86_64-qt-creator mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-clang-libs --noconfirm
 
  
* Run the following from the MSYS2 terminal:
+
: For 32-Bit Mudlet builds:
git clone --recursive -b development https://github.com/Mudlet/Mudlet.git
+
:<syntaxhighlight lang="shell">
 +
MSYS user@computer ~
 +
$ pacman -S --needed base-devel git mercurial cvs wget ruby zip p7zip python mingw-w64-i686-toolchain mingw-w64-i686-qt-creator mingw-w64-i686-qt5-multimedia mingw-w64-i686-libzip mingw-w64-i686-pugixml mingw-w64-i686-lua51 mingw-w64-i686-lua51-lpeg mingw-w64-i686-lua51-lsqlite3 mingw-w64-i686-hunspell mingw-w64-i686-boost mingw-w64-i686-yajl mingw-w64-i686-clang mingw-w64-i686-cmake mingw-w64-i686-SDL unzip
 +
</syntaxhighlight>
  
* Setup the development environment (~5-10min) by running:
+
: For 64-Bit Mudlet builds:
./Mudlet/CI/setup-windows-sdk.sh
+
:<syntaxhighlight lang="shell">
 +
MSYS user@computer ~
 +
$ pacman -S --needed base-devel git mercurial cvs wget ruby zip p7zip python mingw-w64-x86_64-toolchain mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5-multimedia mingw-w64-x86_64-libzip mingw-w64-x86_64-pugixml mingw-w64-x86_64-lua51 mingw-w64-x86_64-lua51-lpeg mingw-w64-x86_64-lua51-lsqlite3 mingw-w64-x86_64-hunspell mingw-w64-x86_64-boost mingw-w64-x86_64-yajl mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL unzip
 +
</syntaxhighlight>
  
{{note}} This might not work on windows arm64, pacman freezes.
+
::The ''*-zziplib'' libraries are used by the ''luazip'' luarock {from the Kepler project} but Mudlet will work perfectly well with the alternative ''lua-zip'' {from the brimworks GitHub repository - which also provides the ''lua-yajl'' rock} which does not require this library - although it is possible that it might still be pulled into the system as a dependency of another MSYS2 package.
  
* Open Qt Creator. You will need to open it via MSYS2 every time:
+
:Note that this will install the MSYS2 builds of the Qt Libraries and Creator IDE - ''THE ON/OFF-LINE INSTALLER OF THE QT LIBRARIES AND CREATOR VIA DOWNLOADS FROM QT ARE NOT USEFUL IN THIS SETUP!''
/mingw64/bin/qtcreator.exe
 
  
* Press '''link with Qt''' on the bottom right of Qt Creator
+
:{| class="wikitable"
[[File:Link with qt.png|500px|center]]
+
|-
 +
|'''Attention - Luarocks packages problem'''
 +
|-
 +
| Recently the Luarocks project attempted to adopt the MSYS2/Mingw-w64 platform as one it would supported natively and the MSYS2/Mingw-w64 project went and upgraded its luarocks packages to make use of the changes and also on-board other improvements (and the version number increased from ''2.4.4-2'' to ''3.5.0-1'') unfortunately this completely broke them and although the issue has been reported ([https://github.com/msys2/MINGW-packages/issues/9037 MSYS2 Issue 9037]) a fix has not yet materialised. The only way to work around this in the meantime is to download the older package (with '''wget''') and install it manually (with '''pacman -U):
 +
|-
 +
|For 32-Bit Mudlet builds:
 +
:<syntaxhighlight lang="shell">
 +
MSYS user@computer ~
 +
$ wget https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
 +
--2021-07-07 22:19:09--  https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
 +
Resolving repo.msys2.org (repo.msys2.org)... 178.63.98.68
 +
Connecting to repo.msys2.org (repo.msys2.org)|178.63.98.68|:443... connected.
 +
HTTP request sent, awaiting response... 200 OK
 +
Length: 97905 (96K) [application/octet-stream]
 +
Saving to: ‘mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’
  
* Choose <code>C:/msys64/mingw64</code> as the location then restart Qt Creator
+
mingw-w64-i686-lua51-luarocks-2.4.4-2- 100%[===========================================================================>]  95.61K  --.-KB/s    in 0.07s
[[File:Qt location.png|500px|center]]
 
  
* '''Open project'''; C:/msys64/home/<user>/Mudlet/src/mudlet.pro
+
2021-07-07 22:19:10 (1.43 MB/s) - ‘mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’ saved [97905/97905]
[[File:Open new project - qtcreator.png|500px|center]]
 
  
* In Build Environment details, set environment variables to the following:
 
WITH_MAIN_BUILD_SYSTEM=NO
 
MINGW_BASE_DIR=C:\msys64\mingw64
 
  
[[File:Build environment details.png|500px|center]]
+
MSYS user@computer ~
 +
$ pacman -U mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
 +
loading packages...
 +
resolving dependencies...
 +
looking for conflicting packages...
  
* In General - Build directory, disable '''Shadow build'''
+
Packages (1) mingw-w64-i686-lua51-luarocks-2.4.4-2
  
[[File:Disable shadow build.png|500px|center]]
+
Total Installed Size: 0.46 MiB
  
* Build Mudlet (Ctrl+B)
+
:: Proceed with installation? [Y/n] y
* Run Mudlet (Ctrl+R)
+
(1/1) checking keys in keyring                                                                [#####################################################] 100%
 +
(1/1) checking package integrity                                                              [#####################################################] 100%
 +
(1/1) loading package files                                                                  [#####################################################] 100%
 +
(1/1) checking for file conflicts                                                            [#####################################################] 100%
 +
(1/1) checking available disk space                                                          [#####################################################] 100%
 +
:: Processing package changes...
 +
(1/1) installing mingw-w64-i686-lua51-luarocks                                                [#####################################################] 100%
 +
 
 +
MSYS user@computer ~
 +
</syntaxhighlight>
 +
|-
 +
|For 64-Bit Mudlet builds:
 +
:<syntaxhighlight lang="shell">
 +
MSYS user@computer ~
 +
$ wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
 +
--2021-07-07 22:17:32--  https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
 +
Resolving repo.msys2.org (repo.msys2.org)... 178.63.98.68
 +
Connecting to repo.msys2.org (repo.msys2.org)|178.63.98.68|:443... connected.
 +
HTTP request sent, awaiting response... 200 OK
 +
Length: 97935 (96K) [application/octet-stream]
 +
Saving to: ‘mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’
 +
 
 +
mingw-w64-x86_64-lua51-luarocks-2.4.4- 100%[===========================================================================>]  95.64K  --.-KB/s    in 0.07s
 +
 
 +
2021-07-07 22:17:32 (1.28 MB/s) - ‘mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’ saved [97935/97935]
 +
 
 +
 
 +
MSYS user@computer ~
 +
$ pacman -U mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
 +
loading packages...
 +
resolving dependencies...
 +
looking for conflicting packages...
 +
 
 +
Packages (1) mingw-w64-x86_64-lua51-luarocks-2.4.4-2
 +
 
 +
Total Installed Size:  0.46 MiB
 +
 
 +
:: Proceed with installation? [Y/n] y
 +
(1/1) checking keys in keyring                                                                [#####################################################] 100%
 +
(1/1) checking package integrity                                                              [#####################################################] 100%
 +
(1/1) loading package files                                                                  [#####################################################] 100%
 +
(1/1) checking for file conflicts                                                            [#####################################################] 100%
 +
(1/1) checking available disk space                                                          [#####################################################] 100%
 +
:: Processing package changes...
 +
(1/1) installing mingw-w64-x86_64-lua51-luarocks                                              [#####################################################] 100%
 +
 
 +
MSYS user@computer ~
 +
</syntaxhighlight>
 +
|}
 +
 
 +
::{| class="wikitable"
 +
|-
 +
|'''Warning for those planning to build ''both'' 32 and 64 bit versions'''
 +
|-
 +
|If one is planning to build ''both'' bitness binaries an additional step is necessary as, by default, the MSYS2/Mingw-w64 ''luarocks'' setup seems to place any ''.lua'' or ''.dll'' modules it builds/installs on a per user (the so-called ''local'' basis) into the same directories with the same names. This is no good for two reasons:
 +
* It is difficult to work out which bitness a particular module is for and whilst 32-bit modules ''might'' work in a 64-bit environment the reverse is definitely not the case
 +
* It confuses the Luarocks package management systems (as effectively there will be two different luarocks systems operated side-by-side)
 +
 
 +
This can be worked around by:
 +
* Editing the '''.\etc\luarocks\config-5.1.lua''' for each bitness so that the ''rocks_trees'' table entry for the ''user'' key is changed from this in '''both''' files:
 +
:<syntaxhighlight lang="lua">    { name = [[user]], root = home..[[/.luarocks]] },</syntaxhighlight>
 +
to something different for each of them, say, for example, for the the 64-bit one:
 +
:<syntaxhighlight lang="lua">    { name = [[user]], root = home..[[/.luarocks-x64]] },</syntaxhighlight>
 +
* Then by specifying the ''rocktree'' name ('''user''') on the command line when '''installing''' or '''building''' a luarock with the ''--tree user'' argument - note that for some inexplicable reason the ''--local'' argument that '''''should''''' do the same thing does not seem to work for these two actions, it is not clear whether this is a MSYS2/Mingw-w64 specific issue or it goes further upstream to Luarocks in general. Thus, in the next step it will be necessary to change from using:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~
 +
$ luarocks install --local rockname
 +
</syntaxhighlight>
 +
to, for the example given:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~
 +
$ luarocks install --tree user rockname
 +
</syntaxhighlight>
 +
where ''user'' is the literal string "user" to match the Lua table key in the rock_trees and not, in this case, a representation of the user-name/account of the person performing the action.
 +
|}
 +
 
 +
From the Windows ''Start menu'' start a shell appropriate for the target with the bitness to be built for i.e. '''"MSYS2 Mingw 32-Bit"''' or '''"MSYS2 Mingw 64-Bit"'''. This will likely position the current directory to the root directory of the MSYS2 environment, the text about the prompt line (the one with the "$") will contain three different bits of colored text '''username@computername'''; one of '''MSYS2'''/'''MINGW32'''/'''MINGW''' depending on the type of shell you currently in use and '''/''' representing the root directory (which will actually be the directory MSYS2 was installed to, for example on the author's system this is "C:/msys64"). Change to the home directory in MYSY by entering "cd" on its own with no argument (it will show up as '''~''' and it would work out to be, for '''user''' to be '''c:/msys64/home/user''' or '''c:/msys32/home/user''' (if both bitnessess are to be built it will be necessary to repeat the following step twice, one for each and also observe the steps in the above warning) install the following luarocks:
 +
 
 +
:{| class="wikitable sortable"
 +
|-
 +
! rockname
 +
|-
 +
| lrexlib-pcre
 +
|-
 +
| lua-yajl
 +
|-
 +
| luafilesystem
 +
|-
 +
| luasql-sqlite3
 +
|-
 +
| luautf8
 +
|-
 +
| luazip or lua-zip
 +
|}
 +
by using:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~
 +
$ luarocks install [--local] rockname
 +
</syntaxhighlight>
 +
The ''--local'' argument is an optional one that causes the luarock and the lua module to be installed on a per-user basis rather than on a system wide one, this may be important if the PC is used by multiple users and more than one of them uses Lua in any form.
 +
 
 +
Now create somewhere to work on the Mudlet source, assuming that other software coding with other pieces of software will be done, create a sub-directory in the home directory, and then make one just for Mudlet under that:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~
 +
$ mkdir ./src
 +
 
 +
MINGW64 user@computer ~
 +
$ mkdir ./src/mudlet
 +
</syntaxhighlight>
 +
 
 +
Change to that directory and get the source code:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~
 +
$ cd ./src/mudlet
 +
 
 +
MINGW64 user@computer ~/src/mudlet
 +
$ git clone git://github.com/Mudlet/Mudlet.git .
 +
</syntaxhighlight>
 +
 
 +
If you are planning to contribute to the Mudlet code you will want to visit Github and create your own GitHub repository, you can then push commits (changes to the code) to there and raise a Pull Request for a Mudlet Maker to drag the changes over to the above repository. You will want to add your repository and perhaps those of some other contributors so you can track what they are doing and see/try/experiment with their PRs before they get merged.  Therefore you will want to add some other repositories into the mix. The names you use to identify those other repositories will show up in any utility that works with the repository you have just created in the above "clone" operation and can be anything you like but it makes sense to have clear names.  So to add "myName", and those of the leading active contributors to the Mudlet codebase you will use:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~/src/mudlet
 +
$ git remote add Mine https://github.com/myName/Mudlet.git
 +
 
 +
MINGW64 user@computer ~/src/mudlet
 +
$ git remote add Vadim https://github.com/vadi2/Mudlet.git
 +
 
 +
MINGW64 user@computer ~/src/mudlet
 +
$ git remote add SlySven https://github.com/SlySven/Mudlet.git
 +
 
 +
MINGW64 user@computer ~/src/mudlet
 +
$ git remote add Kebap https://github.com/Kebap/Mudlet.git
 +
</syntaxhighlight>
 +
 
 +
Now obtain ''all'' the versions of the code with:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~/src/mudlet
 +
$ git fetch --all
 +
</syntaxhighlight>
 +
 
 +
This will produce a lot of lines of output the first time and it might take a little while on a slow connection...
 +
 
 +
{Section missing - it turns out that the default GUI git tools that the author of this section would normally use: "gitk" and "git gui" have some problems in the versions currently supplied from the MSYS2 system - and it was necessary to import them from the set that the Git4Win have patched - see https://github.com/git-for-windows/git/wiki/Install-inside-MSYS2-proper }
 +
 
 +
Some modifications to the qmake/cmake project files are needed and these are now supported in the main ''development'' branch in the upstream {the Mudlet organisation's own GitHub repository} which requires that there is an environmental variable '''WITH_MAIN_BUILD_SYSTEM''' and it is set to the (case-insensitive) value '''NO''':
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~/src/mudlet
 +
$ export WITH_MAIN_BUILD_SYSTEM=NO
 +
</syntaxhighlight>
 +
 
 +
Also the '''MINGW_BASE_DIR''' environmental variable will need to be set to the root directory for the MINGW-W64 installation for the appropriate bitness of the target to be made. For building on a 64-Bit Host {the PC that is ''compiling'' the code} to make a 64-Bit application this will likely be '''C:/msys64/mingw64''' and for a 32-Bit application it will probably be '''C:/msys64/ming32'''.
 +
: E.g. <syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~/src/mudlet
 +
$ export MINGW_BASE_DIR=C:/msys64/mingw64 # To build a 64-Bit Application with a 64-Bit system
 +
</syntaxhighlight>
 +
 
 +
: Or: <syntaxhighlight lang="shell">
 +
MINGW32 user@computer ~/src/mudlet
 +
$ export MINGW_BASE_DIR=C:/msys64/mingw32 # To build a 32-Bit Application with a 64-Bit system
 +
</syntaxhighlight>
 +
 
 +
Now checkout a branch {ideally, if working on solving a new issue, or adding a feature or resolving a bug, one should create a new branch that is a copy of the current, upstream ''development'' branch} and then work on it with Qt Creator:
 +
:<syntaxhighlight lang="shell">
 +
MINGW64 user@computer ~/src/mudlet
 +
$ qtcreator &
 +
</syntaxhighlight>
 +
 
 +
Load in the '''mudlet.pro''' ''qmake'' project file in the '''src''' subdirectory (e.g. for this example: '''c:/msys64/home/user/src/mudlet/src/mudlet.pro''') and get hacking...

Latest revision as of 14:28, 31 July 2024

Compiling on Windows 7+ (MSYS2 Alternative)

INCOMPLETE, IN PROGRESS

Go to http://www.msys2.org/ to download the 64 bit MSYS2 installer (as of 2020/05/24 32 bit hosts - for compiling software, but not for using code built with it have been deprecated, the last installer for that 32-bit systems is held at: http://repo.msys2.org/distrib/i686/msys2-i686-20200517.exe) and follow the installation instructions (Steps 1 to 8 on that page), these instructions assume that "C:\msys64" or "C:\msys32" is used depending on the bitness of the system it is being installed on.

Install the following packages (using "pacman -S packageName"), the ones with a -i686- in the middle are the ones for 32-bit (i686) targets and -x86_64- are the ones for 64-bit targets - it is possible to install both for building Mudlet for target PCs of both bitnesses on a 64-bit host, it is not clear whether the reverse is true with a 32-bit host. These will pull in a number of other required packages as well (the --needed option prevents the re-installation of packages that have already been installed by MSYS2/Mingw-w64's own setup/installation process) - as some of the packages, e.g. base-devel are actually groups you will be requested to select which members of that group are actually required, it is easiest to just go with the default which is to install ALL of the packages in that group!

For 32-Bit Mudlet builds:
MSYS user@computer ~
$ pacman -S --needed base-devel git mercurial cvs wget ruby zip p7zip python mingw-w64-i686-toolchain mingw-w64-i686-qt-creator mingw-w64-i686-qt5-multimedia mingw-w64-i686-libzip mingw-w64-i686-pugixml mingw-w64-i686-lua51 mingw-w64-i686-lua51-lpeg mingw-w64-i686-lua51-lsqlite3 mingw-w64-i686-hunspell mingw-w64-i686-boost mingw-w64-i686-yajl mingw-w64-i686-clang mingw-w64-i686-cmake mingw-w64-i686-SDL unzip
For 64-Bit Mudlet builds:
MSYS user@computer ~
$ pacman -S --needed base-devel git mercurial cvs wget ruby zip p7zip python mingw-w64-x86_64-toolchain mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5-multimedia mingw-w64-x86_64-libzip mingw-w64-x86_64-pugixml mingw-w64-x86_64-lua51 mingw-w64-x86_64-lua51-lpeg mingw-w64-x86_64-lua51-lsqlite3 mingw-w64-x86_64-hunspell mingw-w64-x86_64-boost mingw-w64-x86_64-yajl mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL unzip
The *-zziplib libraries are used by the luazip luarock {from the Kepler project} but Mudlet will work perfectly well with the alternative lua-zip {from the brimworks GitHub repository - which also provides the lua-yajl rock} which does not require this library - although it is possible that it might still be pulled into the system as a dependency of another MSYS2 package.
Note that this will install the MSYS2 builds of the Qt Libraries and Creator IDE - THE ON/OFF-LINE INSTALLER OF THE QT LIBRARIES AND CREATOR VIA DOWNLOADS FROM QT ARE NOT USEFUL IN THIS SETUP!
Attention - Luarocks packages problem
Recently the Luarocks project attempted to adopt the MSYS2/Mingw-w64 platform as one it would supported natively and the MSYS2/Mingw-w64 project went and upgraded its luarocks packages to make use of the changes and also on-board other improvements (and the version number increased from 2.4.4-2 to 3.5.0-1) unfortunately this completely broke them and although the issue has been reported (MSYS2 Issue 9037) a fix has not yet materialised. The only way to work around this in the meantime is to download the older package (with wget) and install it manually (with pacman -U):
For 32-Bit Mudlet builds:
MSYS user@computer ~
$ wget https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
--2021-07-07 22:19:09--  https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
Resolving repo.msys2.org (repo.msys2.org)... 178.63.98.68
Connecting to repo.msys2.org (repo.msys2.org)|178.63.98.68|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 97905 (96K) [application/octet-stream]
Saving to: ‘mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’

mingw-w64-i686-lua51-luarocks-2.4.4-2- 100%[===========================================================================>]  95.61K  --.-KB/s    in 0.07s

2021-07-07 22:19:10 (1.43 MB/s) - ‘mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’ saved [97905/97905]


MSYS user@computer ~
$ pacman -U mingw-w64-i686-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) mingw-w64-i686-lua51-luarocks-2.4.4-2

Total Installed Size:  0.46 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                [#####################################################] 100%
(1/1) checking package integrity                                                              [#####################################################] 100%
(1/1) loading package files                                                                   [#####################################################] 100%
(1/1) checking for file conflicts                                                             [#####################################################] 100%
(1/1) checking available disk space                                                           [#####################################################] 100%
:: Processing package changes...
(1/1) installing mingw-w64-i686-lua51-luarocks                                                [#####################################################] 100%

MSYS user@computer ~
For 64-Bit Mudlet builds:
MSYS user@computer ~
$ wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
--2021-07-07 22:17:32--  https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
Resolving repo.msys2.org (repo.msys2.org)... 178.63.98.68
Connecting to repo.msys2.org (repo.msys2.org)|178.63.98.68|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 97935 (96K) [application/octet-stream]
Saving to: ‘mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’

mingw-w64-x86_64-lua51-luarocks-2.4.4- 100%[===========================================================================>]  95.64K  --.-KB/s    in 0.07s

2021-07-07 22:17:32 (1.28 MB/s) - ‘mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst’ saved [97935/97935]


MSYS user@computer ~
$ pacman -U mingw-w64-x86_64-lua51-luarocks-2.4.4-2-any.pkg.tar.zst
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) mingw-w64-x86_64-lua51-luarocks-2.4.4-2

Total Installed Size:  0.46 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                [#####################################################] 100%
(1/1) checking package integrity                                                              [#####################################################] 100%
(1/1) loading package files                                                                   [#####################################################] 100%
(1/1) checking for file conflicts                                                             [#####################################################] 100%
(1/1) checking available disk space                                                           [#####################################################] 100%
:: Processing package changes...
(1/1) installing mingw-w64-x86_64-lua51-luarocks                                              [#####################################################] 100%

MSYS user@computer ~
Warning for those planning to build both 32 and 64 bit versions
If one is planning to build both bitness binaries an additional step is necessary as, by default, the MSYS2/Mingw-w64 luarocks setup seems to place any .lua or .dll modules it builds/installs on a per user (the so-called local basis) into the same directories with the same names. This is no good for two reasons:
  • It is difficult to work out which bitness a particular module is for and whilst 32-bit modules might work in a 64-bit environment the reverse is definitely not the case
  • It confuses the Luarocks package management systems (as effectively there will be two different luarocks systems operated side-by-side)

This can be worked around by:

  • Editing the .\etc\luarocks\config-5.1.lua for each bitness so that the rocks_trees table entry for the user key is changed from this in both files:
    { name = [[user]], root = home..[[/.luarocks]] },

to something different for each of them, say, for example, for the the 64-bit one:

    { name = [[user]], root = home..[[/.luarocks-x64]] },
  • Then by specifying the rocktree name (user) on the command line when installing or building a luarock with the --tree user argument - note that for some inexplicable reason the --local argument that should do the same thing does not seem to work for these two actions, it is not clear whether this is a MSYS2/Mingw-w64 specific issue or it goes further upstream to Luarocks in general. Thus, in the next step it will be necessary to change from using:
MINGW64 user@computer ~
$ luarocks install --local rockname

to, for the example given:

MINGW64 user@computer ~
$ luarocks install --tree user rockname

where user is the literal string "user" to match the Lua table key in the rock_trees and not, in this case, a representation of the user-name/account of the person performing the action.

From the Windows Start menu start a shell appropriate for the target with the bitness to be built for i.e. "MSYS2 Mingw 32-Bit" or "MSYS2 Mingw 64-Bit". This will likely position the current directory to the root directory of the MSYS2 environment, the text about the prompt line (the one with the "$") will contain three different bits of colored text username@computername; one of MSYS2/MINGW32/MINGW depending on the type of shell you currently in use and / representing the root directory (which will actually be the directory MSYS2 was installed to, for example on the author's system this is "C:/msys64"). Change to the home directory in MYSY by entering "cd" on its own with no argument (it will show up as ~ and it would work out to be, for user to be c:/msys64/home/user or c:/msys32/home/user (if both bitnessess are to be built it will be necessary to repeat the following step twice, one for each and also observe the steps in the above warning) install the following luarocks:

rockname
lrexlib-pcre
lua-yajl
luafilesystem
luasql-sqlite3
luautf8
luazip or lua-zip

by using:

MINGW64 user@computer ~
$ luarocks install [--local] rockname

The --local argument is an optional one that causes the luarock and the lua module to be installed on a per-user basis rather than on a system wide one, this may be important if the PC is used by multiple users and more than one of them uses Lua in any form.

Now create somewhere to work on the Mudlet source, assuming that other software coding with other pieces of software will be done, create a sub-directory in the home directory, and then make one just for Mudlet under that:

MINGW64 user@computer ~
$ mkdir ./src

MINGW64 user@computer ~
$ mkdir ./src/mudlet

Change to that directory and get the source code:

MINGW64 user@computer ~
$ cd ./src/mudlet

MINGW64 user@computer ~/src/mudlet
$ git clone git://github.com/Mudlet/Mudlet.git .

If you are planning to contribute to the Mudlet code you will want to visit Github and create your own GitHub repository, you can then push commits (changes to the code) to there and raise a Pull Request for a Mudlet Maker to drag the changes over to the above repository. You will want to add your repository and perhaps those of some other contributors so you can track what they are doing and see/try/experiment with their PRs before they get merged. Therefore you will want to add some other repositories into the mix. The names you use to identify those other repositories will show up in any utility that works with the repository you have just created in the above "clone" operation and can be anything you like but it makes sense to have clear names. So to add "myName", and those of the leading active contributors to the Mudlet codebase you will use:

MINGW64 user@computer ~/src/mudlet
$ git remote add Mine https://github.com/myName/Mudlet.git

MINGW64 user@computer ~/src/mudlet
$ git remote add Vadim https://github.com/vadi2/Mudlet.git 

MINGW64 user@computer ~/src/mudlet
$ git remote add SlySven https://github.com/SlySven/Mudlet.git

MINGW64 user@computer ~/src/mudlet
$ git remote add Kebap https://github.com/Kebap/Mudlet.git

Now obtain all the versions of the code with:

MINGW64 user@computer ~/src/mudlet
$ git fetch --all

This will produce a lot of lines of output the first time and it might take a little while on a slow connection...

{Section missing - it turns out that the default GUI git tools that the author of this section would normally use: "gitk" and "git gui" have some problems in the versions currently supplied from the MSYS2 system - and it was necessary to import them from the set that the Git4Win have patched - see https://github.com/git-for-windows/git/wiki/Install-inside-MSYS2-proper }

Some modifications to the qmake/cmake project files are needed and these are now supported in the main development branch in the upstream {the Mudlet organisation's own GitHub repository} which requires that there is an environmental variable WITH_MAIN_BUILD_SYSTEM and it is set to the (case-insensitive) value NO:

MINGW64 user@computer ~/src/mudlet
$ export WITH_MAIN_BUILD_SYSTEM=NO

Also the MINGW_BASE_DIR environmental variable will need to be set to the root directory for the MINGW-W64 installation for the appropriate bitness of the target to be made. For building on a 64-Bit Host {the PC that is compiling the code} to make a 64-Bit application this will likely be C:/msys64/mingw64 and for a 32-Bit application it will probably be C:/msys64/ming32.

E.g.
MINGW64 user@computer ~/src/mudlet
$ export MINGW_BASE_DIR=C:/msys64/mingw64 # To build a 64-Bit Application with a 64-Bit system
Or:
MINGW32 user@computer ~/src/mudlet
$ export MINGW_BASE_DIR=C:/msys64/mingw32 # To build a 32-Bit Application with a 64-Bit system

Now checkout a branch {ideally, if working on solving a new issue, or adding a feature or resolving a bug, one should create a new branch that is a copy of the current, upstream development branch} and then work on it with Qt Creator:

MINGW64 user@computer ~/src/mudlet
$ qtcreator &

Load in the mudlet.pro qmake project file in the src subdirectory (e.g. for this example: c:/msys64/home/user/src/mudlet/src/mudlet.pro) and get hacking...