jami-docs/technical/Build-instructions.md

23 KiB

Ring relies on various components which interact together.

Ring-layers

They are divided into three main layers:

1. LibRing (or Daemon) is the core of Ring. It does not interact with users but it is involved in every command.

2. LibRingClient (or LRC) is written in QtCore and facilitates clients' portability between operating systems. It does not interact with the Android client.

3. The Client layer formalizes the use-case on GNU/Linux (Gnome), Windows, Mac OS X and Android.

To fully build Ring, you must build each of these components in order, unless you choose to build Ring easily and quickly.

How to Build Ring Easily and Quickly

We use a GIT repository to manage sources. On shell based platform you can fetch your private copy using following command:

git clone https://gerrit-ring.savoirfairelinux.com/ring-project

Ring installer uses python3. If it's not installed, please install it:

cd ring-project/
./make-ring.py --init

On GNU/Linux

Build and install all the dependencies: Your distro package manager will be used.

./make-ring.py --dependencies

Build and install locally

./make-ring.py --install

Run LibRing (daemon) and client that were installed locally

./make-ring.py --run

You can then stop the processes with CTRL-C. You can also run them in the background with the --background argument and then use the --stop command to stop them. Use Stdout and stderr to go to daemon.log and client-gnome.log.

Install globally for all users instead

./make-ring.py --install --global-install

Run global install: This already starts LibRing (the daemon) automatically for us.

gnome-ring

Uninstall the global install

./make-ring.py --uninstall

On Mac OS X

  • You need to setup Homebrew since there is no built-in package manager on OSX.

Build and install all the dependencies

./make-ring.py --dependencies

Build and install locally

./make-ring.py --install

Output: You can find the .app file in the ./install/client-macosx folder.

On Android

Prepare environment

  • Install required tools (on Ubuntu, check equivalent if you use a different distro)
sudo apt install autoconf automake libtool autopoint

Add these variables to your bash profile:

export JAVA_HOME=<path_to_java_JDK>
export ANDROID_HOME=<path_to_root_folder_sdk>
export ANDROID_SDK=$ANDROID_HOME
export ANDROID_NDK=<path_to_root_folder_ndk>
export ANDROID_NDK_ROOT=$ANDROID_NDK
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK:$JAVA_HOME/bin

ie for Ubuntu :

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/
export ANDROID_HOME=/home/{username}/Android/Sdk
export ANDROID_SDK=/home/{username}/Android/Sdk
export ANDROID_NDK_ROOT=/home/{username}/Android/Sdk/ndk-bundle/
export ANDROID_NDK=/home/{username}/Android/Sdk/ndk-bundle/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK:$JAVA_HOME/bin

Build and install locally-

  • Clone whole project repository
git clone --recurse-submodules https://gerrit-ring.savoirfairelinux.com/ring-project
  • Initialize project
cd ring-project
./make-ring.py --init --distribution=Android
  • Compile
./make-ring.py --install --distribution=Android

Output: You can find the .apk file in the ./client-android/ring-android/app/build/outputs folder.

Troubleshooting

  • Check case in your sdk path. Since api 26, /home/user/Android/sdk have become /home/user/Android/Sdk
  • You can check each path with echo. e.g : echo $JAVA_HOME
  • sudo will use root's bash profile. And you don't need it.

How to Build LibRing (or Daemon)

First thing you need to do is buildind LibRing (or Daemon). Here are the instructions to build chapters for your platform.

Getting LibRing Source Code (all platforms)

We use a GIT repository to manage LibRing sources. On shell based platform you can fetch your private copy using following command:

git clone https://gerrit-ring.savoirfairelinux.com/ring-daemon

Notice that direct push are blocked. See below how to contribute to the daemon sending us patches.

How to Build LibRing (binary and SDK)

Following platforms are officialy supported : GNU/Linux | Windows | Mac OS X

On GNU/Linux

Build environment

Dependencies LibRing : Fedora

