diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 000000000..ae0bd47ca --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,501 @@ +name: Linux. + +on: + push: + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +jobs: + + linux: + name: Ubuntu 14.04 + runs-on: ubuntu-latest + container: ubuntu:trusty + + strategy: + matrix: + defines: + - "" + + env: + GIT: "https://github.com" + QT: "5_12_5" + QT_PREFIX: "/usr/local/desktop-app/Qt-5.12.5" + OPENSSL_VER: "1_1_1" + OPENSSL_PREFIX: "/usr/local/desktop-app/openssl-1.1.1" + CMAKE_VER: "3.16.3" + UPLOAD_ARTIFACT: "false" + ONLY_CACHE: "false" + MANUAL_CACHING: "1" + DOC_PATH: "docs/building-cmake.md" + + steps: + - name: Get repository name. + run: echo ::set-env name=REPO_NAME::${GITHUB_REPOSITORY##*/} + + - name: Clone. + uses: actions/checkout@v1 + with: + submodules: recursive + + - name: First set up. + run: | + cd .. + mv $REPO_NAME temp + mkdir $REPO_NAME + mv temp $REPO_NAME/$REPO_NAME + cd $REPO_NAME + + sudo apt-get update + sudo apt-get install software-properties-common -y && \ + sudo apt-get install git libexif-dev liblzma-dev libz-dev libssl-dev \ + libappindicator-dev libicu-dev libdee-dev libdrm-dev dh-autoreconf \ + autoconf automake build-essential libass-dev libfreetype6-dev \ + libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \ + libvorbis-dev libenchant-dev libxcb1-dev libxcb-image0-dev libxcb-shm0-dev \ + libxcb-xfixes0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libatspi2.0-dev \ + libxcb-render-util0-dev libxcb-util0-dev libxcb-xkb-dev libxrender-dev \ + libasound-dev libpulse-dev libxcb-sync0-dev libxcb-randr0-dev bison \ + libx11-xcb-dev libffi-dev libncurses5-dev pkg-config texi2html yasm \ + zlib1g-dev xutils-dev python-xcbgen chrpath gperf wget -y --force-yes && \ + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ + sudo apt-get update && \ + sudo apt-get install gcc-8 g++-8 -y && \ + 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 && \ + sudo update-alternatives --config gcc && \ + sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y + + gcc --version + + gcc --version > CACHE_KEY.txt + echo $MANUAL_CACHING >> CACHE_KEY.txt + md5cache=$(md5sum CACHE_KEY.txt | cut -c -32) + echo ::set-env name=CACHE_KEY::$md5cache + + mkdir -p Libraries + cd Libraries + echo ::set-env name=LibrariesPath::`pwd` + + - name: Range-v3. + run: | + echo "Find necessary branch from doc." + cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p) + cd $LibrariesPath + echo $cloneRange + eval $cloneRange + + - name: Patches. + run: | + echo "Find necessary commit from doc." + checkoutCommit=$(grep -A 1 "cd patches" $REPO_NAME/$DOC_PATH | sed -n 2p) + cd $LibrariesPath + git clone $GIT/desktop-app/patches.git + cd patches + eval $checkoutCommit + + - name: CMake. + run: | + cd $LibrariesPath + + file=cmake-$CMAKE_VER-Linux-x86_64.sh + wget $GIT/Kitware/CMake/releases/download/v$CMAKE_VER/$file + sudo mkdir /opt/cmake + sudo sh $file --prefix=/opt/cmake --skip-license + sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake + + cmake --version + + - name: Zlib. + run: | + cd $LibrariesPath + + git clone $GIT/madler/zlib.git + cd zlib + ./configure + make -j$(nproc) + sudo make install + + - name: Opus cache. + id: cache-opus + uses: actions/cache@v1 + with: + path: ${{ env.LibrariesPath }}/opus + key: ${{ runner.OS }}-opus-${{ env.CACHE_KEY }} + - name: Opus. + if: steps.cache-opus.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + git clone $GIT/xiph/opus + cd opus + git checkout v1.3 + ./autogen.sh + ./configure + make -j$(nproc) + - name: Opus install. + run: | + cd $LibrariesPath/opus + sudo make install + + - name: Libva. + run: | + cd $LibrariesPath + + git clone $GIT/01org/libva.git + cd libva + ./autogen.sh --enable-static + make -j$(nproc) + sudo make install + + - name: Libvdpau. + run: | + cd $LibrariesPath + + git clone git://anongit.freedesktop.org/vdpau/libvdpau + cd libvdpau + git checkout libvdpau-1.2 + ./autogen.sh --enable-static + make -j$(nproc) + sudo make install + + - name: FFmpeg cache. + id: cache-ffmpeg + uses: actions/cache@v1 + with: + path: ${{ env.LibrariesPath }}/ffmpeg-cache + key: ${{ runner.OS }}-ffmpeg-${{ env.CACHE_KEY }} + - name: FFmpeg build. + if: steps.cache-ffmpeg.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + git clone --branch release/3.4 $GIT/FFmpeg/FFmpeg ffmpeg + cd ffmpeg + ./configure --prefix=$LibrariesPath/ffmpeg-cache \ + --enable-protocol=file --enable-libopus \ + --disable-programs \ + --disable-doc \ + --disable-network \ + --disable-everything \ + --enable-hwaccel=h264_vaapi \ + --enable-hwaccel=h264_vdpau \ + --enable-hwaccel=mpeg4_vaapi \ + --enable-hwaccel=mpeg4_vdpau \ + --enable-decoder=aac \ + --enable-decoder=aac_at \ + --enable-decoder=aac_fixed \ + --enable-decoder=aac_latm \ + --enable-decoder=aasc \ + --enable-decoder=alac \ + --enable-decoder=alac_at \ + --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_alaw_at \ + --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_mulaw_at \ + --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 + + make -j$(nproc) + sudo make install + - name: FFmpeg install. + run: | + cd $LibrariesPath + #List of files from cmake/external/ffmpeg/CMakeLists.txt. + copyLib() { + mkdir -p ffmpeg/$1 + yes | cp -i ffmpeg-cache/lib/$1.a ffmpeg/$1/$1.a + } + copyLib libavformat + copyLib libavcodec + copyLib libswresample + copyLib libswscale + copyLib libavutil + + sudo cp -R ffmpeg-cache/. /usr/local/ + + - name: PortAudio. + run: | + cd $LibrariesPath + + git clone https://git.assembla.com/portaudio.git + cd portaudio + git checkout 396fe4b669 + ./configure + make -j$(nproc) + sudo make install + + - name: OpenAL Soft. + run: | + cd $LibrariesPath + + git clone $GIT/kcat/openal-soft.git + cd openal-soft + git checkout openal-soft-1.19.1 + cd build + cmake -D LIBTYPE:STRING=STATIC .. + make -j$(nproc) + sudo make install + + - name: OpenSSL cache. + id: cache-openssl + uses: actions/cache@v1 + with: + path: ${{ env.LibrariesPath }}/openssl-cache + key: ${{ runner.OS }}-${{ env.OPENSSL_VER }}-${{ env.CACHE_KEY }} + - name: OpenSSL build. + if: steps.cache-openssl.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + git clone $GIT/openssl/openssl openssl_$OPENSSL_VER + cd openssl_$OPENSSL_VER + git checkout OpenSSL_1_1_1-stable + ./config --prefix=$LibrariesPath/openssl-cache + make -j$(nproc) + sudo make install + - name: OpenSSL install. + run: | + cd $LibrariesPath + sudo mkdir -p $OPENSSL_PREFIX + sudo cp -R openssl-cache/. $OPENSSL_PREFIX/ + + - name: Libxkbcommon. + run: | + cd $LibrariesPath + + git clone $GIT/xkbcommon/libxkbcommon.git + cd libxkbcommon + git checkout xkbcommon-0.8.4 + ./autogen.sh + make -j$(nproc) + sudo make install + + - name: Qt 5.12.5 cache. + id: cache-qt + uses: actions/cache@v1 + with: + path: ${{ env.LibrariesPath }}/qt-cache + key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_5.diff') }} + - name: Qt 5.12.5 build. + if: steps.cache-qt.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + git clone git://code.qt.io/qt/qt5.git qt_$QT + cd qt_$QT + perl init-repository --module-subset=qtbase,qtimageformats + git checkout v5.12.5 + git submodule update qtbase + git submodule update qtimageformats + cd qtbase + git apply ../../patches/qtbase_$QT.diff + cd src/plugins/platforminputcontexts + git clone $GIT/desktop-app/fcitx.git + git clone $GIT/desktop-app/hime.git + git clone $GIT/desktop-app/nimf.git + cd ../../../.. + + ./configure -prefix "$LibrariesPath/qt-cache" \ + -release \ + -force-debug-info \ + -opensource \ + -confirm-license \ + -qt-zlib \ + -qt-libpng \ + -qt-libjpeg \ + -qt-harfbuzz \ + -qt-pcre \ + -qt-xcb \ + -system-freetype \ + -fontconfig \ + -no-opengl \ + -no-gtk \ + -static \ + -openssl-linked \ + -I "$OPENSSL_PREFIX/include" OPENSSL_LIBS="$OPENSSL_PREFIX/lib/libssl.a $OPENSSL_PREFIX/lib/libcrypto.a -ldl -lpthread" \ + -nomake examples \ + -nomake tests + + make -j$(nproc) + sudo make install + - name: Qt 5.12.5 install. + run: | + cd $LibrariesPath + sudo mkdir -p $QT_PREFIX + sudo cp -R qt-cache/. $QT_PREFIX/ + + - name: Breakpad cache. + id: cache-breakpad + uses: actions/cache@v1 + with: + path: ${{ env.LibrariesPath }}/breakpad-cache + key: ${{ runner.OS }}-breakpad-${{ env.CACHE_KEY }} + - name: Breakpad clone. + run: | + cd $LibrariesPath + + git clone https://chromium.googlesource.com/breakpad/breakpad + cd breakpad + git checkout bc8fb886 + git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss + cd src/third_party/lss + git checkout a91633d1 + - name: Breakpad build. + if: steps.cache-breakpad.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + BreakpadCache=$LibrariesPath/breakpad-cache + + git clone https://chromium.googlesource.com/external/gyp + cd gyp + git checkout 9f2a7bb1 + git apply ../patches/gyp.diff + cd .. + + cd breakpad + ./configure --prefix=$BreakpadCache + make -j$(nproc) + sudo make install + cd src + rm -r testing + git clone $GIT/google/googletest testing + cd tools + sed -i 's/minidump_upload.m/minidump_upload.cc/' linux/tools_linux.gypi + ../../../gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out tools.gyp --format=cmake + cd ../../out/Default + cmake . + make -j$(nproc) dump_syms + + mv dump_syms $BreakpadCache/ + - name: Breakpad install. + run: | + cd $LibrariesPath + sudo cp -R breakpad-cache/. /usr/local/ + mkdir -p breakpad/out/Default/ + cp breakpad-cache/dump_syms breakpad/out/Default/dump_syms + + - name: Telegram Desktop build. + if: env.ONLY_CACHE == 'false' + run: | + cd $REPO_NAME/Telegram + + DEFINE="" + if [ -n "${{ matrix.defines }}" ]; then + DEFINE="-D ${{ matrix.defines }}=ON" + echo Define from matrix: $DEFINE + fi + + ./configure.sh -D TDESKTOP_API_TEST=ON -D DESKTOP_APP_USE_PACKAGED=OFF $DEFINE + + cd ../out/Debug + make -j$(nproc) + strip -s bin/Telegram + + - name: Check. + if: env.ONLY_CACHE == 'false' + run: | + filePath="$REPO_NAME/out/Debug/bin/Telegram" + if test -f "$filePath"; then + echo "Build successfully done! :)" + + size=$(stat -c %s "$filePath") + echo "File size of ${filePath}: ${size} Bytes." + else + echo "Build error, output file does not exist." + exit 1 + fi + + - name: Move artifact. + if: env.UPLOAD_ARTIFACT == 'true' + run: | + cd $REPO_NAME/out/Debug/bin + mkdir artifact + mv Telegram artifact/ + - uses: actions/upload-artifact@master + if: env.UPLOAD_ARTIFACT == 'true' + name: Upload artifact. + with: + name: Telegram + path: ${{ env.REPO_NAME }}/out/Debug/bin/artifact/ diff --git a/README.md b/README.md index 1edca7cdd..35d7aa0a3 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This is the complete source code and the build instructions for the alpha versio [![Version](https://badge.fury.io/gh/telegramdesktop%2Ftdesktop.svg)](https://github.com/telegramdesktop/tdesktop/releases) [![Build Status](https://github.com/telegramdesktop/tdesktop/workflows/Windows./badge.svg)](https://github.com/telegramdesktop/tdesktop/actions) [![Build Status](https://github.com/telegramdesktop/tdesktop/workflows/MacOS./badge.svg)](https://github.com/telegramdesktop/tdesktop/actions) +[![Build Status](https://github.com/telegramdesktop/tdesktop/workflows/Linux./badge.svg)](https://github.com/telegramdesktop/tdesktop/actions) [![Build Status](https://travis-ci.org/telegramdesktop/tdesktop.svg?branch=dev)](https://travis-ci.org/telegramdesktop/tdesktop) [![Preview of Telegram Desktop][preview_image]][preview_image_url]