diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index fa35c68fc0..48c1fd6219 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - type: [libs, client, apps, libs-vcpkg, client-vcpkg, apps-vcpkg, libs-cmake, manager-with-webview-vcpkg, server, manager-with-webview, manager-without-webview, unit-test, integration-test] + type: [libs, client, apps, libs-vcpkg, client-vcpkg, apps-vcpkg, libs-cmake, libs-arm64, apps-arm64, manager-with-webview-vcpkg, server, manager-with-webview, manager-without-webview, unit-test, integration-test] fail-fast: false steps: - uses: actions/checkout@v2 @@ -34,8 +34,13 @@ jobs: sudo apt-get -qq update sudo apt-get install -y libftgl-dev freeglut3-dev libcurl4-openssl-dev libxmu-dev libxi-dev libfcgi-dev libxss-dev libnotify-dev libxcb-util0-dev libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev libwebkit2gtk-4.0-dev p7zip-full libxxf86vm-dev ocl-icd-opencl-dev zip + - name: Install dependencies for arm64 + if: success() && endsWith(matrix.type, 'arm64') + run: | + sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu + - name: Install dependencies for integration testing - if: matrix.type == 'integration-test' + if: success() && matrix.type == 'integration-test' run: | sudo apt-get install ansible sudo service mysql stop @@ -112,7 +117,7 @@ jobs: run: ./3rdParty/buildLinuxDependencies.sh --gtest-only && ./configure --disable-client --disable-manager --enable-unit-tests CFLAGS="-g -O0" CXXFLAGS="-g -O0" - name: Make - if: success() && ! contains(matrix.type, 'integration-test') && ! endsWith(matrix.type, 'cmake') + if: success() && ! contains(matrix.type, 'integration-test') && ! endsWith(matrix.type, 'cmake') && ! endsWith(matrix.type, 'arm64') run: make - name: Make for cmake @@ -120,6 +125,19 @@ jobs: run: cmake --build build + - name: Build libraries for amd64 + if: success() && matrix.type == 'libs-arm64' + run: | + ./linux/arm64/build_libraries_arm64.sh + + - name: Build apps for amd64 + if: success() && matrix.type == 'apps-arm64' + run: | + ./linux/arm64/build_libraries_arm64.sh + ./linux/arm64/build_openssl_arm64.sh + ./linux/arm64/build_curl_arm64.sh + ./linux/arm64/build_example_arm64.sh + - name: Execute unit-test and report coverage if: success() && matrix.type == 'unit-test' run: ./tests/executeUnitTests.sh --report-coverage --report-xml diff --git a/.gitignore b/.gitignore index 269fe797b2..bc8ecbee40 100644 --- a/.gitignore +++ b/.gitignore @@ -126,6 +126,7 @@ locale/*/*.flag ## dependency builds and CI cache directories 3rdParty/Windows/ 3rdParty/linux/ +3rdParty/linux-arm64/ 3rdParty/mac/ 3rdParty/buildCache/ 3rdParty/android/ diff --git a/deploy/prepare_deployment.py b/deploy/prepare_deployment.py index e6d1a33a38..04a54d2b08 100644 --- a/deploy/prepare_deployment.py +++ b/deploy/prepare_deployment.py @@ -235,6 +235,9 @@ def prepare_linux_client_vcpkg(target_directory): def prepare_linux_apps(target_directory): prepare_7z_archive('linux_apps', target_directory, linux_apps_list) +def prepare_linux_apps_arm64(target_directory): + prepare_7z_archive('linux_apps-arm64', target_directory, linux_apps_list) + def prepare_linux_apps_vcpkg(target_directory): prepare_7z_archive('linux_apps-vcpkg', target_directory, linux_apps_list) @@ -291,6 +294,7 @@ boinc_types = { 'linux_client': prepare_linux_client, 'linux_client-vcpkg': prepare_linux_client_vcpkg, 'linux_apps': prepare_linux_apps, + 'linux_apps-arm64': prepare_linux_apps_arm64, 'linux_apps-vcpkg': prepare_linux_apps_vcpkg, 'linux_manager-with-webview': prepare_linux_manager_with_webview, 'linux_manager-with-webview-vcpkg': prepare_linux_manager_with_webview_vcpkg, diff --git a/linux/arm64/build_curl_arm64.sh b/linux/arm64/build_curl_arm64.sh new file mode 100755 index 0000000000..64dc57c721 --- /dev/null +++ b/linux/arm64/build_curl_arm64.sh @@ -0,0 +1,75 @@ +#!/bin/sh +set -e + +# Script to compile Libcurl for linux arm64 + +STDOUT_TARGET="${STDOUT_TARGET:-/dev/stdout}" +CONFIGURE="yes" +MAKECLEAN="yes" +VERBOSE="${VERBOSE:-no}" +CI="${CI:-no}" +NPROC_USER="${NPROC_USER:-1}" + +export CURL_VERSION=7.84.0 +export BUILD_DIR=${BUILD_DIR:-$PWD/3rdParty/linux-arm64} +export CURL="$BUILD_DIR/curl-$CURL_VERSION" #CURL sources, required by BOINC +export CURL_FLAGFILE=$BUILD_DIR/curl-$CURL_VERSION.flagfile + +export TCINCLUDES="$BUILD_DIR/build" +export TCBINARIES="$TCINCLUDES/bin" +export TCSYSROOT="$BUILD_DIR/sysroot" + +export PATH="$TCBINARIES:$PATH" +export CC=aarch64-linux-gnu-gcc +export CXX=aarch64-linux-gnu-g++ +export LD=aarch64-linux-gnu-ld +export CFLAGS="--sysroot=$TCSYSROOT -I$TCINCLUDES/include -march=armv8-a -O3" +export CXXFLAGS="--sysroot=$TCSYSROOT -I$TCINCLUDES/include -march=armv8-a -O3" +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -march=armv8-a -latomic -static-libstdc++" + +MAKE_FLAGS="" + +if [ $VERBOSE = "no" ]; then + MAKE_FLAGS="$MAKE_FLAGS --silent" +else + MAKE_FLAGS="$MAKE_FLAGS SHELL=\"/bin/bash -x\"" +fi + +if [ $CI = "yes" ]; then + MAKE_FLAGS="$MAKE_FLAGS -j $(nproc --all)" +else + MAKE_FLAGS="$MAKE_FLAGS -j $NPROC_USER" +fi + +if [ ! -e "${CURL_FLAGFILE}" ]; then + rm -rf "$BUILD_DIR/curl-${CURL_VERSION}" + wget -c --no-verbose -O /tmp/curl_${CURL_VERSION}.tgz https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz + tar xzf /tmp/curl_${CURL_VERSION}.tgz --directory=$BUILD_DIR +fi + +if [ ! -e "${CURL_FLAGFILE}" ]; then + cd "$CURL" + echo "===== building curl for arm64 from $PWD =====" + if [ -n "$MAKECLEAN" ] && $(grep -q "^distclean:" "${CURL}/Makefile"); then + if [ "$VERBOSE" = "no" ]; then + make distclean 1>$STDOUT_TARGET 2>&1 + else + make distclean SHELL="/bin/bash -x" + fi + fi + if [ -n "$CONFIGURE" ]; then + ./configure --host=aarch64-linux --prefix="$TCINCLUDES" --libdir="$TCINCLUDES/lib" --disable-shared --enable-static --with-random=/dev/urandom 1>$STDOUT_TARGET --with-openssl + fi + if [ $VERBOSE = "no" ]; then + echo MAKE_FLAGS=$MAKE_FLAGS "1>$STDOUT_TARGET" + make $MAKE_FLAGS 1>$STDOUT_TARGET + make install $MAKE_FLAGS 1>$STDOUT_TARGET + else + echo MAKE_FLAGS=$MAKE_FLAGS + make $MAKE_FLAGS + make install $MAKE_FLAGS + fi + + touch "${CURL_FLAGFILE}" + echo "\e[1;32m===== curl for arm64 build done =====\e[0m" +fi diff --git a/linux/arm64/build_example_arm64.sh b/linux/arm64/build_example_arm64.sh new file mode 100755 index 0000000000..190bf17be9 --- /dev/null +++ b/linux/arm64/build_example_arm64.sh @@ -0,0 +1,67 @@ +#/bin/sh +set -e + +#script to compile Example for Android + +STDOUT_TARGET="${STDOUT_TARGET:-/dev/stdout}" +COMPILEBOINC="yes" +CONFIGURE="yes" +VERBOSE="${VERBOSE:-no}" +CI="${CI:-no}" +NPROC_USER="${NPROC_USER:-1}" + +export BUILD_DIR=${BUILD_DIR:-$PWD/3rdParty/linux-arm64} + +export TCINCLUDES="$BUILD_DIR/build" +export TCBINARIES="$TCINCLUDES/bin" +export TCSYSROOT="$BUILD_DIR/sysroot" + +export BOINC_API_DIR="$PWD/api" +export BOINC_LIB_DIR="$PWD/lib" +export BOINC_ZIP_DIR="$PWD/zip" + +export PATH="$TCBINARIES:$PATH" +export CC=aarch64-linux-gnu-gcc +export CXX=aarch64-linux-gnu-g++ +export LD=aarch64-linux-gnu-ld +export CFLAGS="--sysroot=$TCSYSROOT -I$TCINCLUDES/include -march=armv8-a -O3 -I$BOINC -I$BOINC_LIB_DIR -I$BOINC_API_DIR -I$BOINC_ZIP_DIR" +export CXXFLAGS="--sysroot=$TCSYSROOT -I$TCINCLUDES/include -march=armv8-a -O3 -I$BOINC -I$BOINC_LIB_DIR -I$BOINC_API_DIR -I$BOINC_ZIP_DIR" +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -march=armv8-a -latomic -static-libstdc++" +# export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -march=armv8-a -latomic -static-libstdc++ -lz" + +CONFIG_FLAGS="--with-ssl=$TCINCLUDES --with-libcurl=$TCINCLUDES" +CONFIG_LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib" +export _libcurl_pc="$TCINCLUDES/lib/pkgconfig/libcurl.pc" + +MAKE_FLAGS="" + +if [ $VERBOSE = "no" ]; then + MAKE_FLAGS="$MAKE_FLAGS --silent" +else + MAKE_FLAGS="$MAKE_FLAGS SHELL=\"/bin/bash -x\"" +fi + +if [ $CI = "yes" ]; then + MAKE_FLAGS="$MAKE_FLAGS -j $(nproc --all)" +else + MAKE_FLAGS="$MAKE_FLAGS -j $NPROC_USER" +fi + +if [ -n "$COMPILEBOINC" ]; then + echo "===== building example for arm64 from $PWD =====" + if [ -n "$MAKECLEAN" ] && [ -f "Makefile" ]; then + echo "=== building example clean ===" + if [ "$VERBOSE" = "no" ]; then + make distclean 1>$STDOUT_TARGET 2>&1 + else + make distclean SHELL="/bin/bash -x" + fi + fi + if [ -n "$CONFIGURE" ]; then + ./_autosetup + ./configure --host=aarch64-linux --with-boinc-platform="aarch64-unknown-linux-gnu" --with-boinc-alt-platform="arm-unknown-linux-gnueabihf" --prefix="$TCINCLUDES" --libdir="$TCINCLUDES/lib" $CONFIG_FLAGS --enable-apps --disable-server --disable-manager --disable-client --disable-libraries --disable-shared --enable-static --enable-boinczip + fi + echo MAKE_FLAGS=$MAKE_FLAGS + make $MAKE_FLAGS + echo "\e[1;32m===== building example for arm64 done =====\e[0m" +fi diff --git a/linux/arm64/build_libraries_arm64.sh b/linux/arm64/build_libraries_arm64.sh new file mode 100755 index 0000000000..dd4b039d55 --- /dev/null +++ b/linux/arm64/build_libraries_arm64.sh @@ -0,0 +1,61 @@ +#!/bin/sh +set -e + +# Script to compile various BOINC libraries for linux arm64 + +STDOUT_TARGET="${STDOUT_TARGET:-/dev/stdout}" +COMPILEBOINC="yes" +CONFIGURE="yes" +MAKECLEAN="yes" +VERBOSE="${VERBOSE:-no}" +CI="${CI:-no}" +NPROC_USER="${NPROC_USER:-1}" + +export BUILD_DIR=${BUILD_DIR:-$PWD/3rdParty/linux-arm64} + +export TCINCLUDES="$BUILD_DIR/build" +export TCSYSROOT="$BUILD_DIR/sysroot" + +export CC=aarch64-linux-gnu-gcc +export CXX=aarch64-linux-gnu-g++ +export LD=aarch64-linux-gnu-ld +export CFLAGS="--sysroot=$TCSYSROOT -march=armv8-a" +export CXXFLAGS="--sysroot=$TCSYSROOT -march=armv8-a" +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -march=armv8-a -static-libstdc++ -static" + +MAKE_FLAGS="" + +if [ $VERBOSE = "no" ]; then + MAKE_FLAGS="$MAKE_FLAGS --silent" +else + MAKE_FLAGS="$MAKE_FLAGS SHELL=\"/bin/bash -x\"" +fi + +if [ $CI = "yes" ]; then + MAKE_FLAGS="$MAKE_FLAGS -j $(nproc --all)" +else + MAKE_FLAGS="$MAKE_FLAGS -j $NPROC_USER" +fi + +if [ -n "$COMPILEBOINC" ]; then + + echo "===== building BOINC Libraries for arm64 from $PWD =====" + if [ -n "$MAKECLEAN" ] && [ -f "Makefile" ]; then + if [ "$VERBOSE" = "no" ]; then + make distclean 1>$STDOUT_TARGET 2>&1 + else + make distclean SHELL="/bin/bash -x" + fi + fi + if [ -n "$CONFIGURE" ]; then + ./_autosetup + ./configure --host=aarch64-linux --with-boinc-platform="aarch64-unknown-linux-gnu" --with-boinc-alt-platform="arm-unknown-linux-gnueabihf" --prefix="$TCINCLUDES" --libdir="$TCINCLUDES/lib" --disable-server --disable-manager --disable-client --disable-shared --enable-static --enable-boinczip + fi + echo MAKE_FLAGS=$MAKE_FLAGS + make $MAKE_FLAGS + make stage $MAKE_FLAGS + make install $MAKE_FLAGS + + echo "\e[1;32m===== building BOINC Libraries for arm64 done =====\e[0m" + +fi diff --git a/linux/arm64/build_openssl_arm64.sh b/linux/arm64/build_openssl_arm64.sh new file mode 100755 index 0000000000..fb381b39b6 --- /dev/null +++ b/linux/arm64/build_openssl_arm64.sh @@ -0,0 +1,77 @@ +#!/bin/sh +set -e + +# Script to compile OpenSSL for linux arm64 + +STDOUT_TARGET="${STDOUT_TARGET:-/dev/stdout}" +CONFIGURE="yes" +MAKECLEAN="yes" +VERBOSE="${VERBOSE:-no}" +CI="${CI:-no}" +NPROC_USER="${NPROC_USER:-1}" + +export OPENSSL_VERSION=3.0.5 +export BUILD_DIR=${BUILD_DIR:-$PWD/3rdParty/linux-arm64} +export OPENSSL="$BUILD_DIR/openssl-$OPENSSL_VERSION" #openSSL sources, required by BOINC +export OPENSSL_FLAGFILE=$BUILD_DIR/openssl-$OPENSSL_VERSION.flagfile + +export TCINCLUDES="$BUILD_DIR/build" +export TCBINARIES="$TCINCLUDES/bin" +export TCSYSROOT="$BUILD_DIR/sysroot" + +export PATH="$TCBINARIES:$PATH" +export CC=aarch64-linux-gnu-gcc +export CXX=aarch64-linux-gnu-g++ +export LD=aarch64-linux-gnu-ld +export CFLAGS="--sysroot=$TCSYSROOT -march=armv8-a -O3" +export CXXFLAGS="--sysroot=$TCSYSROOT -march=armv8-a -O3" +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -march=armv8-a -latomic -static-libstdc++" + +MAKE_FLAGS="" + +if [ $VERBOSE = "no" ]; then + MAKE_FLAGS="$MAKE_FLAGS --silent" +else + MAKE_FLAGS="$MAKE_FLAGS SHELL=\"/bin/bash -x\"" +fi + +if [ $CI = "yes" ]; then + MAKE_FLAGS1="$MAKE_FLAGS -j $(nproc --all)" +else + MAKE_FLAGS1="$MAKE_FLAGS -j $NPROC_USER" +fi + +mkdir -p $BUILD_DIR + +if [ ! -e "${OPENSSL_FLAGFILE}" ]; then + rm -rf "$BUILD_DIR/openssl-${OPENSSL_VERSION}" + wget -c --no-verbose -O /tmp/openssl_${OPENSSL_VERSION}.tgz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz + tar xzf /tmp/openssl_${OPENSSL_VERSION}.tgz --directory=$BUILD_DIR +fi + +if [ ! -e "${OPENSSL_FLAGFILE}" ]; then + cd "$OPENSSL" + echo "===== building openssl for arm64 from $PWD =====" + if [ -n "$MAKECLEAN" -a -e "${OPENSSL}/Makefile" ]; then + if [ "$VERBOSE" = "no" ]; then + make clean 1>$STDOUT_TARGET 2>&1 + else + make clean SHELL="/bin/bash -x" + fi + fi + if [ -n "$CONFIGURE" ]; then + ./Configure linux-generic32 no-shared no-dso -DL_ENDIAN --openssldir="$TCINCLUDES" --prefix="$TCINCLUDES" 1>$STDOUT_TARGET + fi + if [ $VERBOSE = "no" ]; then + echo MAKE_FLAGS=$MAKE_FLAGS "1>$STDOUT_TARGET" + make $MAKE_FLAGS 1>$STDOUT_TARGET + make install_sw $MAKE_FLAGS 1>$STDOUT_TARGET + else + echo MAKE_FLAGS=$MAKE_FLAGS + make $MAKE_FLAGS + make install_sw $MAKE_FLAGS + fi + + touch "${OPENSSL_FLAGFILE}" + echo "\e[1;32m===== openssl for arm64 build done =====\e[0m" +fi