sudo yum groupinstall group "Development Tools" "Development Libraries"
sudo yum install gcc-c++ yasm intltool libyaml-devel alsa-lib-devel pulseaudio-libs-devel libsamplerate-devel dbus-c++-devel pcre-devel gsm-devel speex-devel speexdsp-devel expat-devel libsndfile-devel gnutls-devel gettext-devel cmake libtool systemd-devel uuid-devel libXfixes-devel jsoncpp-devel autoconf-archive

For video support, you'll also need ffmpeg, which is only available in the RPMfusion repository as described here http://rpmfusion.org/Configuration

Then install ffmpeg:

sudo yum install ffmpeg-devel

To build and run the tests with make check, you'll also need

sudo yum install cppunit-devel cppcheck sipp dbus

:*Dependencies LibRing : Debian-based

Building dependencies/instructions for Debian, Ubuntu, Crunchbang Linux, etc.

sudo apt-get install autoconf autoconf-archive automake autopoint cmake libpulse-dev libsamplerate0-dev libgsm1-dev libspeex-dev libtool libdbus-1-dev libasound2-dev libopus-dev libspeexdsp-dev libexpat1-dev libpcre3-dev libyaml-cpp-dev libboost-dev libdbus-c++-dev libsndfile1-dev libsrtp-dev libjack-dev libupnp-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libudev-dev yasm uuid-dev libgnutls-dev libjsoncpp-dev libvdpau-dev libva-dev

If you want to run tests (e.g. when setting up a new VM on Jenkins), you must install cppunit and sipp

sudo apt-get install libcppunit-dev sip-tester dbus

For H.264 support, you'll need

sudo apt-get install libavcodec-extra-*

Compile LibRing's dependencies

RING=$PWD/ring-daemon
cd $RING/contrib

mkdir build
cd build
../bootstrap
make
# That's all !

# Optionally, you may also type :
make list

# or

# make .packge?
# to force using downloaded packages, not system locally installed.
make .gnutls .upnp ...

Note: if compiling libav in contrib (you can see the list of dependencies which will be compiled by running 'make list' in $RING/contrib/build) on Linux, you will likely first need to install libx11-dev libxext-dev libxfixes-dev due to the '--enable-x11grab' configure option.

Build LibRing

cd $RING
# Now generate autotools configuration files
./autogen.sh
# Create Makefiles and config.h files for your build target
./configure --prefix=/usr --disable-shared
# Build
make
# Install
sudo make install

On Windows

For the moment only 32-bit MinGW build can be compiled.

Cross-compiling on Linux

Build environment: MinGW-w64 | mingw-w64-pkg-config | gettext-devel | yasm | cmake | patch | libtool | automake | autoconf-archive

starting directory: ring-project/

Fetch and build LibRing's dependencies

cd ring-daemon/contrib
mkdir native
cd native
../bootstrap --host=i686-w64-mingw32
make

Build LibRing

cd ../..
./autogen.sh
mkdir -p "build"
cd build
../configure --host=i686-w64-mingw32 --without-dbus --prefix=(<prefix_path> default=_win32)
rsync -a ../src/buildinfo.cpp ./src/buildinfo.cpp
make (-jX) install
Native compiling on Windows

MSVC: Microsoft Visual C++ 2015 CTP is still lacking some C++11 features needed to compile the daemon (e.g. constexpr is only partially supported).

MinGW: TODO

On Mac OS X

Build Tools: Use your favorite package manager to install the necessary tools (HomeBrew or MacPorts) automake, libtool, gettext, libtoolize, yasm, autoconf, pkg-config. If you don't use a package manager:

cd extras/tools
./bootstrap
make
export PATH=$PATH:$RING/extras/tools/build/bin

Compile LibRing's dependencies

cd contrib
mkdir build
cd build
../bootstrap
make -j3

Build LibRing: If you want to link against libringclient and native client, easiest way is to add --prefix to configure and then run make install

cd ../../
./autogen.sh
./configure  --without-dbus --prefix=<prefix_path>
make install

