Rewrite build system
This commit is contained in:
parent
9d8e67cd2f
commit
7d6c17f386
27
.docker/SymlinkPrefix.javash
Executable file
27
.docker/SymlinkPrefix.javash
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/java --source 11
|
||||
import java.io.IOException; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes;
|
||||
public class Main {
|
||||
/** @param args directory, sourcePrefix, targetPrefix */
|
||||
public static void main(String[] args) throws IOException {
|
||||
Path dir = Path.of(args[0]).toAbsolutePath().normalize();
|
||||
Path sourcePrefix = dir.resolve(Path.of(args[1])).normalize();
|
||||
Path targetPrefix = dir.resolve(Path.of(args[2])).normalize();
|
||||
System.out.printf("Replacing symlinks in '%s' from '%s' to '%s'%n", dir, sourcePrefix, targetPrefix);
|
||||
Files.walkFileTree(dir, new SimpleFileVisitor<>() {
|
||||
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (attrs.isSymbolicLink()) {
|
||||
var originalTarget = Files.readSymbolicLink(file).normalize();
|
||||
if (originalTarget.startsWith(sourcePrefix)) {
|
||||
var symlinkFileDir = file.getParent();
|
||||
originalTarget = symlinkFileDir.resolve(originalTarget);
|
||||
Files.delete(file);
|
||||
var target = symlinkFileDir.relativize(targetPrefix.resolve(sourcePrefix.relativize(originalTarget))).normalize();
|
||||
Files.createSymbolicLink(file, target);
|
||||
System.out.printf("Symlink at '%s' pointing at '%s' is now pointing at '%s'%n", file, originalTarget, target);
|
||||
}
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
10
.docker/downloadthis.sh
Executable file
10
.docker/downloadthis.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash -ex
|
||||
export PREV="$(pwd)"
|
||||
in=(${2//:/ })
|
||||
tmpdir="$1/${in[1]:-"default"}/`cat /etc/os-release | md5sum --binary | awk '{ print $1 }'`"
|
||||
mkdir -p "$tmpdir"
|
||||
cd "$tmpdir"
|
||||
apt-get download "$2"
|
||||
filename="$(find . -type f -name "${in[0]}_*_${in[1]:-"amd64"}.deb" | sort | tail -n1)"
|
||||
dpkg -x "$filename" "$3"
|
||||
cd "$PREV"
|
12
.docker/install-sccache.sh
Executable file
12
.docker/install-sccache.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash -ex
|
||||
if [ ! -f /opt/sccache/sccache ]; then
|
||||
apt-get --assume-yes update
|
||||
apt-get --assume-yes install wget
|
||||
wget https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz
|
||||
tar xzf sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz
|
||||
rm sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz
|
||||
mkdir -p /opt/sccache/
|
||||
mv sccache-v0.5.4-x86_64-unknown-linux-musl/sccache /opt/sccache/sccache
|
||||
rm -r sccache-v0.5.4-x86_64-unknown-linux-musl
|
||||
chmod +x /opt/sccache/sccache
|
||||
fi
|
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
!/.docker
|
||||
!/api
|
||||
!/implementations
|
||||
!/natives
|
||||
!/tdlib-serializer
|
136
.github/workflows/platform_natives.yaml
vendored
136
.github/workflows/platform_natives.yaml
vendored
@ -13,18 +13,18 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# 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_amd64_gcc_ssl1" }
|
||||
- { os: ubuntu-22.04, type: "linux_amd64_gcc_ssl3" }
|
||||
- { os: ubuntu-20.04, type: "linux_arm64_ssl1" }
|
||||
- { os: ubuntu-22.04, type: "linux_arm64_ssl3" }
|
||||
- { os: ubuntu-22.04, type: "linux_armhf_ssl3" }
|
||||
- { os: ubuntu-22.04, type: "linux_ppc64le_ssl3" }
|
||||
# todo: broken ubuntu dependencies, accepting PRs
|
||||
#- { os: ubuntu-22.04, type: "linux_riscv64_ssl3" }
|
||||
- { os: ubuntu-22.04, type: "linux_amd64_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "amd64", tripleArch: "x86_64", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_amd64_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "amd64", tripleArch: "x86_64", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_amd64_clang_ssl3", compiler: "clang", ssl: "ssl3", debianArch: "amd64", tripleArch: "x86_64", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_i386_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "i386", tripleArch: "i386", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_i386_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "i386", tripleArch: "i386", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_ppc64el_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "ppc64el", tripleArch: "powerpc64le", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_riscv64_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "riscv64", tripleArch: "riscv64", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_armhf_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "armhf", tripleArch: "arm", tripleGnu: "gnueabihf" }
|
||||
- { os: ubuntu-22.04, type: "linux_armhf_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "armhf", tripleArch: "arm", tripleGnu: "gnueabihf" }
|
||||
- { os: ubuntu-22.04, type: "linux_arm64_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "arm64", tripleArch: "aarch64", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_arm64_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "arm64", tripleArch: "aarch64", tripleGnu: "gnu" }
|
||||
- { os: ubuntu-22.04, type: "linux_arm64_clang_ssl3", compiler: "clang", ssl: "ssl3", debianArch: "arm64", tripleArch: "aarch64", tripleGnu: "gnu" }
|
||||
- { 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
|
||||
@ -54,6 +54,11 @@ jobs:
|
||||
VERSION=$(echo "$VERSION" | awk '{print tolower($0)}')
|
||||
TYPE=${{ matrix.type }}
|
||||
SAFE_TYPE=${TYPE///} # linux_amd64_ -> linux_amd64_
|
||||
COMPILER=${{ matrix.compiler }}
|
||||
SSL=${{ matrix.ssl }}
|
||||
DEBIAN_ARCH=${{ matrix.debianArch }}
|
||||
TRIPLE_ARCH=${{ matrix.tripleArch }}
|
||||
TRIPLE_GNU=${{ matrix.tripleGnu }}
|
||||
|
||||
REVISION=4.0.${{ github.run_number }}
|
||||
GH_MATRIX_OS=${{ matrix.os }}
|
||||
@ -64,7 +69,10 @@ jobs:
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "TYPE=$TYPE" >> $GITHUB_ENV
|
||||
echo "SAFE_TYPE=$SAFE_TYPE" >> $GITHUB_ENV
|
||||
echo "SSL_TYPE=$SSL_TYPE" >> $GITHUB_ENV
|
||||
echo "SSL=$SSL" >> $GITHUB_ENV
|
||||
echo "DEBIAN_ARCH=$DEBIAN_ARCH" >> $GITHUB_ENV
|
||||
echo "TRIPLE_ARCH=$TRIPLE_ARCH" >> $GITHUB_ENV
|
||||
echo "TRIPLE_GNU=$TRIPLE_GNU" >> $GITHUB_ENV
|
||||
echo "REVISION=$REVISION" >> $GITHUB_ENV
|
||||
echo "GH_MATRIX_OS=$GH_MATRIX_OS" >> $GITHUB_ENV
|
||||
echo "GH_MATRIX_TYPE=$GH_MATRIX_TYPE" >> $GITHUB_ENV
|
||||
@ -73,22 +81,16 @@ jobs:
|
||||
echo "hash version: $HASH_VERSION"
|
||||
echo "version: $VERSION"
|
||||
echo "safe arch: $SAFE_ARCH"
|
||||
echo "ssl type: $SSL_TYPE"
|
||||
echo "ssl: $SSL"
|
||||
echo "debian arch: $DEBIAN_ARCH"
|
||||
echo "triple arch: $TRIPLE_ARCH"
|
||||
echo "triple gnu: $TRIPLE_GNU"
|
||||
|
||||
echo "Variables:"
|
||||
|
||||
# Save env to file
|
||||
cat $GITHUB_ENV > github.env
|
||||
|
||||
- name: Cache packages cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/tdlight-java-natives/tdlight-java-natives/.cache
|
||||
key: ${{ runner.os }}-v3-packages-${{ env.SAFE_TYPE }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-v3-packages-${{ env.SAFE_TYPE }}-
|
||||
|
||||
|
||||
- name: Setup Java (Snapshot)
|
||||
if: github.ref == 'refs/heads/develop'
|
||||
uses: actions/setup-java@v3
|
||||
@ -115,33 +117,34 @@ jobs:
|
||||
with:
|
||||
php-version: '8.0'
|
||||
extensions: readline
|
||||
- name: Install ubuntu 20.04 dependencies
|
||||
if: matrix.os == 'ubuntu-20.04'
|
||||
shell: bash
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get --assume-yes update
|
||||
sudo apt-get --assume-yes install make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-12 lld-12 libc++-12-dev libc++abi-12-dev libgcc-9-dev libunwind-dev libclang-common-12-dev ccache maven aptitude
|
||||
# - name: Install ubuntu 20.04 dependencies (cached)
|
||||
# - name: Install ubuntu 20.04 dependencies
|
||||
# if: matrix.os == 'ubuntu-20.04'
|
||||
# uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
# with:
|
||||
# packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-12 lld-12 libc++-12-dev libc++abi-12-dev libgcc-9-dev libunwind-dev libclang-common-12-dev ccache maven
|
||||
# version: 1.0
|
||||
- name: Install ubuntu 22.04 dependencies
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
shell: bash
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get --assume-yes update
|
||||
sudo apt-get --assume-yes install make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 lld-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev ccache maven aptitude
|
||||
# - name: Install ubuntu 22.04 dependencies (cached)
|
||||
# shell: bash
|
||||
# run: |
|
||||
# export DEBIAN_FRONTEND=noninteractive
|
||||
# sudo apt-get --assume-yes update
|
||||
# sudo apt-get --assume-yes install make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-12 lld-12 libc++-12-dev libc++abi-12-dev libgcc-9-dev libunwind-dev libclang-common-12-dev maven
|
||||
- name: Install ubuntu 20.04 dependencies (cached)
|
||||
if: matrix.os == 'ubuntu-20.04'
|
||||
uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-12 lld-12 libc++-12-dev libc++abi-12-dev libgcc-9-dev libunwind-dev libclang-common-12-dev maven
|
||||
version: 1.0
|
||||
# - name: Install ubuntu 22.04 dependencies
|
||||
# if: matrix.os == 'ubuntu-22.04'
|
||||
# uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
# with:
|
||||
# packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 lld-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev ccache maven
|
||||
# version: 1.0
|
||||
# shell: bash
|
||||
# run: |
|
||||
# export DEBIAN_FRONTEND=noninteractive
|
||||
# sudo apt-get --assume-yes update
|
||||
# sudo apt-get --assume-yes install make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 lld-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev maven
|
||||
- name: Install ubuntu 22.04 dependencies (cached)
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 lld-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev maven
|
||||
version: 1.0
|
||||
- name: Install custom dependencies
|
||||
if: matrix.os == 'macos-12' || matrix.os == 'windows-2019'
|
||||
shell: bash
|
||||
run: |
|
||||
set -xeo pipefail
|
||||
@ -156,8 +159,6 @@ jobs:
|
||||
fi
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.3
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
- name: Install MSVC
|
||||
if: matrix.os == 'windows-2019'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
@ -195,11 +196,8 @@ jobs:
|
||||
set -xeo pipefail
|
||||
./vcpkg/vcpkg install gperf openssl:x64-windows-static zlib:x64-windows-static
|
||||
shell: bash
|
||||
|
||||
- name: Setup tmate session
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
|
||||
- name: Build
|
||||
if: matrix.os == 'macos-12' || matrix.os == 'windows-2019'
|
||||
shell: bash
|
||||
run: |
|
||||
set -xeo pipefail
|
||||
@ -207,7 +205,37 @@ jobs:
|
||||
|
||||
source ./.github/workflows/scripts/build_${SAFE_TYPE}.sh
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
SCCACHE_GHA_ENABLED: "on"
|
||||
- name: Set up Docker buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v4
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
file: tdlight.arch.${{SSL}}.${{COMPILER}}.dockerfile
|
||||
tags: tdlight.${{DEBIAN_ARCH}}.${{SSL}}.${{COMPILER}}
|
||||
build-args: |
|
||||
SCCACHE_GHA_ENABLED=on
|
||||
ACTIONS_CACHE_URL=${{ACTIONS_CACHE_URL}}
|
||||
ACTIONS_RUNTIME_TOKEN=${{ACTIONS_RUNTIME_TOKEN}}
|
||||
ARCH_DEBIAN=${{DEBIAN_ARCH}}
|
||||
ARCH_TRIPLE=${{TRIPLE_ARCH}}
|
||||
TRIPLE_GNU=${{TRIPLE_GNU}}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
- name: Build
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
shell: bash
|
||||
run: |
|
||||
set -xeo pipefail
|
||||
echo "REVISION: $REVISION"
|
||||
|
||||
rm -rf natives
|
||||
docker cp "tdlight.${DEBIAN_ARCH}.${SSL}.${COMPILER}:/out/natives" "natives"
|
||||
docker cp "tdlight.${DEBIAN_ARCH}.${SSL}.${COMPILER}:/out/libtdjni.so" "libtdjni.${env.REVISION}-${env.TYPE}.so"
|
||||
docker cp "tdlight.${DEBIAN_ARCH}.${SSL}.${COMPILER}:/out/tdlight-natives.jar" "natives/target-${TYPE}/tdlight-natives-${REVISION}-${TYPE}.jar"
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: tdlight-natives-${{env.REVISION}}-${{env.TYPE}}.jar
|
||||
|
@ -1,70 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04+
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
|
||||
#export CC="ccache /usr/bin/clang"
|
||||
#export CXX="ccache /usr/bin/clang++"
|
||||
export CC="ccache cc"
|
||||
export CXX="ccache g++"
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
# Build tdlib tools
|
||||
cd implementations/tdlight/td_tools_build
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-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_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14 -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_MINSIZEREL="${CMAKE_CXX_FLAGS_MINSIZEREL} -flto=thin -O3"
|
||||
|
||||
# Build tdlib
|
||||
cd implementations/tdlight/build
|
||||
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-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=MinSizeRel \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR=../../implementations/tdlight \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="../src/main/java" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="../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/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_amd64_ssl3.so
|
||||
mvn package -Dnative.type.classifier=linux_amd64_ssl3 -Drevision="$REVISION"
|
@ -1,99 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_i386.cmake)"
|
||||
|
||||
# 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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_386_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_386_ssl3 package
|
@ -1,91 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 20.04
|
||||
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_C_FLAGS="${CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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 -fuse-linker-plugin -Os"
|
||||
|
||||
# Build tdlib
|
||||
cd implementations/tdlight/build
|
||||
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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_C_FLAGS="${CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -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/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_amd64_gcc_ssl1.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_amd64_gcc_ssl1 package
|
@ -1,91 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
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_C_FLAGS="${CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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 -fuse-linker-plugin -Os"
|
||||
|
||||
# Build tdlib
|
||||
cd implementations/tdlight/build
|
||||
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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_C_FLAGS="${CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -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/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_amd64_gcc_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_amd64_gcc_ssl3 package
|
107
.github/workflows/scripts/build_linux_amd64_ssl1.sh
vendored
107
.github/workflows/scripts/build_linux_amd64_ssl1.sh
vendored
@ -1,107 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 20.04
|
||||
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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-12"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-12"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -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/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_amd64_ssl1.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_amd64_ssl1 package
|
107
.github/workflows/scripts/build_linux_amd64_ssl3.sh
vendored
107
.github/workflows/scripts/build_linux_amd64_ssl3.sh
vendored
@ -1,107 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -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/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_amd64_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_amd64_ssl3 package
|
@ -1,99 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 20.04
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_arm64.cmake)"
|
||||
|
||||
# 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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-12"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-12"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_arm64_ssl1.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_arm64_ssl1 package
|
@ -1,99 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_arm64.cmake)"
|
||||
|
||||
# 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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_arm64_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_arm64_ssl3 package
|
@ -1,99 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_armhf.cmake)"
|
||||
|
||||
# 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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_armhf_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_armhf_ssl3 package
|
@ -1,99 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_ppc64le.cmake)"
|
||||
|
||||
# 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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_ppc64le_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_ppc64le_ssl3 package
|
@ -1,99 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
|
||||
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_riscv64.cmake)"
|
||||
|
||||
# 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
|
||||
|
||||
# machine-specific flags
|
||||
HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
# 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
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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="$(readlink -e ./td_bin/)"
|
||||
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_riscv64_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_riscv64_ssl3 package
|
@ -1,29 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
dpkg --add-architecture i386
|
||||
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
|
||||
sed 's/deb mirror/deb \[arch=amd64,i386\] mirror/' -i /etc/apt/sources.list
|
||||
[ -d "/etc/apt/sources.list.d" ] && find /etc/apt/sources.list.d -name "*.list" -type f -exec sed 's/deb http/deb \[arch=amd64,i386\] http/' -i {} \;
|
||||
|
||||
aptitude -y update
|
||||
|
||||
# Install and bypass a bug in the cross-platform libc++ packages
|
||||
apt-get --assume-yes autoremove "libc++-14-dev:*" "libc++abi-14-dev:*" "libc++1-14:*" "libc++abi1-14:*" "libunwind-14-dev:*" "libunwind-14:*" "libc6-dev" "gcc" "gcc-12" "libgcc-12-dev" "libgfortran-12-dev" "libasan8" "libtsan2" "g++-12" "gfortran-12" "libgfortran-12-dev" "libstdc++-12-dev" || true
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:i386 libc++abi-14-dev:i386 libunwind-14-dev:i386 libunwind-14:i386
|
||||
# shellcheck disable=SC2016
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libunwind.so.1" "{}/libunwind.so" || true'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libc++.so.1" "{}/libc++.so" || true'
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libunwind-14-dev libunwind-14 zlib1g-dev
|
||||
# End libc++ packages bugfix
|
||||
|
||||
# Add i386 common files
|
||||
apt-get download libclang-common-14-dev:i386
|
||||
dpkg-deb -xv libclang-common-14-dev_*_i386.deb /
|
||||
|
||||
|
||||
# Install dependencies
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libssl-dev:i386 zlib1g-dev:i386 openjdk-17-jdk-headless:i386 libgcc-12-dev:i386 libc6-dev:i386
|
@ -1,33 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 20.04
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
dpkg --add-architecture arm64
|
||||
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
|
||||
sed 's/deb mirror/deb \[arch=amd64,i386\] mirror/' -i /etc/apt/sources.list
|
||||
[ -d "/etc/apt/sources.list.d" ] && find /etc/apt/sources.list.d -name "*.list" -type f -exec sed 's/deb http/deb \[arch=amd64,i386\] http/' -i {} \;
|
||||
echo "# tdlight multiarch" > /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs) main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-security main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
|
||||
aptitude -y update
|
||||
|
||||
# Install and bypass a bug in the cross-platform libc++ packages
|
||||
apt-get --assume-yes autoremove "libc++-12-dev:*" "libc++abi-12-dev:*" "libc++1-12:*" "libc++abi1-12:*" "libc6-dev" "gcc" "gcc-*" "libgcc-*-dev" "libgfortran-*-dev" "libasan8" "libtsan2" "g++-*" "gfortran-*" "libgfortran-*-dev" "libstdc++-*-dev" || true
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libc++-12-dev:arm64 libc++abi-12-dev:arm64
|
||||
# shellcheck disable=SC2016
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libunwind.so.1" "{}/libunwind.so" || true'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libc++.so.1" "{}/libc++.so" || true'
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install clang-12 libc++-12-dev libc++abi-12-dev zlib1g-dev
|
||||
# End libc++ packages bugfix
|
||||
|
||||
# Add arm64 common files
|
||||
apt-get download libclang-common-12-dev:arm64
|
||||
dpkg-deb -xv libclang-common-12-dev_*_arm64.deb /
|
||||
|
||||
|
||||
# Install dependencies
|
||||
aptitude -y install libssl-dev:arm64 zlib1g-dev:arm64 openjdk-8-jdk-headless:arm64 libgcc-9-dev:arm64 libc6-dev:arm64 libunwind-dev:arm64
|
@ -1,33 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
dpkg --add-architecture arm64
|
||||
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
|
||||
sed 's/deb mirror/deb \[arch=amd64,i386\] mirror/' -i /etc/apt/sources.list
|
||||
[ -d "/etc/apt/sources.list.d" ] && find /etc/apt/sources.list.d -name "*.list" -type f -exec sed 's/deb http/deb \[arch=amd64,i386\] http/' -i {} \;
|
||||
echo "# tdlight multiarch" > /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs) main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-security main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
|
||||
aptitude -y update
|
||||
|
||||
# Install and bypass a bug in the cross-platform libc++ packages
|
||||
apt-get --assume-yes autoremove "libc++-14-dev:*" "libc++abi-14-dev:*" "libc++1-14:*" "libc++abi1-14:*" "libunwind-14-dev:*" "libunwind-14:*" "libc6-dev" "gcc" "gcc-12" "libgcc-12-dev" "libgfortran-12-dev" "libasan8" "libtsan2" "g++-12" "gfortran-12" "libgfortran-12-dev" "libstdc++-12-dev" || true
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:arm64 libc++abi-14-dev:arm64 libunwind-14-dev:arm64 libunwind-14:arm64
|
||||
# shellcheck disable=SC2016
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libunwind.so.1" "{}/libunwind.so" || true'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libc++.so.1" "{}/libc++.so" || true'
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libunwind-14-dev libunwind-14 zlib1g-dev
|
||||
# End libc++ packages bugfix
|
||||
|
||||
# Add arm64 common files
|
||||
apt-get download libclang-common-14-dev:arm64
|
||||
dpkg-deb -xv libclang-common-14-dev_*_arm64.deb /
|
||||
|
||||
|
||||
# Install dependencies
|
||||
aptitude -y install libssl-dev:arm64 zlib1g-dev:arm64 openjdk-17-jdk-headless:arm64 libgcc-12-dev:arm64 libc6-dev:arm64
|
@ -1,33 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
dpkg --add-architecture armhf
|
||||
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
|
||||
sed 's/deb mirror/deb \[arch=amd64,i386\] mirror/' -i /etc/apt/sources.list
|
||||
[ -d "/etc/apt/sources.list.d" ] && find /etc/apt/sources.list.d -name "*.list" -type f -exec sed 's/deb http/deb \[arch=amd64,i386\] http/' -i {} \;
|
||||
echo "# tdlight multiarch" > /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs) main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-security main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
|
||||
aptitude -y update
|
||||
|
||||
# Install and bypass a bug in the cross-platform libc++ packages
|
||||
apt-get --assume-yes autoremove "libc++-14-dev:*" "libc++abi-14-dev:*" "libc++1-14:*" "libc++abi1-14:*" "libunwind-14-dev:*" "libunwind-14:*" "libc6-dev" "gcc" "gcc-12" "libgcc-12-dev" "libgfortran-12-dev" "libasan8" "libtsan2" "g++-12" "gfortran-12" "libgfortran-12-dev" "libstdc++-12-dev" || true
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:armhf libc++abi-14-dev:armhf libunwind-14-dev:armhf libunwind-14:armhf
|
||||
# shellcheck disable=SC2016
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libunwind.so.1" "{}/libunwind.so" || true'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libc++.so.1" "{}/libc++.so" || true'
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libunwind-14-dev libunwind-14 zlib1g-dev
|
||||
# End libc++ packages bugfix
|
||||
|
||||
# Add armhf common files
|
||||
apt-get download libclang-common-14-dev:armhf
|
||||
dpkg-deb -xv libclang-common-14-dev_*_armhf.deb /
|
||||
|
||||
|
||||
# Install dependencies
|
||||
aptitude -y install libssl-dev:armhf zlib1g-dev:armhf openjdk-17-jdk-headless:armhf libgcc-12-dev:armhf libc6-dev:armhf
|
@ -1,33 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
dpkg --add-architecture ppc64el
|
||||
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
|
||||
sed 's/deb mirror/deb \[arch=amd64,i386\] mirror/' -i /etc/apt/sources.list
|
||||
[ -d "/etc/apt/sources.list.d" ] && find /etc/apt/sources.list.d -name "*.list" -type f -exec sed 's/deb http/deb \[arch=amd64,i386\] http/' -i {} \;
|
||||
echo "# tdlight multiarch" > /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs) main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-security main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
|
||||
aptitude -y update
|
||||
|
||||
# Install and bypass a bug in the cross-platform libc++ packages
|
||||
apt-get --assume-yes autoremove "libc++-14-dev:*" "libc++abi-14-dev:*" "libc++1-14:*" "libc++abi1-14:*" "libunwind-14-dev:*" "libunwind-14:*" "libc6-dev" "gcc" "gcc-12" "libgcc-12-dev" "libgfortran-12-dev" "libasan8" "libtsan2" "g++-12" "gfortran-12" "libgfortran-12-dev" "libstdc++-12-dev" || true
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:ppc64el libc++abi-14-dev:ppc64el libunwind-14-dev:ppc64el libunwind-14:ppc64el
|
||||
# shellcheck disable=SC2016
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libunwind.so.1" "{}/libunwind.so" || true'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libc++.so.1" "{}/libc++.so" || true'
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libunwind-14-dev libunwind-14 zlib1g-dev
|
||||
# End libc++ packages bugfix
|
||||
|
||||
# Add ppc64le common files
|
||||
apt-get download libclang-common-14-dev:ppc64el
|
||||
dpkg-deb -xv libclang-common-14-dev_*_ppc64el.deb /
|
||||
|
||||
|
||||
# Install dependencies
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libssl-dev:ppc64el zlib1g-dev:ppc64el openjdk-17-jdk-headless:ppc64el libgcc-12-dev:ppc64el libc6-dev:ppc64el
|
@ -1,50 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
# Ubuntu 22.04
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
dpkg --add-architecture riscv64
|
||||
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
|
||||
sed 's/deb mirror/deb \[arch=amd64,i386\] mirror/' -i /etc/apt/sources.list
|
||||
[ -d "/etc/apt/sources.list.d" ] && find /etc/apt/sources.list.d -name "*.list" -type f -exec sed 's/deb http/deb \[arch=amd64,i386\] http/' -i {} \;
|
||||
echo "# tdlight multiarch" > /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs) main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
echo "deb [arch=arm64,armhf,ppc64el,riscv64,s390x] http://ports.ubuntu.com/ $(lsb_release -cs)-security main universe restricted multiverse" >> /etc/apt/sources.list.d/tdlight-multiarch.list
|
||||
|
||||
aptitude -y update
|
||||
|
||||
# Install and bypass a bug in the cross-platform libc++ packages
|
||||
apt-get --assume-yes autoremove "libc++-14-dev:*" "libc++abi-14-dev:*" "libc++1-14:*" "libc++abi1-14:*" "libunwind-14-dev:*" "libunwind-14:*" "libc6-dev" "gcc" "gcc-12" "libgcc-12-dev" "libgfortran-12-dev" "libasan8" "libtsan2" "g++-12" "gfortran-12" "libgfortran-12-dev" "libstdc++-12-dev" || true
|
||||
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:riscv64 libc++abi-14-dev:riscv64 libunwind-14-dev:riscv64 libunwind-14:riscv64 libatomic1:riscv64 libgcc-s1:riscv64
|
||||
# shellcheck disable=SC2016
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libunwind.so.1" "{}/libunwind.so" || true'
|
||||
find /usr/lib/ -maxdepth 1 -path "*-linux-*" -type d -print0 | xargs -0 -I{} sh -c 'ln -s "{}/libc++.so.1" "{}/libc++.so" || true'
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libunwind-14-dev libunwind-14 zlib1g-dev
|
||||
# End libc++ packages bugfix
|
||||
|
||||
# Add riscv64 common files
|
||||
apt-get download libclang-common-14-dev:riscv64
|
||||
dpkg-deb -xv libclang-common-14-dev_*_riscv64.deb /
|
||||
|
||||
|
||||
# Install dependencies
|
||||
#
|
||||
#I don't know why this command fails in github actions only with risc-v:
|
||||
#Reading package lists...
|
||||
#Building dependency tree...
|
||||
#Reading state information...
|
||||
#Some packages could not be installed. This may mean that you have
|
||||
#requested an impossible situation or if you are using the unstable
|
||||
#distribution that some required packages have not yet been created
|
||||
#or been moved out of Incoming.
|
||||
#The following information may help to resolve the situation:
|
||||
#
|
||||
#The following packages have unmet dependencies:
|
||||
# libgcc-12-dev:riscv64 : Depends: libgomp1:riscv64 (>= 12.1.0-2ubuntu1~22.04) but it is not going to be installed
|
||||
# Depends: libasan8:riscv64 (>= 12.1.0-2ubuntu1~22.04) but it is not going to be installed
|
||||
# libselinux1:riscv64 : Depends: libpcre2-8-0:riscv64 (>= 10.22) but it is not going to be installed
|
||||
#E: Unable to correct problems, you have held broken packages.
|
||||
aptitude -y -o Dpkg::Options::="--force-overwrite" install libssl-dev:riscv64 zlib1g-dev:riscv64 openjdk-17-jdk-headless:riscv64 libgcc-12-dev:riscv64 libc6-dev:riscv64 libstdc++6:riscv64
|
2
.github/workflows/tdapi_file.yaml
vendored
2
.github/workflows/tdapi_file.yaml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: sudo make git zlib1g-dev libssl-dev gperf php-cli cmake openjdk-17-jdk clang-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev ccache maven
|
||||
packages: sudo make git zlib1g-dev libssl-dev gperf php-cli cmake openjdk-17-jdk clang-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev maven
|
||||
version: 1.0
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
|
@ -1,80 +0,0 @@
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
set(TARGET_TRIPLE aarch64-linux-gnu)
|
||||
|
||||
if(EXISTS "/usr/bin/clang-14")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-12")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu /usr/include/aarch64-linux-gnu /usr/bin/aarch64-linux-gnu)
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/aarch64-linux-gnu)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/aarch64-linux-gnu)
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/aarch64-linux-gnu)
|
||||
#set(CMAKE_SYSROOT /usr/lib/aarch64-linux-gnu)
|
||||
#set(OPENSSL_INCLUDE_DIR /usr/include/openssl)
|
||||
#include_directories("/usr/include/openssl")
|
||||
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
|
||||
|
||||
|
||||
# Use our definitions for compiler tools
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search for libraries and headers in the target directories only
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
|
||||
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-arm64")
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-arm64")
|
||||
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
else()
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-arm64")
|
||||
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/jre/lib/aarch64/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/jre/lib/aarch64/libawt.so")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/linux")
|
||||
|
||||
|
||||
# Only on aarch64 & armhf architecture
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
# Use LLD on linux
|
||||
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
|
||||
#add_link_options("-fuse-ld=lld")
|
@ -1,79 +0,0 @@
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(TARGET_TRIPLE arm-linux-gnueabihf)
|
||||
|
||||
if(EXISTS "/usr/bin/clang-14")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-12")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf /usr/lib/arm-linux-gnueabihf /usr/include/arm-linux-gnueabihf /usr/bin/arm-linux-gnueabihf)
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/arm-linux-gnueabihf)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/arm-linux-gnueabihf)
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/arm-linux-gnueabihf)
|
||||
#set(CMAKE_SYSROOT /usr/lib/arm-linux-gnueabihf)
|
||||
#set(OPENSSL_INCLUDE_DIR /usr/include/openssl)
|
||||
#include_directories("/usr/include/openssl")
|
||||
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
|
||||
|
||||
|
||||
# Use our definitions for compiler tools
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search for libraries and headers in the target directories only
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
|
||||
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-armhf")
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-armhf")
|
||||
else()
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-armhf")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/linux")
|
||||
|
||||
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
|
||||
# Only on aarch64 & armhf architecture
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
# Use LLD on linux
|
||||
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
|
||||
#add_link_options("-fuse-ld=lld")
|
@ -1,71 +0,0 @@
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR i386)
|
||||
set(TARGET_TRIPLE i386-linux-gnu)
|
||||
|
||||
if(EXISTS "/usr/bin/clang-14")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-12")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/include/i386-linux-gnu /usr/bin/i386-linux-gnu)
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/i386-linux-gnu)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu)
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/i386-linux-gnu)
|
||||
#set(CMAKE_SYSROOT /usr/lib/i386-linux-gnu)
|
||||
#set(OPENSSL_INCLUDE_DIR /usr/include/openssl)
|
||||
#include_directories("/usr/include/openssl")
|
||||
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
|
||||
|
||||
|
||||
# Use our definitions for compiler tools
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search for libraries and headers in the target directories only
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
|
||||
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-i386")
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-i386")
|
||||
else()
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-i386")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/linux")
|
||||
|
||||
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
# Use LLD on linux
|
||||
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
|
||||
#add_link_options("-fuse-ld=lld")
|
@ -1,71 +0,0 @@
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR powerpc64le)
|
||||
set(TARGET_TRIPLE powerpc64le-linux-gnu)
|
||||
|
||||
if(EXISTS "/usr/bin/clang-14")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-12")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/powerpc64le-linux-gnu /usr/lib/powerpc64le-linux-gnu /usr/include/powerpc64le-linux-gnu /usr/bin/powerpc64le-linux-gnu)
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/powerpc64le-linux-gnu)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/powerpc64le-linux-gnu)
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/powerpc64le-linux-gnu)
|
||||
#set(CMAKE_SYSROOT /usr/lib/powerpc64le-linux-gnu)
|
||||
#set(OPENSSL_INCLUDE_DIR /usr/include/openssl)
|
||||
#include_directories("/usr/include/openssl")
|
||||
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
|
||||
|
||||
|
||||
# Use our definitions for compiler tools
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search for libraries and headers in the target directories only
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
|
||||
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-ppc64el")
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-ppc64el")
|
||||
else()
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-ppc64el")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/linux")
|
||||
|
||||
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
# Use LLD on linux
|
||||
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
|
||||
#add_link_options("-fuse-ld=lld")
|
@ -1,71 +0,0 @@
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR riscv64)
|
||||
set(TARGET_TRIPLE riscv64-linux-gnu)
|
||||
|
||||
if(EXISTS "/usr/bin/clang-14")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-12")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/riscv64-linux-gnu /usr/lib/riscv64-linux-gnu /usr/include/riscv64-linux-gnu /usr/bin/riscv64-linux-gnu)
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/riscv64-linux-gnu)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/riscv64-linux-gnu)
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/riscv64-linux-gnu)
|
||||
#set(CMAKE_SYSROOT /usr/lib/riscv64-linux-gnu)
|
||||
#set(OPENSSL_INCLUDE_DIR /usr/include/openssl)
|
||||
#include_directories("/usr/include/openssl")
|
||||
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
|
||||
|
||||
|
||||
# Use our definitions for compiler tools
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search for libraries and headers in the target directories only
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
|
||||
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-riscv64")
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-riscv64")
|
||||
else()
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-riscv64")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/linux")
|
||||
|
||||
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
# Use LLD on linux
|
||||
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
|
||||
#add_link_options("-fuse-ld=lld")
|
@ -1 +1 @@
|
||||
Subproject commit 68bd45da52d447331c76fe1a39f840368148d4e3
|
||||
Subproject commit 15b956f94cfa82b17da01b74bc293564fb412ac9
|
@ -12,7 +12,8 @@ endif()
|
||||
find_package(Td REQUIRED)
|
||||
|
||||
if (NOT JNI_FOUND)
|
||||
find_package(JNI REQUIRED)
|
||||
SET(JNI_FIND_REQUIRED_AWT FALSE CACHE BOOL "" FORCE)
|
||||
find_package(JNI REQUIRED COMPONENTS JVM)
|
||||
endif()
|
||||
message(STATUS "Found JNI: ${JNI_INCLUDE_DIRS} ${JNI_LIBRARIES}")
|
||||
|
||||
|
@ -168,7 +168,7 @@ static jint register_native(JavaVM *vm) {
|
||||
#undef TD_OBJECT
|
||||
|
||||
td::jni::init_vars(env, API_PACKAGE_NAME);
|
||||
td::td_api::set_package_name(API_PACKAGE_NAME);
|
||||
td::td_api::get_package_name_ref() = API_PACKAGE_NAME;
|
||||
|
||||
return JAVA_VERSION;
|
||||
}
|
||||
|
217
tdlight.arch.ssl1.gnu.dockerfile
Normal file
217
tdlight.arch.ssl1.gnu.dockerfile
Normal file
@ -0,0 +1,217 @@
|
||||
FROM debian:buster-backports AS ssl1_debian
|
||||
WORKDIR /build
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
# amd64, i386, ppc64el, riscv64, armhf, arm64
|
||||
ARG ARCH_DEBIAN
|
||||
# x86_64, i386, powerpc64le, riscv64, arm, aarch64
|
||||
ARG ARCH_TRIPLE
|
||||
# gnu, gnueabihf (armhf)
|
||||
ARG TRIPLE_GNU
|
||||
ARG SCCACHE_GHA_ENABLED=off
|
||||
ARG ACTIONS_CACHE_URL
|
||||
ARG ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
# Check for mandatory build arguments
|
||||
RUN : "${ARCH_DEBIAN:?Build argument needs to be set and non-empty.}"
|
||||
RUN : "${ARCH_TRIPLE:?Build argument needs to be set and non-empty.}"
|
||||
RUN : "${TRIPLE_GNU:?Build argument needs to be set and non-empty.}"
|
||||
|
||||
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
COPY .docker ./.docker
|
||||
# Install sccache to greatly speedup builds in the CI
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked --mount=type=cache,target=/var/cache/sccache,sharing=locked .docker/install-sccache.sh
|
||||
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked <<"EOF"
|
||||
dpkg --add-architecture ${ARCH_DEBIAN}
|
||||
apt-get --assume-yes update
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends openjdk-11-jdk-headless
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp libssl-dev:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp libssl1.1:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp zlib1g-dev:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp zlib1g:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp openjdk-11-jre-headless:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp openjdk-11-jdk-headless:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/SymlinkPrefix.javash "/root/cross-build-pkgs/" "/" "./"
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends \
|
||||
g++-8 gcc-8 zlib1g-dev libssl-dev gperf \
|
||||
tree git maven php-cli php-readline make cmake \
|
||||
g++-8-${ARCH_TRIPLE}-linux-${TRIPLE_GNU} gcc-8-${ARCH_TRIPLE}-linux-${TRIPLE_GNU} \
|
||||
libatomic1-${ARCH_DEBIAN}-cross libc6-dev-${ARCH_DEBIAN}-cross libgcc-8-dev-${ARCH_DEBIAN}-cross libstdc++-8-dev-${ARCH_DEBIAN}-cross
|
||||
|
||||
EOF
|
||||
|
||||
FROM ssl1_debian AS build
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG SCCACHE_GHA_ENABLED=off
|
||||
ARG ACTIONS_CACHE_URL
|
||||
ARG ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
ENV TOOLCHAIN_FILE="toolchain.cmake"
|
||||
ENV SCCACHE_DIR=/var/cache/sccache
|
||||
|
||||
# machine-specific flags
|
||||
ENV HOST_CMAKE_C_COMPILER="/usr/bin/gcc-8"
|
||||
ENV HOST_CMAKE_CXX_COMPILER="/usr/bin/g++-8"
|
||||
ENV HOST_CMAKE_C_FLAGS=""
|
||||
ENV HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS}"
|
||||
ENV HOST_CMAKE_EXE_LINKER_FLAGS=""
|
||||
|
||||
# Use c++11
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
ENV CMAKE_C_FLAGS="${CMAKE_C_FLAGS}"
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
|
||||
ENV CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -O3"
|
||||
ENV CCACHE=/opt/sccache/sccache
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
|
||||
|
||||
COPY --link . ./
|
||||
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
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
|
||||
cd implementations/tdlight/td_tools_build
|
||||
CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
-DJAVA_AWT_LIBRARY="/dev/null" \
|
||||
-DJAVA_AWT_INCLUDE_PATH="/dev/null" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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 ../../../
|
||||
|
||||
./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"
|
||||
EOF
|
||||
|
||||
COPY <<EOF ./toolchain.cmake
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR $ARCH_TRIPLE)
|
||||
set(TARGET_TRIPLE $ARCH_TRIPLE-linux-$TRIPLE_GNU)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/\${TARGET_TRIPLE}-gcc-8)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/\${TARGET_TRIPLE}-g++-8)
|
||||
set(CMAKE_AR "/usr/bin/\${TARGET_TRIPLE}-gcc-ar-8" CACHE FILEPATH "" FORCE)
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/include/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/include)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/lib/\${TARGET_TRIPLE} /root/cross-build-pkgs/lib/\${TARGET_TRIPLE})
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/bin/\${TARGET_TRIPLE})
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
set(CMAKE_SYSROOT /root/cross-build-pkgs)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
if(EXISTS "/usr/lib/jvm/java-11-openjdk-amd64")
|
||||
SET(JAVA_HOME "/usr/lib/jvm/java-11-openjdk-amd64")
|
||||
else()
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "\${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "\${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "\${JAVA_HOME}/include/linux")
|
||||
SET(JAVA_CROSS_HOME "/root/cross-build-pkgs/usr/lib/jvm/java-11-openjdk-$ARCH_DEBIAN")
|
||||
SET(JAVA_JVM_LIBRARY "\${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "\${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
if("$ARCH_DEBIAN" STREQUAL "armhf" OR "$ARCH_DEBIAN" STREQUAL "arm64")
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
endif()
|
||||
EOF
|
||||
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
cd implementations/tdlight/build
|
||||
export INSTALL_PREFIX="$(readlink -e ./td_bin/)"
|
||||
export INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="../../../${TOOLCHAIN_FILE}" ..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="../../${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_${ARCH_DEBIAN}_gnu_ssl1.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_${ARCH_DEBIAN}_gnu_ssl1 package
|
||||
EOF
|
||||
|
||||
FROM debian:buster-backports AS maven
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
WORKDIR /source
|
||||
COPY --from=build /build/natives /source/natives
|
||||
ENTRYPOINT ["/bin/true"]
|
||||
|
||||
FROM debian:buster-backports
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG ARCH_DEBIAN
|
||||
ARG ARCH_TRIPLE
|
||||
ARG TRIPLE_GNU
|
||||
WORKDIR /out
|
||||
COPY --from=build /build/natives natives
|
||||
COPY --from=build /build/natives/src/main/resources/META-INF/tdlightjni/libtdjni.linux_${ARCH_DEBIAN}_gnu_ssl1.so libtdjni.so
|
||||
COPY --from=build /build/natives/target-linux_${ARCH_DEBIAN}_gnu_ssl1/tdlight-natives-${REVISION}-linux_${ARCH_DEBIAN}_gnu_ssl1.jar tdlight-natives.jar
|
||||
USER 65534:65534
|
||||
ENTRYPOINT ["/bin/true"]
|
229
tdlight.arch.ssl3.clang.dockerfile
Normal file
229
tdlight.arch.ssl3.clang.dockerfile
Normal file
@ -0,0 +1,229 @@
|
||||
FROM debian:bookworm-backports AS ssl3_debian
|
||||
WORKDIR /build
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
# amd64, i386, ppc64el, riscv64, armhf, arm64
|
||||
ARG ARCH_DEBIAN
|
||||
# x86_64, i386, powerpc64le, riscv64, arm, aarch64
|
||||
ARG ARCH_TRIPLE
|
||||
# gnu, gnueabihf (armhf)
|
||||
ARG TRIPLE_GNU
|
||||
ARG SCCACHE_GHA_ENABLED=off
|
||||
ARG ACTIONS_CACHE_URL
|
||||
ARG ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
# Check for mandatory build arguments
|
||||
RUN : "${ARCH_DEBIAN:?Build argument needs to be set and non-empty.}"
|
||||
RUN : "${ARCH_TRIPLE:?Build argument needs to be set and non-empty.}"
|
||||
RUN : "${TRIPLE_GNU:?Build argument needs to be set and non-empty.}"
|
||||
|
||||
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
COPY .docker ./.docker
|
||||
# Install sccache to greatly speedup builds in the CI
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked --mount=type=cache,target=/var/cache/sccache,sharing=locked .docker/install-sccache.sh
|
||||
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked <<"EOF"
|
||||
dpkg --add-architecture ${ARCH_DEBIAN}
|
||||
apt-get --assume-yes update
|
||||
|
||||
export LLVMLIBS_NATIVE="libc++-14-dev libc++abi-14-dev libunwind-14-dev libunwind-14 libclang-rt-14-dev"
|
||||
export LLVMLIBS_TARGET="libc++-14-dev:${ARCH_DEBIAN} libc++abi-14-dev:${ARCH_DEBIAN} libunwind-14-dev:${ARCH_DEBIAN} libunwind-14:${ARCH_DEBIAN} libclang-rt-14-dev:${ARCH_DEBIAN}"
|
||||
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends $LLVMLIBS_TARGET
|
||||
find /usr/lib/ -path "*-linux-*" -lname "*llvm*" -print0 | xargs -0 -I{} sh -c 'cp --remove-destination $(realpath "{}") "{}"'
|
||||
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends git \
|
||||
zlib1g-dev libssl-dev gperf g++ \
|
||||
php-cli make cmake llvm-14 clang-14 lld-14 \
|
||||
libgcc-11-dev libclang-common-14-dev \
|
||||
git maven php-readline ca-certificates-java \
|
||||
openjdk-17-jdk-headless libssl-dev:${ARCH_DEBIAN} zlib1g-dev:${ARCH_DEBIAN} \
|
||||
libgcc-11-dev:${ARCH_DEBIAN} libc6-dev:${ARCH_DEBIAN} $LLVMLIBS_NATIVE
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends openjdk-17-jdk-headless:${ARCH_DEBIAN}
|
||||
EOF
|
||||
|
||||
FROM ssl3_debian AS build
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG SCCACHE_GHA_ENABLED=off
|
||||
ARG ACTIONS_CACHE_URL
|
||||
ARG ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
ENV TOOLCHAIN_FILE="toolchain.cmake"
|
||||
ENV SCCACHE_DIR=/var/cache/sccache
|
||||
|
||||
# machine-specific flags
|
||||
ENV HOST_CMAKE_C_COMPILER="/usr/bin/clang-14"
|
||||
ENV HOST_CMAKE_CXX_COMPILER="/usr/bin/clang++-14"
|
||||
ENV HOST_CMAKE_C_FLAGS="-fuse-ld=lld"
|
||||
ENV HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS} -stdlib=libc++"
|
||||
ENV HOST_CMAKE_EXE_LINKER_FLAGS="-lc++ -lc++abi -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
|
||||
|
||||
# Use c++11
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
ENV CMAKE_C_FLAGS="${CMAKE_C_FLAGS}"
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
|
||||
ENV CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -flto=thin -O3"
|
||||
ENV CCACHE=/opt/sccache/sccache
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
|
||||
|
||||
COPY --link . ./
|
||||
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
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
|
||||
cd implementations/tdlight/td_tools_build
|
||||
CXXFLAGS="-stdlib=libc++" CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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 ../../../
|
||||
|
||||
./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"
|
||||
EOF
|
||||
|
||||
COPY <<EOF ./toolchain.cmake
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR $ARCH_TRIPLE)
|
||||
set(TARGET_TRIPLE $ARCH_TRIPLE-linux-$TRIPLE_GNU)
|
||||
|
||||
if(EXISTS "/usr/bin/clang-14")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-12")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
|
||||
elseif(EXISTS "/usr/bin/clang-9")
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang-9)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-9)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang-9)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar-9" CACHE FILEPATH "" FORCE)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/include/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/include)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/lib/\${TARGET_TRIPLE} /root/cross-build-pkgs/lib/\${TARGET_TRIPLE})
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/bin/\${TARGET_TRIPLE})
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
# Use our definitions for compiler tools
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-amd64")
|
||||
SET(JAVA_HOME "/usr/lib/jvm/java-17-openjdk-amd64")
|
||||
else()
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "\${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "\${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "\${JAVA_HOME}/include/linux")
|
||||
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-$ARCH_DEBIAN")
|
||||
SET(JAVA_JVM_LIBRARY "\${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "\${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
if("$ARCH_DEBIAN" STREQUAL "armhf" OR "$ARCH_DEBIAN" STREQUAL "arm64")
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
endif()
|
||||
EOF
|
||||
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
cd implementations/tdlight/build
|
||||
export INSTALL_PREFIX="$(readlink -e ./td_bin/)"
|
||||
export INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="../../../${TOOLCHAIN_FILE}" ..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="../../${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_${ARCH_DEBIAN}_clang_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_${ARCH_DEBIAN}_clang_ssl3 package
|
||||
EOF
|
||||
|
||||
FROM debian:bookworm-backports
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG ARCH_DEBIAN
|
||||
ARG ARCH_TRIPLE
|
||||
ARG TRIPLE_GNU
|
||||
WORKDIR /out
|
||||
COPY --from=build /build/natives natives
|
||||
COPY --from=build /build/natives/src/main/resources/META-INF/tdlightjni/libtdjni.linux_${ARCH_DEBIAN}_clang_ssl3.so libtdjni.so
|
||||
COPY --from=build /build/natives/target-linux_${ARCH_DEBIAN}_clang_ssl3/tdlight-natives-${REVISION}-linux_${ARCH_DEBIAN}_clang_ssl3.jar tdlight-natives.jar
|
||||
USER 65534:65534
|
||||
ENTRYPOINT ["/bin/true"]
|
289
tdlight.arch.ssl3.gnu.dockerfile
Normal file
289
tdlight.arch.ssl3.gnu.dockerfile
Normal file
@ -0,0 +1,289 @@
|
||||
# use "sid" for riscv64
|
||||
ARG DEBIAN_VERSION=bookworm-backports
|
||||
FROM debian:${DEBIAN_VERSION} AS ssl3_debian
|
||||
WORKDIR /build
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
# amd64, i386, ppc64el, riscv64, armhf, arm64
|
||||
ARG ARCH_DEBIAN
|
||||
# x86_64, i386, powerpc64le, riscv64, arm, aarch64
|
||||
ARG ARCH_TRIPLE
|
||||
# gnu, gnueabihf (armhf)
|
||||
ARG TRIPLE_GNU
|
||||
ARG SCCACHE_GHA_ENABLED=off
|
||||
ARG ACTIONS_CACHE_URL
|
||||
ARG ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
# Check for mandatory build arguments
|
||||
RUN : "${ARCH_DEBIAN:?Build argument needs to be set and non-empty.}"
|
||||
RUN : "${ARCH_TRIPLE:?Build argument needs to be set and non-empty.}"
|
||||
RUN : "${TRIPLE_GNU:?Build argument needs to be set and non-empty.}"
|
||||
|
||||
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
COPY .docker ./.docker
|
||||
# Install sccache to greatly speedup builds in the CI
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked --mount=type=cache,target=/var/cache/sccache,sharing=locked .docker/install-sccache.sh
|
||||
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked <<"EOF"
|
||||
dpkg --add-architecture ${ARCH_DEBIAN}
|
||||
apt-get --assume-yes update
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends openjdk-17-jdk-headless
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp libssl-dev:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp libssl3:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp zlib1g-dev:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp zlib1g:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp openjdk-17-jre-headless:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/downloadthis.sh /var/cache/apt/downloaded_tmp openjdk-17-jdk-headless:${ARCH_DEBIAN} /root/cross-build-pkgs/
|
||||
./.docker/SymlinkPrefix.javash "/root/cross-build-pkgs/" "/" "./"
|
||||
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install --no-install-recommends \
|
||||
g++-12 gcc-12 zlib1g-dev libssl-dev gperf \
|
||||
tree git maven php-cli php-readline make cmake \
|
||||
g++-12-${ARCH_TRIPLE}-linux-${TRIPLE_GNU} gcc-12-${ARCH_TRIPLE}-linux-${TRIPLE_GNU} \
|
||||
libatomic1-${ARCH_DEBIAN}-cross libc6-dev-${ARCH_DEBIAN}-cross libgcc-12-dev-${ARCH_DEBIAN}-cross libstdc++-12-dev-${ARCH_DEBIAN}-cross
|
||||
|
||||
EOF
|
||||
|
||||
FROM ssl3_debian AS build
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG SCCACHE_GHA_ENABLED=off
|
||||
ARG ACTIONS_CACHE_URL
|
||||
ARG ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
ENV TOOLCHAIN_FILE="toolchain.cmake"
|
||||
ENV SCCACHE_DIR=/var/cache/sccache
|
||||
|
||||
# machine-specific flags
|
||||
ENV HOST_CMAKE_C_COMPILER="/usr/bin/gcc-12"
|
||||
ENV HOST_CMAKE_CXX_COMPILER="/usr/bin/g++-12"
|
||||
ENV HOST_CMAKE_C_FLAGS=""
|
||||
ENV HOST_CMAKE_CXX_FLAGS="${HOST_CMAKE_C_FLAGS}"
|
||||
ENV HOST_CMAKE_EXE_LINKER_FLAGS=""
|
||||
|
||||
# Use c++11
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14"
|
||||
|
||||
ENV CMAKE_C_FLAGS="${CMAKE_C_FLAGS}"
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
|
||||
ENV CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
|
||||
ENV CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -O3"
|
||||
ENV CCACHE=/opt/sccache/sccache
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
||||
|
||||
COPY --link . ./
|
||||
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
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
|
||||
cd implementations/tdlight/td_tools_build
|
||||
CC="$HOST_CMAKE_C_COMPILER" CXX="$HOST_CMAKE_CXX_COMPILER" cmake \
|
||||
-DCMAKE_C_COMPILER="${HOST_CMAKE_C_COMPILER}" \
|
||||
-DCMAKE_CXX_COMPILER="${HOST_CMAKE_CXX_COMPILER}" \
|
||||
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${HOST_CMAKE_C_FLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${HOST_CMAKE_CXX_FLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} ${HOST_CMAKE_EXE_LINKER_FLAGS}" \
|
||||
\
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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 ../../../
|
||||
|
||||
./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"
|
||||
EOF
|
||||
|
||||
COPY <<EOF ./toolchain.cmake
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR $ARCH_TRIPLE)
|
||||
set(TARGET_TRIPLE $ARCH_TRIPLE-linux-$TRIPLE_GNU)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/\${TARGET_TRIPLE}-gcc-12)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/\${TARGET_TRIPLE}-g++-12)
|
||||
set(CMAKE_AR "/usr/bin/\${TARGET_TRIPLE}-gcc-ar-12" CACHE FILEPATH "" FORCE)
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
set(CMAKE_ASM_COMPILER_TARGET \${TARGET_TRIPLE})
|
||||
|
||||
set(CMAKE_INCLUDE_PATH /usr/include/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/include/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/include)
|
||||
set(CMAKE_LIBRARY_PATH /usr/lib/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/lib/\${TARGET_TRIPLE} /root/cross-build-pkgs/lib/\${TARGET_TRIPLE})
|
||||
set(CMAKE_PROGRAM_PATH /usr/bin/\${TARGET_TRIPLE} /root/cross-build-pkgs/usr/bin/\${TARGET_TRIPLE})
|
||||
|
||||
# Set various compiler flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-fno-fat-lto-objects")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
set(CMAKE_SYSROOT /root/cross-build-pkgs)
|
||||
|
||||
# This must be set or compiler checks fail when linking
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
if(EXISTS "/usr/lib/jvm/java-17-openjdk-amd64")
|
||||
SET(JAVA_HOME "/usr/lib/jvm/java-17-openjdk-amd64")
|
||||
else()
|
||||
SET(JAVA_HOME "/usr/lib/jvm/default-java")
|
||||
endif()
|
||||
SET(JAVA_INCLUDE_PATH "\${JAVA_HOME}/include")
|
||||
SET(JAVA_AWT_INCLUDE_PATH "\${JAVA_HOME}/include")
|
||||
SET(JAVA_INCLUDE_PATH2 "\${JAVA_HOME}/include/linux")
|
||||
SET(JAVA_CROSS_HOME "/root/cross-build-pkgs/usr/lib/jvm/java-17-openjdk-$ARCH_DEBIAN")
|
||||
SET(JAVA_JVM_LIBRARY "\${JAVA_CROSS_HOME}/lib/server/libjvm.so")
|
||||
SET(JAVA_AWT_LIBRARY "\${JAVA_CROSS_HOME}/lib/libawt.so")
|
||||
|
||||
if("$ARCH_DEBIAN" STREQUAL "armhf" OR "$ARCH_DEBIAN" STREQUAL "arm64")
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
endif()
|
||||
EOF
|
||||
|
||||
RUN --mount=type=cache,target=/opt/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/sccache,sharing=locked \
|
||||
--mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
cd implementations/tdlight/build
|
||||
export INSTALL_PREFIX="$(readlink -e ./td_bin/)"
|
||||
export INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-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" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="../../../${TOOLCHAIN_FILE}" ..
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ../../../
|
||||
|
||||
cd natives/build
|
||||
cmake \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" \
|
||||
-DTD_GENERATED_BINARIES_DIR="$(readlink -e ../../implementations/tdlight/td_tools_build/td/generate)" \
|
||||
-DTD_SRC_DIR="$(readlink -e ../../implementations/tdlight)" \
|
||||
-DTD_ENABLE_LTO=ON \
|
||||
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
|
||||
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
|
||||
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
|
||||
-DJAVA_SRC_DIR="$(readlink -e ../src/main/java)" \
|
||||
-DTDNATIVES_CPP_SRC_DIR="$(readlink -e ../src/main/cpp)" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="../../${TOOLCHAIN_FILE}" \
|
||||
../src/main/cpp
|
||||
cmake --build . --target install --config Release --parallel "$(nproc)"
|
||||
cd ..
|
||||
mkdir -p src/main/resources/META-INF/tdlightjni/
|
||||
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_${ARCH_DEBIAN}_gnu_ssl3.so
|
||||
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_${ARCH_DEBIAN}_gnu_ssl3 package
|
||||
EOF
|
||||
|
||||
FROM debian:buster-backports AS deploy-release
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG ARCH_DEBIAN
|
||||
ARG ARCH_TRIPLE
|
||||
ARG TRIPLE_GNU
|
||||
WORKDIR /source
|
||||
COPY --from=build /build/natives /source/natives
|
||||
|
||||
RUN --mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
export TYPE=linux_${ARCH_DEBIAN}_gnu_ssl3
|
||||
|
||||
mvn -B -f natives/pom.xml -Drevision="$REVISION" -Dnative.type.classifier="$TYPE" clean package
|
||||
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv \
|
||||
-DrepositoryId=mchv-release-distribution \
|
||||
-Dfile=natives/target-$TYPE/tdlight-natives-$REVISION-$TYPE.jar \
|
||||
-Dpackaging=pom \
|
||||
-DgroupId=it.tdlight \
|
||||
-DartifactId=tdlight-natives \
|
||||
-Dversion=$REVISION \
|
||||
-Drevision=$REVISION \
|
||||
-Dclassifier=$TYPE \
|
||||
-Dnative.type.classifier="$TYPE"
|
||||
if [[ "$TYPE" == "linux_amd64_ssl1" ]]; then
|
||||
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv \
|
||||
-DrepositoryId=mchv-release-distribution \
|
||||
-Dfile=natives/.ci-friendly-pom.xml \
|
||||
-Dpackaging=pom \
|
||||
-DgroupId=it.tdlight \
|
||||
-DartifactId=tdlight-natives \
|
||||
-Dversion=$REVISION \
|
||||
-Drevision=$REVISION \
|
||||
-Dnative.type.classifier="$TYPE"
|
||||
fi
|
||||
EOF
|
||||
|
||||
FROM debian:buster-backports AS deploy-snapshot
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG ARCH_DEBIAN
|
||||
ARG ARCH_TRIPLE
|
||||
ARG TRIPLE_GNU
|
||||
WORKDIR /source
|
||||
COPY --from=build /build/natives /source/natives
|
||||
|
||||
RUN --mount=type=cache,target=/root/.m2 <<"EOF"
|
||||
export TYPE=linux_${ARCH_DEBIAN}_gnu_ssl3
|
||||
|
||||
mvn -B -f natives/pom.xml -Drevision="$REVISION" -Dnative.type.classifier="$TYPE" clean package
|
||||
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv-snapshot \
|
||||
-DrepositoryId=mchv-snapshot-distribution \
|
||||
-Dfile=natives/target-$TYPE/tdlight-natives-$REVISION-$TYPE.jar \
|
||||
-Dpackaging=pom \
|
||||
-DgroupId=it.tdlight \
|
||||
-DartifactId=tdlight-natives \
|
||||
-Dversion=$REVISION \
|
||||
-Drevision=$REVISION \
|
||||
-Dclassifier=$TYPE \
|
||||
-Dnative.type.classifier="$TYPE"
|
||||
if [[ "$TYPE" == "linux_amd64_ssl1" ]]; then
|
||||
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv-snapshot \
|
||||
-DrepositoryId=mchv-snapshot-distribution \
|
||||
-Dfile=natives/.ci-friendly-pom.xml \
|
||||
-Dpackaging=pom \
|
||||
-DgroupId=it.tdlight \
|
||||
-DartifactId=tdlight-natives \
|
||||
-Dversion=$REVISION \
|
||||
-Drevision=$REVISION \
|
||||
-Dnative.type.classifier="$TYPE"
|
||||
fi
|
||||
EOF
|
||||
|
||||
FROM debian:buster-backports AS maven
|
||||
SHELL ["/bin/bash", "-exc"]
|
||||
WORKDIR /source
|
||||
COPY --from=build /build/natives /source/natives
|
||||
ENTRYPOINT ["/bin/true"]
|
||||
|
||||
FROM debian:bookworm-backports
|
||||
ARG REVISION="1.0.0.0-SNAPSHOT"
|
||||
ARG ARCH_DEBIAN
|
||||
ARG ARCH_TRIPLE
|
||||
ARG TRIPLE_GNU
|
||||
WORKDIR /out
|
||||
COPY --from=build /build/natives natives
|
||||
COPY --from=build /build/natives/src/main/resources/META-INF/tdlightjni/libtdjni.linux_${ARCH_DEBIAN}_gnu_ssl3.so libtdjni.so
|
||||
COPY --from=build /build/natives/target-linux_${ARCH_DEBIAN}_gnu_ssl3/tdlight-natives-${REVISION}-linux_${ARCH_DEBIAN}_gnu_ssl3.jar tdlight-natives.jar
|
||||
USER 65534:65534
|
||||
ENTRYPOINT ["/bin/true"]
|
Loading…
Reference in New Issue
Block a user