Difference between revisions of "Compiling Mudlet"

From Mudlet
Jump to navigation Jump to search
m (Removed $ signs from Debian sections)
(43 intermediate revisions by 4 users not shown)
Line 12: Line 12:
  
 
Fork and submit a PR with your changes ([https://guides.github.com/activities/forking/ Github tutorial]).
 
Fork and submit a PR with your changes ([https://guides.github.com/activities/forking/ Github tutorial]).
 +
 +
{{note}} if you've previously compiled Mudlet - <code>src/src.pro</code> has been renamed to <code>src/mudlet.pro</code> in Mudlet 3.3.
  
 
== Travis Integration ==
 
== Travis Integration ==
Line 23: Line 25:
 
= Compiling =
 
= Compiling =
  
== Compiling on Ubuntu 16.04 ==
+
== Compiling on Ubuntu ==
 +
 
 +
These instructions will get you setup compiling on Ubuntu. Need a hand? [https://discord.gg/BwgJpMj Discord], [https://gitter.im/Mudlet/Mudlet Join us on Gitter] (need a Github account), or [http://forums.mudlet.org/viewforum.php?f=7 forums].
 +
 
 +
'''1. Ubuntu 16.04 setup'''
  
These instructions will get you setup compiling on Ubuntu. Need a hand? [https://gitter.im/Mudlet/Mudlet Join us on Gitter] (need a Github account), [https://discord.gg/BwgJpMj Discord server] or [http://forums.mudlet.org/viewforum.php?f=7 forums] otherwise.
+
If you're on Ubuntu 16.04 (Xenial Xerus), install the following. If you're on a newer Ubuntu, skip this step and go to ''2. Install dependencies''.
  
'''1. Install Git'''
+
  sudo add-apt-repository ppa:beineri/opt-qt58-xenial
 +
  sudo apt update
 +
  sudo apt install qt58-meta-full qt58creator
 +
  source /opt/qt58/bin/qt58-env.sh
  
  sudo apt install git build-essential qt5-default qtmultimedia5-dev qttools5-dev \
+
'''2. Install dependencies'''
    libhunspell-dev lua5.1 liblua5.1-0-dev libpcre3-dev libboost-dev zlib1g-dev cmake \
 
    libhunspell-dev lua-rex-pcre lua-sql-sqlite3 lua-filesystem lua-zip libyajl-dev \
 
    libzip-dev gstreamer0.10-fluendo-mp3 libgstreamer0.10-0 libglu1-mesa-dev \
 
    mesa-common-dev
 
  
'''2. Get Mudlet source'''
+
sudo apt install git build-essential qt5-default qtmultimedia5-dev qttools5-dev \
 +
  libhunspell-dev lua5.1 liblua5.1-0-dev libpcre3-dev libboost-dev zlib1g-dev cmake \
 +
  libhunspell-dev lua-rex-pcre lua-sql-sqlite3 lua-filesystem lua-zip libyajl-dev \
 +
  libzip-dev libgstreamer0.10-0 libglu1-mesa-dev \
 +
  mesa-common-dev qtcreator libpulse-dev libglib2.0-dev luarocks libboost-all-dev
 +
sudo apt install gstreamer0.10-fluendo-mp3 # may not work on newer Ubuntu
 +
sudo luarocks install luautf8
  
  git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet
+
'''3. Get Mudlet source'''
  
'''3. Go to the '''parent''' of the mudlet "src" folder and create (if necessary) a build subdirectory '''
+
git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet
  
''(This is so that we can build ''out of source'' which keeps the source code clean!}''
+
'''4. Create a build directory'''
  
 
   cd mudlet
 
   cd mudlet
Line 47: Line 58:
 
   cd build
 
   cd build
  
'''4. Run the following commands, depending on which build system you want to use '''
+
'''5. Run the following commands, depending on which build system you want to use '''
  
 
'''EITHER:'''
 
'''EITHER:'''
  
  qmake CONFIG+=debug ../src/src.pro
+
cmake ..
  
 
'''OR:'''
 
'''OR:'''
  
  cmake ..
+
qmake CONFIG+=debug ../src/mudlet.pro
  
 
'''THEN:'''
 
'''THEN:'''
  
  make -j `nproc`
+
make -j `nproc`
 
 
''if you have more than one processor core you can increase the number after -j to one more than the number of cores you would like to devote to building the application to speed things up.''
 
  
 
'''5. Start the application you have just compiled - enjoy'''
 
'''5. Start the application you have just compiled - enjoy'''
  
  ./mudlet
+
./mudlet
  
Optionally - install [https://apps.ubuntu.com/cat/applications/ccache/ ccache] and [http://manpages.ubuntu.com/manpages/trusty/man1/ccache.1.html#contenttoc3 enable it] for quicker compilation when switching branches and so on.
+
Optionally - install [https://apps.ubuntu.com/cat/applications/ccache/ ccache] and [http://manpages.ubuntu.com/manpages/trusty/man1/ccache.1.html#contenttoc3 enable it] for quicker compilation - it especially helps when you're switching between Git branches.
  
 
== Compiling on macOS ==
 
== Compiling on macOS ==
Line 96: Line 105:
 
   CI/travis.osx.before_install.sh
 
   CI/travis.osx.before_install.sh
 
   CI/travis.osx.install.sh
 
   CI/travis.osx.install.sh
 +
  sudo luarocks-5.1 install lrexlib-pcre
 +
  sudo luarocks-5.1 install luasql-sqlite3
 +
  sudo luarocks-5.1 install luautf8
  
 
'''4. Go to the mudlet build folder'''
 
'''4. Go to the mudlet build folder'''
Line 104: Line 116:
 
'''EITHER:'''
 
'''EITHER:'''
  
   qmake ../src/src.pro
+
   qmake ../src/mudlet.pro
  
 
'''OR:'''
 
'''OR:'''
Line 123: Line 135:
 
'''1. Install required packages from main repo.'''
 
'''1. Install required packages from main repo.'''
 
 
  $ sudo apt-get install build-essential liblua5.1-dev zlib1g-dev libhunspell-dev libpcre3-dev \
+
  sudo apt-get install build-essential git liblua5.1-dev zlib1g-dev libhunspell-dev libpcre3-dev \
  libzip-dev libboost-dev libyajl-dev libpulse-dev lua-rex-pcre lua-filesystem lua-zip \
+
libzip-dev libboost-dev libyajl-dev libpulse-dev lua-rex-pcre lua-filesystem lua-zip \
  lua-sql-sqlite3 qt5-default qtmultimedia5-dev qttools5-dev
+
lua-sql-sqlite3 qt5-default qtmultimedia5-dev qttools5-dev luarocks
  
 +
sudo luarocks install luautf8 
  
 
'''2. Grab latest Mudlet source.'''
 
'''2. Grab latest Mudlet source.'''
 
 
  $ cd ~ && mkdir projects && cd projects && git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet
+
  mkdir ~/projects && cd ~/projects && git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet
 +
 
 +
'''3. Build Mudlet.'''
 +
 
 +
cd ~/projects/mudlet/src
 +
 
 +
qmake
 +
 
 +
make
 +
 
 +
sudo make install
 +
 
 +
 
 +
== Compiling on Debian 9 'Stretch' ==
 +
 
 +
'''1. Install required packages.'''
 +
 +
sudo apt-get install build-essential git liblua5.1-dev zlib1g-dev libhunspell-dev libpcre3-dev \
 +
libzip-dev libboost-dev libyajl-dev libpulse-dev lua-rex-pcre lua-filesystem lua-zip \
 +
lua-sql-sqlite3 qt5-default qtmultimedia5-dev qttools5-dev luarocks
 +
 
 +
sudo luarocks install luautf8 
 +
 
 +
'''2. Get Mudlet source.'''
 +
 +
mkdir ~/source && cd ~/source
 +
 
 +
git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet
  
 +
Note: the line above will check out `development` branch source code, and this might not always be stable.  You can check out the latest release source code using this command:
 +
 +
git clone --recursive --branch master https://github.com/Mudlet/Mudlet.git mudlet
  
 
'''3. Build Mudlet.'''
 
'''3. Build Mudlet.'''
  
  $ cd ~/projects/mudlet/src
+
  mkdir ~/source/mudlet/build && cd ~/source/mudlet/build
 +
 
 +
qmake ../src/mudlet.pro
 +
 
 +
make -j `nproc`
  
  $ qmake
+
  sudo make install
  
$ make
+
After these steps you can run Mudlet by typing:
  
  $ sudo make install
+
  mudlet
  
 
== Compiling on ArchLinux ==
 
== Compiling on ArchLinux ==
Line 158: Line 205:
  
 
These instructions will get you setup compiling on Windows. Need a hand? [https://gitter.im/Mudlet/Mudlet Join us on Gitter] (need a Github account), [https://discord.gg/BwgJpMj Discord server] or [http://forums.mudlet.org/viewforum.php?f=7 forums] otherwise.
 
These instructions will get you setup compiling on Windows. Need a hand? [https://gitter.im/Mudlet/Mudlet Join us on Gitter] (need a Github account), [https://discord.gg/BwgJpMj Discord server] or [http://forums.mudlet.org/viewforum.php?f=7 forums] otherwise.
 +
 +
MinGW is able to make use of all the cores on your system to do parallel compilation - throughout this tutorial a dualcore system is assumed, but if you have more than 2 cores set the <code>-j #</code> to the number of threads you need. For example, on an AMD Ryzen that has 6 cores and 12 threads, <code>-j 12</code> will make full use of the CPU.
  
 
'''1.Download & Install the Prerequisites'''
 
'''1.Download & Install the Prerequisites'''
  
  Qt:  
+
  Qt:
 
   http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe
 
   http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe
 
  Run the installer and de-select everything and just select:
 
  Run the installer and de-select everything and just select:
   Qt->Qt 5.6->MinGW 4.9.2 (32 bit)
+
   Qt→Qt 5.9.1→MinGW 5.3.0 (32 bit)
   Qt->Qt 5.6->Source components
+
   Tools→MinGW 5.3.0
In this tutorial, it is installed in C:\Qt\ (so you will have C:\Qt\5.x)
+
 
 +
In this tutorial, it is installed in C:\Qt\ (so you will have <code>C:\Qt\5.x</code>)
  
 
  7Zip:
 
  7Zip:
 
   http://www.7-zip.org/a/7z1602-x64.msi
 
   http://www.7-zip.org/a/7z1602-x64.msi
  
  Notepad++:  
+
  Notepad++:
   https://notepad-plus-plus.org/download (at the last check it was at version 7.3)
+
   https://notepad-plus-plus.org/download
  Recommended if you don't have a good source editor installed already (it is release under a GPL License).
+
  Recommended if you don't have a good source editor installed already (it is released under a GPL License).
 
 
Mingw-builds:
 
  https://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-posix/dwarf/x32-4.8.1-release-posix-dwarf-rev5.7z/download
 
extract this to C:\mingw32
 
  
 
  Latest msys from:
 
  Latest msys from:
 
   http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/
 
   http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/
put the msys folder in C:\mingw32, so you get C:\mingw32\msys
+
 
 +
Right-click, select 7-Zip -> Extract files... and extract the msys folder using 7zip into C:\mingw32, so you get C:\mingw32\msys:
 +
 
 +
[[File:7zip extract windows.png]]
  
 
  CMake:
 
  CMake:
Line 192: Line 241:
 
'''2.Download libraries in MSYS'''
 
'''2.Download libraries in MSYS'''
  
Open MSYS (click msys.bat in the C:\mingw32\msys folder), where you'll be in a home directory. Copy the lines below and right-click on the terminal to paste them:
+
Open MSYS - doubleclick msys.bat in the C:\mingw32\msys folder. It might take a while to come up. Copy the lines below when it does and right-click on the terminal to paste them:
  
 
  mkdir src
 
  mkdir src
Line 217: Line 266:
 
  wget --no-check-certificate https://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
 
  wget --no-check-certificate https://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
 
  /c/Program\ Files/7-Zip/7z e boost_1_60_0.tar.gz && /c/Program\ Files/7-Zip/7z x boost_1_60_0.tar
 
  /c/Program\ Files/7-Zip/7z e boost_1_60_0.tar.gz && /c/Program\ Files/7-Zip/7z x boost_1_60_0.tar
  cp -r boost_1_60_0/boost /c/mingw32/include
+
  cp -r boost_1_60_0/boost /c/mingw32/include/boost
  
 
'''3.Compiling libraries'''
 
'''3.Compiling libraries'''
Line 227: Line 276:
 
  C:\Python27
 
  C:\Python27
 
  C:\mingw32\bin
 
  C:\mingw32\bin
 +
C:\mingw32\lib
 
  C:\Program Files (x86)\CMake\bin
 
  C:\Program Files (x86)\CMake\bin
  C:\Qt\5.6\mingw49_32\bin
+
  C:\Qt\5.9.1\mingw53_32\bin
 +
C:\Qt\Tools\mingw530_32\bin
  
 
Be sure to restart msys.bat after setting the above to pick up the new values.
 
Be sure to restart msys.bat after setting the above to pick up the new values.
 +
 +
<div class="toccolours mw-collapsible mw-collapsed">
 +
{{note}} WIP: most of Mudlet dependencies condensed for less manual work. This is not ready yet - do not use.
 +
 +
cd hunspell-1.4.1
 +
./configure --prefix=/c/mingw32 && make -j 2 && make install
 +
cd ../pcre-8.38
 +
./configure --prefix=/c/mingw32 && make -j 2 && make install
 +
cd ../sqlite-autoconf-3071700
 +
./configure --prefix=/c/mingw32 && make -j 2 && make install
 +
cd ../zlib-1.2.11
 +
make -f win32/Makefile.gcc
 +
export INCLUDE_PATH=/c/mingw32/include/
 +
export LIBRARY_PATH=/c/mingw32/lib/
 +
export BINARY_PATH=/c/mingw32/bin/
 +
make -f win32/Makefile.gcc install
 +
cp zlib1.dll /c/mingw32/bin
 +
cp libz.dll.a /c/mingw32/lib
 +
cd ../libzip-0.11.2/
 +
./configure --prefix=/c/mingw32 && make -j 2 && make install
 +
cp lib/zipconf.h /c/mingw32/include
 +
cd ../zziplib-0.13.62
 +
powershell -Command "(gc configure) -replace 'uname -msr', 'uname -ms' | Out-File -encoding ASCII configure"
 +
configure --disable-mmap --prefix=c:/mingw32/ && make -j 2 && make install
 +
cd ../lloyd-yajl-f4b2b1a/
 +
powershell -Command "(Get-Content CMakeLists.txt -Raw) -replace '\/W4' -replace '(?<=SET\(linkFlags)[^\)]+' -replace '\/wd4996 \/wd4255 \/wd4130 \/wd4100 \/wd4711' -replace '(?<=SET\(CMAKE_C_FLAGS_DEBUG  .)\/D \DEBUG \/Od \/Z7', '-g' -replace '(?<=SET\(CMAKE_C_FLAGS_RELEASE .)\/D NDEBUG \/O2', '-O2' | Out-File -encoding ASCII CMakeLists.txt"
 +
mkdir build
 +
cd build
 +
cmake -G "MSYS Makefiles" ..
 +
 +
make
 +
cp yajl-2.0.1/lib/* /c/mingw32/lib/
 +
cp -R yajl-2.0.1/include/* /c/mingw32/include/
 +
 +
# Lua: edit src\lua-5.1.5\Makefile, change INSTALL_TOP= /usr/local to INSTALL_TOP= /c/mingw32
 +
# change TO_LIB= liblua.a to TO_LIB= liblua.a lua51.dll
 +
cd ../../lua-5.1.5
 +
make mingw
 +
make install
 +
 +
To just install everything and not compile:
 +
 +
cd hunspell-1.4.1
 +
make install
 +
cd ../pcre-8.38
 +
make install
 +
cd ../sqlite-autoconf-3071700
 +
make install
 +
cd ../zlib-1.2.11
 +
make -f win32/Makefile.gcc
 +
export INCLUDE_PATH=/c/mingw32/include/
 +
export LIBRARY_PATH=/c/mingw32/lib/
 +
export BINARY_PATH=/c/mingw32/bin/
 +
make -f win32/Makefile.gcc install
 +
cp zlib1.dll /c/mingw32/bin
 +
cp libz.dll.a /c/mingw32/lib
 +
cd ../libzip-0.11.2/
 +
make install
 +
cp lib/zipconf.h /c/mingw32/include
 +
cd ../zziplib-0.13.62
 +
make install
 +
cd ../lloyd-yajl-f4b2b1a/build
 +
cp yajl-2.0.1/lib/* /c/mingw32/lib/
 +
cp -R yajl-2.0.1/include/* /c/mingw32/include/
 +
cd ../../lua-5.1.5
 +
make install
 +
</div>
  
 
'''MSYS Compilations'''
 
'''MSYS Compilations'''
  
All of the following will be completed inside the msys command prompt.
+
All of the following will be completed inside the msys command prompt:
  
cd into each respective directory:
+
cd ~/src
  
 
'''Hunspell''':
 
'''Hunspell''':
 +
cd hunspell-1.4.1
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
  
 
'''YAJL''':
 
'''YAJL''':
 
First, remove all the windows specific compiler settings with:
 
First, remove all the windows specific compiler settings with:
 +
cd ../lloyd-yajl-f4b2b1a/
 
  powershell -Command "(Get-Content CMakeLists.txt -Raw) -replace '\/W4' -replace '(?<=SET\(linkFlags)[^\)]+' -replace '\/wd4996 \/wd4255 \/wd4130 \/wd4100 \/wd4711' -replace '(?<=SET\(CMAKE_C_FLAGS_DEBUG .)\/D \DEBUG \/Od \/Z7', '-g' -replace '(?<=SET\(CMAKE_C_FLAGS_RELEASE .)\/D NDEBUG \/O2', '-O2' | Out-File -encoding ASCII CMakeLists.txt"
 
  powershell -Command "(Get-Content CMakeLists.txt -Raw) -replace '\/W4' -replace '(?<=SET\(linkFlags)[^\)]+' -replace '\/wd4996 \/wd4255 \/wd4130 \/wd4100 \/wd4711' -replace '(?<=SET\(CMAKE_C_FLAGS_DEBUG .)\/D \DEBUG \/Od \/Z7', '-g' -replace '(?<=SET\(CMAKE_C_FLAGS_RELEASE .)\/D NDEBUG \/O2', '-O2' | Out-File -encoding ASCII CMakeLists.txt"
  
Line 250: Line 370:
 
  cd build
 
  cd build
 
  cmake -G "MSYS Makefiles" ..
 
  cmake -G "MSYS Makefiles" ..
 +
 
  make
 
  make
 
  cp yajl-2.0.1/lib/* /c/mingw32/lib/
 
  cp yajl-2.0.1/lib/* /c/mingw32/lib/
Line 255: Line 376:
  
 
'''Lua''':
 
'''Lua''':
edit the Makefile, change <tt>INSTALL_TOP= /usr/local</tt> to <tt>INSTALL_TOP= /c/mingw32</tt>
+
edit <code>src\lua-5.1.5\Makefile</code>, change <code>INSTALL_TOP= /usr/local</code> to <code>INSTALL_TOP= /c/mingw32</code>
  
change <tt>TO_LIB= liblua.a</tt> to <tt>TO_LIB= liblua.a lua51.dll</tt>
+
change <code>TO_LIB= liblua.a</code> to <code>TO_LIB= liblua.a lua51.dll</code>
  
 +
cd ../../lua-5.1.5
 
  make mingw
 
  make mingw
 
  make install
 
  make install
  
 
'''PCRE''':
 
'''PCRE''':
 +
cd ../pcre-8.38
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
  
 
'''Sqlite''':
 
'''Sqlite''':
 +
cd ../sqlite-autoconf-3071700
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
  
 
'''ZLib''':
 
'''ZLib''':
 +
cd ../zlib-1.2.11
 
  make -f win32/Makefile.gcc
 
  make -f win32/Makefile.gcc
 
  export INCLUDE_PATH=/c/mingw32/include/
 
  export INCLUDE_PATH=/c/mingw32/include/
Line 278: Line 403:
  
 
'''LibZip''':
 
'''LibZip''':
 +
cd ../libzip-0.11.2/
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
 
  ./configure --prefix=/c/mingw32 && make -j 2 && make install
 
  cp lib/zipconf.h /c/mingw32/include
 
  cp lib/zipconf.h /c/mingw32/include
  
 
'''ZZIPlib''':
 
'''ZZIPlib''':
 +
cd ../zziplib-0.13.62
 
  powershell -Command "(gc configure) -replace 'uname -msr', 'uname -ms' | Out-File -encoding ASCII configure"
 
  powershell -Command "(gc configure) -replace 'uname -msr', 'uname -ms' | Out-File -encoding ASCII configure"
 
  configure --disable-mmap --prefix=c:/mingw32/ && make -j 2 && make install
 
  configure --disable-mmap --prefix=c:/mingw32/ && make -j 2 && make install
Line 292: Line 419:
  
 
  cd ~/src
 
  cd ~/src
  git clone https://github.com/Mudlet/Mudlet.git
+
  git clone --recursive https://github.com/Mudlet/Mudlet.git
 
  cd Mudlet/src
 
  cd Mudlet/src
  
'''Building Mudlet from terminal'''
 
 
cd ~/src/Mudlet/src
 
qmake CONFIG+=debug
 
make -j 2
 
  
 
''NOTE:'' If you install any of the above in a directory other than /c/mingw32, it is necessary to override some of the default include/lib paths that qmake sets up. To do so, you'll need to append a number of INCLUDEPATH and LIBPATH parameters to the qmake call.
 
''NOTE:'' If you install any of the above in a directory other than /c/mingw32, it is necessary to override some of the default include/lib paths that qmake sets up. To do so, you'll need to append a number of INCLUDEPATH and LIBPATH parameters to the qmake call.
Line 308: Line 430:
 
'''Building Mudlet from QtCreator'''
 
'''Building Mudlet from QtCreator'''
  
Open src.pro (within Mudlet2/src) in Qt Creator, disable shadow builds for both release and debug. Change build type to debug (bottom-left) and compile.
+
Open <code>C:\mingw32\msys\home\<username>\src\Mudlet\src\mudlet.pro</code> in Qt Creator, enable Debug and Release builds and hit ''Configure Project'':
 +
 
 +
[[File:Selection_173.png|frame|none]]
 +
 
 +
Press <code>Ctrl+5</code> and update project settings for the # of cores/threads available to your system:
 +
 
 +
[[File:Change Qt Creator to use many cores.gif|frame|none]]
 +
 
 +
Hit run:
 +
 
 +
[[File:Selection 176.png|frame|none]]
 +
 
 +
Click on '''Compile Output''' to see progress on compiling:
 +
 
 +
[[File:Selection 177.png|frame|none]]
 +
 
 +
This'll take ~10min, after which Mudlet will launch! But it's not completely ready yet - close it and follow more:
  
 
'''4.Copy Needed DLLs'''
 
'''4.Copy Needed DLLs'''
Line 315: Line 453:
 
''See above note about alternative install paths before copying.''
 
''See above note about alternative install paths before copying.''
  
  cd debug/
+
  cd ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug
cp /c/Qt/5.6/mingw49_32/bin/icudt54.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Cored.dll .
  cp /c/Qt/5.6/mingw49_32/bin/icuin54.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Guid.dll .
  cp /c/Qt/5.6/mingw49_32/bin/icuuc54.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libEGLd.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Cored.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libGLESv2d.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Guid.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Networkd.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libEGLd.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5OpenGLd.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libGLESv2d.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Widgetsd.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Networkd.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Multimediad.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5OpenGLd.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Gamepadd.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Widgetsd.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libgcc_s_dw2-1.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Multimediad.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libstdc++-6.dll .
cp /c/Qt/5.6/mingw49_32/bin/libgcc_s_dw2-1.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libwinpthread-1.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libstdc++-6.dll .
 
  cp /c/Qt/5.6/mingw49_32/bin/libwinpthread-1.dll .
 
 
  cp /c/mingw32/lib/libyajl.dll .
 
  cp /c/mingw32/lib/libyajl.dll .
 
  cp $HOME/src/lua-5.1.5/src/lua51.dll .
 
  cp $HOME/src/lua-5.1.5/src/lua51.dll .
Line 340: Line 476:
 
  cp /c/mingw32/bin/libsqlite3-0.dll .
 
  cp /c/mingw32/bin/libsqlite3-0.dll .
 
  cp /c/mingw32/bin/zlib1.dll .
 
  cp /c/mingw32/bin/zlib1.dll .
  cp -r ../mudlet-lua/ .
+
  cp ~/src/Mudlet/src/*.dic .
cp ../*.dic .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/audio .
  cp -r /c/Qt/5.6/mingw49_32/plugins/audio .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/mediaservice .
  cp -r /c/Qt/5.6/mingw49_32/plugins/mediaservice .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/platforms .
  cp -r /c/Qt/5.6/mingw49_32/plugins/platforms .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/imageformats .
  cp -r /c/Qt/5.6/mingw49_32/plugins/imageformats .
 
  
  cd ../release/
+
  mkdir ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
cp /c/Qt/5.6/mingw49_32/bin/icudt54.dll .
+
  cd ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
  cp /c/Qt/5.6/mingw49_32/bin/icuin54.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Core.dll .
  cp /c/Qt/5.6/mingw49_32/bin/icuuc54.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Gui.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Core.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libEGL.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Gui.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libGLESv2.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libEGL.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Network.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libGLESv2.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5OpenGL.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Network.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Widgets.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5OpenGL.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Multimedia.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Widgets.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Gamepad.dll .
  cp /c/Qt/5.6/mingw49_32/bin/Qt5Multimedia.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libgcc_s_dw2-1.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libgcc_s_dw2-1.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libstdc++-6.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libstdc++-6.dll .
+
  cp /c/Qt/5.9.1/mingw53_32/bin/libwinpthread-1.dll .
  cp /c/Qt/5.6/mingw49_32/bin/libwinpthread-1.dll .
 
 
  cp /c/mingw32/lib/libyajl.dll .
 
  cp /c/mingw32/lib/libyajl.dll .
 
  cp $HOME/src/lua-5.1.5/src/lua51.dll .
 
  cp $HOME/src/lua-5.1.5/src/lua51.dll .
Line 372: Line 506:
 
  cp /c/mingw32/bin/libsqlite3-0.dll .
 
  cp /c/mingw32/bin/libsqlite3-0.dll .
 
  cp /c/mingw32/bin/zlib1.dll .
 
  cp /c/mingw32/bin/zlib1.dll .
  cp -r ../mudlet-lua/ .
+
  cp ~/src/Mudlet/src/*.dic .
cp ../*.dic .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/audio .
  cp -r /c/Qt/5.6/mingw49_32/plugins/audio .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/mediaservice .
  cp -r /c/Qt/5.6/mingw49_32/plugins/mediaservice .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/platforms .
  cp -r /c/Qt/5.6/mingw49_32/plugins/platforms .
+
  cp -r /c/Qt/5.9.1/mingw53_32/plugins/imageformats .
  cp -r /c/Qt/5.6/mingw49_32/plugins/imageformats .
 
  
  
Line 388: Line 521:
 
  unzip luarocks-2.4.0-win32.zip
 
  unzip luarocks-2.4.0-win32.zip
  
Switch to the Windows command line to install luarocks:
+
Open up the Windows command line <code>cmd</code> to install Luarocks:
 
  cd C:\mingw32\msys\home\%USERNAME%\src\luarocks-2.4.0-win32
 
  cd C:\mingw32\msys\home\%USERNAME%\src\luarocks-2.4.0-win32
 
  install.bat /P C:\LuaRocks /MW
 
  install.bat /P C:\LuaRocks /MW
Line 399: Line 532:
 
  luarocks install LuaSQL-SQLite3 SQLITE_INCDIR="c:\mingw32\include" SQLITE_LIBDIR="c:\mingw32\lib"
 
  luarocks install LuaSQL-SQLite3 SQLITE_INCDIR="c:\mingw32\include" SQLITE_LIBDIR="c:\mingw32\lib"
 
  luarocks install lrexlib-pcre PCRE_LIBDIR="c:\mingw32\lib" PCRE_INCDIR="c:\mingw32\include"
 
  luarocks install lrexlib-pcre PCRE_LIBDIR="c:\mingw32\lib" PCRE_INCDIR="c:\mingw32\include"
 +
luarocks install luautf8
  
 
Back in the msys command line:
 
Back in the msys command line:
Line 405: Line 539:
 
  unzip master
 
  unzip master
 
  cd luazip-master/
 
  cd luazip-master/
  gcc -O2 -c -o src/luazip.o -IC:/mingw32/include/ src/luazip.c  
+
  gcc -O2 -c -o src/luazip.o -IC:/mingw32/include/ src/luazip.c
 
  gcc -shared -o zip.dll src/luazip.o -Lc:\mingw32\lib -lzzip -lz c:/mingw32/bin/lua51.dll -lm
 
  gcc -shared -o zip.dll src/luazip.o -Lc:\mingw32\lib -lzzip -lz c:/mingw32/bin/lua51.dll -lm
  cp zip.dll ~/src/Mudlet/src/debug
+
  cp zip.dll ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug
  cp zip.dll ~/src/Mudlet/src/release
+
  cp zip.dll ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
  cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/src/debug
+
  cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug
  cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/src/release
+
  cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
 +
cp -r ~/src/Mudlet/src/mudlet-lua/ ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug
 +
cp -r ~/src/Mudlet/src/mudlet-lua/ ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release
  
  
 +
You're done! Press the green Run button again in Qt Creator (bottom-right) and a Mudlet window should come up without any errors.
  
You're done! You can now launch mudlet by running '''mudlet.exe''' in the debug/ folder, or from command line:
+
=== Uninstalling ===
 +
To uninstall, remove the following folders:
  
  cd ~/src/Mudlet/src/debug
+
  C:\LuaRocks
  ./mudlet.exe
+
  C:\mingw32
 +
C:\Qt
  
 
= Setting up IDEs =
 
= Setting up IDEs =

Revision as of 07:25, 23 July 2017

Key contributing information

Clang format is used to automatically format code submissions using the src/.clang-format style. See here how to enable clang-format with Qt Creator - and make sure to specify the 'File' option for the configuration style.

Branches:

development is the development branch where new features can go.

Workflow:

Fork and submit a PR with your changes (Github tutorial).

Note Note: if you've previously compiled Mudlet - src/src.pro has been renamed to src/mudlet.pro in Mudlet 3.3.

Travis Integration

Mudlet is hosted on Github and uses Travis for continuous integration by building on a Ubuntu 14.04 LTS Linux and a macOS 10.11 platforms. This means that every push to the Git repository is test compiled on both Ubuntu and Mac OSX but not Microsoft Windows (yet).

Travis integration is defined in a .travis.yml file and in our case, it references shell scripts in the CI directory, which handle things like installing dependencies and building mudlet.

Note Note: Travis builds do not currently package mudlet, so not everything is automated.

Compiling

Compiling on Ubuntu

These instructions will get you setup compiling on Ubuntu. Need a hand? Discord, Join us on Gitter (need a Github account), or forums.

1. Ubuntu 16.04 setup

If you're on Ubuntu 16.04 (Xenial Xerus), install the following. If you're on a newer Ubuntu, skip this step and go to 2. Install dependencies.

 sudo add-apt-repository ppa:beineri/opt-qt58-xenial
 sudo apt update
 sudo apt install qt58-meta-full qt58creator
 source /opt/qt58/bin/qt58-env.sh

2. Install dependencies

sudo apt install git build-essential qt5-default qtmultimedia5-dev qttools5-dev \
  libhunspell-dev lua5.1 liblua5.1-0-dev libpcre3-dev libboost-dev zlib1g-dev cmake \
  libhunspell-dev lua-rex-pcre lua-sql-sqlite3 lua-filesystem lua-zip libyajl-dev \
  libzip-dev libgstreamer0.10-0 libglu1-mesa-dev \
  mesa-common-dev qtcreator libpulse-dev libglib2.0-dev luarocks libboost-all-dev
sudo apt install gstreamer0.10-fluendo-mp3 # may not work on newer Ubuntu
sudo luarocks install luautf8

3. Get Mudlet source

git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet

4. Create a build directory

 cd mudlet
 mkdir build
 cd build

5. Run the following commands, depending on which build system you want to use

EITHER:

cmake ..

OR:

qmake CONFIG+=debug ../src/mudlet.pro

THEN:

make -j `nproc`

5. Start the application you have just compiled - enjoy

./mudlet

Optionally - install ccache and enable it for quicker compilation - it especially helps when you're switching between Git branches.

Compiling on macOS

These instructions will get you setup compiling on macOS. Need a hand? Join us on Gitter (need a Github account), Discord server or forums otherwise.


1. Install prerequisites

Install XCode, command line tools for XCode, and HomeBrew.

Once homebrew is installed, do:

 brew doctor
 brew update
 brew install git

2. Get Mudlet source

 git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet

3. Go to the parent of the mudlet "src" folder and create (if necessary) a build subdirectory (this is so that we can build out of source which keeps the source code clean}

 mkdir build

3. Setup your environment you only need the first three lines if your system cannot find the right Qt libraries or tools, the added directories might be different if you have installed them differently

 export PATH="/usr/local/opt/qt5/bin:$PATH"
 export LDFLAGS=" -L/usr/local/opt/qt5/lib ${LDFLAGS}"
 export CPPFLAGS=" -I/usr/local/opt/qt5/include ${CPPFLAGS}"
 CI/travis.osx.before_install.sh
 CI/travis.osx.install.sh
 sudo luarocks-5.1 install lrexlib-pcre
 sudo luarocks-5.1 install luasql-sqlite3
 sudo luarocks-5.1 install luautf8

4. Go to the mudlet build folder

 cd build

5. Run the following commands, depending on which build system you want to use (qmake IS recommended for Linux and Mac platforms)

EITHER:

 qmake ../src/mudlet.pro

OR:

 cmake ..

THEN:

 make -j `sysctl -n hw.ncpu`


6. Enjoy

The Mudlet.app is now available in Finder for launching.

Compiling on Debian 'Sid'

1. Install required packages from main repo.

sudo apt-get install build-essential git liblua5.1-dev zlib1g-dev libhunspell-dev libpcre3-dev \
libzip-dev libboost-dev libyajl-dev libpulse-dev lua-rex-pcre lua-filesystem lua-zip \
lua-sql-sqlite3 qt5-default qtmultimedia5-dev qttools5-dev luarocks
sudo luarocks install luautf8  

2. Grab latest Mudlet source.

mkdir ~/projects && cd ~/projects && git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet

3. Build Mudlet.

cd ~/projects/mudlet/src
qmake
make
sudo make install


Compiling on Debian 9 'Stretch'

1. Install required packages.

sudo apt-get install build-essential git liblua5.1-dev zlib1g-dev libhunspell-dev libpcre3-dev \
libzip-dev libboost-dev libyajl-dev libpulse-dev lua-rex-pcre lua-filesystem lua-zip \
lua-sql-sqlite3 qt5-default qtmultimedia5-dev qttools5-dev luarocks
sudo luarocks install luautf8  

2. Get Mudlet source.

mkdir ~/source && cd ~/source
git clone --recursive https://github.com/Mudlet/Mudlet.git mudlet

Note: the line above will check out `development` branch source code, and this might not always be stable. You can check out the latest release source code using this command:

git clone --recursive --branch master https://github.com/Mudlet/Mudlet.git mudlet

3. Build Mudlet.

mkdir ~/source/mudlet/build && cd ~/source/mudlet/build
qmake ../src/mudlet.pro
make -j `nproc`
sudo make install

After these steps you can run Mudlet by typing:

mudlet

Compiling on ArchLinux

The best way to do this would be to use the PKGBUILD found here. You'll just download the PKGBUILD into a directory, run

makepkg
sudo pacman -U [name of the generated pkg file]

and you'll be done. For more info on what this does, visit this site.

Compiling on Gentoo

An overlay containing Mudlet is available for compiling Mudlet on Gentoo.

Compiling on Windows 10

These instructions will get you setup compiling on Windows. Need a hand? Join us on Gitter (need a Github account), Discord server or forums otherwise.

MinGW is able to make use of all the cores on your system to do parallel compilation - throughout this tutorial a dualcore system is assumed, but if you have more than 2 cores set the -j # to the number of threads you need. For example, on an AMD Ryzen that has 6 cores and 12 threads, -j 12 will make full use of the CPU.

1.Download & Install the Prerequisites

Qt:
 http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe
Run the installer and de-select everything and just select:
 Qt→Qt 5.9.1→MinGW 5.3.0 (32 bit)
 Tools→MinGW 5.3.0

In this tutorial, it is installed in C:\Qt\ (so you will have C:\Qt\5.x)

7Zip:
 http://www.7-zip.org/a/7z1602-x64.msi
Notepad++:
 https://notepad-plus-plus.org/download
Recommended if you don't have a good source editor installed already (it is released under a GPL License).
Latest msys from:
 http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/

Right-click, select 7-Zip -> Extract files... and extract the msys folder using 7zip into C:\mingw32, so you get C:\mingw32\msys:

7zip extract windows.png

CMake:
 http://www.cmake.org/files/v3.0/cmake-3.0.0-win32-x86.exe
Python:
 https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi


2.Download libraries in MSYS

Open MSYS - doubleclick msys.bat in the C:\mingw32\msys folder. It might take a while to come up. Copy the lines below when it does and right-click on the terminal to paste them:

mkdir src
cd src
wget --no-check-certificate --output-document hunspell-1.4.1.tar.gz https://github.com/hunspell/hunspell/archive/v1.4.1.tar.gz
wget http://www.lua.org/ftp/lua-5.1.5.tar.gz
wget --no-check-certificate https://sourceforge.net/projects/pcre/files/pcre/8.38/pcre-8.38.tar.gz/download
wget http://zlib.net/zlib-1.2.11.tar.gz
wget http://www.sqlite.org/2013/sqlite-autoconf-3071700.tar.gz
wget --no-check-certificate https://launchpad.net/ubuntu/+archive/primary/+files/libzip_0.11.2.orig.tar.gz
wget --no-check-certificate --output-document yajl-2.0.1.tar.gz https://github.com/lloyd/yajl/tarball/2.0.1
wget --no-check-certificate https://sourceforge.net/projects/zziplib/files/zziplib13/0.13.62/zziplib-0.13.62.tar.bz2/download
wget --no-check-certificate https://indy.fulgan.com/SSL/openssl-1.0.2k-i386-win32.zip

A folder will get created in C:\mingw32\msys\home\your_name\src with all the files.

Extract all libraries with:

for a in `ls -1 *.tar.gz`; do tar -zxvf $a; done
for a in `ls -1 *.tar.bz2`; do tar xvfj $a; done
 /c/Program\ Files/7-Zip/7z -oopenssl-1.0.2k e openssl-1.0.2k-i386-win32.zip

Boost:

wget --no-check-certificate https://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
/c/Program\ Files/7-Zip/7z e boost_1_60_0.tar.gz && /c/Program\ Files/7-Zip/7z x boost_1_60_0.tar
cp -r boost_1_60_0/boost /c/mingw32/include/boost

3.Compiling libraries

Environment Settings

You want control over what compilers are being using so prefix your Path with (in system environment variables):

C:\Python27
C:\mingw32\bin
C:\mingw32\lib
C:\Program Files (x86)\CMake\bin
C:\Qt\5.9.1\mingw53_32\bin
C:\Qt\Tools\mingw530_32\bin

Be sure to restart msys.bat after setting the above to pick up the new values.

Note Note: WIP: most of Mudlet dependencies condensed for less manual work. This is not ready yet - do not use.

cd hunspell-1.4.1
./configure --prefix=/c/mingw32 && make -j 2 && make install
cd ../pcre-8.38
./configure --prefix=/c/mingw32 && make -j 2 && make install
cd ../sqlite-autoconf-3071700
./configure --prefix=/c/mingw32 && make -j 2 && make install
cd ../zlib-1.2.11
make -f win32/Makefile.gcc
export INCLUDE_PATH=/c/mingw32/include/
export LIBRARY_PATH=/c/mingw32/lib/
export BINARY_PATH=/c/mingw32/bin/
make -f win32/Makefile.gcc install
cp zlib1.dll /c/mingw32/bin
cp libz.dll.a /c/mingw32/lib
cd ../libzip-0.11.2/
./configure --prefix=/c/mingw32 && make -j 2 && make install
cp lib/zipconf.h /c/mingw32/include
cd ../zziplib-0.13.62
powershell -Command "(gc configure) -replace 'uname -msr', 'uname -ms' | Out-File -encoding ASCII configure"
configure --disable-mmap --prefix=c:/mingw32/ && make -j 2 && make install
cd ../lloyd-yajl-f4b2b1a/
powershell -Command "(Get-Content CMakeLists.txt -Raw) -replace '\/W4' -replace '(?<=SET\(linkFlags)[^\)]+' -replace '\/wd4996 \/wd4255 \/wd4130 \/wd4100 \/wd4711' -replace '(?<=SET\(CMAKE_C_FLAGS_DEBUG  .)\/D \DEBUG \/Od \/Z7', '-g' -replace '(?<=SET\(CMAKE_C_FLAGS_RELEASE .)\/D NDEBUG \/O2', '-O2' | Out-File -encoding ASCII CMakeLists.txt"
mkdir build
cd build
cmake -G "MSYS Makefiles" ..
make
cp yajl-2.0.1/lib/* /c/mingw32/lib/
cp -R yajl-2.0.1/include/* /c/mingw32/include/

# Lua: edit src\lua-5.1.5\Makefile, change INSTALL_TOP= /usr/local to INSTALL_TOP= /c/mingw32
# change TO_LIB= liblua.a to TO_LIB= liblua.a lua51.dll
cd ../../lua-5.1.5
make mingw
make install

To just install everything and not compile:

cd hunspell-1.4.1
make install
cd ../pcre-8.38
make install
cd ../sqlite-autoconf-3071700
make install
cd ../zlib-1.2.11
make -f win32/Makefile.gcc
export INCLUDE_PATH=/c/mingw32/include/
export LIBRARY_PATH=/c/mingw32/lib/
export BINARY_PATH=/c/mingw32/bin/
make -f win32/Makefile.gcc install
cp zlib1.dll /c/mingw32/bin
cp libz.dll.a /c/mingw32/lib
cd ../libzip-0.11.2/
make install
cp lib/zipconf.h /c/mingw32/include
cd ../zziplib-0.13.62
make install
cd ../lloyd-yajl-f4b2b1a/build
cp yajl-2.0.1/lib/* /c/mingw32/lib/
cp -R yajl-2.0.1/include/* /c/mingw32/include/
cd ../../lua-5.1.5
make install

MSYS Compilations

All of the following will be completed inside the msys command prompt:

cd ~/src

Hunspell:

cd hunspell-1.4.1
./configure --prefix=/c/mingw32 && make -j 2 && make install

YAJL: First, remove all the windows specific compiler settings with:

cd ../lloyd-yajl-f4b2b1a/
powershell -Command "(Get-Content CMakeLists.txt -Raw) -replace '\/W4' -replace '(?<=SET\(linkFlags)[^\)]+' -replace '\/wd4996 \/wd4255 \/wd4130 \/wd4100 \/wd4711' -replace '(?<=SET\(CMAKE_C_FLAGS_DEBUG .)\/D \DEBUG \/Od \/Z7', '-g' -replace '(?<=SET\(CMAKE_C_FLAGS_RELEASE .)\/D NDEBUG \/O2', '-O2' | Out-File -encoding ASCII CMakeLists.txt"

Then compile:

mkdir build
cd build
cmake -G "MSYS Makefiles" ..
make
cp yajl-2.0.1/lib/* /c/mingw32/lib/
cp -R yajl-2.0.1/include/* /c/mingw32/include/

Lua: edit src\lua-5.1.5\Makefile, change INSTALL_TOP= /usr/local to INSTALL_TOP= /c/mingw32

change TO_LIB= liblua.a to TO_LIB= liblua.a lua51.dll

cd ../../lua-5.1.5
make mingw
make install

PCRE:

cd ../pcre-8.38
./configure --prefix=/c/mingw32 && make -j 2 && make install

Sqlite:

cd ../sqlite-autoconf-3071700
./configure --prefix=/c/mingw32 && make -j 2 && make install

ZLib:

cd ../zlib-1.2.11
make -f win32/Makefile.gcc
export INCLUDE_PATH=/c/mingw32/include/
export LIBRARY_PATH=/c/mingw32/lib/
export BINARY_PATH=/c/mingw32/bin/
make -f win32/Makefile.gcc install
cp zlib1.dll /c/mingw32/bin
cp libz.dll.a /c/mingw32/lib

LibZip:

cd ../libzip-0.11.2/
./configure --prefix=/c/mingw32 && make -j 2 && make install
cp lib/zipconf.h /c/mingw32/include

ZZIPlib:

cd ../zziplib-0.13.62
powershell -Command "(gc configure) -replace 'uname -msr', 'uname -ms' | Out-File -encoding ASCII configure"
configure --disable-mmap --prefix=c:/mingw32/ && make -j 2 && make install

3.Downloading Mudlet Sources

Getting Mudlet

From within msys:

cd ~/src
git clone --recursive https://github.com/Mudlet/Mudlet.git
cd Mudlet/src


NOTE: If you install any of the above in a directory other than /c/mingw32, it is necessary to override some of the default include/lib paths that qmake sets up. To do so, you'll need to append a number of INCLUDEPATH and LIBPATH parameters to the qmake call.

Example (installed in an F: drive):

qmake CONFIG+=debug INCLUDEPATH+=/f/mingw32/include INCLUDEPATH+=/f/mingw32/lib/include LIBPATH+=/f/mingw32/lib LIBPATH+=/f/mingw32/lib/lib LIBPATH+=/f/mingw32/bin

Building Mudlet from QtCreator

Open C:\mingw32\msys\home\<username>\src\Mudlet\src\mudlet.pro in Qt Creator, enable Debug and Release builds and hit Configure Project:

Selection 173.png

Press Ctrl+5 and update project settings for the # of cores/threads available to your system:

Change Qt Creator to use many cores.gif

Hit run:

Selection 176.png

Click on Compile Output to see progress on compiling:

Selection 177.png

This'll take ~10min, after which Mudlet will launch! But it's not completely ready yet - close it and follow more:

4.Copy Needed DLLs

Copy the following dll's needed to run Mudlet: See above note about alternative install paths before copying.

cd ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Cored.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Guid.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libEGLd.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libGLESv2d.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Networkd.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5OpenGLd.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Widgetsd.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Multimediad.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Gamepadd.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libgcc_s_dw2-1.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libstdc++-6.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libwinpthread-1.dll .
cp /c/mingw32/lib/libyajl.dll .
cp $HOME/src/lua-5.1.5/src/lua51.dll .
cp $HOME/src/lua-5.1.5/src/lua51.dll /c/mingw32/bin
cp $HOME/src/openssl-1.0.2k/libeay32.dll .
cp $HOME/src/openssl-1.0.2k/ssleay32.dll .
cp /c/mingw32/bin/libzip-2.dll .
cp /c/mingw32/bin/libhunspell-1.4-0.dll .
cp /c/mingw32/bin/libpcre-1.dll .
cp /c/mingw32/bin/libsqlite3-0.dll .
cp /c/mingw32/bin/zlib1.dll .
cp ~/src/Mudlet/src/*.dic .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/audio .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/mediaservice .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/platforms .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/imageformats .
mkdir ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
cd ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Core.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Gui.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libEGL.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libGLESv2.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Network.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5OpenGL.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Widgets.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Multimedia.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/Qt5Gamepad.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libgcc_s_dw2-1.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libstdc++-6.dll .
cp /c/Qt/5.9.1/mingw53_32/bin/libwinpthread-1.dll .
cp /c/mingw32/lib/libyajl.dll .
cp $HOME/src/lua-5.1.5/src/lua51.dll .
cp $HOME/src/lua-5.1.5/src/lua51.dll /c/mingw32/bin
cp $HOME/src/openssl-1.0.2k/libeay32.dll .
cp $HOME/src/openssl-1.0.2k/ssleay32.dll .
cp /c/mingw32/bin/libzip-2.dll .
cp /c/mingw32/bin/libhunspell-1.4-0.dll .
cp /c/mingw32/bin/libpcre-1.dll .
cp /c/mingw32/bin/libsqlite3-0.dll .
cp /c/mingw32/bin/zlib1.dll .
cp ~/src/Mudlet/src/*.dic .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/audio .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/mediaservice .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/platforms .
cp -r /c/Qt/5.9.1/mingw53_32/plugins/imageformats .


5.Setting up Lua libraries

At this point your Lua install will be bare-bones and lacking the Lua libraries Mudlet uses.

cd ~/src
wget --no-check-certificate http://keplerproject.github.io/luarocks/releases/luarocks-2.4.0-win32.zip
unzip luarocks-2.4.0-win32.zip

Open up the Windows command line cmd to install Luarocks:

cd C:\mingw32\msys\home\%USERNAME%\src\luarocks-2.4.0-win32
install.bat /P C:\LuaRocks /MW

Wait for the installation to finish. Then:

cd \LuaRocks\lua\luarocks
powershell -Command "(gc cfg.lua) -replace 'mingw32-gcc', 'gcc' | Out-File -encoding ASCII cfg.lua"
cd \LuaRocks
luarocks install LuaFileSystem
luarocks install LuaSQL-SQLite3 SQLITE_INCDIR="c:\mingw32\include" SQLITE_LIBDIR="c:\mingw32\lib"
luarocks install lrexlib-pcre PCRE_LIBDIR="c:\mingw32\lib" PCRE_INCDIR="c:\mingw32\include"
luarocks install luautf8

Back in the msys command line:

cd ~/src
wget --no-check-certificate https://github.com/rjpcomputing/luazip/archive/master.zip
unzip master
cd luazip-master/
gcc -O2 -c -o src/luazip.o -IC:/mingw32/include/ src/luazip.c
gcc -shared -o zip.dll src/luazip.o -Lc:\mingw32\lib -lzzip -lz c:/mingw32/bin/lua51.dll -lm
cp zip.dll ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug
cp zip.dll ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug
cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release/release
cp -r ~/src/Mudlet/src/mudlet-lua/ ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Debug
cp -r ~/src/Mudlet/src/mudlet-lua/ ~/src/Mudlet/build-mudlet-Desktop_Qt_5_9_1_MinGW_32bit-Release


You're done! Press the green Run button again in Qt Creator (bottom-right) and a Mudlet window should come up without any errors.

Uninstalling

To uninstall, remove the following folders:

C:\LuaRocks
C:\mingw32
C:\Qt

Setting up IDEs

CLion

If you'd like to use CLion and it is giving the following error:

By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Core", but
CMake did not find one.

Could not find a package configuration file provided by "Qt5Core" with any
of the following names:

Qt5CoreConfig.cmake
qt5core-config.cmake

Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
"Qt5Core_DIR" to a directory containing one of the above files.  If
"Qt5Core" provides a separate development package or SDK, be sure it has
been installed.

You can fix this by setting -DCMAKE_PREFIX_PATH=<your Qt + version + compiler location>. For example: -DCMAKE_PREFIX_PATH=/home/vadi/Programs/Qt/5.8/gcc_64/

CLion CMake settings - finidng Qt.png