Skip to content

Instantly share code, notes, and snippets.

@FabianPastor
Last active October 16, 2017 12:17
Show Gist options
  • Save FabianPastor/a1e87726bd7f937223954341c5343574 to your computer and use it in GitHub Desktop.
Save FabianPastor/a1e87726bd7f937223954341c5343574 to your computer and use it in GitHub Desktop.
Instalador de dependencias de TDesktop para Ubuntu 12.04
#!/bin/bash
cpus="6"
# zlibv="1.2.8"
opusv="v1.2-alpha2"
ffmpegv="3.2"
portaudiov="pa_stable_v19_20140130_r1919"
opensslv="OpenSSL_1_0_1-stable"
cmakev="3.6.2" #Cuidado al cambiar esto. Tener en cuenta gyp/refresh.sh
tddir="tdesktop"
update="false"
rootpath=`pwd`;
Make="make" #colormake
usegyp="true"
# set colors
RCol='\e[0m' # Text Reset
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m';
Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m';
Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m';
Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m'; On_Yel='\e[43m'; On_IYel='\e[0;103m';
Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m'; On_Blu='\e[44m'; On_IBlu='\e[0;104m';
Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m'; BIPur='\e[1;95m'; On_Pur='\e[45m'; On_IPur='\e[0;105m';
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';
start_msg() {
echo -e "\n${Gre}$*${RCol}"
}
info_msg() {
sameLineInfoMessage "\n$1"
}
error_msg() {
echo -e "\n${BRed}$*${RCol}"
}
success_msg() {
echo -e "\n${BGre}$*${RCol}"
}
sameLineInfoMessage() {
echo -e "${Cya}$*${RCol}"
}
#Install all libraries
#Dependencias
info_msg "Installing dependencies..."
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git g++ gcc-6 g++-6 libexif-dev liblzma-dev libz-dev libssl-dev libappindicator-dev\
autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev\
libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev\
libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev yasm cmake xutils-dev bison\
python-xcbgen libxcb-image0-dev libxcb-keysyms1-dev libxcb-icccm4-dev\
libxcb-render-util0-dev libxcb-util0-dev libxrender-dev libasound-dev libpulse-dev\
libxcb-sync0-dev libxcb-randr0-dev libx11-xcb-dev libffi-dev libdee-dev libicu-dev libunity-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 60
info_msg "Downloading TDesktop"
if [ ! -d "$tddir" ];then
git clone --recursive https://github.com/telegramdesktop/tdesktop.git $tddir
cd $tddir
git checkout dev
success_msg "Downloaded TDesktop"
else
success_msg "TDesktop already Downloaded"
cd $tddir
if [ "$update" == "true" ];then
start_msg "Updating TDesktop"
#Fix
fi
fi
cd ..
info_msg "Creating Libraries Dir and preparing to make magic...."
if [ ! -d "Libraries" ];then
mkdir Libraries
fi
cd Libraries
#### zlib
info_msg "Installing zlib"
if [ ! -d "zlib" ];then
# # git clone https://github.com/madler/zlib zlib-$zlibv # tag v1.2.8
# cd zlib-$zlibv
# git checkout tags/v$zlibv
git clone https://github.com/telegramdesktop/zlib.git
cd zlib
./configure
#cmake .
$Make -j $cpus
sudo $Make install
cd ..
success_msg "Installed zlib"
else
success_msg "zlib already installed"
fi
#### opus
info_msg "Installing opus"
if [ ! -d "opus" ];then
git clone https://github.com/xiph/opus
cd opus
git checkout $opusv
./autogen.sh --enable-static
./configure
$Make -j $cpus
sudo $Make install
cd ..
success_msg "Installed opus"
else
success_msg "opus already installed"
fi
#### ffmpeg
info_msg "Installing ffmpeg"
if [ ! -d "ffmpeg" ];then
git clone https://github.com/01org/libva.git
git clone git://anongit.freedesktop.org/vdpau/libvdpau
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd libva
./autogen.sh --enable-static
$Make -j $cpus
sudo $Make install
cd ..
cd libvdpau
./autogen.sh --enable-static
$Make -j $cpus
sudo $Make install
cd ..
cd ffmpeg
git checkout release/$ffmpegv
./configure --prefix=/usr/local --disable-programs --disable-doc --disable-everything --enable-protocol=file \
--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=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-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 -j $cpus
sudo $Make install
cd ..
success_msg "Installed ffmpeg"
else
success_msg "ffmpeg already installed"
fi
#### portaudio
info_msg "Installing portaudio"
if [ ! -d "portaudio" ];then
git clone git://git.assembla.com/portaudio.git # tag: pa_stable_v19_20140130_r1919
cd portaudio
git checkout tags/$portaudiov
./configure
$Make -j $cpus
sudo $Make install
cd ../
success_msg "Installed portaudio"
else
success_msg "portaudio already installed"
fi
#### GYP and CMake
info_msg "Installing GYP and CMake 3.6.2"
if [ ! -d "gyp" ];then
git clone https://chromium.googlesource.com/external/gyp
git clone git://cmake.org/cmake.git cmake-$cmakev #tag v3.6.2
cd cmake-$cmakev
git checkout tags/v$cmakev
cd ../gyp
git checkout 702ac58e47
git apply -v $rootpath/$tddir/Telegram/Patches/gyp.diff
cd ../cmake-$cmakev
./configure
$Make -j $cpus
success_msg "Installed GYP and CMake"
cd ..
else
success_msg "GYP and CMake already installed"
fi
#### openal-soft
info_msg "Installing openal-soft"
if [ ! -d "openal-soft" ];then
git clone git://repo.or.cz/openal-soft.git
cd openal-soft/build
../../cmake-3.6.2/bin/cmake -D LIBTYPE:STRING=STATIC ..
$Make -j $cpus
sudo $Make install
cd ../../
success_msg "Installed openal-soft"
else
success_msg "openal-soft already installed"
fi
#### OpenSSL
info_msg "Installing OpenSSL"
if [ ! -d "openssl" ];then
git clone https://github.com/openssl/openssl
cd openssl
git checkout $opensslv
./config
$Make -j $cpus
sudo $Make install
cd ../
success_msg "Installed openssl"
else
success_msg "openssl already installed"
fi
#### libxkbcommon
info_msg "Installing libxkbcommon"
if [ ! -d "libxkbcommon" ];then
git clone https://github.com/xkbcommon/libxkbcommon.git
cd libxkbcommon
./autogen.sh --disable-x11
$Make -j $cpus
sudo $Make install
cd ../
success_msg "Installed libxkbcommon"
else
success_msg "libxkbcommon already installed"
fi
#### Qt 5.6.2, slightly patched
info_msg "Installing Qt 5.6.2, slightly patched"
if [ ! -d "qt5_6_2" ];then
git clone git://code.qt.io/qt/qt5.git qt5_6_2
cd qt5_6_2
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.6.2
cd qtimageformats && git checkout v5.6.2 && cd ..
cd qtbase && git checkout v5.6.2
git apply -v $rootpath/$tddir/Telegram/Patches/qtbase_5_6_2.diff && cd ..
cd qtbase/src/plugins/platforminputcontexts
git clone https://github.com/telegramdesktop/fcitx.git
git clone https://github.com/telegramdesktop/hime.git
cd ../../../..
./configure -prefix "/usr/local/tdesktop/Qt-5.6.2" -release -force-debug-info\
-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 -openssl-linked -nomake examples -nomake tests
$Make -j $cpus
sudo $Make install
cd ../
success_msg "Installed Qt 5.6.2"
else
success_msg "Qt 5.6.2 already installed"
fi
#### Google Breakpad
info_msg "Installing Google Breakpad"
if [ ! -d "breakpad" ];then
git clone https://chromium.googlesource.com/breakpad/breakpad
git clone https://chromium.googlesource.com/linux-syscall-support breakpad/src/third_party/lss
cd breakpad
./configure --prefix=$PWD
$Make -j $cpus
sudo $Make install
cd ../
success_msg "Installed Google Breakpad"
else
success_msg "Google Breakpad already installed"
fi
cd $rootpath/$tddir/
info_msg "Building TDesktop with GYP For testing"
cd Telegram
./gyp/refresh.sh
info_msg "--MAKE with GYP For testing"
cd $rootpath/$tddir/out/Debug
$Make -j $cpus
success_msg "Install with GYP finished"
###### Añadir al Telegram.pro para deshabilitar la integración con unity
# DEFINES +=TDESKTOP_DISABLE_UNITY_INTEGRATION
# DEFINES +=TDESKTOP_DISABLE_AUTOUPDATE
# DEFINES +=TDESKTOP_DISABLE_CRASH_REPORTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment