Add ppc64le, riscv64, s390x, i386

This commit is contained in:
Andrea Cavalli 2023-05-12 01:51:21 +02:00
parent 9ef688a833
commit 305473c206
15 changed files with 591 additions and 12 deletions

View File

@ -0,0 +1,96 @@
#!/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"
# 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 "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(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 "-j$(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 "-j$(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

View File

@ -0,0 +1,96 @@
#!/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"
# 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 "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(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 "-j$(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 "-j$(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

View File

@ -0,0 +1,96 @@
#!/bin/bash -ex
# Ubuntu 22.04
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain_s390x.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"
# 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 "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(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 "-j$(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 "-j$(nproc)"
cd ..
mkdir -p src/main/resources/META-INF/tdlightjni/
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlightjni/libtdjni.linux_s390x_ssl3.so
mvn -B -f pom.xml -Drevision="$REVISION" -Dnative.type.classifier=linux_s390x_ssl3 package

View File

@ -23,4 +23,4 @@ dpkg-deb -xv libclang-common-14-dev_*_i386.deb /
# Install dependencies
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libssl-dev:i386 zlib1g-dev:i386 openjdk-8-jdk-headless:i386 libgcc-12-dev:i386 libc6-dev:i386
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libssl-dev:i386 zlib1g-dev:i386 openjdk-17-jdk-headless:i386 libgcc-12-dev:i386 libc6-dev:i386

View File

@ -27,4 +27,4 @@ dpkg-deb -xv libclang-common-14-dev_*_arm64.deb /
# Install dependencies
apt-get --assume-yes install libssl-dev:arm64 zlib1g-dev:arm64 openjdk-8-jdk-headless:arm64 libgcc-12-dev:arm64 libc6-dev:arm64
apt-get --assume-yes install libssl-dev:arm64 zlib1g-dev:arm64 openjdk-17-jdk-headless:arm64 libgcc-12-dev:arm64 libc6-dev:arm64

View File

@ -27,4 +27,4 @@ dpkg-deb -xv libclang-common-14-dev_*_armhf.deb /
# Install dependencies
apt-get --assume-yes install libssl-dev:armhf zlib1g-dev:armhf openjdk-8-jdk-headless:armhf libgcc-12-dev:armhf libc6-dev:armhf
apt-get --assume-yes install libssl-dev:armhf zlib1g-dev:armhf openjdk-17-jdk-headless:armhf libgcc-12-dev:armhf libc6-dev:armhf

View File

@ -0,0 +1,30 @@
#!/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
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
apt-get --assume-yes 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:*" || true
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:ppc64el libc++abi-14-dev:ppc64el libc++1-14:ppc64el libc++abi1-14:ppc64el libunwind-14-dev:ppc64el libunwind-14:ppc64el
cp --remove-destination \
/usr/lib/llvm-14/lib/{libc++abi.so,libc++abi.so.1.0,libc++.so,libc++.so.1.0,libunwind.so.1.0} \
/usr/lib/aarch64-linux-gnu/ || true
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libc++1-14 libc++abi1-14 libunwind-14-dev libunwind-14
# 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
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libssl-dev:ppc64el zlib1g-dev:ppc64el openjdk-17-jdk-headless:ppc64el libgcc-12-dev:ppc64el libc6-dev:ppc64el

View File

@ -0,0 +1,30 @@
#!/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
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
apt-get --assume-yes 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:*" || true
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:riscv64 libc++abi-14-dev:riscv64 libc++1-14:riscv64 libc++abi1-14:riscv64 libunwind-14-dev:riscv64 libunwind-14:riscv64
cp --remove-destination \
/usr/lib/llvm-14/lib/{libc++abi.so,libc++abi.so.1.0,libc++.so,libc++.so.1.0,libunwind.so.1.0} \
/usr/lib/aarch64-linux-gnu/ || true
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libc++1-14 libc++abi1-14 libunwind-14-dev libunwind-14
# 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
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libssl-dev:riscv64 zlib1g-dev:riscv64 openjdk-17-jdk-headless:riscv64 libgcc-12-dev:riscv64 libc6-dev:riscv64

