Improve paths for Xcode build.

This commit is contained in:
John Preston 2017-10-13 22:23:19 +03:00
parent 989f0cc683
commit 66146c382d
11 changed files with 143 additions and 346 deletions

@ -1 +1 @@
Subproject commit 9f78cb85e5db9b39a6c4c3f7847ea3e98c9f544a
Subproject commit 651594b3cef23051ca7370ddd14d7c23377d6341

View File

@ -57,8 +57,8 @@ set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%"
set "SignPath=%HomePath%\..\..\TelegramPrivate\Sign.bat"
set "SignAppxPath=%HomePath%\..\..\TelegramPrivate\AppxSign.bat"
set "BinaryName=Telegram"
set "DropboxSymbolsPath=X:\Telegram\symbols"
set "FinalReleasePath=Y:\TBuild\tother\tsetup"
set "DropboxSymbolsPath=Y:\Telegram\symbols"
set "FinalReleasePath=Z:\Telegram\deploy_temp\tsetup"
if not exist %DropboxSymbolsPath% (
echo Dropbox path %DropboxSymbolsPath% not found!

View File

@ -210,7 +210,7 @@ fi
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" == "macstore" ]; then
DropboxSymbolsPath="/Volumes/Storage/Dropbox/Telegram/symbols"
DropboxSymbolsPath="$HOME/Dropbox/Telegram/symbols"
if [ ! -d "$DropboxSymbolsPath" ]; then
Error "Dropbox path not found!"
fi
@ -349,7 +349,7 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "mac32" ] || [ "$BuildTarg
mv "$ReleasePath/$SetupFile" "$DeployPath/"
if [ "$BuildTarget" == "mac32" ]; then
ReleaseToPath="$HomePath/../../tother/tmac32"
ReleaseToPath="$HomePath/../../deploy_temp/tmac32"
DeployToPath="$ReleaseToPath/$AppVersionStrMajor/$AppVersionStrFull"
if [ ! -d "$ReleaseToPath/$AppVersionStrMajor" ]; then
mkdir "$ReleaseToPath/$AppVersionStrMajor"

View File

@ -85,16 +85,16 @@ elif [ "$BuildTarget" == "mac" ]; then
SetupFile="tsetup.$AppVersionStrFull.dmg"
ReleasePath="$HomePath/../out/Release"
RemoteFolder="tmac"
Mac32DeployPath="$HomePath/../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull"
Mac32DeployPath="$HomePath/../../deploy_temp/tmac32/$AppVersionStrMajor/$AppVersionStrFull"
Mac32UpdateFile="tmac32upd$AppVersion"
Mac32SetupFile="tsetup32.$AppVersionStrFull.dmg"
Mac32RemoteFolder="tmac32"
WinDeployPath="$HomePath/../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull"
WinDeployPath="$HomePath/../../deploy_temp/tsetup/$AppVersionStrMajor/$AppVersionStrFull"
WinUpdateFile="tupdate$AppVersion"
WinSetupFile="tsetup.$AppVersionStrFull.exe"
WinPortableFile="tportable.$AppVersionStrFull.zip"
WinRemoteFolder="tsetup"
BackupPath="/Volumes/Storage/backup/$AppVersionStrMajor/$AppVersionStrFull"
BackupPath="$HOME/Telegram/backup/$AppVersionStrMajor/$AppVersionStrFull"
elif [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" = "macstore" ]; then
Error "No need to deploy this target."
else

View File

@ -98,7 +98,7 @@ if access_token == '':
sys.exit(1)
print('Version: ' + version_full);
local_folder = '/Volumes/Storage/backup/' + version_major + '/' + version_full
local_folder = '$HOME/Telegram/backup/' + version_major + '/' + version_full
if stable == 1:
if os.path.isdir(local_folder + '.dev'):

View File

@ -98,7 +98,6 @@
'<(SHARED_INTERMEDIATE_DIR)',
'<(libs_loc)/breakpad/src',
'<(libs_loc)/lzma/C',
'<(libs_loc)/libexif-0.6.20',
'<(libs_loc)/zlib',
'<(libs_loc)/ffmpeg',
'<(libs_loc)/openal-soft/include',

View File

@ -30,7 +30,6 @@
],
'linux_path_ffmpeg%': '/usr/local',
'linux_path_openal%': '/usr/local',
'linux_path_libexif_lib%': '<(libs_loc)/libexif-0.6.20/libexif/.libs',
'linux_path_va%': '/usr/local',
'linux_path_vdpau%': '/usr/local',
'linux_path_breakpad%': '/usr/local',
@ -47,7 +46,6 @@
'/usr/local/lib',
'<(linux_path_ffmpeg)/lib',
'<(linux_path_openal)/lib',
'<(linux_path_libexif_lib)',
'<(linux_path_va)/lib',
'<(linux_path_vdpau)/lib',
'<(linux_path_breakpad)/lib',

View File

@ -76,14 +76,15 @@
'/usr/local/macold/lib/libexif.a',
'/usr/local/macold/lib/libc++.a',
'/usr/local/macold/lib/libc++abi.a',
'<(libs_loc)/macold/openssl-1.0.1h/libssl.a',
'<(libs_loc)/macold/openssl-1.0.1h/libcrypto.a',
'<(libs_loc)/macold/openssl/libssl.a',
'<(libs_loc)/macold/openssl/libcrypto.a',
],
},
'include_dirs': [
'/usr/local/macold',
'/usr/local/macold/include/c++/v1',
'<(libs_loc)/macold/openssl-1.0.1h/include',
'<(libs_loc)/macold/openssl/include',
'<(libs_loc)/macold/libexif-0.6.20',
'<(libs_loc)/macold/crashpad',
'<(libs_loc)/macold/crashpad/third_party/mini_chromium/mini_chromium',
],
@ -136,14 +137,14 @@
'/usr/local/lib/libavutil.a',
'/usr/local/lib/libswscale.a',
'/usr/local/lib/libswresample.a',
'<(libs_loc)/openssl-xcode/libssl.a',
'<(libs_loc)/openssl-xcode/libcrypto.a',
'<(libs_loc)/openssl/libssl.a',
'<(libs_loc)/openssl/libcrypto.a',
],
},
'include_dirs': [
'<(libs_loc)/crashpad',
'<(libs_loc)/crashpad/third_party/mini_chromium/mini_chromium',
'<(libs_loc)/openssl-xcode/include'
'<(libs_loc)/openssl/include'
],
'configurations': {
'Debug': {

View File

@ -93,10 +93,10 @@
}],
[ 'build_mac', {
'include_dirs': [
'<(libs_loc)/openssl-xcode/include'
'<(libs_loc)/openssl/include'
],
'library_dirs': [
'<(libs_loc)/openssl-xcode',
'<(libs_loc)/openssl',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
@ -131,7 +131,7 @@
}, {
'include_dirs': [
'/usr/local/include',
'<(libs_loc)/openssl-xcode/include'
'<(libs_loc)/openssl/include'
],
'library_dirs': [
'/usr/local/lib',
@ -153,7 +153,7 @@
}, {
'include_dirs': [
'/usr/local/include',
'<(libs_loc)/openssl-xcode/include'
'<(libs_loc)/openssl/include'
],
'library_dirs': [
'/usr/local/lib',

View File

@ -4,37 +4,38 @@
### Prepare folder
Choose a folder for the future build, for example **/Users/user/TBuild** There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
Choose a folder for the future build, for example **/Users/user/TBuild**. It will be named ***BuildPath*** in the rest of this document. All commands will be launched from Terminal.
### Clone source code
### Download libraries
By git in Terminal go to **/Users/user/TBuild** and run
Download [**xz-5.0.5**](http://tukaani.org/xz/xz-5.0.5.tar.gz) and unpack to ***BuildPath*/Libraries/xz-5.0.5**
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
Download [**libiconv-1.15**](http://www.gnu.org/software/libiconv/#downloading) and unpack to ***BuildPath*/Libraries/macold/libiconv-1.15**
then go to **/Users/user/TBuild/tdesktop** and run
### Clone source code and prepare libraries
git checkout dev
#### Prepare latest cmake
Download the [latest sources](https://cmake.org/download/) and unpack to **/Users/user/TBuild/Libraries/macold**
./bootstrap
make -j4
sudo make install
### Prepare libraries
In your build Terminal run
Go to ***BuildPath*** and run
MACOSX_DEPLOYMENT_TARGET=10.6
to set minimal supported OS version to 10.6 for future console builds.
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
#### custom build of libc++
cd Libraries
From **/Users/user/TBuild/Libraries/macold** run
cd xz-5.0.5
./configure
make
sudo make install
cd ..
git clone https://github.com/Kitware/CMake
cd CMake
./bootstrap
make -j4
sudo make install
cd ..
cd macold
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/projects
@ -57,155 +58,51 @@ From **/Users/user/TBuild/Libraries/macold** run
make -j4
sudo make install
#### zlib
In Terminal go to **/Users/user/TBuild/Libraries** and run:
git clone https://github.com/telegramdesktop/zlib.git
cd zlib
prefix=/usr/local/macold CFLAGS="-mmacosx-version-min=10.6" LDFLAGS="-mmacosx-version-min=10.6" ./configure
make
sudo make install
#### OpenSSL 1.0.1g
http://www.openssl.org/source/ > Download [**openssl-1.0.1h.tar.gz**](http://www.openssl.org/source/openssl-1.0.1h.tar.gz) (4.3 Mb)
Extract openssl-1.0.1h.tar.gz to **/Users/user/TBuild/Libraries/macold/openssl-1.0.1h**
./Configure --install_prefix=/usr/local/macold darwin64-x86_64-cc -static -mmacosx-version-min=10.6
make build_crypto build_ssl -j4
#### liblzma
http://tukaani.org/xz/ > Download [**xz-5.0.5.tar.gz**](http://tukaani.org/xz/xz-5.0.5.tar.gz)
Extract to **/Users/user/TBuild/Libraries**
##### Building library
In Terminal go to **/Users/user/TBuild/Libraries/xz-5.0.5** and there run
./configure
make
sudo make install
#### libexif 0.6.20
Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git in Terminal go to **/Users/user/TBuild/Libraries/macold** and run
git clone https://github.com/telegramdesktop/libexif-0.6.20.git
##### Building library
In Terminal go to **/Users/user/TBuild/Libraries/macold/libexif-0.6.20** and there run
CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6 -nostdinc++" LDFLAGS="-mmacosx-version-min=10.6" ./configure --prefix=/usr/local/macold
make -j4
sudo make install
cd ..
#### OpenAL Soft
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_0_1-stable
./Configure --install_prefix=/usr/local/macold darwin64-x86_64-cc -static -mmacosx-version-min=10.6
make build_libs -j4
cd ..
Get sources by git in Terminal go to **/Users/user/TBuild/Libraries/macold** and run
git clone git://repo.or.cz/openal-soft.git
to have **/Users/user/TBuild/Libraries/macold/openal-soft/CMakeLists.txt**
##### Building library
In Terminal go to **/Users/user/TBuild/Libraries/openal-soft/build** and there run
cmake -DLIBTYPE:STRING=STATIC -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.6 -DCMAKE_INSTALL_PREFIX:STRING=/usr/local/macold ..
make
cd libiconv-1.15
CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6 -nostdinc++" LDFLAGS="-mmacosx-version-min=10.6" ./configure --enable-static --prefix=/usr/local/macold
make -j4
sudo make install
#### Opus codec
In Terminal go to **/Users/user/TBuild/Libraries/macold** and there run
git clone https://github.com/xiph/opus
cd opus
git checkout v1.2-alpha2
./autogen.sh
CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6" LDFLAGS="-mmacosx-version-min=10.6" ./configure --prefix=/usr/local/macold
make
sudo make install
#### FFmpeg
In Terminal go to **/Users/user/TBuild/Libraries/macold** and run:
cd ..
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
git checkout release/3.2
##### Building libraries
Download [libiconv-1.14](http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz) from http://www.gnu.org/software/libiconv/#downloading, extract it to **/Users/user/TBuild/Libraries/macold**
In Termianl go to **/Users/user/TBuild/Libraries/macold/libiconv-1.14** and run
CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6 -nostdinc++" LDFLAGS="-mmacosx-version-min=10.6" ./configure --enable-static --prefix=/usr/local/macold
make -j4
sudo make install
Then in Terminal go to **/Users/user/TBuild/Libraries/macold/ffmpeg** and run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 xvid yasm
CFLAGS=`freetype-config --cflags`
LDFLAGS=`freetype-config --libs`
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig
./configure --prefix=/usr/local/macold --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=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=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=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 --extra-cflags="-mmacosx-version-min=10.6" --extra-cxxflags="-mmacosx-version-min=10.6 -nostdinc++" --extra-ldflags="-mmacosx-version-min=10.6"
./configure --prefix=/usr/local/macold --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=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=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=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 --extra-cflags="-mmacosx-version-min=10.6" --extra-cxxflags="-mmacosx-version-min=10.6 -nostdinc++" --extra-ldflags="-mmacosx-version-min=10.6"
make
sudo make install
#### Qt 5.3.2, slightly patched
##### Get the source code
In Terminal go to **/Users/user/TBuild/Libraries** and run:
git clone git://code.qt.io/qt/qt5.git qt5_3_2
cd qt5_3_2
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.3.2
cd qtimageformats && git checkout v5.3.2 && cd ..
cd qtbase && git checkout v5.3.2 && cd ..
##### Apply the patch
From **/Users/user/TBuild/Libraries/macold/qt5_3_2/qtbase**, run:
git apply ../../../../tdesktop/Telegram/Patches/macold/qtbase_5_3_2.diff
From **/Users/user/TBuild/Libraries/macold/qt5_3_2/qtimageformats**, run:
git apply ../../../../tdesktop/Telegram/Patches/macold/qtimageformats_5_3_2.diff
##### Building library
Go to **/Users/user/TBuild/Libraries/macold/qt5_3_2** and run:
OPENSSL_LIBS="/Users/user/TBuild/Libraries/macold/openssl-1.0.1h/libssl.a /Users/user/TBuild/Libraries/macold/openssl-1.0.1h/libcrypto.a" ./configure -prefix "/usr/local/macold/Qt-5.3.2" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -openssl-linked -I "/Users/user/TBuild/Libraries/macold/openssl-1.0.1h/include" -nomake examples -nomake tests -platform macx-g++
make -j4
sudo make -j4 install
sudo make install
cd ..
building (**make** command) will take really long time.
git clone git://repo.or.cz/openal-soft.git
cd openal-soft/build
cmake -DLIBTYPE:STRING=STATIC -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.6 -DCMAKE_INSTALL_PREFIX:STRING=/usr/local/macold ..
make -j4
sudo make install
cd ..
#### Google Crashpad
##### Install gyp
.. the same as modern ..
##### Build crashpad
In Terminal go to **/Users/user/TBuild/Libraries/macold** and run:
git clone https://github.com/telegramdesktop/libexif-0.6.20.git
cd libexif-0.6.20
CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6 -nostdinc++" LDFLAGS="-mmacosx-version-min=10.6" ./configure --prefix=/usr/local/macold
make -j4
sudo make install
git clone https://chromium.googlesource.com/crashpad/crashpad.git
cd crashpad
@ -225,18 +122,29 @@ In Terminal go to **/Users/user/TBuild/Libraries/macold** and run:
build/gyp_crashpad.py -Dmac_deployment_target=10.6
ninja -C out/Debug
ninja -C out/Release
cd ..
#### Prepare GYP
CurDir = `pwd`
.. the same as modern ..
git clone git://code.qt.io/qt/qt5.git qt5_3_2
cd qt5_3_2
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.3.2
cd qtimageformats && git checkout v5.3.2 && git apply ../../../../tdesktop/Telegram/Patches/macold/qtimageformats_5_3_2.diff && cd ..
cd qtbase && git checkout v5.3.2 && git apply ../../../../tdesktop/Telegram/Patches/macold/qtbase_5_3_2.diff && cd ..
### Building Telegram Desktop
OPENSSL_LIBS="$CurDir/macold/openssl/libssl.a $CurDir/macold/openssl/libcrypto.a" ./configure -prefix "/usr/local/macold/Qt-5.3.2" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -openssl-linked -I "$CurDir/macold/openssl/include" -nomake examples -nomake tests -platform macx-g++
* Launch Xcode, all projects will be taken from **/Users/user/TBuild/tdesktop/Telegram**
* Open MetaEmoji.xcodeproj and build for Debug (Release optionally)
* Open MetaLang.xcodeproj and build for Debug (Release optionally)
* Open Telegram.xcodeproj and build for Debug
* Build Updater target as well, it is required for Telegram relaunch
* Release Telegram build will require removing **CUSTOM_API_ID** definition in Telegram target settings (Apple LLVM 6.1 - Custom Compiler Flags > Other C / C++ Flags > Release)
make -j4
sudo make install
cd ..
### Building the project
Go to ***BuildPath*/tdesktop/Telegram** and run
gyp/refresh.sh
Then launch Xcode, open ***BuildPath*/tdesktop/Telegram/Telegram.xcodeproj** and build for Debug / Release.
[xcode]: building-xcode.md

View File

@ -2,190 +2,79 @@
### Prepare folder
Choose a folder for the future build, for example **/Users/user/TBuild**
Choose a folder for the future build, for example **/Users/user/TBuild**. It will be named ***BuildPath*** in the rest of this document. All commands will be launched from Terminal.
There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
### Download libraries
**You will need this hierarchy to be able to follow this README !**
Download [**xz-5.0.5**](http://tukaani.org/xz/xz-5.0.5.tar.gz) and unpack to ***BuildPath*/Libraries/xz-5.0.5**
### Clone source code
Download [**libiconv-1.15**](http://www.gnu.org/software/libiconv/#downloading) and unpack to ***BuildPath*/Libraries/libiconv-1.15**
By git in Terminal go to **/Users/user/TBuild** and run:
### Clone source code and prepare libraries
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
### Prepare libraries
In your build Terminal run:
Go to ***BuildPath*** and run
MACOSX_DEPLOYMENT_TARGET=10.8
to set minimal supported OS version to 10.8 for future console builds.
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
#### zlib
cd Libraries
In Terminal go to **/Users/user/TBuild/Libraries/zlib** and run:
cd xz-5.0.5
./configure
make
sudo make install
cd ..
git clone https://github.com/Kitware/CMake
cd CMake
./bootstrap
make -j4
sudo make install
cd ..
git clone https://github.com/telegramdesktop/zlib.git
cd zlib
CFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure
make
make -j4
sudo make install
cd ..
#### OpenSSL 1.0.1g
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_0_1-stable
./Configure darwin64-x86_64-cc -static -mmacosx-version-min=10.8
make build_libs -j4
cd ..
##### Get openssl-xcode project file
From https://github.com/telegramdesktop/openssl-xcode with git in Terminal:
* go to **/Users/user/TBuild/Libraries
* run:
git clone https://github.com/telegramdesktop/openssl-xcode.git
The path to openssl.xcodeproj should now be: **/Users/user/TBuild/Libraries/openssl-xcode/openssl.xcodeproj**
##### Get the source code:
Download [**openssl-1.0.1h.tar.gz**](http://www.openssl.org/source/openssl-1.0.1h.tar.gz) (4.3 Mb)
* Extract openssl-1.0.1h.tar.gz
* Copy everything from **openssl-1.0.1h** to **/Users/user/TBuild/Libraries/openssl-xcode**
The folder include of openssl should be:
**/Users/user/TBuild/Libraries/openssl-xcode/include**
##### Building library
* Open **/Users/user/TBuild/Libraries/openssl-xcode/openssl.xcodeproj** with Xcode
* Product > Build
#### liblzma
##### Get the source code
Download [**xz-5.0.5.tar.gz**](http://tukaani.org/xz/xz-5.0.5.tar.gz)
Extract to **/Users/user/TBuild/Libraries**
##### Building library
In Terminal go to **/Users/user/TBuild/Libraries/xz-5.0.5** and there run:
./configure
make
cd libiconv-1.15
CFLAGS="-mmacosx-version-min=10.8" CPPFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure --enable-static
make -j4
sudo make install
cd ..
#### libexif 0.6.20
##### Get the source code
From https://github.com/telegramdesktop/libexif-0.6.20 with git in Terminal:
* go to **/Users/user/TBuild/Libraries**
* run:
git clone https://github.com/telegramdesktop/libexif-0.6.20.git
The folder configure should have this path:
**/Users/user/TBuild/Libraries/libexif-0.6.20/configure**
##### Building library
In Terminal go to **/Users/user/TBuild/Libraries/libexif-0.6.20** and there run
./configure
make
sudo make install
#### OpenAL Soft
Get sources by git in Terminal go to **/Users/user/TBuild/Libraries** and run
git clone git://repo.or.cz/openal-soft.git
cd openal-soft/build
cmake -D LIBTYPE:STRING=STATIC -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8 ..
make
sudo make install
#### Opus codec
In Terminal go to **/Users/user/TBuild/Libraries** and there run
git clone https://github.com/xiph/opus
cd opus
git checkout v1.2-alpha2
./autogen.sh
CFLAGS="-mmacosx-version-min=10.8" CPPFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure
make
sudo make install
#### FFmpeg and Libiconv
##### Get the source code
In Terminal go to **/Users/user/TBuild/Libraries** and run:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 xvid yasm
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
git checkout release/3.2
* Download [libiconv-1.14](http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz) from http://www.gnu.org/software/libiconv/#downloading
* Extract to **/Users/user/TBuild/Libraries** to have **/Users/user/TBuild/Libraries/ibiconv-1.14**
##### Building library
In Terminal go to **/Users/user/TBuild/Libraries/libiconv-1.14** and run:
CFLAGS="-mmacosx-version-min=10.8" CPPFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure --enable-static
make
sudo make install
Then in Terminal go to **/Users/user/TBuild/Libraries/ffmpeg** and run:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 xvid yasm
CFLAGS=`freetype-config --cflags`
LDFLAGS=`freetype-config --libs`
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig
./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_vda --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=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=mpeg4_videotoolbox --enable-hwaccel=h264_vda --enable-hwaccel=h264_videotoolbox --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 --extra-cflags="-mmacosx-version-min=10.8" --extra-cxxflags="-mmacosx-version-min=10.8" --extra-ldflags="-mmacosx-version-min=10.8"
make
sudo make install
#### Qt 5.6.2, slightly patched
##### Get the source code
In Terminal go to **/Users/user/TBuild/Libraries** and run:
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 && cd ..
##### Apply the patch
From **/Users/user/TBuild/Libraries/qt5_6_2/qtbase**, run:
git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff
##### Building library
Go to **/Users/user/TBuild/Libraries/qt5_6_2** and run:
./configure -prefix "/usr/local/tdesktop/Qt-5.6.2" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang
make -j4
sudo make install
cd ..
Building (**make** command) will take a really long time.
#### Google Crashpad
##### Install gyp
In Terminal go to **/Users/user/TBuild/Libraries** and run:
git clone git://repo.or.cz/openal-soft.git
cd openal-soft/build
cmake -D LIBTYPE:STRING=STATIC -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8 ..
make -j4
sudo make install
cd ..
git clone https://chromium.googlesource.com/external/gyp
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
@ -196,10 +85,6 @@ In Terminal go to **/Users/user/TBuild/Libraries** and run:
sudo ./setup.py install
cd ..
##### Build crashpad
In Terminal go to **/Users/user/TBuild/Libraries** and run:
git clone https://chromium.googlesource.com/crashpad/crashpad.git
cd crashpad
git checkout feb3aa3923
@ -212,23 +97,29 @@ In Terminal go to **/Users/user/TBuild/Libraries** and run:
git clone https://chromium.googlesource.com/external/github.com/google/googletest gtest
cd gtest
git checkout d62d6c6556
cd ../../../
cd ../../..
build/gyp_crashpad.py -Dmac_deployment_target=10.8
ninja -C out/Debug
ninja -C out/Release
cd ..
#### Prepare GYP
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 ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff && cd ..
In Terminal go to **/Users/user/TBuild/Libraries** and run
./configure -prefix "/usr/local/tdesktop/Qt-5.6.2" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang
make -j4
sudo make install
cd ..
cd gyp
git apply ../../tdesktop/Telegram/Patches/gyp.diff
### Building the project
### Building Telegram Desktop
In Terminal go to **/home/user/TBuild/tdesktop/Telegram** and run
Go to ***BuildPath*/tdesktop/Telegram** and run
gyp/refresh.sh
Then launch Xcode, open **/Users/user/TBuild/tdesktop/Telegram/Telegram.xcodeproj** and build for Debug / Release.
Then launch Xcode, open ***BuildPath*/tdesktop/Telegram/Telegram.xcodeproj** and build for Debug / Release.