Merge branch 'master' into dev

This commit is contained in:
John Preston 2016-07-19 14:42:10 +03:00
commit 5369e08a6e
8 changed files with 357 additions and 472 deletions

View file

@ -1,11 +1,16 @@
sudo: required
dist: trusty
language: cpp
cache:
directories:
- $HOME/travisCacheDir
env:
global:
# GitHub auth token (GH_AUTH_TOKEN)
- secure: "QBbD9VXAx3Mn0vFmHZtm6/sq+twMyR7ilQh7TQm8gBy2TrjhHKDKQ4wRQ5sa2MUFUbzrUOvPlPGq1WuY1mAUt8UE6jZDJNyyDWb6iIlcEmNRsd39XAhYHvJ+uI9JsD+U3OctZ+7Bo4fno0RLv1D5lzh5bpohmjgWxx9TiSZItbsRU+m0XM0Tahx335aXF8NFoVjheGXCOcLAXDt6OmaKPmlrXreuta5nOoRKeOg5vHlt/KNU1pYb8MFvWJc14DKxq3jNqrYlo9vHFv5tVhR1aqvVFWTD/4Z88OSxx3POzyVWdMso0lFov9uxs8qHoqLsGhDMElggyz/jnqZIHpwQMaYIGQ0LLYDv21jGgOuCOWKYlfjDY+tuESXmVPzerTlYBWLZDPrpE8BnXVYo8B/sF4WN6oCuBRjawlqYhqTH+tDDORc9Uc9pamhcuh6OsLMx3PHoyg8joN3t8yUnwhySXyfQ36hqlZ+Y4bBDRZBH/SB/EPmedyLGwdhzQFsUnOBotYeOym7LUdnGraGcj1iTPLdo5TMlBYlAiB12J5mHTNuzUKXh+PBV4REg4Mm2xYX+Pue5Qo1JcOWJteIX4BdPv526DXB3yaNWS1pZgGvYqtBwQlCeOfwOYupS0PksvmV7aX7c4qJSyW3dmEd03cxmebD0b2SbqyPxGFuUajJ7B60="
# GitHub auth token (GH_AUTH_TOKEN)
- secure: "QBbD9VXAx3Mn0vFmHZtm6/sq+twMyR7ilQh7TQm8gBy2TrjhHKDKQ4wRQ5sa2MUFUbzrUOvPlPGq1WuY1mAUt8UE6jZDJNyyDWb6iIlcEmNRsd39XAhYHvJ+uI9JsD+U3OctZ+7Bo4fno0RLv1D5lzh5bpohmjgWxx9TiSZItbsRU+m0XM0Tahx335aXF8NFoVjheGXCOcLAXDt6OmaKPmlrXreuta5nOoRKeOg5vHlt/KNU1pYb8MFvWJc14DKxq3jNqrYlo9vHFv5tVhR1aqvVFWTD/4Z88OSxx3POzyVWdMso0lFov9uxs8qHoqLsGhDMElggyz/jnqZIHpwQMaYIGQ0LLYDv21jGgOuCOWKYlfjDY+tuESXmVPzerTlYBWLZDPrpE8BnXVYo8B/sF4WN6oCuBRjawlqYhqTH+tDDORc9Uc9pamhcuh6OsLMx3PHoyg8joN3t8yUnwhySXyfQ36hqlZ+Y4bBDRZBH/SB/EPmedyLGwdhzQFsUnOBotYeOym7LUdnGraGcj1iTPLdo5TMlBYlAiB12J5mHTNuzUKXh+PBV4REg4Mm2xYX+Pue5Qo1JcOWJteIX4BdPv526DXB3yaNWS1pZgGvYqtBwQlCeOfwOYupS0PksvmV7aX7c4qJSyW3dmEd03cxmebD0b2SbqyPxGFuUajJ7B60="
matrix:
- BUILD_VERSION=""
- BUILD_VERSION="disable_autoupdate"
@ -18,42 +23,48 @@ env:
matrix:
fast_finish: true
arch:
repos:
- home_ItachiSan_archlinux_Arch_Extra=http://download.opensuse.org/repositories/home:/ItachiSan:/archlinux/Arch_Extra/$arch
packages:
- bzr
- wget
- qt5-base
- git
- patch
- home_ItachiSan_archlinux_Arch_Extra/dee # Use fixed dee version (See #2005)
- libunity
- libappindicator-gtk2
- ffmpeg
- icu
- jasper
- libexif
- libmng
- libwebp
- libxkbcommon-x11
- libinput
- libproxy
- mtdev
- openal
- libva
- desktop-file-utils
- gtk-update-icon-cache
script:
- libtool --finish /usr/lib
- .travis/build.sh
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- bison
- build-essential
- cmake
- devscripts
- dpatch
- equivs
- fakeroot
- g++-4.9
- gcc-4.9
- git
- gnome-common
- gobject-introspection
- gtk-doc-tools
- libappindicator-dev
- libasound2-dev
- libdbusmenu-glib-dev
- liblzma-dev
- libopus-dev
- libpulse-dev
- libssl-dev
- libunity-dev
- libva-dev
- libxcb-xkb-dev
- libxkbcommon-dev
- lintian
- quilt
- valac
- xutils-dev
- yasm
before_install:
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- .travis/check.sh
- export CXX="g++-4.9" CC="gcc-4.9"
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
- sudo update-alternatives --config gcc
- g++ --version
script:
- .travis/arch.sh
- .travis/build.sh

