-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-tdlib.sh
executable file
·39 lines (31 loc) · 1.18 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
rm -rf build/generate
rm -rf build/tdlib
mkdir -p build/generate
mkdir -p build/tdlib
TD_ROOT=$(realpath td/)
ZLIB_ROOT=$(realpath ./build/zlib/)
ZLIB_LIBRARIES=$ZLIB_ROOT/lib/libz.a
OPENSSL_ROOT=$(realpath ./build/crypto/)
OPENSSL_CRYPTO_LIBRARY=$OPENSSL_ROOT/lib/libcrypto.a
OPENSSL_SSL_LIBRARY=$OPENSSL_ROOT/lib/libssl.a
OPENSSL_OPTIONS="-DOPENSSL_FOUND=1 \
-DOPENSSL_ROOT_DIR=\"$OPENSSL_ROOT\" \
-DOPENSSL_INCLUDE_DIR=\"$OPENSSL_ROOT/include\" \
-DOPENSSL_CRYPTO_LIBRARY=\"$OPENSSL_CRYPTO_LIBRARY\" \
-DOPENSSL_SSL_LIBRARY=\"$OPENSSL_SSL_LIBRARY\" \
-DOPENSSL_LIBRARIES=\"$OPENSSL_SSL_LIBRARY;$OPENSSL_CRYPTO_LIBRARY\" \
-DOPENSSL_VERSION=\"1.1.1d\""
ZLIB_OPTION="-DZLIB_FOUND=1 \
-DZLIB_LIBRARIES=\"$ZLIB_LIBRARIES\" \
-DZLIB_INCLUDE_DIR=\"$ZLIB_ROOT/include\""
cd build/generate
cmake $TD_ROOT || exit 1
cd ../..
cd build/tdlib
eval cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=~/toolchain.cmake $OPENSSL_OPTIONS $ZLIB_OPTION $TD_ROOT || exit 1
cd ../..
echo "Generating TDLib autogenerated source files..."
cmake --build build/generate --target prepare_cross_compiling || exit 1
echo "Building TDLib to for Harmattan..."
cmake --build build/tdlib || exit 1