diff --git a/scripts/continuous-integration/github-workflows/install-dependencies.sh b/scripts/continuous-integration/github-workflows/install-dependencies.sh index 158ed02..fa2311d 100755 --- a/scripts/continuous-integration/github-workflows/install-dependencies.sh +++ b/scripts/continuous-integration/github-workflows/install-dependencies.sh @@ -54,7 +54,7 @@ elif [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then #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 ./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 diff --git a/scripts/continuous-integration/github-workflows/setup-variables.sh b/scripts/continuous-integration/github-workflows/setup-variables.sh index 8b6b3df..78236a9 100644 --- a/scripts/continuous-integration/github-workflows/setup-variables.sh +++ b/scripts/continuous-integration/github-workflows/setup-variables.sh @@ -12,11 +12,14 @@ else export PCRE="r" fi -export GH_CPU_ARCH=$(echo $GH_MATRIX_ARCH | sed -$PCRE 's/^(linux\/|windows\/|macos\/)?(386|amd64|arm64|ppc64le|arm)(\/(v6|v7))?$/\2\4/g') -export GH_OS_NAME=$(echo $GH_MATRIX_ARCH | sed -$PCRE 's/^((linux)\/|(windows)\/|(macos)\/)?(386|amd64|arm64|ppc64le|arm)(\/(v6|v7))?$/\2\3\4/g') +GH_CPU_ARCH=$(echo "$GH_MATRIX_ARCH" | sed -$PCRE 's/^(linux\/|windows\/|macos\/)?(386|amd64|arm64|ppc64le|arm)(\/(v6|v7))?$/\2\4/g') +export GH_CPU_ARCH +GH_OS_NAME=$(echo "$GH_MATRIX_ARCH" | sed -$PCRE 's/^((linux)\/|(windows)\/|(macos)\/)?(386|amd64|arm64|ppc64le|arm)(\/(v6|v7))?$/\2\3\4/g') +export GH_OS_NAME if [[ -z "$GH_OS_NAME" ]]; then - export GH_OS_NAME=$(echo $GH_MATRIX_OS | sed -$PCRE 's/^([^-]+).*$/\1/g') + GH_OS_NAME=$(echo "$GH_MATRIX_OS" | sed -$PCRE 's/^([^-]+).*$/\1/g') + export GH_OS_NAME fi if [[ "$GH_CPU_ARCH" == "arm64" ]]; then @@ -67,7 +70,8 @@ echo "=============================" if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then export CMAKE_BUILD_TYPE=MinSizeRel export BUILD_TYPE=MinSizeRel - export VCPKG_DIR="$(realpath .)/vcpkg" + 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 CPU_CORES=" -- -m" diff --git a/scripts/core/compile_tdjni.sh b/scripts/core/compile_tdjni.sh index 0e2cf8e..15ed1c9 100755 --- a/scripts/core/compile_tdjni.sh +++ b/scripts/core/compile_tdjni.sh @@ -80,17 +80,18 @@ echo "Creating missing jni-src folders..." # Copy executables echo "Copying executables..." if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then - export TD_GENERATED_BINARIES_DIR=$(realpath -m ./generated/td_tools/td/generate/Release) + TD_GENERATED_BINARIES_DIR=$(realpath -m ./generated/td_tools/td/generate/Release) else - export TD_GENERATED_BINARIES_DIR=$(realpath -m ./generated/td_tools/td/generate) + TD_GENERATED_BINARIES_DIR=$(realpath -m ./generated/td_tools/td/generate) fi +export TD_GENERATED_BINARIES_DIR # Configure cmake echo "Configuring CMake..." cd ./generated/tdjni_build/ CMAKE_EXTRA_ARGUMENTS_TDJNI="" -if [[ -z "$CROSS_BUILD_DEPS_DIR" ]]; then +if [[ ! -z "$CROSS_BUILD_DEPS_DIR" ]]; then # shellcheck disable=SC2089 CMAKE_EXTRA_ARGUMENTS_TDJNI="${CMAKE_EXTRA_ARGUMENTS_TDJNI} -DCMAKE_TOOLCHAIN_FILE=${CROSS_BUILD_DEPS_DIR}/toolchain.cmake" fi @@ -99,16 +100,16 @@ fi cmake \ "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \ -DTD_GENERATED_BINARIES_DIR=${TD_GENERATED_BINARIES_DIR} \ - -DTD_SRC_DIR=$(realpath -m ../implementation/) \ - -DTDNATIVES_BIN_DIR=$(realpath -m ../tdjni_bin/) \ - -DTDNATIVES_DOCS_BIN_DIR=$(realpath -m ../tdjni_docs/) \ - -DTd_DIR=$(realpath -m ../td_bin/lib/cmake/Td/) \ - -DJAVA_SRC_DIR=$(realpath -m ../src/main/jni-java-src/) \ - -DTDNATIVES_CPP_SRC_DIR:PATH=$(realpath -m ../src/main/jni-cpp-src/) \ + "-DTD_SRC_DIR=$(realpath -m ../implementation/)" \ + "-DTDNATIVES_BIN_DIR=$(realpath -m ../tdjni_bin/)" \ + "-DTDNATIVES_DOCS_BIN_DIR=$(realpath -m ../tdjni_docs/)" \ + "-DTd_DIR=$(realpath -m ../td_bin/lib/cmake/Td/)" \ + "-DJAVA_SRC_DIR=$(realpath -m ../src/main/jni-java-src/)" \ + "-DTDNATIVES_CPP_SRC_DIR:PATH=$(realpath -m ../src/main/jni-cpp-src/)" \ -DOPENSSL_USE_STATIC_LIBS=True \ ${CMAKE_EXTRA_ARGUMENTS_TDJNI} \ ${CMAKE_EXTRA_ARGUMENTS} \ - $(realpath -m ../src/main/jni-cpp-src/) + "$(realpath -m ../src/main/jni-cpp-src/)" # Build echo "Compiling ${IMPLEMENTATION_NAME} jni..." diff --git a/scripts/core/configure_td.sh b/scripts/core/configure_td.sh index 5755083..e29754c 100755 --- a/scripts/core/configure_td.sh +++ b/scripts/core/configure_td.sh @@ -55,16 +55,18 @@ echo "Creating missing folders..." # Configure cmake echo "Configuring CMake..." cd ./generated/td_build/ -export CMAKE_EXTRA_ARGUMENTS_TD; + if [[ "$IMPLEMENTATION_NAME" = "tdlight" ]]; then CMAKE_EXTRA_ARGUMENTS_TD="-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON" else CMAKE_EXTRA_ARGUMENTS_TD="" fi -if [[ -z "$CROSS_BUILD_DEPS_DIR" ]]; then +if [[ ! -z "$CROSS_BUILD_DEPS_DIR" ]]; then # shellcheck disable=SC2089 CMAKE_EXTRA_ARGUMENTS_TD="${CMAKE_EXTRA_ARGUMENTS_TD} -DCMAKE_TOOLCHAIN_FILE=${CROSS_BUILD_DEPS_DIR}/toolchain.cmake" fi +export CMAKE_EXTRA_ARGUMENTS_TD + INSTALL_PREFIX="$(realpath -m ../td_bin/)" INSTALL_BINDIR="$(realpath -m ../td_bin/bin)" echo "Install prefix: $INSTALL_PREFIX" diff --git a/scripts/core/generate_tdapi_java_file.sh b/scripts/core/generate_tdapi_java_file.sh index afd030e..106cfb8 100755 --- a/scripts/core/generate_tdapi_java_file.sh +++ b/scripts/core/generate_tdapi_java_file.sh @@ -66,12 +66,14 @@ echo "Creating missing folders..." # Copy executables echo "Copying executables..." -export TD_GENERATED_BINARIES_DIR; + if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then TD_GENERATED_BINARIES_DIR="$(realpath -m ./generated/td_tools/td/generate/Release)" else TD_GENERATED_BINARIES_DIR="$(realpath -m ./generated/td_tools/td/generate)" fi +export TD_GENERATED_BINARIES_DIR + # Configure cmake echo "Configuring CMake..." cd ./generated/ diff --git a/scripts/core/setup-variables.sh b/scripts/core/setup-variables.sh index fb84768..5c42856 100755 --- a/scripts/core/setup-variables.sh +++ b/scripts/core/setup-variables.sh @@ -50,7 +50,6 @@ else fi unset CROSS_BUILD_DEPS_DIR -export CROSS_BUILD_DEPS_DIR if [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then if [[ "$CPU_ARCHITECTURE_NAME" == "aarch64" ]]; then export CMAKE_EXTRA_ARGUMENTS="$CMAKE_EXTRA_ARGUMENTS" @@ -73,6 +72,7 @@ if [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then export CROSS_CXX="${CPU_ARCH_CMAKE}-linux-gnu-g++" CROSS_BUILD_DEPS_DIR="$(realpath "../../")/.cache/tdlib-build-cross-${CPU_ARCH_DPKG}/" + export CROSS_BUILD_DEPS_DIR fi # ====== Print variables