2020-12-26 12:49:50 +01:00
|
|
|
#!/bin/bash -e
|
|
|
|
set -e
|
2021-09-11 12:46:42 +02:00
|
|
|
|
2020-12-26 12:55:05 +01: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"
|
2020-12-26 12:31:10 +01:00
|
|
|
|
2020-12-26 13:07:23 +01:00
|
|
|
echo "MATRIX_OS: $GH_MATRIX_OS"
|
|
|
|
echo "MATRIX_ARCH: $GH_MATRIX_ARCH"
|
2020-12-26 12:55:05 +01:00
|
|
|
|
2020-12-26 13:47:45 +01:00
|
|
|
if [ "$GH_MATRIX_OS" == "macos-10.15" ]; then
|
2020-12-26 12:55:05 +01:00
|
|
|
export PCRE="E"
|
|
|
|
else
|
|
|
|
export PCRE="r"
|
|
|
|
fi
|
|
|
|
|
2021-09-14 13:32:20 +02:00
|
|
|
GH_CPU_ARCH=$(echo "$GH_MATRIX_ARCH" | sed -$PCRE 's/^(linux\/|windows\/|macos\/)?(386|amd64|arm64|ppc64le|armhf|s390x)$/\2/g')
|
2021-09-14 02:58:39 +02:00
|
|
|
export GH_CPU_ARCH
|
2021-09-14 13:32:20 +02:00
|
|
|
GH_OS_NAME=$(echo "$GH_MATRIX_OS" | sed -$PCRE 's/^(linux|ubuntu|windows|macos).*$/\1/g')
|
|
|
|
if [[ $GH_OS_NAME == "ubuntu" ]]; then
|
|
|
|
GH_OS_NAME="linux"
|
2020-12-26 13:07:23 +01:00
|
|
|
fi
|
2021-09-14 13:32:20 +02:00
|
|
|
export GH_OS_NAME
|
2020-12-26 12:55:05 +01:00
|
|
|
|
|
|
|
if [[ "$GH_CPU_ARCH" == "arm64" ]]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="aarch64"
|
2021-09-14 13:32:20 +02:00
|
|
|
elif [[ "$GH_CPU_ARCH" == "armhf" ]]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="armhf"
|
|
|
|
elif [[ "$GH_CPU_ARCH" == "s390x" ]]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="s390x"
|
2020-12-26 12:55:05 +01:00
|
|
|
elif [[ "$GH_CPU_ARCH" == "386" ]]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="386"
|
|
|
|
elif [[ "$GH_CPU_ARCH" == "amd64" ]]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="amd64"
|
|
|
|
elif [[ "$GH_CPU_ARCH" == "ppc64le" ]]; then
|
|
|
|
export CPU_ARCHITECTURE_NAME="ppc64le"
|
|
|
|
else
|
|
|
|
echo "Unrecognized cpu arch: $GH_CPU_ARCH"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-03-19 19:26:56 +01:00
|
|
|
if [ -z "${CPU_CORES_NUM}" ]; then
|
2022-03-19 19:27:24 +01:00
|
|
|
export CPU_CORES_NUM="4"
|
2022-03-19 19:26:56 +01:00
|
|
|
fi
|
|
|
|
|
2020-12-26 12:55:05 +01:00
|
|
|
if [[ "$GH_OS_NAME" == "windows" ]]; then
|
|
|
|
export OPERATING_SYSTEM_NAME="windows"
|
|
|
|
export OPERATING_SYSTEM_NAME_SHORT="win"
|
|
|
|
elif [[ "$GH_OS_NAME" == "macos" ]]; then
|
|
|
|
export OPERATING_SYSTEM_NAME="osx"
|
|
|
|
export OPERATING_SYSTEM_NAME_SHORT="osx"
|
|
|
|
elif [[ "$GH_OS_NAME" == "linux" ]]; then
|
|
|
|
export OPERATING_SYSTEM_NAME="linux"
|
|
|
|
export OPERATING_SYSTEM_NAME_SHORT="linux"
|
|
|
|
else
|
|
|
|
echo "Unrecognized os name: $GH_OS_NAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "====== Setup variables ======"
|
2021-09-14 02:03:14 +02:00
|
|
|
if [[ "$OPERATING_SYSTEM_NAME" != "osx" ]]; then
|
|
|
|
echo "Current root directory:"
|
2021-09-14 01:58:13 +02:00
|
|
|
realpath .
|
|
|
|
fi
|
2020-12-26 12:55:05 +01:00
|
|
|
echo "============================="
|
|
|
|
|
|
|
|
# ====== OS Variables
|
|
|
|
if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then
|
2021-01-05 12:52:18 +01:00
|
|
|
export CMAKE_BUILD_TYPE=MinSizeRel
|
|
|
|
export BUILD_TYPE=MinSizeRel
|
2021-09-14 02:58:39 +02:00
|
|
|
VCPKG_DIR="$(realpath .)/vcpkg"
|
|
|
|
export VCPKG_DIR
|
2020-12-26 12:55:05 +01: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"
|
2021-09-14 15:03:15 +02:00
|
|
|
export PATH="$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-12-26 12:55:05 +01:00
|
|
|
export CPU_CORES=" -- -m"
|
|
|
|
elif [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
|
2021-01-05 12:52:18 +01:00
|
|
|
export BUILD_TYPE=MinSizeRel
|
2020-12-26 12:55:05 +01:00
|
|
|
export CMAKE_EXTRA_ARGUMENTS="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/"
|
|
|
|
export CPU_CORES=" -- -j${CPU_CORES_NUM}"
|
|
|
|
elif [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then
|
2021-01-05 12:52:18 +01:00
|
|
|
export BUILD_TYPE=MinSizeRel
|
2021-03-15 18:37:35 +01:00
|
|
|
|
2020-12-26 12:55:05 +01:00
|
|
|
export CPU_CORES=" -- -j${CPU_CORES_NUM}"
|
|
|
|
fi
|
|
|
|
|
2021-09-11 12:32:03 +02:00
|
|
|
cd ./scripts/core/
|
|
|
|
source ./setup-variables.sh
|
|
|
|
cd ../../
|
|
|
|
|
2020-12-26 12:55:05 +01:00
|
|
|
# ====== Print variables
|
|
|
|
echo "REVISION=${REVISION}"
|
2021-01-05 12:34:21 +01:00
|
|
|
echo "BUILD_TYPE=${BUILD_TYPE}"
|
2020-12-26 12:55:05 +01: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}"
|
|
|
|
echo "CMAKE_EXTRA_ARGUMENTS=${CMAKE_EXTRA_ARGUMENTS}"
|
|
|
|
echo "VCPKG_DIR=${VCPKG_DIR}"
|
|
|
|
echo "MAVEN_OPTS=${MAVEN_OPTS}"
|
|
|
|
echo "GH_CPU_ARCH=${GH_CPU_ARCH}"
|
|
|
|
echo "CPU_ARCHITECTURE_NAME=${CPU_ARCHITECTURE_NAME}"
|
|
|
|
echo "CPU_CORES_NUM=${CPU_CORES_NUM}"
|
|
|
|
echo "CPU_CORES=${CPU_CORES}"
|
|
|
|
echo "GH_OS_NAME=${GH_OS_NAME}"
|
|
|
|
echo "GH_MATRIX_ARCH=${GH_MATRIX_ARCH}"
|
|
|
|
echo "OPERATING_SYSTEM_NAME=${OPERATING_SYSTEM_NAME}"
|
|
|
|
echo "OPERATING_SYSTEM_NAME_SHORT=${OPERATING_SYSTEM_NAME_SHORT}"
|
|
|
|
echo "SRC_TDJNI_LIBNAME=${SRC_TDJNI_LIBNAME}"
|
|
|
|
echo "DEST_TDJNI_LIBNAME=${DEST_TDJNI_LIBNAME}"
|