View File

@ -0,0 +1,30 @@
#!/bin/bash -ex
# Ubuntu 22.04
export DEBIAN_FRONTEND=noninteractive
dpkg --add-architecture s390x
sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
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
apt-get --assume-yes 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:*" || true
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libc++-14-dev:s390x libc++abi-14-dev:s390x libc++1-14:s390x libc++abi1-14:s390x libunwind-14-dev:s390x libunwind-14:s390x
cp --remove-destination \
/usr/lib/llvm-14/lib/{libc++abi.so,libc++abi.so.1.0,libc++.so,libc++.so.1.0,libunwind.so.1.0} \
/usr/lib/aarch64-linux-gnu/ || true
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install clang-14 libc++-14-dev libc++abi-14-dev libc++1-14 libc++abi1-14 libunwind-14-dev libunwind-14
# End libc++ packages bugfix
# Add s390x common files
apt-get download libclang-common-14-dev:s390x
dpkg-deb -xv libclang-common-14-dev_*_s390x.deb /
# Install dependencies
apt-get --assume-yes -o Dpkg::Options::="--force-overwrite" install libssl-dev:s390x zlib1g-dev:s390x openjdk-17-jdk-headless:s390x libgcc-12-dev:s390x libc6-dev:s390x

View File

@ -54,13 +54,13 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-1.8.0-openjdk-arm64")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-arm64")
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}/jre/lib/aarch64/server/libjvm.so")
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/jre/lib/aarch64/libawt.so")
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

View File

@ -54,13 +54,13 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-1.8.0-openjdk-armhf")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-armhf")
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}/jre/lib/arm/server/libjvm.so")
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/jre/lib/arm/libawt.so")
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

View File

@ -54,13 +54,13 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-i386")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-i386")
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}/jre/lib/i386/server/libjvm.so")
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/jre/lib/i386/libawt.so")
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")

View File

@ -0,0 +1,67 @@
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-10")
set(CMAKE_C_COMPILER /usr/bin/clang-10)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-10)
set(CMAKE_ASM_COMPILER /usr/bin/clang-10)
set(CMAKE_AR "/usr/bin/llvm-ar-10" CACHE FILEPATH "" FORCE)
elseif(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)
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++")
# 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/")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-ppc64el")
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")

View File

@ -0,0 +1,67 @@
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-10")
set(CMAKE_C_COMPILER /usr/bin/clang-10)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-10)
set(CMAKE_ASM_COMPILER /usr/bin/clang-10)
set(CMAKE_AR "/usr/bin/llvm-ar-10" CACHE FILEPATH "" FORCE)
elseif(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)
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++")
# 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/")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-riscv64")
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")

View File

@ -0,0 +1,67 @@
set(CMAKE_CROSSCOMPILING TRUE)
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR s390x)
set(TARGET_TRIPLE s390x-linux-gnu)
if(EXISTS "/usr/bin/clang-10")
set(CMAKE_C_COMPILER /usr/bin/clang-10)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-10)
set(CMAKE_ASM_COMPILER /usr/bin/clang-10)
set(CMAKE_AR "/usr/bin/llvm-ar-10" CACHE FILEPATH "" FORCE)
elseif(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)
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/s390x-linux-gnu /usr/lib/s390x-linux-gnu /usr/include/s390x-linux-gnu /usr/bin/s390x-linux-gnu)
set(CMAKE_INCLUDE_PATH /usr/include/s390x-linux-gnu)
set(CMAKE_LIBRARY_PATH /usr/lib/s390x-linux-gnu)
set(CMAKE_PROGRAM_PATH /usr/bin/s390x-linux-gnu)
#set(CMAKE_SYSROOT /usr/lib/s390x-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++")
# 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/")
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-s390x")
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")