If you do not want to install LibRing, you will have to use -DRING_BUILD_DIR=<path_to_ring>/src as a cmake argument for LibRingClient.

Common Issues: "Autopoint not found" When using Homebrew, autopoint is not found even when gettext is installed, because symlinks are not created. To fixt it, run:

brew link --force gettext

Contributing to LibRing Source Code

First read our LibRing Coding Rules page before sending us any patches.

Gerrit is used as code review / integration tool. Register your ID (you need a Google/GitHUB OAuth2 account) on our public web gerrit service here:

https://gerrit-ring.savoirfairelinux.com

This service works for all Ring sub-projects (LibRing, LRC and clients).

How to Build LibRingClient (or LRC)

Getting the Source Code

git clone https://gerrit-ring.savoirfairelinux.com/ring-lrc

LIBRINGLIENT=`pwd`/ring-lrc
RING=`pwd`/ring-daemon

How to Build LibRingClient from Sources

Dependencies

  • Qt5core
    • Debian/Ubuntu: qtbase5-dev
    • Fedora: qt5-qtbase-devel
  • Qt5Linguist Tools are needed to enable compiling of translations
    • Debian/Ubuntu: qttools5-dev and qttools5-dev-tools
    • Fedora: qt5-qttools-devel

GNU/Linux & Mac OS X

cd $LIBRINGLIENT
mkdir build
cd build
cmake .. -DRING_BUILD_DIR=$RING/src -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

For debug symbols add the appropriate cmake option to the cmake configure line, like so:

cmake .. -DRING_BUILD_DIR=$RING/src -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug

Windows

Build on Linux with MinGW

Build environment: minGW-w64 | mingw32-qt5-qtbase | mingw32-qt5-qttools

Build LibRingClient

LIBRING_INSTALL_PREFIX makes reference to the build directory of LibRing, so it is either ring-daemon/build/_win32/, or the directory specified via --prefix argument defined during LibRing compilation.

cd ring-lrc
mkdir -p build
cd build
export CMAKE_PREFIX_PATH=/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/winBuild.cmake  -DRING_BUILD_DIR=<LIBRING_INSTALL_PREFIX> -DENABLE_LIBWRAP=true -DCMAKE_INSTALL_PREFIX=<LIBRING_INSTALL_PREFIX> ..
make [-jX] (for X-way multi-threaded build ) install || exit 1

note:the CMAKE_INSTALL_PREFIX must be the same as LibRing for building the client

Build on Native Windows

MVSC: Microsoft Visual C++ 2015 CTP is still lacking some C++11 features needed to compile the common library (e.g. constexpr is only partially supported).

MinGW: TODO

Developper

KDE Coding Guidelines

Rapport de projet de fin d'études (French - 54,866 Mo) Emmanuel Lepage, 2015/04/23

How to Build a Client

In most of cases you want a client to control the daemon. We provide ready to use clients for major platforms.

Choose your client build instructions below

Gnome Client for Ring

Getting the Source Code

git clone https://gerrit-ring.savoirfairelinux.com/ring-client-gnome

Dependencies

Building Environment
  • cmake
  • C++11 compiler (eg: gcc >= 4.8)
  • GTK+ >= 3.10
  • clutter and clutter-gtk
  • libRingClient
  • Qt5Core
  • gnome-icon-theme-symbolic
  • X11
  • libebook1.2 >= 3.10 or evolution-data-server >= 3.10

Some distros (Debian/Ubuntu) have separated the EDS APIs into its different client and server components, while others (Fedora) have put everything in one EDS package)

  • libnotify (optional for desktop notifications)
  • gettext (optional for compiling translations)

Debian/Ubuntu

sudo apt-get install g++ cmake libgtk-3-dev qtbase5-dev libclutter-gtk-1.0-dev gnome-icon-theme-symbolic libebook1.2-dev libnotify-dev gettext

Fedora

