73 lines
2.7 KiB
Bash
Raw Normal View History

#!/bin/bash -e
2020-08-18 14:40:21 +02:00
2020-08-19 00:24:53 +02:00
# ====== Variables
export TD_SRC_DIR=${PWD}/dependencies/tdlight
export TD_BIN_DIR=${PWD}/bin-td
export TDNATIVES_BIN_DIR=${PWD}/bin-tdnatives
export TDNATIVES_CPP_SRC_DIR=${PWD}/src/tdnatives-cpp
export TDNATIVES_DOCS_BIN_DIR=${PWD}/bin-docs
export TD_BUILD_DIR=${PWD}/build-td
export TDNATIVES_CPP_BUILD_DIR=${PWD}/build-tdnatives
export JAVA_SRC_DIR=${PWD}/src/tdnatives-java
export TDLIB_SERIALIZER_DIR=${PWD}/dependencies/tdlib-serializer
# ====== Print variables
echo "TD_SRC_DIR=${TD_SRC_DIR}"
echo "TD_BIN_DIR=${TD_BIN_DIR}"
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
2020-08-18 16:37:54 +02:00
2020-08-19 00:24:53 +02:00
# ====== OS Variables
2020-08-19 02:33:45 +02:00
export PATH="$PATH:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools:/c/ProgramData/chocolatey/lib/nasm/tools"
2020-08-18 20:16:17 +02:00
export JAVA_HOME="/c/Program Files/OpenJDK/openjdk-11.0.8_10"
2020-08-19 00:24:53 +02:00
# ====== Cleanup
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/TdApi.java || true
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/new_TdApi.java || true
# ====== Environment setup
2020-08-19 02:11:35 +02:00
mkdir -p $TRAVIS_BUILD_DIR/out || true
2020-08-19 00:24:53 +02:00
mkdir $TD_BUILD_DIR || true
mkdir $TDNATIVES_CPP_BUILD_DIR || true
2020-08-18 20:11:34 +02:00
choco install openjdk11 --version=11.0.8.10
2020-08-18 20:08:49 +02:00
choco install maven --version=3.6.3
2020-08-18 19:20:30 +02:00
choco install base64
2020-08-19 02:33:45 +02:00
choco install gperf
choco install strawberryperl
choco install nasm
2020-08-18 14:40:21 +02:00
2020-08-19 00:24:53 +02:00
# Install OpenSSL and ZLib
2020-08-18 15:40:22 +02:00
cd $TRAVIS_BUILD_DIR
2020-08-19 02:11:35 +02:00
# openssl
mkdir $TRAVIS_BUILD_DIR/openssl-root
git clone https://github.com/openssl/openssl.git -b OpenSSL_1_1_1-stable
cd openssl
perl Configure enable-static-engine enable-capieng no-ssl2 -utf-8 VC-WIN64A --prefix=$TRAVIS_BUILD_DIR/openssl-root --openssldir=$TRAVIS_BUILD_DIR/openssl-root no-shared
nmake
nmake install
cd ..
# zlib
cd $TRAVIS_BUILD_DIR
mkdir $TRAVIS_BUILD_DIR/zlib-root
git clone https://github.com/madler/zlib.git -b v1.2.11
cd zlib
cmake -DCMAKE_INSTALL_PREFIX:PATH=$TRAVIS_BUILD_DIR/zlib-root -DSKIP_BUILD_EXAMPLES=ON .
cmake --build . --target install
cd ..
ls $TRAVIS_BUILD_DIR/openssl-root
ls $TRAVIS_BUILD_DIR/zlib-root
2020-08-18 14:40:21 +02:00
2020-08-19 00:24:53 +02:00
# ====== Build Td
cd $TD_BUILD_DIR
2020-08-19 02:11:35 +02:00
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR}
2020-08-19 00:24:53 +02:00
cmake --build $TD_BUILD_DIR --target install
2020-08-18 14:40:21 +02:00
2020-08-19 00:24:53 +02:00
# ====== Build TdNatives
cd $TDNATIVES_CPP_BUILD_DIR
2020-08-19 02:11:35 +02:00
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR
2020-08-19 00:24:53 +02:00
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install
2020-08-18 14:40:21 +02:00
2020-08-19 00:24:53 +02:00
# ====== Copy output
2020-08-19 01:46:39 +02:00
mv $TDNATIVES_BIN_DIR/libtdjni.dll $TRAVIS_BUILD_DIR/out/libtdjni.dll