Try to fix risc-v

This commit is contained in:
Andrea Cavalli 2023-05-14 14:41:59 +02:00
parent da24d314ea
commit cab5a3d8eb
4 changed files with 102 additions and 10 deletions

View File

@ -13,16 +13,19 @@ jobs:
strategy:
matrix:
include:
# todo: re-enable
# todo: broken ubuntu dependencies, accepting PRs
#- { os: ubuntu-22.04, type: "linux_386_ssl3" }
- { os: ubuntu-20.04, type: "linux_amd64_ssl1" }
- { os: ubuntu-22.04, type: "linux_amd64_ssl3" }
- { os: ubuntu-20.04, type: "linux_arm64_ssl1" }
- { os: ubuntu-22.04, type: "linux_arm64_ssl3" }
- { os: ubuntu-22.04, type: "linux_ppc64le_ssl3" }
#- { os: ubuntu-22.04, type: "linux_riscv64_ssl3" }
- { os: windows-2019, type: "windows_amd64", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static" }
- { os: macos-12, type: "macos_amd64" }
#- { os: ubuntu-20.04, type: "linux_amd64_ssl1" }
#- { os: ubuntu-22.04, type: "linux_amd64_ssl3" }
#- { os: ubuntu-20.04, type: "linux_arm64_ssl1" }
#- { os: ubuntu-22.04, type: "linux_arm64_ssl3" }
#- { os: ubuntu-22.04, type: "linux_ppc64le_ssl3" }
# todo: broken ubuntu dependencies, accepting PRs
- { os: ubuntu-22.04, type: "linux_riscv64_ssl3" }
#- { os: windows-2019, type: "windows_amd64", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static" }
#- { os: macos-12, type: "macos_amd64" }
# todo: do not enable until github actions adds support to apple silicon, accepting PRs
# - { os: macos-12, type: "macos_arm64" }
steps:
- name: Checkout current repo
uses: actions/checkout@v3

View File

@ -1,5 +1,5 @@
#!/bin/bash -ex
# Windows 2019
# MacOS 12
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
# Create missing dirs

View File

@ -0,0 +1,84 @@
#!/bin/bash -ex
# MacOS 12
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
# Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
mkdir -p implementations/tdlight/build implementations/tdlight/build/td_bin/bin implementations/tdlight/td_tools_build/java/it/tdlight/jni api/src/main/java-legacy/it/tdlight/jni api/src/main/java-sealed/it/tdlight/jni natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
# ccache
CCACHE=$(which sccache || true)
if [[ -x "$CCACHE" ]]; then
echo "found sccache: $CCACHE"
else
echo "sccache not found"
CCACHE=$(which ccache)
fi
# Build tdlib tools
cd implementations/tdlight/td_tools_build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
-DOPENSSL_USE_STATIC_LIBS=True \
-DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl/ \
-DCMAKE_C_FLAGS_RELEASE="" \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \
..
cmake --build . --target prepare_cross_compiling --parallel "$(nproc)"
cmake --build . --target td_generate_java_api --parallel "$(nproc)"
cd ../../../
# Generate TdApi.java
./implementations/tdlight/td_tools_build/td/generate/td_generate_java_api TdApi "./implementations/tdlight/td/generate/auto/tlo/td_api.tlo" "./natives/src/main/java" "it/tdlight/jni"
# Optimization flags
export CMAKE_C_FLAGS="${CMAKE_C_FLAGS}"
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
export CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -flto=thin -O3"
# Build tdlib
cd implementations/tdlight/build
INSTALL_PREFIX="$(greadlink -e ./td_bin/)"
INSTALL_BINDIR="$(greadlink -e ./td_bin/bin)"
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
-DOPENSSL_USE_STATIC_LIBS=True \
-DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl/ \
-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON \
-DTD_ENABLE_LTO=ON \
-DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
..
cmake --build . --target install --config Release --parallel "$(nproc)"
cd ../../../
cd natives/build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
-DOPENSSL_USE_STATIC_LIBS=True \
-DTD_GENERATED_BINARIES_DIR="$(greadlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
-DTD_SRC_DIR="$(greadlink -e ../../implementations/tdlight)" \
-DTD_ENABLE_LTO=ON \
-DTDNATIVES_BIN_DIR="$(greadlink -e ../tdjni_bin/)" \
-DTDNATIVES_DOCS_BIN_DIR="$(greadlink -e ../tdjni_docs/)" \
-DTd_DIR:PATH="$(greadlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
-DJAVA_SRC_DIR="$(greadlink -e ../src/main/java)" \
-DTDNATIVES_CPP_SRC_DIR="$(greadlink -e ../src/main/cpp)" \
../src/main/cpp
cmake --build . --target install --config Release --parallel "$(nproc)"
cd ..
mkdir -p src/main/resources/META-INF/tdlightjni/
mv tdjni_bin/tdjni.dylib src/main/resources/META-INF/tdlightjni/libtdjni.linux_arm64_ssl3.dylib
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_arm64_ssl3 package

View File

@ -0,0 +1,5 @@
#!/bin/bash -ex
brew update
brew install gperf cmake openssl coreutils
brew install openjdk
brew install freetype gd libtiff