2020-02-25 13:56:11 +00:00
## Build instructions for CMake under Ubuntu 14.04
2016-09-12 11:45:41 +00:00
2020-11-05 17:18:11 +00:00
**NB** These are outdated.
2017-09-28 09:40:26 +00:00
### Prepare folder
2016-09-12 11:45:41 +00:00
2017-10-13 17:35:29 +00:00
Choose an empty folder for the future build, for example ** /home/user/TBuild**. It will be named ** *BuildPath*** in the rest of this document.
2016-09-12 11:45:41 +00:00
2018-11-04 10:29:30 +00:00
### Obtain your API credentials
You will require **api_id** and **api_hash** to access the Telegram API servers. To learn how to obtain them [click here][api_credentials].
2017-09-28 09:40:26 +00:00
### Install software and required packages
2016-09-12 11:45:41 +00:00
2019-11-22 10:16:43 +00:00
You will need GCC 8 installed. To install them and all the required dependencies run
2016-09-12 11:45:41 +00:00
2019-05-15 11:00:41 +00:00
sudo apt-get install software-properties-common -y & & \
2019-11-22 10:16:43 +00:00
sudo apt-get install git libexif-dev liblzma-dev libz-dev libssl-dev \
2020-01-31 06:34:37 +00:00
libgtk2.0-dev libice-dev libsm-dev libicu-dev libdrm-dev dh-autoreconf \
2020-02-11 15:10:07 +00:00
autoconf automake build-essential libxml2-dev libass-dev libfreetype6-dev \
2019-11-22 10:16:43 +00:00
libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \
2020-08-20 19:19:53 +00:00
libvorbis-dev libxcb1-dev libxcb-image0-dev libxcb-shm0-dev \
libxcb-screensaver0-dev ninja-build libegl1-mesa-dev \
2019-12-02 15:52:30 +00:00
libxcb-xfixes0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libatspi2.0-dev \
2019-11-22 10:16:43 +00:00
libxcb-render-util0-dev libxcb-util0-dev libxcb-xkb-dev libxrender-dev \
2020-08-20 19:19:53 +00:00
libasound-dev libpulse-dev libxcb-sync0-dev libxcb-randr0-dev \
2020-02-11 15:10:07 +00:00
libx11-xcb-dev libffi-dev libncurses5-dev pkg-config texi2html bison yasm \
2019-11-22 10:16:43 +00:00
zlib1g-dev xutils-dev python-xcbgen chrpath gperf -y --force-yes & & \
2019-05-15 11:00:41 +00:00
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y & & \
sudo apt-get update & & \
2019-09-26 09:23:57 +00:00
sudo apt-get install gcc-8 g++-8 -y & & \
2019-05-15 11:19:26 +00:00
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 & & \
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 60 & & \
2019-05-15 11:00:41 +00:00
sudo update-alternatives --config gcc & & \
2019-11-22 10:16:43 +00:00
sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
You can set the multithreaded make parameter by running
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
MAKE_THREADS_CNT=-j8
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
### Clone source code and prepare libraries
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
Go to ** *BuildPath*** and run
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
mkdir Libraries
cd Libraries
2016-09-12 11:45:41 +00:00
2019-09-26 09:23:57 +00:00
git clone https://github.com/Kitware/CMake cmake
cd cmake
2019-12-31 12:08:56 +00:00
git checkout v3.16.0
2019-09-26 09:23:57 +00:00
./bootstrap
make $MAKE_THREADS_CNT
sudo make install
2019-11-22 10:16:43 +00:00
cd ..
2019-09-26 09:23:57 +00:00
2019-10-02 11:43:54 +00:00
git clone https://github.com/desktop-app/patches.git
2019-11-05 08:33:13 +00:00
cd patches
2020-08-18 14:16:00 +00:00
git checkout ddd4084
2019-11-05 08:33:13 +00:00
cd ../
2017-11-19 14:37:07 +00:00
2020-10-07 02:21:20 +00:00
git clone -b v4.0.1-rc2 https://github.com/mozilla/mozjpeg.git
cd mozjpeg
cmake -B build . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DWITH_JPEG8=ON \
-DPNG_SUPPORTED=OFF
cmake --build build $MAKE_THREADS_CNT
sudo cmake --install build
cd ..
2017-05-04 11:15:21 +00:00
git clone https://github.com/xiph/opus
cd opus
2018-11-29 12:33:01 +00:00
git checkout v1.3
2017-05-04 11:15:21 +00:00
./autogen.sh
2016-09-12 11:45:41 +00:00
./configure
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
sudo make install
2017-09-28 09:40:26 +00:00
cd ..
2016-09-12 11:45:41 +00:00
2020-10-20 05:26:17 +00:00
git clone https://github.com/intel/libva.git
2016-09-12 11:45:41 +00:00
cd libva
2020-05-18 14:24:20 +00:00
CFLAGS=-fPIC CPPFLAGS=-fPIC LDFLAGS=-fPIC ./autogen.sh --enable-static
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
sudo make install
cd ..
2020-02-18 13:25:37 +00:00
git clone https://gitlab.freedesktop.org/vdpau/libvdpau.git --depth=1 -b libvdpau-1.2
2017-01-05 13:46:36 +00:00
cd libvdpau
2020-05-18 14:24:20 +00:00
CFLAGS=-fPIC CPPFLAGS=-fPIC LDFLAGS=-fPIC ./autogen.sh --enable-static
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2017-01-05 13:46:36 +00:00
sudo make install
cd ..
2016-09-12 11:45:41 +00:00
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
2017-11-23 15:00:11 +00:00
git checkout release/3.4
2016-09-12 11:45:41 +00:00
2020-04-12 03:29:24 +00:00
./configure \
2020-05-18 14:24:20 +00:00
--extra-cflags="-fPIC" \
--extra-cxxflags="-fPIC" \
--extra-ldflags="-fPIC" \
2019-03-06 10:00:35 +00:00
--disable-programs \
--disable-doc \
--disable-network \
2020-04-12 03:29:24 +00:00
--disable-autodetect \
2019-03-06 10:00:35 +00:00
--disable-everything \
2020-05-25 02:42:14 +00:00
--disable-alsa \
2020-04-12 03:29:24 +00:00
--disable-iconv \
--enable-libopus \
--enable-vaapi \
--enable-vdpau \
--enable-protocol=file \
2019-03-06 10:00:35 +00:00
--enable-hwaccel=h264_vaapi \
--enable-hwaccel=h264_vdpau \
--enable-hwaccel=mpeg4_vaapi \
--enable-hwaccel=mpeg4_vdpau \
--enable-decoder=aac \
--enable-decoder=aac_fixed \
--enable-decoder=aac_latm \
--enable-decoder=aasc \
--enable-decoder=alac \
--enable-decoder=flac \
--enable-decoder=gif \
--enable-decoder=h264 \
--enable-decoder=h264_vdpau \
--enable-decoder=hevc \
--enable-decoder=mp1 \
--enable-decoder=mp1float \
--enable-decoder=mp2 \
--enable-decoder=mp2float \
--enable-decoder=mp3 \
--enable-decoder=mp3adu \
--enable-decoder=mp3adufloat \
--enable-decoder=mp3float \
--enable-decoder=mp3on4 \
--enable-decoder=mp3on4float \
--enable-decoder=mpeg4 \
--enable-decoder=mpeg4_vdpau \
--enable-decoder=msmpeg4v2 \
--enable-decoder=msmpeg4v3 \
--enable-decoder=opus \
--enable-decoder=pcm_alaw \
--enable-decoder=pcm_f32be \
--enable-decoder=pcm_f32le \
--enable-decoder=pcm_f64be \
--enable-decoder=pcm_f64le \
--enable-decoder=pcm_lxf \
--enable-decoder=pcm_mulaw \
--enable-decoder=pcm_s16be \
--enable-decoder=pcm_s16be_planar \
--enable-decoder=pcm_s16le \
--enable-decoder=pcm_s16le_planar \
--enable-decoder=pcm_s24be \
--enable-decoder=pcm_s24daud \
--enable-decoder=pcm_s24le \
--enable-decoder=pcm_s24le_planar \
--enable-decoder=pcm_s32be \
--enable-decoder=pcm_s32le \
--enable-decoder=pcm_s32le_planar \
--enable-decoder=pcm_s64be \
--enable-decoder=pcm_s64le \
--enable-decoder=pcm_s8 \
--enable-decoder=pcm_s8_planar \
--enable-decoder=pcm_u16be \
--enable-decoder=pcm_u16le \
--enable-decoder=pcm_u24be \
--enable-decoder=pcm_u24le \
--enable-decoder=pcm_u32be \
--enable-decoder=pcm_u32le \
--enable-decoder=pcm_u8 \
--enable-decoder=pcm_zork \
--enable-decoder=vorbis \
--enable-decoder=wavpack \
--enable-decoder=wmalossless \
--enable-decoder=wmapro \
--enable-decoder=wmav1 \
--enable-decoder=wmav2 \
--enable-decoder=wmavoice \
--enable-encoder=libopus \
--enable-parser=aac \
--enable-parser=aac_latm \
--enable-parser=flac \
--enable-parser=h264 \
--enable-parser=hevc \
--enable-parser=mpeg4video \
--enable-parser=mpegaudio \
--enable-parser=opus \
--enable-parser=vorbis \
--enable-demuxer=aac \
--enable-demuxer=flac \
--enable-demuxer=gif \
--enable-demuxer=h264 \
--enable-demuxer=hevc \
--enable-demuxer=m4v \
--enable-demuxer=mov \
--enable-demuxer=mp3 \
--enable-demuxer=ogg \
--enable-demuxer=wav \
--enable-muxer=ogg \
--enable-muxer=opus
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
sudo make install
2017-09-28 09:40:26 +00:00
cd ..
2016-09-12 11:45:41 +00:00
git clone git://repo.or.cz/openal-soft.git
2018-04-18 18:10:21 +00:00
cd openal-soft
2020-06-08 08:23:27 +00:00
git checkout openal-soft-1.19.1
2018-04-18 18:10:21 +00:00
cd build
2020-04-12 03:29:24 +00:00
cmake .. \
-DLIBTYPE:STRING=STATIC \
-DALSOFT_EXAMPLES=OFF \
-DALSOFT_TESTS=OFF \
-DALSOFT_UTILS=OFF \
-DALSOFT_CONFIG=OFF
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
sudo make install
2017-09-28 09:40:26 +00:00
cd ../..
2016-09-12 11:45:41 +00:00
2019-10-11 06:32:26 +00:00
git clone https://github.com/openssl/openssl openssl_1_1_1
cd openssl_1_1_1
git checkout OpenSSL_1_1_1-stable
2020-07-12 19:35:19 +00:00
./config --prefix=/usr/local/desktop-app/openssl-1.1.1 no-tests
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2020-02-25 13:56:11 +00:00
sudo make install_sw
2017-09-28 09:40:26 +00:00
cd ..
2016-09-12 11:45:41 +00:00
2020-06-05 19:38:18 +00:00
git clone -b 1.18.0 https://gitlab.freedesktop.org/wayland/wayland
2020-05-25 02:40:47 +00:00
cd wayland
./autogen.sh \
--enable-static \
--disable-documentation \
--disable-dtd-validation
2020-10-07 02:21:20 +00:00
make $MAKE_THREADS_CNT
2020-05-25 02:40:47 +00:00
sudo make install
cd ..
2016-09-12 11:45:41 +00:00
git clone https://github.com/xkbcommon/libxkbcommon.git
cd libxkbcommon
2019-08-19 12:23:37 +00:00
git checkout xkbcommon-0.8.4
2020-05-25 02:40:47 +00:00
./autogen.sh \
--disable-docs \
--disable-wayland \
--with-xkb-config-root=/usr/share/X11/xkb \
--with-x-locale-root=/usr/share/X11/locale
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
sudo make install
2017-09-28 09:40:26 +00:00
cd ..
2016-09-12 11:45:41 +00:00
2020-03-01 11:38:25 +00:00
git clone git://code.qt.io/qt/qt5.git qt_5_12_8
cd qt_5_12_8
2020-08-01 13:09:56 +00:00
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
2020-03-01 11:38:25 +00:00
git checkout v5.12.8
2020-08-01 13:09:56 +00:00
git submodule update qtbase qtwayland qtimageformats qtsvg
2019-10-11 06:32:26 +00:00
cd qtbase
2020-06-02 10:14:51 +00:00
find ../../patches/qtbase_5_12_8 -type f -print0 | sort -z | xargs -r0 git apply
2020-05-31 05:48:04 +00:00
cd ..
cd qtwayland
2020-06-02 10:14:51 +00:00
find ../../patches/qtwayland_5_12_8 -type f -print0 | sort -z | xargs -r0 git apply
2020-05-02 02:32:40 +00:00
cd ..
2017-09-06 09:12:27 +00:00
2019-11-22 10:16:43 +00:00
OPENSSL_DIR=/usr/local/desktop-app/openssl-1.1.1
2020-03-01 11:38:25 +00:00
./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \
2020-10-30 10:17:02 +00:00
-release \
-force-debug-info \
-opensource \
-confirm-license \
-qt-zlib \
-qt-libpng \
-qt-harfbuzz \
-qt-pcre \
-qt-xcb \
-no-gtk \
-no-icu \
-static \
-dbus-runtime \
-openssl-linked \
-I "$OPENSSL_DIR/include" \
OPENSSL_LIBS="$OPENSSL_DIR/lib/libssl.a $OPENSSL_DIR/lib/libcrypto.a -ldl -lpthread" \
2020-10-30 18:30:55 +00:00
-I "/usr/local/include" \
LIBJPEG_LIBS="/usr/local/lib/libjpeg.a" \
2020-10-30 10:17:02 +00:00
-nomake examples \
-nomake tests
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
sudo make install
cd ..
2016-09-12 11:45:41 +00:00
2020-08-20 12:45:54 +00:00
git clone https://github.com/desktop-app/tg_owt.git
cd tg_owt
mkdir out
cd out
mkdir Debug
cd Debug
2020-08-20 19:19:53 +00:00
cmake -G Ninja \
2020-10-30 10:17:02 +00:00
-DCMAKE_BUILD_TYPE=Debug \
-DTG_OWT_SPECIAL_TARGET=linux \
-DTG_OWT_LIBJPEG_INCLUDE_PATH=/usr/local/include \
-DTG_OWT_OPENSSL_INCLUDE_PATH=/usr/local/desktop-app/openssl-1.1.1/include \
-DTG_OWT_OPUS_INCLUDE_PATH=/usr/local/include/opus \
-DTG_OWT_FFMPEG_INCLUDE_PATH=/usr/local/include ../..
2020-08-20 12:45:54 +00:00
ninja
cd ..
mkdir Release
cd Release
2020-08-20 19:19:53 +00:00
cmake -G Ninja \
2020-10-30 10:17:02 +00:00
-DCMAKE_BUILD_TYPE=Release \
-DTG_OWT_SPECIAL_TARGET=linux \
-DTG_OWT_LIBJPEG_INCLUDE_PATH=`pwd`/../../../qt_5_12_8/qtbase/src/3rdparty/libjpeg \
-DTG_OWT_OPENSSL_INCLUDE_PATH=/usr/local/desktop-app/openssl-1.1.1/include \
-DTG_OWT_OPUS_INCLUDE_PATH=/usr/local/include/opus \
-DTG_OWT_FFMPEG_INCLUDE_PATH=/usr/local/include ../..
2020-08-20 12:45:54 +00:00
ninja
2020-08-20 19:19:53 +00:00
cd ../../..
2020-08-11 10:26:48 +00:00
2016-09-12 11:45:41 +00:00
git clone https://chromium.googlesource.com/external/gyp
cd gyp
2019-10-02 11:43:54 +00:00
git checkout 9f2a7bb1
git apply ../patches/gyp.diff
2017-09-28 09:40:26 +00:00
cd ..
git clone https://chromium.googlesource.com/breakpad/breakpad
cd breakpad
2018-03-08 22:55:18 +00:00
git checkout bc8fb886
git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss
cd src/third_party/lss
git checkout a91633d1
cd ../../..
2016-09-12 11:45:41 +00:00
./configure
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
sudo make install
2019-11-05 23:22:05 +00:00
cd src
rm -r testing
git clone https://github.com/google/googletest testing
cd tools
sed -i 's/minidump_upload.m/minidump_upload.cc/' linux/tools_linux.gypi
2017-09-28 09:40:26 +00:00
../../../gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out tools.gyp --format=cmake
cd ../../out/Default
cmake .
make $MAKE_THREADS_CNT dump_syms
cd ../../..
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
### Building the project
2016-09-12 11:45:41 +00:00
2018-11-04 10:29:30 +00:00
Go to ** *BuildPath*/tdesktop/Telegram** and run (using [your **api_id** and **api_hash** ](#obtain-your-api-credentials ))
2016-09-12 11:45:41 +00:00
2020-08-10 14:10:42 +00:00
./configure.sh -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH -D DESKTOP_APP_USE_PACKAGED=OFF -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
To make Debug version go to ** *BuildPath*/tdesktop/out/Debug** and run
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
To make Release version go to ** *BuildPath*/tdesktop/out/Release** and run
2016-09-12 11:45:41 +00:00
2017-09-28 09:40:26 +00:00
make $MAKE_THREADS_CNT
2016-09-12 11:45:41 +00:00
2019-12-31 12:08:56 +00:00
You can debug your builds from Qt Creator, just open ** *BuildPath*/tdesktop/CMakeLists.txt**, configure to a separate directory with correct options and launch with debug.
2016-09-12 11:45:41 +00:00
2018-11-04 10:29:30 +00:00
[api_credentials]: api_credentials.md