View file

@ -1,312 +0,0 @@
#!/bin/bash
# Copyright (C) 2016 Mikkel Oscar Lyderik Larsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Source: https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh
# Script for setting up and running a travis-ci build in an up to date
# Arch Linux chroot
ARCH_TRAVIS_MIRROR=${ARCH_TRAVIS_MIRROR:-"https://lug.mtu.edu/archlinux"}
ARCH_TRAVIS_ARCH_ISO=${ARCH_TRAVIS_ARCH_ISO:-"$(date +%Y.%m).01"}
ARCH_TRAVIS_ARCH=${ARCH_TRAVIS_ARCH:-"x86_64"}
mirror_entry='Server = '$ARCH_TRAVIS_MIRROR'/\$repo/os/\$arch'
archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-${ARCH_TRAVIS_ARCH}.tar.gz"
default_root="root.${ARCH_TRAVIS_ARCH}"
ARCH_TRAVIS_CHROOT=${ARCH_TRAVIS_CHROOT:-"$default_root"}
user="travis"
user_home="/home/$user"
user_build_dir=$(pwd)
uid=$UID
gid=$GID
if [ -n "$CC" ]; then
# store travis CC
TRAVIS_CC=$CC
# reset to gcc for building arch packages
CC=gcc
fi
# default packages
default_packages=("base-devel" "git")
# pacman.conf repository line
repo_line=70
# setup working Arch Linux chroot
setup_chroot() {
arch_msg "Setting up Arch chroot"
if [ ! -f $archive ]; then
# get root fs
curl --fail -O "$ARCH_TRAVIS_MIRROR/iso/$ARCH_TRAVIS_ARCH_ISO/$archive" 2>&1
local ret=$?
# if it fails, try arch iso form the previous month
if [ $ret -gt 0 ]; then
ARCH_TRAVIS_ARCH_ISO="$(date +%Y.%m -d "-1 month").01"
archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-${ARCH_TRAVIS_ARCH}.tar.gz"
as_normal "curl -O $ARCH_TRAVIS_MIRROR/iso/$ARCH_TRAVIS_ARCH_ISO/$archive"
fi
fi
# extract root fs
as_root "tar xf $archive"
# remove archive if ARCH_TRAVIS_CLEAN_CHROOT is set
if [ -n "$ARCH_TRAVIS_CLEAN_CHROOT" ]; then
as_root "rm $archive"
fi
if [ "$ARCH_TRAVIS_CHROOT" != "$default_root" ]; then
as_root "mv $default_root $ARCH_TRAVIS_CHROOT"
fi
# don't care for signed packages
as_root "sed -i 's|SigLevel = Required DatabaseOptional|SigLevel = Never|' $ARCH_TRAVIS_CHROOT/etc/pacman.conf"
# enable multilib
as_root "sed -i 's|#\[multilib\]|\[multilib\]\nInclude = /etc/pacman.d/mirrorlist|' $ARCH_TRAVIS_CHROOT/etc/pacman.conf"
# add mirror
as_root "echo $mirror_entry >> $ARCH_TRAVIS_CHROOT/etc/pacman.d/mirrorlist"
# add nameserver to resolv.conf
as_root "echo nameserver 8.8.8.8 >> $ARCH_TRAVIS_CHROOT/etc/resolv.conf"
sudo mount $ARCH_TRAVIS_CHROOT $ARCH_TRAVIS_CHROOT --bind
sudo mount --bind /proc $ARCH_TRAVIS_CHROOT/proc
sudo mount --bind /sys $ARCH_TRAVIS_CHROOT/sys
sudo mount --bind /dev $ARCH_TRAVIS_CHROOT/dev
sudo mount --bind /dev/pts $ARCH_TRAVIS_CHROOT/dev/pts
sudo mount --bind /dev/shm $ARCH_TRAVIS_CHROOT/dev/shm
sudo mount --bind /run $ARCH_TRAVIS_CHROOT/run
# update packages
chroot_as_root "pacman -Syy"
chroot_as_root "pacman -Syu ${default_packages[*]} --noconfirm"
# use LANG=en_US.UTF-8 as expected in travis environments
as_root "sed -i 's|#en_US.UTF-8|en_US.UTF-8|' $ARCH_TRAVIS_CHROOT/etc/locale.gen"
chroot_as_root "locale-gen"
# setup non-root user
chroot_as_root "useradd -u $uid -m -s /bin/bash $user"
# disable password for sudo users
as_root "echo \"$user ALL=(ALL) NOPASSWD: ALL\" >> $ARCH_TRAVIS_CHROOT/etc/sudoers.d/$user"
# Add build dir
chroot_as_root "mkdir -p $user_build_dir && chown $user $user_build_dir"
# bind $TRAVIS_BUILD_DIR to chroot build dir
sudo mount --bind $TRAVIS_BUILD_DIR $ARCH_TRAVIS_CHROOT$user_build_dir
# add custom repos
add_repositories
# setup pacaur for AUR packages
setup_pacaur
}
# add custom repositories to pacman.conf
add_repositories() {
if [ ${#CONFIG_REPOS[@]} -gt 0 ]; then
for r in "${CONFIG_REPOS[@]}"; do
local splitarr=(${r//=/ })
((repo_line+=1))
as_root "sed -i '${repo_line}i[${splitarr[0]}]' $ARCH_TRAVIS_CHROOT/etc/pacman.conf"
((repo_line+=1))
as_root "sed -i '${repo_line}iServer = ${splitarr[1]}\n' $ARCH_TRAVIS_CHROOT/etc/pacman.conf"
((repo_line+=1))
done
# update repos
chroot_as_root "pacman -Syy"
fi
}
# a wrapper which can be used to eventually add fakeroot support.
sudo_wrapper() {
sudo "$@"
}
# run command as normal user
as_normal() {
local str="$@"
run /bin/bash -c "$str"
}
# run command as root
as_root() {
local str="$@"
run sudo_wrapper /bin/bash -c "$str"
}
# run command in chroot as root
chroot_as_root() {
local str="$@"
run sudo_wrapper setarch $ARCH_TRAVIS_ARCH chroot \
$ARCH_TRAVIS_CHROOT /bin/bash -c "$str"
}
# execute command in chroot as normal user
_chroot_as_normal() {
local str="$@"
sudo_wrapper setarch $ARCH_TRAVIS_ARCH chroot \
--userspec=$uid:$uid $ARCH_TRAVIS_CHROOT /bin/bash \
-c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $str"
}
# run command in chroot as normal user
chroot_as_normal() {
local str="$@"
run _chroot_as_normal "$str"
}
# run command
run() {
"$@"
local ret=$?
if [ $ret -gt 0 ]; then
takedown_chroot
exit $ret
fi
}
# run build script
run_build_script() {
local cmd="$@"
echo "$ $cmd"
_chroot_as_normal "$cmd"
local ret=$?
if [ $ret -gt 0 ]; then
takedown_chroot
exit $ret
fi
}
# setup pacaur
setup_pacaur() {
# Check if pacaur is available in the added repos
if _chroot_as_normal "pacman -Si pacaur &> /dev/null"; then
chroot_as_root "pacman -S --noconfirm pacaur"
else
local cowerarchive="cower.tar.gz"
local aururl="https://aur.archlinux.org/cgit/aur.git/snapshot/"
# install cower
as_normal "curl -O $aururl/$cowerarchive"
as_normal "tar xf $cowerarchive"
chroot_as_normal "cd cower && makepkg -is --skippgpcheck --noconfirm"
as_root "rm -r cower"
as_normal "rm $cowerarchive"
# install pacaur
chroot_as_normal "cower -dd pacaur"
chroot_as_normal "cd pacaur && makepkg -is --noconfirm"
chroot_as_normal "rm -rf pacaur"
fi
}
# install package through pacaur
_pacaur() {
local pacaur="pacaur -S $@ --noconfirm --noedit"
chroot_as_normal "$pacaur"
}
# takedown chroot
# unmounts anything mounted in the chroot setup
takedown_chroot() {
sudo umount $ARCH_TRAVIS_CHROOT/{run,dev/shm,dev/pts,dev,sys,proc}
sudo umount $ARCH_TRAVIS_CHROOT$user_build_dir
sudo umount $ARCH_TRAVIS_CHROOT
if [ -n "$ARCH_TRAVIS_CLEAN_CHROOT" ]; then
as_root "rm -rf $ARCH_TRAVIS_CHROOT"
fi
}
# read value from .travis.yml
travis_yml() {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' .travis.yml $@
}
read_config() {
local old_ifs=$IFS
IFS=$'\n'
CONFIG_BUILD_SCRIPTS=($(travis_yml arch script))
CONFIG_PACKAGES=($(travis_yml arch packages))
CONFIG_REPOS=($(travis_yml arch repos))
IFS=$old_ifs
}
# run build scripts defined in .travis.yml
build_scripts() {
if [ ${#CONFIG_BUILD_SCRIPTS[@]} -gt 0 ]; then
for script in "${CONFIG_BUILD_SCRIPTS[@]}"; do
run_build_script $script
done
else
echo "No build scripts defined"
takedown_chroot
exit 1
fi
}
# install packages defined in .travis.yml
install_packages() {
for package in "${CONFIG_PACKAGES[@]}"; do
_pacaur $package
done
}
# install custom compiler if CC != gcc
install_c_compiler() {
if [ "$TRAVIS_CC" != "gcc" ]; then
_pacaur "$TRAVIS_CC"
fi
}
arch_msg() {
lightblue='\033[1;34m'
reset='\e[0m'
echo -e "${lightblue}$@${reset}"
}
# read .travis.yml
read_config
echo "travis_fold:start:arch_travis"
setup_chroot
install_packages
if [ -n "$CC" ]; then
install_c_compiler
# restore CC
CC=$TRAVIS_CC
fi
echo "travis_fold:end:arch_travis"
echo ""
arch_msg "Running travis build"
build_scripts
takedown_chroot
# vim:set ts=2 sw=2 et:

View file

@ -1,65 +1,147 @@
#!/bin/bash
# Installs libs and compiles tdesktop
set -e
REPO="$PWD"
BUILD="$REPO/build"
UPSTREAM="$REPO/upstream"
EXTERNAL="$REPO/external"
CACHE="$HOME/travisCacheDir"
QT_PATH="$BUILD/qt"
BREAKPAD_PATH="$EXTERNAL/breakpad"
[[ ! $MAKE_ARGS ]] && MAKE_ARGS="--quiet -j4"
QT_VERSION=5.6.0
run() {
info_msg "Build version: ${BUILD_VERSION}"
# Move files to subdir
cd ..
mv tdesktop tdesktop2
mkdir tdesktop
mv tdesktop2 "$UPSTREAM"
downloadLibs
prepare
build
check
mkdir "$BUILD"
downloadLibs
build
check
}
# install
downloadLibs() {
travis_fold_start "download_libs"
# Move telegram project to subfolder
mkdir tdesktop
mv -f Telegram tdesktop
travisStartFold "Download libraries"
# Download libraries
info_msg "QT-Version: ${_qtver}, SRC-Dir: ${srcdir}"
cd "$REPO"
mkdir external && cd external
echo -e "Clone Qt\n"
git clone git://code.qt.io/qt/qt5.git qt${_qtver}
cd qt${_qtver}
git checkout $(echo ${_qtver} | sed -e "s/\..$//")
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v${_qtver}
cd qtbase && git checkout v${_qtver} && cd ..
cd qtimageformats && git checkout v${_qtver} && cd ..
cd ..
echo -e "Clone Breakpad\n"
git clone https://chromium.googlesource.com/breakpad/breakpad breakpad
echo -e "Clone Linux Syscall Support\n"
git clone https://chromium.googlesource.com/linux-syscall-support breakpad-lss
echo -e "Lets view the folder content\n"
ls
travis_fold_end "download_libs"
git clone https://chromium.googlesource.com/linux-syscall-support
git clone https://git.ffmpeg.org/ffmpeg.git
git clone https://github.com/xkbcommon/libxkbcommon.git
git clone https://github.com/kcat/openal-soft.git
}
prepare() {
travis_fold_start "prepare"
start_msg "Preparing the libraries..."
build() {
travisStartFold "Build libraries"
cd "$srcdir/tdesktop"
# libxkbcommon
cd "$EXTERNAL/libxkbcommon"
./autogen.sh \
--prefix='/usr/local'
make $MAKE_ARGS
sudo make install
sudo ldconfig
mkdir -p "$srcdir/Libraries"
# ffmpeg
cd "$EXTERNAL/ffmpeg"
./configure \
--prefix='/usr/local' \
--disable-debug \
--disable-programs \
--disable-doc \
--disable-everything \
--enable-gpl \
--enable-version3 \
--enable-libopus \
--enable-decoder=aac \
--enable-decoder=aac_latm \
--enable-decoder=aasc \
--enable-decoder=flac \
--enable-decoder=gif \
--enable-decoder=h264 \
--enable-decoder=h264_vdpau \
--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=vorbis \
--enable-decoder=wavpack \
--enable-decoder=wmalossless \
--enable-decoder=wmapro \
--enable-decoder=wmav1 \
--enable-decoder=wmav2 \
--enable-decoder=wmavoice \
--enable-encoder=libopus \
--enable-hwaccel=h264_vaapi \
--enable-hwaccel=h264_vdpau \
--enable-hwaccel=mpeg4_vaapi \
--enable-hwaccel=mpeg4_vdpau \
--enable-parser=aac \
--enable-parser=aac_latm \
--enable-parser=flac \
--enable-parser=h264 \
--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=mov \
--enable-demuxer=mp3 \
--enable-demuxer=ogg \
--enable-demuxer=wav \
--enable-muxer=ogg \
--enable-muxer=opus
make $MAKE_ARGS
sudo make install
sudo ldconfig
ln -s "$srcdir/qt${_qtver}" "$srcdir/Libraries/qt${_qtver}"
cd "$srcdir/Libraries/qt${_qtver}/qtbase"
git apply "$srcdir/tdesktop/Telegram/Patches/qtbase_$(echo ${_qtver} | sed -e "s/\./_/g").diff"
# openal_soft
cd "$EXTERNAL/openal-soft/build"
cmake \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D CMAKE_BUILD_TYPE=Release \
-D LIBTYPE=STATIC \
..
make $MAKE_ARGS
sudo make install
sudo ldconfig
if [ ! -h "$srcdir/Libraries/breakpad" ]; then
ln -s "$srcdir/breakpad" "$srcdir/Libraries/breakpad"
ln -s "$srcdir/breakpad-lss" "$srcdir/Libraries/breakpad/src/third_party/lss"
fi
# Qt
getCustomQt
sed -i 's/CUSTOM_API_ID//g' "$srcdir/tdesktop/Telegram/Telegram.pro"
sed -i 's,LIBS += /usr/local/lib/libxkbcommon.a,,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
sed -i 's,LIBS += /usr/local/lib/libz.a,LIBS += -lz,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
# Breakpad
getBreakpad
travisStartFold "Patch tdesktop"
# Patch tdesktop
sed -i 's/CUSTOM_API_ID//g' "$UPSTREAM/Telegram/Telegram.pro"
sed -i "s,\..*/Libraries/breakpad/,$BREAKPAD_PATH/,g" "$UPSTREAM/Telegram/Telegram.pro"
local options=""
@ -87,74 +169,144 @@ prepare() {
options+="\nDEFINES += TDESKTOP_DISABLE_UNITY_INTEGRATION"
fi
options+='\nINCLUDEPATH += "/usr/lib/glib-2.0/include"'
options+='\nINCLUDEPATH += "/usr/lib/gtk-2.0/include"'
options+='\nINCLUDEPATH += "/usr/include/opus"'
options+='\nLIBS += -lcrypto -lssl'
info_msg "Build options: ${options}"
echo -e "${options}" >> "$srcdir/tdesktop/Telegram/Telegram.pro"
echo -e "${options}" >> "$UPSTREAM/Telegram/Telegram.pro"
success_msg "Prepare done! :)"
travis_fold_end "prepare"
travisStartFold "Build tdesktop"
buildTelegram
travisEndFold
}
build() {
start_msg "Building the projects..."
getBreakpad() {
travisStartFold "Getting breakpad"
info_msg "Build patched Qt"
# Build patched Qt
cd "$srcdir/Libraries/qt${_qtver}"
./configure -prefix "$srcdir/qt" -release -opensource -confirm-license -qt-zlib \
-qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb \
-qt-xkbcommon-x11 -no-opengl -no-gtkstyle -static -nomake examples -nomake tests
make --silent -j4
make --silent -j4 install
local BREAKPAD_CACHE="$CACHE/breakpad"
local BREAKPAD_CACHE_FILE="$BREAKPAD_CACHE/.cache.txt"
if [ ! -d "$BREAKPAD_CACHE" ]; then
mkdir -p "$BREAKPAD_CACHE"
fi
export PATH="$srcdir/qt/bin:$PATH"
ln -sf "$BREAKPAD_CACHE" "$BREAKPAD_PATH"
info_msg "Build breakpad"
# Build breakpad
cd "$srcdir/Libraries/breakpad"
./configure
make --silent -j4
if [ -f "$BREAKPAD_CACHE_FILE" ]; then
info_msg "Using cached breakpad"
makeBreakpadLink
else
buildBreakpad
sudo touch "$BREAKPAD_CACHE_FILE"
fi
}
buildBreakpad() {
info_msg "Downloading and building breakpad"
cd "$EXTERNAL"
git clone https://chromium.googlesource.com/breakpad/breakpad
makeBreakpadLink
cd "$BREAKPAD_PATH"
./configure
make $MAKE_ARGS
}
makeBreakpadLink() {
local LSS_PATH="$BREAKPAD_PATH/src/third_party/lss"
ln -s -f "$EXTERNAL/linux-syscall-support" "$LSS_PATH"
local LSS_GIT_PATH="$LSS_PATH/.git"
if [ -d "$LSS_GIT_PATH" ]; then # Remove git dir to prevent cache changes
rm -rf "$LSS_GIT_PATH"
fi
}
getCustomQt() {
travisStartFold "Getting patched QT"
local QT_CACHE="$CACHE/qtPatched"
local QT_CACHE_FILE="$QT_CACHE/.cache.txt"
if [ ! -d "$QT_CACHE" ]; then
mkdir -p "$QT_CACHE"
fi
ln -sf "$QT_CACHE" "$QT_PATH"
if [ -f "$QT_CACHE_FILE" ]; then
info_msg "Using cached patched qt"
else
buildCustomQt
sudo touch "$QT_CACHE_FILE"
fi
export PATH="$QT_PATH/bin:$PATH"
}
buildCustomQt() {
info_msg "Downloading and building patched qt"
cd "$EXTERNAL"
echo -e "Clone Qt ${QT_VERSION}\n"
git clone git://code.qt.io/qt/qt5.git qt${QT_VERSION}
cd qt${QT_VERSION}
git checkout "$(echo ${QT_VERSION} | sed -e s/\..$//)"
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v${QT_VERSION}
cd qtbase && git checkout v${QT_VERSION} && cd ..
cd qtimageformats && git checkout v${QT_VERSION} && cd ..
cd ..
cd "$EXTERNAL/qt${QT_VERSION}/qtbase"
git apply "$UPSTREAM/Telegram/Patches/qtbase_${QT_VERSION//\./_}.diff"
cd ..
./configure -prefix "$QT_PATH" -release -opensource -confirm-license -qt-zlib \
-qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb \
-qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests \
-dbus-runtime -openssl-linked -no-gstreamer -no-mtdev # <- Not sure about these
make $MAKE_ARGS
sudo make install
}
buildTelegram() {
info_msg "Build codegen_style"
# Build codegen_style
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
qmake QT_TDESKTOP_PATH=${srcdir}/qt QT_TDESKTOP_VERSION=${_qtver} CONFIG+=debug "../../../../Telegram/build/qmake/codegen_style/codegen_style.pro"
make --silent -j4
mkdir -p "$UPSTREAM/Linux/obj/codegen_style/Debug"
cd "$UPSTREAM/Linux/obj/codegen_style/Debug"
qmake QT_TDESKTOP_PATH="${QT_PATH}" QT_TDESKTOP_VERSION=${QT_VERSION} CONFIG+=debug "../../../../Telegram/build/qmake/codegen_style/codegen_style.pro"
make $MAKE_ARGS
info_msg "Build codegen_numbers"
# Build codegen_numbers
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
qmake QT_TDESKTOP_PATH=${srcdir}/qt QT_TDESKTOP_VERSION=${_qtver} CONFIG+=debug "../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro"
make --silent -j4
mkdir -p "$UPSTREAM/Linux/obj/codegen_numbers/Debug"
cd "$UPSTREAM/Linux/obj/codegen_numbers/Debug"
qmake QT_TDESKTOP_PATH="${QT_PATH}" QT_TDESKTOP_VERSION=${QT_VERSION} CONFIG+=debug "../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro"
make $MAKE_ARGS
info_msg "Build MetaLang"
# Build MetaLang
mkdir -p "$srcdir/tdesktop/Linux/DebugIntermediateLang"
cd "$srcdir/tdesktop/Linux/DebugIntermediateLang"
qmake QT_TDESKTOP_PATH=${srcdir}/qt QT_TDESKTOP_VERSION=${_qtver} CONFIG+=debug "../../Telegram/MetaLang.pro"
make --silent -j4
mkdir -p "$UPSTREAM/Linux/DebugIntermediateLang"
cd "$UPSTREAM/Linux/DebugIntermediateLang"
qmake QT_TDESKTOP_PATH="${QT_PATH}" QT_TDESKTOP_VERSION=${QT_VERSION} CONFIG+=debug "../../Telegram/MetaLang.pro"
make $MAKE_ARGS
info_msg "Build Telegram Desktop"
# Build Telegram Desktop
mkdir -p "$srcdir/tdesktop/Linux/DebugIntermediate"
cd "$srcdir/tdesktop/Linux/DebugIntermediate"
mkdir -p "$UPSTREAM/Linux/DebugIntermediate"
cd "$UPSTREAM/Linux/DebugIntermediate"
./../codegen/Debug/codegen_style "-I./../../Telegram/Resources" "-I./../../Telegram/SourceFiles" "-o./GeneratedFiles/styles" all_files.style --rebuild
./../codegen/Debug/codegen_numbers "-o./GeneratedFiles" "./../../Telegram/Resources/numbers.txt"
./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/langs/lang.strings -lang_out ./GeneratedFiles/lang_auto
qmake QT_TDESKTOP_PATH=${srcdir}/qt QT_TDESKTOP_VERSION=${_qtver} CONFIG+=debug "../../Telegram/Telegram.pro"
make -j4
qmake QT_TDESKTOP_PATH="${QT_PATH}" QT_TDESKTOP_VERSION=${QT_VERSION} CONFIG+=debug "../../Telegram/Telegram.pro"
make $MAKE_ARGS
}
check() {
local filePath="$srcdir/tdesktop/Linux/Debug/Telegram"
local filePath="$UPSTREAM/Linux/Debug/Telegram"
if test -f "$filePath"; then
success_msg "Build successful done! :)"
@ -169,4 +321,4 @@ check() {
source ./.travis/common.sh
run
run

View file

@ -11,30 +11,55 @@ Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m';
Cya='\e[0;36m'; BCya='\e[1;36m'; UCya='\e[4;36m'; ICya='\e[0;96m'; BICya='\e[1;96m'; On_Cya='\e[46m'; On_ICya='\e[0;106m';
Whi='\e[0;37m'; BWhi='\e[1;37m'; UWhi='\e[4;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m'; On_Whi='\e[47m'; On_IWhi='\e[0;107m';
# Set variables
_qtver=5.6.0
srcdir=${PWD}
start_msg() {
echo -e "\n${Gre}$*${RCol}"
echo -e "\n${Gre}$*${RCol}"
}
info_msg() {
echo -e "\n${Cya}$*${RCol}"
sameLineInfoMessage "\n$1"
}
error_msg() {
echo -e "\n${BRed}$*${RCol}"
echo -e "\n${BRed}$*${RCol}"
}
success_msg() {
echo -e "\n${BGre}$*${RCol}"
echo -e "\n${BGre}$*${RCol}"
}
travis_fold_start() {
echo "travis_fold:start:$*"
sameLineInfoMessage() {
echo -e "${Cya}$*${RCol}"
}
travis_fold_end() {
echo "travis_fold:end:$*"
TRAVIS_LAST_FOLD=""
travisStartFold() {
local TITLE="$1"
local NAME=$(sanitizeName "$TITLE")
if [ "$TRAVIS_LAST_FOLD" != "" ]; then
travisEndFold
fi
echo "travis_fold:start:$NAME"
sameLineInfoMessage "$TITLE"
TRAVIS_LAST_FOLD="$NAME"
}
travisEndFold() {
if [ "$TRAVIS_LAST_FOLD" == "" ]; then
return
fi
echo "travis_fold:end:$TRAVIS_LAST_FOLD"
TRAVIS_LAST_FOLD=""
}
sanitizeName() {
local NAME="${1// /_}"
local NAME="${NAME,,}"
echo "$NAME"
}

View file

@ -476,35 +476,45 @@ CONFIG(debug, debug|release) {
include(qt_static.pri)
INCLUDEPATH += \
/usr/local/include\
/usr/local/include/opus\
./SourceFiles\
./GeneratedFiles\
./ThirdParty/minizip\
./../../Libraries/breakpad/src
INCLUDEPATH += "/usr/include/libappindicator-0.1"
#INCLUDEPATH += "/usr/include/gtk-3.0"
INCLUDEPATH += "/usr/include/gtk-2.0"
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
INCLUDEPATH += "/usr/include/glib-2.0"
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
INCLUDEPATH += "/usr/include/cairo"
INCLUDEPATH += "/usr/include/pango-1.0"
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
INCLUDEPATH += "/usr/include/atk-1.0"
CONFIG += link_pkgconfig
PKG_CONFIG = $$pkgConfigExecutable()
INCLUDEPATH += "/usr/include/dee-1.0"
INCLUDEPATH += "/usr/include/libdbusmenu-glib-0.4"
# include dirs only
QMAKE_CXXFLAGS += `$$PKG_CONFIG --cflags appindicator-0.1`
QMAKE_CXXFLAGS += `$$PKG_CONFIG --cflags gtk+-2.0`
QMAKE_CXXFLAGS += `$$PKG_CONFIG --cflags glib-2.0`
QMAKE_CXXFLAGS += `$$PKG_CONFIG --cflags dee-1.0`
# include dirs and libraries
PKGCONFIG += \
x11\
xi\
xext\
xkbcommon\
openal\
libavformat\
libavcodec\
libswresample\
libswscale\
libavutil\
opus\
libva\
libssl\
libcrypto\
zlib\
liblzma
LIBS += -ldl
LIBS += -ldl -llzma -lopenal -lavformat -lavcodec -lswresample -lswscale -lavutil -lopus -lva
LIBS += $${QT_TDESKTOP_PATH}/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.a \
$${QT_TDESKTOP_PATH}/plugins/platforminputcontexts/libibusplatforminputcontextplugin.a \
$${QT_TDESKTOP_PATH}/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.a
LIBS += /usr/local/lib/libz.a
LIBS += /usr/local/lib/libxkbcommon.a
LIBS += ./../../../Libraries/breakpad/src/client/linux/libbreakpad_client.a
RESOURCES += \

View file

@ -4,6 +4,7 @@ pushd `dirname $0` > /dev/null
FullScriptPath=`pwd`
popd > /dev/null
QMakePath="/usr/local/tdesktop/Qt-5.6.0/bin/qmake"
QMakeArgs="INCLUDEPATH+=/usr/local/include INCLUDEPATH+=/usr/local/include/opus"
if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then
echo ""
@ -136,7 +137,7 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then
mkdir -p "$WorkPath/ReleaseIntermediate"
cd "$WorkPath/ReleaseIntermediate"
"$QMakePath" "$HomePath/Telegram.pro" -r -spec linux-g++
"$QMakePath" $QMakeArgs "$HomePath/Telegram.pro" -r -spec linux-g++
eval "$HomePath/build/makefile_static.sh"
./../codegen/Debug/codegen_style "-I./../../Telegram/Resources" "-I./../../Telegram/SourceFiles" "-o./GeneratedFiles/styles" all_files.style --rebuild

View file

@ -48,6 +48,9 @@ Replace () {
fi
}
Replace '\-lssl' "$ArchDirPath\/libssl\.a"
Replace '\-lcrypto' "$ArchDirPath\/libcrypto\.a"
Replace '\-lz' "$ArchDirPath\/libz\.a"
Replace '\-llzma' "$ArchDirPath\/liblzma\.a"
Replace '\-lXi' "$ArchDirPath\/libXi\.a $ArchDirPath\/libXext\.a"
Replace '\-lSM' "$ArchDirPath\/libSM\.a"
@ -55,6 +58,7 @@ Replace '\-lICE' "$ArchDirPath\/libICE\.a"
Replace '\-lfontconfig' "$ArchDirPath\/libfontconfig\.a $ArchDirPath\/libexpat\.a"
Replace '\-lfreetype' "$ArchDirPath\/libfreetype\.a"
Replace '\-lXext' "$ArchDirPath\/libXext\.a"
Replace '\-lxkbcommon' "$LocalDirPath\/libxkbcommon\.a"
Replace '\-lopus' "$LocalDirPath\/libopus\.a"
Replace '\-lopenal' "$LocalDirPath\/libopenal\.a"
Replace '\-lavformat' "$LocalDirPath\/libavformat\.a"

View file

@ -52,16 +52,10 @@ Preparation
fi
sed -i 's/CUSTOM_API_ID//g' "$srcdir/tdesktop/Telegram/Telegram.pro"
sed -i 's,LIBS += /usr/local/lib/libxkbcommon.a,,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
sed -i 's,LIBS += /usr/local/lib/libz.a,LIBS += -lz,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
(
echo "DEFINES += TDESKTOP_DISABLE_AUTOUPDATE"
echo "DEFINES += TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
echo 'INCLUDEPATH += "/usr/lib/glib-2.0/include"'
echo 'INCLUDEPATH += "/usr/lib/gtk-2.0/include"'
echo 'INCLUDEPATH += "/usr/include/opus"'
echo 'LIBS += -lcrypto -lssl'
) >> "$srcdir/tdesktop/Telegram/Telegram.pro"
Building