Bugfixes
This commit is contained in:
parent
d02a98b2fa
commit
4d25daccc3
34
.github/workflows/platform_natives.yaml
vendored
34
.github/workflows/platform_natives.yaml
vendored
@ -24,8 +24,8 @@ jobs:
|
||||
- {os: ubuntu-18.04, usedocker: "false", arch: "linux/s390x", implementation: "tdlib"}
|
||||
- {os: ubuntu-18.04, usedocker: "false", arch: "linux/ppc64le", implementation: "tdlight"}
|
||||
- {os: ubuntu-18.04, usedocker: "false", arch: "linux/ppc64le", implementation: "tdlib"}
|
||||
- {os: windows-2019, usedocker: "false", arch: "amd64", implementation: "tdlight", triplet: "x64-windows-static"}
|
||||
- {os: windows-2019, usedocker: "false", arch: "amd64", implementation: "tdlib", triplet: "x64-windows-static"}
|
||||
- {os: windows-2019, usedocker: "false", arch: "amd64", implementation: "tdlight", vcpkgCommitId: "30124253eecff36bc90f73341edbfb4f845e2a1e", triplet: "x64-windows-static"}
|
||||
- {os: windows-2019, usedocker: "false", arch: "amd64", implementation: "tdlib", vcpkgCommitId: "30124253eecff36bc90f73341edbfb4f845e2a1e", triplet: "x64-windows-static"}
|
||||
- {os: macos-10.15, usedocker: "false", arch: "amd64", implementation: "tdlight"}
|
||||
- {os: macos-10.15, usedocker: "false", arch: "amd64", implementation: "tdlib"}
|
||||
steps:
|
||||
@ -149,7 +149,9 @@ jobs:
|
||||
echo "TDNATIVES_CPP_BUILD_DIR=$TDNATIVES_CPP_BUILD_DIR" >> $GITHUB_ENV
|
||||
echo "JAVA_SRC_DIR=$JAVA_SRC_DIR" >> $GITHUB_ENV
|
||||
echo "TDLIB_SERIALIZER_DIR=$TDLIB_SERIALIZER_DIR" >> $GITHUB_ENV
|
||||
echo "PATH=$PATH" >> $GITHUB_ENV
|
||||
if [[ ! -z "$PATH" && "$OPERATING_SYSTEM_NAME" != "windows" ]]; then
|
||||
echo "PATH=$PATH" >> $GITHUB_ENV
|
||||
fi
|
||||
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
|
||||
echo "JAVA_INCLUDE_PATH=$JAVA_INCLUDE_PATH" >> $GITHUB_ENV
|
||||
echo "CMAKE_EXTRA_ARGUMENTS=$CMAKE_EXTRA_ARGUMENTS" >> $GITHUB_ENV
|
||||
@ -172,6 +174,28 @@ jobs:
|
||||
echo "REVISION: $REVISION"
|
||||
|
||||
source ./scripts/continuous-integration/github-workflows/install-dependencies.sh
|
||||
- name: Setup PHP with Readline extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
extensions: readline
|
||||
- name: Install MSVC
|
||||
if: matrix.os == 'windows-2019'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
vs-version: '[16.4,16.5)'
|
||||
- name: Setup cmake
|
||||
if: matrix.os == 'windows-2019'
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
with:
|
||||
cmake-version: '3.16.x'
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v4.2
|
||||
with:
|
||||
maven-version: 3.8.2
|
||||
- name: Setup NASM
|
||||
if: matrix.os == 'windows-2019'
|
||||
uses: ilammy/setup-nasm@v1
|
||||
- name: Restore artifacts, or setup vcpkg (do not install any package)
|
||||
if: matrix.os == 'windows-2019'
|
||||
uses: lukka/run-vcpkg@v7
|
||||
@ -179,12 +203,14 @@ jobs:
|
||||
# Just install vcpkg for now, do not install any ports in this step yet.
|
||||
setupOnly: true
|
||||
# Location of the vcpkg submodule in the Git repository.
|
||||
vcpkgDirectory: '${{ env.VCPKG_DIR }}'
|
||||
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
|
||||
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId}}'
|
||||
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
|
||||
# compute its hash and append this to the computed cache's key.
|
||||
appendedCacheKey: ${{ hashFiles( '**/vcpkg_manifest/vcpkg.json' ) }}
|
||||
vcpkgTriplet: ${{ matrix.triplet }}
|
||||
# Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed' directory.
|
||||
additionalCachedPaths: ${{ github.workspace }}/vcpkg
|
||||
- name: Install vcpkg deps
|
||||
if: matrix.os == 'windows-2019'
|
||||
run: |
|
||||
|
4
.github/workflows/tdapi_file.yaml
vendored
4
.github/workflows/tdapi_file.yaml
vendored
@ -82,7 +82,9 @@ jobs:
|
||||
echo "TDNATIVES_CPP_BUILD_DIR=$TDNATIVES_CPP_BUILD_DIR" >> $GITHUB_ENV
|
||||
echo "JAVA_SRC_DIR=$JAVA_SRC_DIR" >> $GITHUB_ENV
|
||||
echo "TDLIB_SERIALIZER_DIR=$TDLIB_SERIALIZER_DIR" >> $GITHUB_ENV
|
||||
echo "PATH=$PATH" >> $GITHUB_ENV
|
||||
if [[ ! -z "$PATH" ]]; then
|
||||
echo "PATH=$PATH" >> $GITHUB_ENV
|
||||
fi
|
||||
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
|
||||
echo "JAVA_INCLUDE_PATH=$JAVA_INCLUDE_PATH" >> $GITHUB_ENV
|
||||
echo "CMAKE_EXTRA_ARGUMENTS=$CMAKE_EXTRA_ARGUMENTS" >> $GITHUB_ENV
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -60,3 +60,5 @@ linux-generate-tdapi.sh
|
||||
win-build.sh
|
||||
win-deps.sh
|
||||
/.cache/
|
||||
|
||||
.idea/
|
||||
|
@ -4,62 +4,22 @@ set -e
|
||||
if [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then
|
||||
echo "==Linux===="
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y make git gperf cmake \
|
||||
ccache maven python3 python3-pip php-cli \
|
||||
sudo apt-get install -y make gperf \
|
||||
ccache python3 python3-pip php-cli \
|
||||
build-essential gcc-multilib g++-multilib
|
||||
|
||||
elif [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
|
||||
echo "==OSX======"
|
||||
export PYTHON=36
|
||||
brew install swig;
|
||||
#curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
|
||||
#source ./macports-ci install;
|
||||
#yes | sudo port install python$PYTHON;
|
||||
#yes | sudo port install py$PYTHON-pip;
|
||||
#sudo port select --set python3 python$PYTHON;
|
||||
#sudo port select --set pip pip$PYTHON;
|
||||
#pip install pyinstaller --user;
|
||||
#export PATH=$PATH:$(python3 -c "import site; print(site.USER_BASE)")/bin;
|
||||
brew install gperf openssl coreutils
|
||||
|
||||
## Precompile .tlo files because of a bug in travis/macOs
|
||||
#cd ./implementations/tdlight/td/generate/tl-parser/
|
||||
#echo "Configuring tl-parser"
|
||||
#./configure
|
||||
#echo "Compiling tl-parser"
|
||||
#make
|
||||
#cd ..
|
||||
#echo "Running tl-parser on mtproto_api"
|
||||
#./tl-parser/bin/tl-parser -v -e scheme/mtproto_api.tlo scheme/mtproto_api.tl
|
||||
#echo "Running tl-parser on secret_api"
|
||||
#./tl-parser/bin/tl-parser -v -e scheme/secret_api.tlo scheme/secret_api.tl
|
||||
#echo "Running tl-parser on telegram_api"
|
||||
#./tl-parser/bin/tl-parser -v -e scheme/telegram_api.tlo scheme/telegram_api.tl
|
||||
#echo "Running tl-parser on td_api"
|
||||
#./tl-parser/bin/tl-parser -v -e scheme/td_api.tlo scheme/td_api.tl
|
||||
#echo "Done .tlo"
|
||||
elif [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then
|
||||
echo "==Windows=="
|
||||
choco install ccache
|
||||
choco install make
|
||||
#choco install windows-sdk-10.1
|
||||
choco install visualstudio2019buildtools --version=16.10.4.0 --allow-downgrade --package-parameters "--passive"
|
||||
choco install visualstudio2019-workload-vctools
|
||||
#choco install openjdk11 --version=11.0.8.10
|
||||
choco install maven --version=3.8.2 --allow-downgrade
|
||||
#choco install visualstudio2019buildtools --version=16.10.4.0 --allow-downgrade --package-parameters "--passive"
|
||||
#choco install visualstudio2019-workload-vctools
|
||||
choco install base64
|
||||
choco install gperf
|
||||
choco install strawberryperl
|
||||
choco install nasm
|
||||
#choco install php --version=7.4.9 --package-parameters='"/ThreadSafe ""/InstallDir:C:\PHP"""'
|
||||
#choco install python3 --params "/InstallDir:C:\Python3"
|
||||
|
||||
#[ -d ./windowsenv/ ] && $(yes | rm -rf ./windowsenv/)
|
||||
#[ -d $VCPKG_DIR ] && $(yes | rm -rf $VCPKG_DIR)
|
||||
#git clone --depth=1 https://github.com/tdlight-team/windows-amd64-prebuilt-libraries.git windowsenv
|
||||
#mv windowsenv/vcpkg $VCPKG_DIR
|
||||
#cd $VCPKG_DIR
|
||||
#./vcpkg integrate install
|
||||
else
|
||||
echo "Unrecognized os: $OPERATING_SYSTEM_NAME"
|
||||
exit 1
|
||||
|
@ -71,7 +71,7 @@ if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then
|
||||
VCPKG_DIR="$(realpath .)/vcpkg"
|
||||
export VCPKG_DIR
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
export CPU_CORES=" -- -m"
|
||||
elif [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
|
||||
export BUILD_TYPE=MinSizeRel
|
||||
|
@ -76,6 +76,7 @@ deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bioni
|
||||
" | sudo tee /etc/apt/sources.list
|
||||
sudo dpkg --add-architecture "${CPU_ARCH_DPKG}"
|
||||
sudo apt-get update || true
|
||||
sudo apt-get install -y openjdk-8-jdk
|
||||
sudo apt-get install -y "libstdc++-8-dev-${CPU_ARCH_DPKG}-cross" "libstdc++-8-pic-${CPU_ARCH_DPKG}-cross"
|
||||
if [[ "${CPU_ARCHITECTURE_NAME}" != "amd64" && "${CPU_ARCHITECTURE_NAME}" != "386" ]]; then
|
||||
sudo apt-get install -y "crossbuild-essential-${CPU_ARCH_DPKG}"
|
||||
@ -145,34 +146,45 @@ deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bioni
|
||||
cd "$ROOT_DIR"
|
||||
{
|
||||
echo "set(CMAKE_SYSTEM_PROCESSOR ${CPU_ARCH_CMAKE})";
|
||||
echo "set(CMAKE_C_COMPILER ${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-gcc)";
|
||||
echo "set(CMAKE_C_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
echo "set(CMAKE_CXX_COMPILER ${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-g++)";
|
||||
echo "set(CMAKE_CXX_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
echo "set(CMAKE_ASM_COMPILER ${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-g++)";
|
||||
echo "set(CMAKE_ASM_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "386" ]] || [[ "$CPU_ARCHITECTURE_NAME" == "amd64" ]]; then
|
||||
echo "set(CMAKE_C_COMPILER gcc)";
|
||||
echo "set(CMAKE_C_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
echo "set(CMAKE_CXX_COMPILER g++)";
|
||||
echo "set(CMAKE_CXX_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
else
|
||||
echo "set(CMAKE_C_COMPILER ${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-gcc)";
|
||||
echo "set(CMAKE_C_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
echo "set(CMAKE_CXX_COMPILER ${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-g++)";
|
||||
echo "set(CMAKE_CXX_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
echo "set(CMAKE_ASM_COMPILER ${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-g++)";
|
||||
echo "set(CMAKE_ASM_COMPILER_TARGET ${CLANG_TRIPLE})";
|
||||
fi
|
||||
echo "set(CMAKE_LIBRARY_PATH \"$CROSS_BUILD_DEPS_DIR/\")";
|
||||
#echo "include_directories(\"${CROSS_BUILD_DEPS_DIR}\")";
|
||||
#echo "include_directories(\"${CROSS_BUILD_DEPS_DIR}/usr/include/\")";
|
||||
echo "include_directories(\"${CROSS_BUILD_DEPS_DIR}/usr/include/${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}/\")";
|
||||
echo "SET(CMAKE_FIND_ROOT_PATH \"$CROSS_BUILD_DEPS_DIR\" \"$JAVA_HOME\" \"/\" \"/usr/lib/jvm/java-8-openjdk-amd64/include\")";
|
||||
echo "include_directories(\"${CROSS_OPENJDK_PATH}/include\")";
|
||||
echo "include_directories(\"${CROSS_OPENJDK_PATH}/include/linux\")";
|
||||
#echo "set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES \"$CROSS_BUILD_DEPS_DIR/usr/include/\" \"${CROSS_BUILD_DEPS_DIR}/usr/include/${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}/\")";
|
||||
|
||||
echo "SET(CMAKE_FIND_ROOT_PATH \"$CROSS_BUILD_DEPS_DIR\" \"$JAVA_HOME\")";
|
||||
echo "SET(JAVA_HOME \"/usr/lib/jvm/java-8-openjdk-amd64/\")";
|
||||
echo "SET(JAVA_INCLUDE_PATH \"/usr/lib/jvm/java-8-openjdk-amd64/include\")";
|
||||
echo "SET(JAVA_AWT_INCLUDE_PATH \"/usr/lib/jvm/java-8-openjdk-amd64/include\")";
|
||||
echo "SET(JAVA_INCLUDE_PATH2 \"/usr/lib/jvm/java-8-openjdk-amd64/include/linux\")";
|
||||
#echo "SET(JAVA_JVM_LIBRARY \"/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so\")";
|
||||
#echo "SET(JAVA_AWT_LIBRARY \"/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libawt.so\")";
|
||||
|
||||
#echo "SET(JAVA_HOME \"$CROSS_OPENJDK_PATH\")";
|
||||
echo "SET(JAVA_INCLUDE_PATH \"$CROSS_OPENJDK_PATH/include\")";
|
||||
echo "SET(JAVA_INCLUDE_PATH2 \"$CROSS_OPENJDK_PATH/include/linux\")";
|
||||
echo "SET(JAVA_JVM_LIBRARY \"$CROSS_OPENJDK_PATH/lib/server/libjvm.so\")";
|
||||
echo "SET(JAVA_AWT_LIBRARY \"$CROSS_OPENJDK_PATH/lib/libawt.so\")";
|
||||
echo "SET(JNI_INCLUDE_DIRS \"$CROSS_OPENJDK_PATH/include\" \"$CROSS_OPENJDK_PATH/include/linux\")";
|
||||
echo "SET(JNI_LIBRARIES \"$CROSS_OPENJDK_PATH/lib/server/libjvm.so\" \"$CROSS_OPENJDK_PATH/lib/libawt.so\")";
|
||||
echo "SET(JNI_FOUND True)";
|
||||
echo "MESSAGE(STATUS \"JNI INCLUDE DIRS: \${JNI_INCLUDE_DIRS}\")";
|
||||
echo "MESSAGE(STATUS \"JNI LIBS: \${JNI_LIBRARIES}\")";
|
||||
#echo "SET(JAVA_AWT_LIBRARY \"$CROSS_OPENJDK_PATH\")";
|
||||
#echo "SET(JAVA_JVM_LIBRARY \"$CROSS_OPENJDK_PATH\")";
|
||||
#echo "SET(JAVA_AWT_INCLUDE_PATH \"$CROSS_OPENJDK_PATH\")";
|
||||
#echo "SET(JAVA_INCLUDE_PATH \"$CROSS_OPENJDK_PATH/include\")";
|
||||
#echo "SET(JAVA_INCLUDE_PATH2 \"$CROSS_OPENJDK_PATH/include/linux\")";
|
||||
echo "SET(JAVA_JVM_LIBRARY \"$CROSS_OPENJDK_PATH/jre/lib/${CPU_ARCH_JAVA_INTERNAL}/server/libjvm.so\")";
|
||||
echo "SET(JAVA_AWT_LIBRARY \"$CROSS_OPENJDK_PATH/jre/lib/${CPU_ARCH_JAVA_INTERNAL}/libawt.so\")";
|
||||
#echo "SET(JNI_INCLUDE_DIRS \"$CROSS_OPENJDK_PATH/include\" \"$CROSS_OPENJDK_PATH/include/linux\")";
|
||||
#echo "SET(Java_JAR_EXECUTABLE \"$CROSS_OPENJDK_PATH/bin/java\")";
|
||||
#echo "SET(Java_JAVAC_EXECUTABLE \"$CROSS_OPENJDK_PATH/bin/javac\")";
|
||||
#echo "SET(Java_JAVADOC_EXECUTABLE \"$CROSS_OPENJDK_PATH/bin/javadoc\")";
|
||||
#echo "SET(JNI_LIBRARIES \"$CROSS_OPENJDK_PATH/jre/lib/${CPU_ARCH_JAVA_INTERNAL}/server/libjvm.so\" \"$CROSS_OPENJDK_PATH/jre/lib/${CPU_ARCH_JAVA_INTERNAL}/libawt.so\")";
|
||||
#echo "SET(JNI_FOUND True)";
|
||||
#echo "MESSAGE(STATUS \"JNI INCLUDE DIRS: \${JNI_INCLUDE_DIRS}\")";
|
||||
#echo "MESSAGE(STATUS \"JNI LIBS: \${JNI_LIBRARIES}\")";
|
||||
cat <<EOF
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
|
@ -1,103 +1,103 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [[ "$CORE_VARIABLES_SET" == "YES" ]]; then
|
||||
exit 0
|
||||
if [[ "$CORE_VARIABLES_SET" != "YES" ]]; then
|
||||
echo "====== Setup variables ======"
|
||||
if [[ "$OPERATING_SYSTEM_NAME" != "osx" ]]; then
|
||||
echo "Current root directory:"
|
||||
realpath "."
|
||||
fi
|
||||
echo "============================="
|
||||
|
||||
# ====== CPU Architecture Variables
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "aarch64" ]]; then
|
||||
export CPU_ARCH_JAVA="arm64"
|
||||
export CPU_ARCH_JAVA_INTERNAL="aarch64"
|
||||
export CPU_ARCH_DPKG="arm64"
|
||||
export CPU_ARCH_CMAKE="aarch64"
|
||||
export CLANG_TRIPLE="aarch64-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "armhf" ]]; then
|
||||
export CPU_ARCH_JAVA="armhf"
|
||||
export CPU_ARCH_JAVA_INTERNAL="arm"
|
||||
export CPU_ARCH_DPKG="armhf"
|
||||
export CPU_ARCH_CMAKE="arm"
|
||||
export CLANG_TRIPLE="arm-linux-gnueabihf"
|
||||
export CPU_COMPILATION_TOOL="gnueabihf"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "s390x" ]]; then
|
||||
export CPU_ARCH_JAVA="s390x"
|
||||
export CPU_ARCH_JAVA_INTERNAL="s390x"
|
||||
export CPU_ARCH_DPKG="s390x"
|
||||
export CPU_ARCH_CMAKE="s390x"
|
||||
export CLANG_TRIPLE="s390x-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "386" ]]; then
|
||||
export CPU_ARCH_JAVA="386"
|
||||
export CPU_ARCH_JAVA_INTERNAL="i386"
|
||||
export CPU_ARCH_DPKG="i386"
|
||||
export CPU_ARCH_CMAKE="i686"
|
||||
export CLANG_TRIPLE="i386-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "amd64" ]]; then
|
||||
export CPU_ARCH_JAVA="amd64"
|
||||
export CPU_ARCH_JAVA_INTERNAL="amd64"
|
||||
export CPU_ARCH_DPKG="amd64"
|
||||
export CPU_ARCH_CMAKE="x86_64"
|
||||
export CLANG_TRIPLE="x86_64-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "ppc64le" ]]; then
|
||||
export CPU_ARCH_JAVA="ppc64le"
|
||||
export CPU_ARCH_JAVA_INTERNAL="ppc64le"
|
||||
export CPU_ARCH_DPKG="ppc64el"
|
||||
export CPU_ARCH_CMAKE="powerpc64le"
|
||||
export CLANG_TRIPLE="powerpc64-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
else
|
||||
echo "Unrecognized cpu arch: $CPU_ARCHITECTURE_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export CPU_CORES_NUM="2"
|
||||
|
||||
unset CROSS_BUILD_DEPS_DIR
|
||||
if [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "aarch64" ]]; then
|
||||
export CMAKE_EXTRA_ARGUMENTS="$CMAKE_EXTRA_ARGUMENTS"
|
||||
else
|
||||
export CMAKE_EXTRA_ARGUMENTS="$CMAKE_EXTRA_ARGUMENTS -DOPENSSL_USE_STATIC_LIBS=ON -DCMAKE_FIND_LIBRARY_SUFFIXES=\".a\""
|
||||
fi
|
||||
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "386" ]] || [[ "$CPU_ARCHITECTURE_NAME" == "armhf" ]]; then
|
||||
export CMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS -latomic"
|
||||
export LDFLAGS="$LDFLAGS -latomic"
|
||||
export CXXFLAGS="$CXXFLAGS -latomic"
|
||||
fi
|
||||
|
||||
export CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++"
|
||||
export CC="gcc"
|
||||
export CXX="g++"
|
||||
|
||||
export CROSS_CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++"
|
||||
export CROSS_CC="${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-gcc"
|
||||
export CROSS_CXX="${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-g++"
|
||||
|
||||
CROSS_BUILD_DEPS_DIR="$(realpath "../../")/.cache/tdlib-build-cross-${CPU_ARCH_DPKG}/"
|
||||
export CROSS_BUILD_DEPS_DIR
|
||||
fi
|
||||
|
||||
# ====== Print variables
|
||||
echo "========= Variables ========="
|
||||
echo "Variables"
|
||||
echo "CPU_ARCH_JAVA=${CPU_ARCH_JAVA}"
|
||||
echo "CPU_ARCH_DPKG=${CPU_ARCH_DPKG}"
|
||||
echo "CPU_ARCH_CMAKE=${CPU_ARCH_CMAKE}"
|
||||
echo "CLANG_TRIPLE=${CLANG_TRIPLE}"
|
||||
echo "CC=${CC}"
|
||||
echo "CXX=${CXX}"
|
||||
echo "CXXFLAGS=${CXXFLAGS}"
|
||||
echo "CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}"
|
||||
echo "CMAKE_EXTRA_ARGUMENTS=${CMAKE_EXTRA_ARGUMENTS}"
|
||||
echo "CROSS_BUILD_DEPS_DIR=${CROSS_BUILD_DEPS_DIR}"
|
||||
echo "============================="
|
||||
|
||||
export CORE_VARIABLES_SET="YES"
|
||||
fi
|
||||
|
||||
echo "====== Setup variables ======"
|
||||
if [[ "$OPERATING_SYSTEM_NAME" != "osx" ]]; then
|
||||
echo "Current root directory:"
|
||||
realpath "."
|
||||
fi
|
||||
echo "============================="
|
||||
|
||||
# ====== CPU Architecture Variables
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "aarch64" ]]; then
|
||||
export CPU_ARCH_JAVA="arm64"
|
||||
export CPU_ARCH_DPKG="arm64"
|
||||
export CPU_ARCH_CMAKE="aarch64"
|
||||
export CLANG_TRIPLE="aarch64-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
export CPU_CORES_NUM="2"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "armhf" ]]; then
|
||||
export CPU_ARCH_JAVA="armhf"
|
||||
export CPU_ARCH_DPKG="armhf"
|
||||
export CPU_ARCH_CMAKE="arm"
|
||||
export CLANG_TRIPLE="arm-linux-gnueabihf"
|
||||
export CPU_COMPILATION_TOOL="gnueabihf"
|
||||
export CPU_CORES_NUM="2"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "s390x" ]]; then
|
||||
export CPU_ARCH_JAVA="s390x"
|
||||
export CPU_ARCH_DPKG="s390x"
|
||||
export CPU_ARCH_CMAKE="s390x"
|
||||
export CLANG_TRIPLE="s390x-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
export CPU_CORES_NUM="2"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "386" ]]; then
|
||||
export CPU_ARCH_JAVA="386"
|
||||
export CPU_ARCH_DPKG="i386"
|
||||
export CPU_ARCH_CMAKE="i386"
|
||||
export CLANG_TRIPLE="i386-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
export CPU_CORES_NUM="2"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "amd64" ]]; then
|
||||
export CPU_ARCH_JAVA="amd64"
|
||||
export CPU_ARCH_DPKG="amd64"
|
||||
export CPU_ARCH_CMAKE="x86_64"
|
||||
export CLANG_TRIPLE="x86_64-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
export CPU_CORES_NUM="2"
|
||||
elif [[ "$CPU_ARCHITECTURE_NAME" == "ppc64le" ]]; then
|
||||
export CPU_ARCH_JAVA="ppc64le"
|
||||
export CPU_ARCH_DPKG="ppc64el"
|
||||
export CPU_ARCH_CMAKE="ppc64el"
|
||||
export CLANG_TRIPLE="powerpc64-linux-gnu"
|
||||
export CPU_COMPILATION_TOOL="gnu"
|
||||
export CPU_CORES_NUM="2"
|
||||
else
|
||||
echo "Unrecognized cpu arch: $CPU_ARCHITECTURE_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset CROSS_BUILD_DEPS_DIR
|
||||
if [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "aarch64" ]]; then
|
||||
export CMAKE_EXTRA_ARGUMENTS="$CMAKE_EXTRA_ARGUMENTS"
|
||||
else
|
||||
export CMAKE_EXTRA_ARGUMENTS="$CMAKE_EXTRA_ARGUMENTS -DOPENSSL_USE_STATIC_LIBS=ON -DCMAKE_FIND_LIBRARY_SUFFIXES=\".a\""
|
||||
fi
|
||||
|
||||
if [[ "$CPU_ARCHITECTURE_NAME" == "386" ]] || [[ "$CPU_ARCHITECTURE_NAME" == "armhf" ]]; then
|
||||
export CMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS -latomic"
|
||||
export LDFLAGS="$LDFLAGS -latomic"
|
||||
export CXXFLAGS="$CXXFLAGS -latomic"
|
||||
fi
|
||||
|
||||
export CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++"
|
||||
export CC="gcc"
|
||||
export CXX="g++"
|
||||
|
||||
export CROSS_CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++"
|
||||
export CROSS_CC="${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-gcc"
|
||||
export CROSS_CXX="${CPU_ARCH_CMAKE}-linux-${CPU_COMPILATION_TOOL}-g++"
|
||||
|
||||
CROSS_BUILD_DEPS_DIR="$(realpath "../../")/.cache/tdlib-build-cross-${CPU_ARCH_DPKG}/"
|
||||
export CROSS_BUILD_DEPS_DIR
|
||||
fi
|
||||
|
||||
# ====== Print variables
|
||||
echo "========= Variables ========="
|
||||
echo "Variables"
|
||||
echo "CPU_ARCH_JAVA=${CPU_ARCH_JAVA}"
|
||||
echo "CPU_ARCH_DPKG=${CPU_ARCH_DPKG}"
|
||||
echo "CPU_ARCH_CMAKE=${CPU_ARCH_CMAKE}"
|
||||
echo "CLANG_TRIPLE=${CLANG_TRIPLE}"
|
||||
echo "CC=${CC}"
|
||||
echo "CXX=${CXX}"
|
||||
echo "CXXFLAGS=${CXXFLAGS}"
|
||||
echo "CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}"
|
||||
echo "CMAKE_EXTRA_ARGUMENTS=${CMAKE_EXTRA_ARGUMENTS}"
|
||||
echo "CROSS_BUILD_DEPS_DIR=${CROSS_BUILD_DEPS_DIR}"
|
||||
echo "============================="
|
||||
|
||||
export CORE_VARIABLES_SET="YES"
|
||||
|
Loading…
Reference in New Issue
Block a user