Compiling Mudlet
Contributing
Clang format can be used to automatically format code submissions. Go here for more information on Clang format: http://clang.llvm.org/docs/ClangFormat.html
Travis Integration
Mudlet is hosted on Github and uses Travis for continuous integration by building on a Ubuntu 12.04 (Precise Pangolin) LTS Linux and a MacOs Mavericks (10.9) 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: Travis builds do not currently package mudlet, so not everything is automated.
Compiling
Note: Mudlet uses Qt 5.x now, at one stage it was Qt5.2 or later but I think I have fixed that. {Note: so far it has proven possible to compile using a late Qt4.x but some code does have to be changed this is my backport of the 3.0.0 release post-delta preview code but I expect it is not likely to be merged - and it has not been proven to be fully functional, only build-able - your mileage may vary!} slysven
Note: Mudlet uses C++11 features now. Please use the latest versions of GCC (4.9.1) and Clang (3.5), if possible.
Compiling on Ubuntu 12.04
1. Install Git
sudo apt-get install git
2. Get Mudlet source
git clone 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!}
cd mudlet mkdir build
4. Setup your environment
CI/travis.linux.before_install.sh CI/travis.linux.install.sh
5 Move to the build location
cd build
6. Run the following commands, depending on which build system you want to use (qmake IS recommended for Linux and Mac platforms)
EITHER:
qmake ../src/src.pro
OR:
cmake ..
THEN:
make -j 2
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.
7. Start the application you have just compiled - enjoy
./mudlet
Compiling on OS X
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 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
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/src.pro
OR:
cmake ..
THEN:
make -j 2 make install
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.
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 lua5.1 liblua5.1-0-dev libpcre3-dev libboost-dev zlib1g-dbg zlib1g-dev libyajl2 \ libyajl-dev libyajl2-dbg libphonon-dev libhunspell-dev lua-filesystem zlib-bin libzzip-dev lua-rex-pcre lua-zip \ lua-sql-sqlite3 qt5-default git libquazip-dev
2. Grab latest Mudlet source.
$ cd ~ && mkdir projects && cd projects && git clone https://github.com/Mudlet/Mudlet.git
3. Build latest libzip.
$ cd mudlet/src && wget http://www.nih.at/libzip/libzip-0.11.1.tar.gz
$ tar -xvzf libzip-0.11.1.tar.gz && cd libzip-0.11.1
$ ./configure && make && sudo make install
Note: libzip has since reached the version 1.0 milestone - and it is possible that we will move forward to use later version library calls - this version is, I think the minimum version that is usable with the current Mudlet code which may be an issue for some earlier Debian distributions (7.x, "Wheezy" at least only ships a 0.10.x version). --slysven 19:41, 15 January 2017 (EST)
4. Download and install QT development package.
$ \curl -sS http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x86-5.3.1.run
$ chmod +x qt-opensource* && ./qt-opensource*
5. Fix issues.
$ sudo ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
6. Build Mudlet.
$ cd ..
$ /home/<username>/Qt5.3.1/5.3/gcc/bin/qmake
$ make
Compiling in 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 in Gentoo
An overlay is available for compiling Mudlet on Gentoo.
Compiling on Windows 10
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.6->MinGW 4.9.2 (32 bit) Qt->Qt 5.6->Source components 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 (at the last check it was at version 7.3) Recommended if you don't have a good source editor installed already (it is release 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: http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/ put the msys folder in C:\mingw32, so you get C:\mingw32\msys
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 (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:
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.10.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
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
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
3.Compiling libraries
Environment Settings
You want control over what compilers are being using so prefix your Path with (in system environmental variables):
C:\Python27 C:\mingw32\bin C:\Program Files (x86)\CMake\bin C:\Qt\5.6\mingw49_32\bin
Be sure to restart msys.bat after setting the above to pick up the new values.
MSYS Compilations
All of the following will be completed inside the msys command prompt.
cd into each respective directory:
Hunspell:
./configure --prefix=/c/mingw32 && make -j 2 && make install
YAJL: Edit CMakeLists.txt in the base dir of YAJL, and make the following changes to remove all the windows specific compiler settings:
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") to SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF") to SET(linkFlags) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711") to SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7") to SET(CMAKE_C_FLAGS_DEBUG "-g") SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2") to SET(CMAKE_C_FLAGS_RELEASE "-O2")
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 the Makefile, change INSTALL_TOP= /usr/local to INSTALL_TOP= /c/mingw32
change TO_LIB= liblua.a to TO_LIB= liblua.a lua51.dll
make mingw make install
PCRE:
./configure --prefix=/c/mingw32 && make -j 2 && make install
Sqlite:
./configure --prefix=/c/mingw32 && make -j 2 && make install
ZLib:
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:
./configure --prefix=/c/mingw32 && make -j 2 && make install cp lib/zipconf.h /c/mingw32/include
ZZIPlib:
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 https://github.com/Mudlet/Mudlet.git cd Mudlet/src git checkout release_30
Building Mudlet from terminal
cd ~/src/Mudlet/src qmake make -j 2
Building Mudlet from QtCreator
Open src.pro (within Mudlet2/src) in Qt Creator
4.Copy Needed DLLs
Copy the following dll's into the release directory:
cd release/ cp /c/Qt/5.6/mingw49_32/bin/icudt54.dll . cp /c/Qt/5.6/mingw49_32/bin/icuin54.dll . cp /c/Qt/5.6/mingw49_32/bin/icuuc54.dll . cp /c/Qt/5.6/mingw49_32/bin/Qt5Core.dll . cp /c/Qt/5.6/mingw49_32/bin/Qt5Gui.dll . cp /c/Qt/5.6/mingw49_32/bin/Qt5Network.dll . cp /c/Qt/5.6/mingw49_32/bin/Qt5OpenGL.dll . cp /c/Qt/5.6/mingw49_32/bin/Qt5Widgets.dll . cp /c/Qt/5.6/mingw49_32/bin/Qt5Multimedia.dll . cp /c/Qt/5.6/mingw49_32/bin/libgcc_s_dw2-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 $HOME/src/lua-5.1.5/src/lua51.dll . cp $HOME/src/lua-5.1.5/src/lua51.dll /c/mingw32/bin 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 -r ../mudlet-lua/ . cp ../*.dic . cp -r /c/Qt/5.6/mingw49_32/plugins/audio . cp -r /c/Qt/5.6/mingw49_32/plugins/mediaservice . cp -r /c/Qt/5.6/mingw49_32/plugins/platforms .
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
Switch to the Windows command line 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"
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/src/release cp -r /c/mingw32/lib/lua/5.1/* ~/src/Mudlet/src/release
You're done! You can now launch mudlet by running mudlet.exe in the release/ folder, or from command line:
cd ~/src/Mudlet/src/release ./mudlet.exe
Outdated compiling instructions
Instructions below need to be updated.
Compiling on Debian 7.1 ("Wheezy")
1. Install GIT. In a terminal window type:
sudo apt-get install git
2. Install needed Debian packages.
Only the development [-dev] ones are shown here, as this should also get the associated main packages auto-magically if not already present on the system:
sudo apt-get install "compiler packages & qt-sdk packages" liblua5.1-0-dev libboost-dev libhunspell-dev libphonon-dev lua-zlib-dev libzip-dev libyajl-dev lua-rex-pcre lua-zip lua-filesystem lua-sql-sqlite3
N.B. "compiler packages & qt-sdk packages" could probably be "g++", "libstdc++6" and "qmake" to pull in the default GCC C++ compiler and associated libraries and qt Make system; "qt4-dev-tools" to pull in the development Qt libraries; "gdb" if you are planning on doing any debugging and "qtcreator" to provide a nice IDE to do it all in. The last four dependences are not required to compile the code but their absence will show up in error messages from the LUA subsystem as connection is made to a MUD and the session starts up, unlike other dependences only the main files seem to be required (it not being necessary to include the development [-dev] packages.)
3. Build and install non-Debian packages. Which presently is only the C++/Qt Zip library "quazip", download the latest version quazip-0.5.1.zip. After unzipping to a new directory of your choice add: "QMAKE_CXXFLAGS += -fpermissive" near the top of the "./qztest/qztest.pro" file to change errors to warnings on assigning some gzFile pointers to void ones in the test suite - this seems to be needed to get the whole thing to compile (though the test suite isn't necessary for compiling Mudlet purposes). After making that change in a terminal window run "qmake" on the quazip project file in the base of the quazip project directory tree to update the subdirectory project files. After building (with "make") in that base directory use "sudo make install" to install the newly constructed files in your system - this puts headers in /include and libraries in /lib of your file-system so some tweaking in the last couple of bits of this section could avoid the need to manually move the library and the three symbolic links from /lib to /usr/local/lib/ and the header files from /includes to /usr/local/includes/.
4. Get the Mudlet source. In a terminal window:
git clone git://git.code.sf.net/p/mudlet/code
5. Compile the Mudlet source. In that terminal window:
qmake make
or if you've got qtcreator set up once you've opened the Mudlet project file which is "./src/src.pro" relative to wherever you had Git clone the code in the previous step, hit the "build src.pro" and go and grab a hot drink or whatever whilst the code is compiled...!
6. Run Mudlet, and Enjoy. From a terminal window run the mudlet executable, as it is relative to where you had Git clone the code to this will be the file:
./src/mudlet
Like other systems documented here, it may not be possible to do a "make install" to make this executable work for all users of the system on which it has just been built. At the point of writing the default Qt libraries provided for Debian "Wheezy" are version 4.8.2 which may not match the ones of the Qt-sdk recommended by the Mudlet makers. In the event of problems in that area you may be recommended to build that specific version of the libraries and recompile Mudlet with them - fortunately Qt-Creator does make the latter part relatively straightforward.