2020-10-10 04:03:20 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# ====== Variables
|
2020-10-11 17:52:48 +02:00
|
|
|
export REVISION=$TRAVIS_BUILD_NUMBER
|
2020-10-10 04:03:20 +02:00
|
|
|
export MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
|
|
|
|
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="aarch64"
|
2020-10-10 15:32:45 +02:00
|
|
|
export CPU_CORES_NUM="2"
|
2020-10-10 04:03:20 +02:00
|
|
|
else
|
|
|
|
CPU_ARCHITECTURE_NAME="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
|
|
|
|
export CPU_ARCHITECTURE_NAME;
|
2020-10-10 15:32:45 +02:00
|
|
|
export CPU_CORES_NUM="2"
|
2020-10-10 04:03:20 +02:00
|
|
|
fi
|
|
|
|
OPERATING_SYSTEM_NAME="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_OS_NAME}")"
|
|
|
|
export OPERATING_SYSTEM_NAME
|
|
|
|
if [ "$OPERATING_SYSTEM_NAME" = "windows" ]; then
|
|
|
|
export OPERATING_SYSTEM_NAME_SHORT="win"
|
|
|
|
else
|
|
|
|
export OPERATING_SYSTEM_NAME_SHORT=$OPERATING_SYSTEM_NAME
|
|
|
|
fi
|
|
|
|
|
2020-10-10 22:25:34 +02:00
|
|
|
echo "====== Setup variables ======"
|
|
|
|
echo "Current root directory:"
|
|
|
|
echo "$(realpath .)"
|
|
|
|
echo "============================="
|
|
|
|
|
2020-10-10 04:03:20 +02:00
|
|
|
# ====== OS Variables
|
|
|
|
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
|
2020-10-10 22:52:29 +02:00
|
|
|
export VCPKG_DIR="$(realpath .)/vcpkg"
|
2020-10-11 02:19:36 +02:00
|
|
|
export CMAKE_EXTRA_ARGUMENTS="-A x64 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DOPENSSL_USE_STATIC_LIBS=ON"
|
2020-10-11 12:07:51 +02:00
|
|
|
export PATH="/c/Python3:$PATH:/c/tools/php74:/c/PHP:/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/Program Files/CMake/bin:/c/ProgramData/chocolatey/bin:/c/Program Files/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools:/c/Program Files/NASM"
|
2020-10-10 04:03:20 +02:00
|
|
|
export JAVA_HOME="/c/Program Files/OpenJDK/openjdk-11.0.8_10"
|
2020-10-11 03:20:34 +02:00
|
|
|
export CPU_CORES=" -- -m"
|
2020-10-11 01:17:21 +02:00
|
|
|
export CMAKE_BUILD_TYPE=Release
|
2020-10-10 04:03:20 +02:00
|
|
|
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
2020-10-11 12:07:51 +02:00
|
|
|
export CMAKE_EXTRA_ARGUMENTS="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/"
|
2020-10-10 15:08:26 +02:00
|
|
|
export PATH="$PATH:$(/usr/libexec/java_home -v 14)"
|
|
|
|
export JAVA_HOME="$(/usr/libexec/java_home -v 14)"
|
|
|
|
export JAVA_INCLUDE_PATH="$(/usr/libexec/java_home -v 14)/include"
|
2020-10-10 15:32:45 +02:00
|
|
|
export CPU_CORES=" -- -j${CPU_CORES_NUM}"
|
2020-10-10 04:03:20 +02:00
|
|
|
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
2020-10-11 23:46:09 +02:00
|
|
|
export CMAKE_EXTRA_ARGUMENTS="-DOPENSSL_USE_STATIC_LIBS=ON -DCMAKE_FIND_LIBRARY_SUFFIXES=\".a\""
|
2020-10-10 15:08:26 +02:00
|
|
|
export TRAVIS_CPU_ARCH_JAVA="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
|
2020-10-10 19:25:31 +02:00
|
|
|
export PATH="$PATH:/usr/lib/jvm/java-11-openjdk-$TRAVIS_CPU_ARCH_JAVA/bin"
|
|
|
|
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$TRAVIS_CPU_ARCH_JAVA"
|
|
|
|
export JAVA_INCLUDE_PATH="/usr/lib/jvm/java-11-openjdk-$TRAVIS_CPU_ARCH_JAVA/include"
|
2020-10-10 15:32:45 +02:00
|
|
|
export CPU_CORES=" -- -j${CPU_CORES_NUM}"
|
2020-10-11 23:46:09 +02:00
|
|
|
export CXXFLAGS="-static-libgcc -static-libstdc++"
|
2020-10-10 19:42:40 +02:00
|
|
|
export CC="/usr/bin/clang-10"
|
|
|
|
export CXX="/usr/bin/clang++-10"
|
2020-10-12 01:16:42 +02:00
|
|
|
if [[ "$CPU_ARCHITECTURE_NAME" = "aarch64" ]]; then
|
|
|
|
export CMAKE_EXTRA_ARGUMENTS="-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DPOSITION_INDEPENDENT_CODE=ON $CMAKE_EXTRA_ARGUMENTS"
|
|
|
|
export CMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS -f"
|
|
|
|
export CFLAGS="-fPIC"
|
|
|
|
fi
|
2020-10-10 04:03:20 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# ====== Print variables
|
2020-10-11 17:52:48 +02:00
|
|
|
echo "REVISION=${REVISION}"
|
2020-10-10 04:03:20 +02:00
|
|
|
echo "TD_SRC_DIR=${TD_SRC_DIR}"
|
|
|
|
echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
|
|
|
echo "TDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR}"
|
|
|
|
echo "TDNATIVES_CPP_SRC_DIR=${TDNATIVES_CPP_SRC_DIR}"
|
|
|
|
echo "TDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR}"
|
|
|
|
echo "TD_BUILD_DIR=${TD_BUILD_DIR}"
|
|
|
|
echo "TDNATIVES_CPP_BUILD_DIR=${TDNATIVES_CPP_BUILD_DIR}"
|
|
|
|
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
|
|
|
echo "TDLIB_SERIALIZER_DIR=${TDLIB_SERIALIZER_DIR}"
|
|
|
|
echo "PATH=${PATH}"
|
|
|
|
echo "JAVA_HOME=${JAVA_HOME}"
|
|
|
|
echo "JAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH}"
|
2020-10-10 15:08:26 +02:00
|
|
|
echo "CMAKE_EXTRA_ARGUMENTS=${CMAKE_EXTRA_ARGUMENTS}"
|
2020-10-10 04:03:20 +02:00
|
|
|
echo "VCPKG_DIR=${VCPKG_DIR}"
|
|
|
|
echo "MAVEN_OPTS=${MAVEN_OPTS}"
|
|
|
|
echo "TRAVIS_CPU_ARCH=${TRAVIS_CPU_ARCH}"
|
|
|
|
echo "TRAVIS_CPU_ARCH_JAVA=${TRAVIS_CPU_ARCH_JAVA}"
|
2020-10-10 15:08:26 +02:00
|
|
|
echo "CPU_ARCHITECTURE_NAME=${CPU_ARCHITECTURE_NAME}"
|
2020-10-10 15:32:45 +02:00
|
|
|
echo "CPU_CORES_NUM=${CPU_CORES_NUM}"
|
2020-10-10 15:08:26 +02:00
|
|
|
echo "CPU_CORES=${CPU_CORES}"
|
2020-10-10 04:03:20 +02:00
|
|
|
echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
|
2020-10-10 15:08:26 +02:00
|
|
|
echo "OPERATING_SYSTEM_NAME=${OPERATING_SYSTEM_NAME}"
|
|
|
|
echo "OPERATING_SYSTEM_NAME_SHORT=${OPERATING_SYSTEM_NAME}"
|
2020-10-10 04:03:20 +02:00
|
|
|
echo "SRC_TDJNI_LIBNAME=${SRC_TDJNI_LIBNAME}"
|
|
|
|
echo "DEST_TDJNI_LIBNAME=${DEST_TDJNI_LIBNAME}"
|