-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-tdlib.sh
23 lines (17 loc) · 1.29 KB
/
build-tdlib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
TZ=America/New_York
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -y && apt-get autoremove -y && apt-get install make git zlib1g-dev libssl-dev gperf php-cli cmake clang libc++-dev libc++abi-dev -y
clangVersion=$(clang --version | awk 'NR==1 {split($4, a, "."); print a[1]}')
cd /app
git clone https://github.com/tdlib/td.git
cd /app/td
rm -rf build && mkdir build && cd build
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib/Release -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-$clangVersion -DCMAKE_NM=/usr/bin/llvm-nm-$clangVersion -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-$clangVersion -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-$clangVersion ..
cmake --build . --target install
cd /app/td
rm -rf build && mkdir build && cd build
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=../tdlib/Debug -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-$clangVersion -DCMAKE_NM=/usr/bin/llvm-nm-$clangVersion -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-$clangVersion -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-$clangVersion ..
cmake --build . --target install
ls -alh /app/td/tdlib