Compiling Mudlet

From Mudlet
Revision as of 22:54, 2 March 2019 by Jieiku (talk | contribs) (correct path case)
Jump to navigation Jump to search

If you just want to use Mudlet, you can skip these steps, and use one of the pre-compiled installers ready for download here: https://www.mudlet.org/download/

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.

Continuous Integration

Mudlet is hosted on Github it uses Travis and AppVeyor for continuous integration by building on a Ubuntu 14.04 LTS Linux and a macOS 10.11 platforms (Travis) and a Visual Studios 2015 on a MicroSoft Windows Server 2012 R2 platform (AppVeyor) repectively. This means that every push to the Git repository is test compiled on Linux (Ubuntu), Mac OSX and Microsoft Windows.

Travis integration is defined in a .travis.yml file and AppVeyor integration by .appveyor.yml file, in our case, they reference shell/PowerShell 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? Join us on Mudlet's Discord 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 \
  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 ccache libpugixml-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
sudo luarocks install lua-yajl

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

cd src
./mudlet

Compiling on Chrome OS

These instructions will get you setup compiling on Chrome OS. Need a hand? Join us on Mudlet's Discord or forums.

1. Install dependencies

sudo apt install git build-essential qt5-default qtmultimedia5-dev qttools5-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 libglu1-mesa-dev ccache libpugixml-dev mesa-common-dev qtcreator \
  libpulse-dev libglib2.0-dev luarocks libboost-all-dev
sudo luarocks install luautf8
sudo luarocks install lua-yajl

You'll also need to download a few files from the web and install them locally.

libgstreamer0.10 - gstreamer0.10-fluendo-mp3 - liboil0.3

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 command

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

THEN:

make -j `nproc`

5. Start the application you have just compiled - enjoy

./mudlet

Compiling on macOS

These instructions will get you setup compiling on macOS. Need a hand? Join us on Mudlet's Discord server or forums otherwise.


1. Install prerequisites

Install XCode, command line tools for XCode, HomeBrew and CocoaPods (we'll need packages from both).

Once everything 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
 sudo luarocks-5.1 install lua-yajl

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 src/ 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 ccache libpugixml-dev
sudo luarocks install luautf8
sudo luarocks install lua-yajl

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 ccache libpugixml-dev
sudo luarocks install luautf8  
sudo luarocks install lua-yajl

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 7+

These instructions will get you setup compiling on Windows.

Need a hand? Join us on the Mudlet Discord server or forums.

1. Download Mudlet source code

  1. Install Github Desktop.
  2. Clone (instructions) Mudlet's repository to your local drive.

Note Note: You must use a location on C:\ without any spaces in folder names!

2. Perform a one-time setup

Right-click on setup-windows-sdk.ps1 and select Run with PowerShell. This will automatically download all of the requires tools and libraries, set them up for you, build Mudlet, and launch it! If this script exits immediately, please upgrade your PowerShell version first.

Note Note: Depending on your Internet connection and computer speed, this one-time setup will take 30 minutes or more - so grab a cup of tea or coffee.

Start-of-installation.gif

During the installation, you'll see the Qt installer window pop-up - this is normal:

Qt-installer.gif

The installer's final step will be compiling all of the source code, which looks like this:

Compiling-step.gif

After it's all done, a Mudlet version ending in "-dev" will launch automatically:

Mudlet-launching.gif

Coding on Mudlet

Open C:\<path to repository>\src\mudlet.pro in Qt Creator, which resides here: C:\Qt\Tools\QtCreator\bin\qtcreator.exe. Then enable Debug and Release builds and hit Configure Project:

Selection 173.png

Press Ctrl+5 and update project settings. Check how many logical processors are available in your system with the Task Manager:

2 processors are available in this example

And set this amount in Qt Creator:

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

When it's all ready, the new Mudlet with your changes will launch.

Contributing changes

Once you're all done with your changes, contribute them to Mudlet using a pull request. Thanks for improving open-source!

Uninstalling

To get rid of everything, uninstall Qt using the C:\Qt\MaintenanceTool.exe and remove the following folders:

C:\Libraries
C:\LuaRocks
C:\MinGW
C:\Python27
C:\Qt
C:\src

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.9/gcc_64/

CLion CMake settings - finidng Qt.png