Building Tribler

This page contains instructions on how to build and package Tribler.

Windows

This section contains information about building Tribler on Windows. In the end you should be left with a .exe file which, when opened, enables users to install Tribler on their system. This guide installs a 64-bit version of Tribler and has been tested on Windows 10 and Windows 2008 Server R2, 64-bit. It is recommended to create this builder on a system that is already able to run Tribler from a git checkout (it means that all the required packages required by Tribler are installed already). In case you want to build a 32 bit version, just install all the dependencies mentioned in 32 bit version. Information about setting up a developer environment on Windows can be found on tribler_dev_windows.

When you have installed zope, an empty __init__.py file must be present in the zope folder. If this file is missing, a No module named zope error will be thrown. Create this file in the site-packes/zope folder if it does not exist.

Required packages

To build a Tribler installer, you’ll need some additional scripts and packages. The versions used as of writing this guide are mentioned next to the package or script. * The git command tools (version 2.7.0) are required to fetch the latest release information. These can be downloaded from here. * Py2Exe (0.6.9), a tool to create an executeable from python files. Grab the latest version here. * The builder needs to find all packages that are required by Tribler so make sure you can run Tribler on your machine and that there are no missing dependencies. * Nullsoft Scriptable Install System (NSIS) (version 2.5.0) is a script-driven Installer authoring tool for Microsoft Windows with minimal overhead. It can be downloaded here. We selected version 2.5 as the uninstall functions were not called properly in 3.03b. * Three plugins are required.The UAC plugin is the first. This can be downloaded from here (version 0.2.4c). How to install a plugin can be found here. * The second plugin that is needed is AccessControl plug-in (version 1.0.8.1). It can be downloaded here. * The third plugin required is NSIS Simple Firewall Plugin (version 1.2.0). You can download it here. * The fourth plugin needed is NSProcess (Version 1.6.7), which can be downloaded here. * A version of Microsoft Visual Studio should be installed (we use 2012), but make sure you do not have the build-tools only. The full (community) edition can be downloaded here.

Building & Packaging Tribler

Start by cloning Tribler if you haven’t done already (using the git clone --recursive command). Next, create a build folder directly on your C:\ drive. Inside the build folder, put the following items:

  1. A static version (64 bit, git-1d8f9b7) of ffmpeg, available here. Place it in a folder called ffmpeg in the build folder.
  2. A folder certs containing a .pfx key. In our case it’s named swarmplayerprivatekey.pfx. Make sure to rename paths in makedist_win.bat to match your file name.
  3. A vlc folder containing a full instalation of vlc (Version 2.2.1).
  4. vc_redist_90.exe (Microsoft Visual C++ 2008 Redistributable Package), which is available here. In case you build 32 bit, get the x86 version here. Don’t forget to rename the file.
  5. vc_redist_110.exe (Visual C++ Redistributable for Visual Studio 2012), which is available here. In case you build 32 bit, get the x86 version. Once more, don’t forget to rename the file.
  6. libsodium.dll which can be downloaded from libsodium.org (as of writing version 1.0.8).

Then, set a PASSWORD environment variable with its value set to the password matching the one set in your .pfx file.

Finally, open a command prompt and enter the following commands (Change 11.0 depending on your version of Microsoft Visual Studio): Note that for building 32 bit you need to pass anything but 64, i.e. 32 or 86 to the update_version_from_git.py script.

setlocal enabledelayedexpansion
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
SET PATH=%PATH%;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
dir
cd tribler
python Tribler/Main/Build/update_version_from_git.py 64
xcopy C:\build\vlc vlc /E /I
win\makedist_win.bat

This builds an .exe installer which installs Tribler when ran.

OS X

This section contains information about building Tribler on OS X. The final result you should have is a .dmg file which, when opened, allows Tribler.app to be copied to the Applications directory. This guide has been tested on OS X 10.11 (El Capitan). It is recommended to run this builder on a system that is already able to run Tribler without problems (it means that all the required packages required by Tribler are installed already). Information about setting up a developer environment on OS X can be found here.

Required packages

To build and distribute Tribler, there are some required scripts and packages: * The git command tools are required to fetch the latest release information. They are installed when you start Xcode for the first time but you can also install it using brew or another package library. * Py2app. The built-in version of py2app does not function correctly when System Integrity Protection (SIP) is turned on. You can either turn SIP off (instructions on how to do this can be found here) or you can install a more recent version of py2app using PIP in your user-defined site-packages. Note that you should place the site-packages directory with py2app in it higher in the PYTHONPATH environment variable than the site-packages directory managed by the system. Otherwise, the builder will chooose the py2app package installed by the system. * The builder needs to find all packages that are required by Tribler so make sure you can run Tribler on your machine and that there are no missing dependencies. * In order to attach the EULA to the .dmg file, we make use of the eulagise script. This script is written in PERL and is based on a more fully-featured script. The script can be dowloaded from GitHub. The builder expects the script to be executable and added to the PATH environment variable. This can be done with the following commands:

cp eulagise.pl /usr/local/bin/eulagise
chmod +x /usr/local/bin/eulagise
eulagise # to test it - it should show that you should add some flags

Building Tribler on OS X

Start by checking out the directory you want to clone (using git clone --recursive). Open a terminal and cd to this new cloned directory (referenced to as tribler_source in this guide).

First we need to copy the ffmpeg library to tribler_source. You can download this file from here. Next, create a directory named vlc in tribler_source and copy the ffmpeg file to that directory. Make sure to name the file ffmpeg, otherwise the builder cannot find it.

Next, we should inject version information into the files about the latest release. This is done by the update_version_from_git.py script found in Tribler/Main/Build. Invoke it from the tribler_source directory by executing:

Tribler/Main/Build/update_version_from_git.py

Before we can build the .dmg file, some environment variables need to be set:

export MACOSX_DEPLOYMENT_TARGET=10.11
export CFLAGS=' -mmacosx-version-min=10.6 -O -g '
export CXXFLAGS=' -mmacosx-version-min=10.6 -O -g '

If you are building on another environment, you should change MACOSX_DEPLOYMENT_TARGET to match your version of OS X. The -mmacosx-version-min is required so the builder can optimize the build depending on the minimum supported version.

Now execute the builder with the following command:

./mac/makedistmac_64bit.sh

This will create the .dmg file in the tribler_source/dist directory.

Debian and derivatives

Run the following commands in your terminal:

sudo apt-get install devscripts python-setuptools
cd tribler
Tribler/Main/Build/update_version_from_git.py
debuild -i -us -uc -b

Other Unixes

We don’t have a generic setup.py yet.

So for the time being, the easiest way to package Tribler is to put Tribler/ in /usr/share/tribler/ and debian/bin/tribler in /usr/bin/. A good reference for the dependency list is debian/control.