sudo yum install gcc-c++ cmake gtk3-devel qt5-qtbase-devel clutter-gtk-devel gnome-icon-theme-symbolic evolution-data-server-devel libnotify-devel gettext-devel

Documentation

You may optionally install doxygen to be able to build the documentation via 'make doc'

Run-time Environment
  • GTK+ >= 3.10
  • clutter and clutter-gtk
  • the Ring daemon and libRingClient
  • Qt5Core (libRingClient uses the Core module of Qt5, thus Qt5Core is required to properly interface between it and GTK)
  • gnome-icon-theme-symbolic, for the use of certain symbolic icons (this dependency may be dropped in the future)
  • X11 (this is currently needed for screen area selection during screen sharing, a Wayland (or otherwise) alternative is not currently supported)
  • libebook1.2 >= 3.10 or evolution-data-server >= 3.10

Some distros (Debian/Ubuntu) have separated the EDS APIs into its different client and server components, while others (Fedora) have put everything in one EDS package)

  • libnotify (optional for desktop notifications)

Debian/Ubuntu

sudo apt-get install libgtk-3-0 libqt5core5a libclutter-gtk-1.0-0 gnome-icon-theme-symbolic libebook-1.2-14 libnotify4

Note: for Debian 9 replace libebook-1.2-14 with libebook-1.2-16

Fedora

sudo yum install gtk3 qt5-qtbase clutter-gtk gnome-icon-theme-symbolic evolution-data-server libnotify

Build Instructions

If LibRing and LibRingClient are already installed on the system (eg: /usr/) in the gnome-ring project root dir:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

Building without installing LibRing and LibRingClient

This allows you to build every component separately and to run them from their location without having to install them. To do this, you must first build LibRing and then tell LibRingClient where it is located. Then, you build the LibRingClient and tell client-gnome where LibRingClient it is located. Finally, you build client-gnome.

  1. Build the daemon as explained above.

  2. Configure the build of LibRingClient by specifying the location of the (non-installed) daemon with e.g.: cd build && cmake .. -DRING_BUILD_DIR=$HOME/ring-project/daemon/src -DCMAKE_BUILD_TYPE=Debug

  3. Build LibRingClient by running "make".

  4. Configure the build of client-gnome by specifying the location of LibRingClient using the specific variable designed for it: cd build && cmake .. -DLibRingClient_PROJECT_DIR=$HOME/ring-project/lrc -DCMAKE_BUILD_TYPE=Debug

  5. Build client-gnome by running "make".

To run an install-less Ring, you must manually start the daemon and then the client, e.g.:

term1: $HOME/ring-project/daemon/bin/dring -cdp
term2: $HOME/ring-project/client-gnome/gnome-ring --debug

KDE Client for Ring

{width="30"} LibRing and LibRingClient must be installed first. If you have not already done so, go to the #How to build LibRing (or Daemon) and #How to build LibRingClient (or LRC) sections.

Getting the Source Code

git clone git://anongit.kde.org/ring-kde

Installing Build Dependencies

Debian/Ubuntu

sudo apt-get install cmake git-core qtbase5-dev extra-cmake-modules libqt5svg5-dev libkf5attica-dev libkf5attica-dev libkf5config-dev libkf5guiaddons-dev libkf5dbusaddons-dev libkf5i18n-dev  libkf5windowsystem-dev libkf5xmlgui-dev libkf5iconthemes-dev kinit-dev kio-dev libkf5completion-dev libkf5crash-dev kdelibs5-dev libkf5notifications-dev

Building Ring-KDE from Sources

cd $RING-KDE
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
make
sudo make install

If LibRing isn't installed, you can use:

`-DRING_BUILD_DIR=$RING`

Windows Client for Ring

Other Requirements

  • Mingw-w64 build environment
  • Qt5 (we link against Qt5Core, Qt5Widgets, Qt5Gui) built with Mingw
  • Qt5 Svg & Qt5 WinExtras

Getting the Source Code

git clone https://gerrit-ring.savoirfairelinux.com/ring-client-windows

Build Instructions

USE THE QMAKE OF Qt BUILT WITH MINGW (e.g. /usr/bin/i686-w64-mingw32-qmake-qt5)

Windows Client dependencies

The windows client version relies on two git submodules, to update them go to ring-client-windows folder and run:

git submodule update --init
cd winsparkle
git submodule update --init

Build Windows Client (executable)

cd ring-client-windows
cd winsparkle
mkdir -p build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=<your path to ring-lrc/>cmake/winBuild.cmake -DCMAKE_INSTALL_PREFIX=LIBRING_INSTALL_PREFIX (same as for LibRing & LibRingClient) ../cmake
make [-jX] (for X-way multi-threaded build )
make install
cd ../../libqrencode
./autogen.sh
mkdir -p build && cd build
../configure --host=i686-w64-mingw32 --prefix=<absolute path of LIBRING_INSTALL_PREFIX>
make [-jX] (for X-way multi-threaded build )
make install
cd ../.. && mkdir build && cd build
i686-w64-mingw32-qmake-qt5 ../RingWinClient.pro -r -spec win32-g++ RING=LIBRING_INSTALL_PREFIX (same as for LibRing & LibRingClient)
make [-jX] (for X-way multi-threaded build )
make install

note: an absolute path is a path starting with /, mandatory here; unlike in cmake command lines which allows relative paths.

You will find all files in ./release directory.

Debugging

Compile the client with BUILD=Debug and compile LibRingClient with -DCMAKE_BUILD_TYPE=Debug

Packaging

Nsis : Nullsoft Scriptable Install System

cd build/release
makensis ring.nsi

Mac OS X Client for Ring

Other Requirements

  • Qt5 (we link against Qt5Core, Qt5Widgets, Qt5Gui)
  • Cocoa framework and Xcode toolchains

Getting the Source Code

git clone https://gerrit-ring.savoirfairelinux.com/ring-client-macosx

Build Instructions

mkdir build && cd build
export CMAKE_PREFIX_PATH=<dir_to_qt5>
Setting up Compilation with XCode

Generate an Xcode project with CMake:

cmake ../ -DCMAKE_INSTALL_PREFIX=<libringclient_install_path> -G Xcode
open Ring.xcodeproj/

Build and run it from Xcode.

Setting up Compilation by Command Line
cmake ../ -DCMAKE_INSTALL_PREFIX=<libringclient_install_path>
make
open Ring.app/
  • The app built using 'make' contains only links to required libraries. To fully build and package as a standalone Bundle, see the Packaging section.
Debugging

For now, the build type of the client is "Debug" by default. However it is useful to also have the debug symbols of LibRingClient. To do this, specify -DCMAKE_BUILD_TYPE=Debug when compiling LibRingClient in the cmake options.

Packaging

To make a standalone Bundle we use a cmake module: BundleUtilities. All dependencies are copied inside the Bundle and links are fixed.

We can then generate a "DragNDrop" dmg file with CPack.

cmake ../ -DCMAKE_INSTALL_PREFIX=<libringclient_install_path>
make install -j
cpack -G DragNDrop Ring

iOS Client for Ring

After installing Brew and Python3 (brew install python3):

git clone https://gerrit-ring.savoirfairelinux.com/ring-project
cd ring-project
./make-ring.py --init
./make-ring.py --dependencies --distribution iOS
./make-ring.py --install --distribution iOS
cd client-ios/Ring && carthage bootstrap --platform iOS --no-use-binaries --cache-builds && cd ..
xcodebuild build -project Ring/Ring.xcodeproj/ -configuration "Release" -arch "x86_64" -destination "platform=iOS Simulator,name=iPhone $DATE,OS=11" -sdk iphonesimulator11.0 VALID_ARCHS="x86_64"

it could be useful to do this if an error occurs:
ln -s /usr/local/opt/gettext/bin/autopoint /usr/local/bin