diff --git a/.github/workflows/build-tdlib.yml b/.github/workflows/build-tdlib.yml index 5b447c2..badc89b 100644 --- a/.github/workflows/build-tdlib.yml +++ b/.github/workflows/build-tdlib.yml @@ -10,27 +10,33 @@ env: jobs: build-linux: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + - os: ubuntu-24.04-arm + runs-on: ${{ matrix.os }} steps: - name: Restore cache TDLib id: cache-tdlib-restore uses: actions/cache/restore@v4 with: path: td/ - key: tdlib-${{ env.TDLIB_VERSION }}-linux-x86_64 + key: tdlib-${{ env.TDLIB_VERSION }}-linux-${{ runner.arch == 'ARM64' && 'aarch64' || 'x86_64' }} - name: Build TDLib if: steps.cache-tdlib-restore.outputs.cache-hit != 'true' run: | sudo apt-get update sudo apt-get -y upgrade - sudo apt-get -y install make git zlib1g-dev libssl-dev gperf php-cli cmake clang-14 libc++-dev libc++abi-dev + sudo apt-get install make git zlib1g-dev libssl-dev gperf php-cli cmake clang-18 libc++-18-dev libc++abi-18-dev git clone https://github.com/tdlib/td.git cd td git checkout $TDLIB_COMMIT rm -rf build mkdir build cd build - CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib .. + CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib .. cmake --build . --target install - name: Save cache TDLib uses: actions/cache/save@v4 @@ -64,7 +70,7 @@ jobs: if: steps.cache-tdlib-restore.outputs.cache-hit != 'true' run: | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - brew install gperf cmake openssl + brew install gperf openssl git clone https://github.com/tdlib/td.git cd td git checkout $TDLIB_COMMIT @@ -103,7 +109,7 @@ jobs: git checkout $TDLIB_COMMIT git clone https://github.com/Microsoft/vcpkg.git cd vcpkg - git checkout cd5e746ec203c8c3c61647e0886a8df8c1e78e41 + git checkout 07b30b49e5136a36100a2ce644476e60d7f3ddc1 ./bootstrap-vcpkg.bat ./vcpkg.exe install gperf:x64-windows openssl:x64-windows zlib:x64-windows cd .. diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 2b08b34..2d42690 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -24,8 +24,9 @@ jobs: fail-fast: false matrix: feature: [local-tdlib, download-tdlib, pkg-config, docs] + os: [ubuntu-latest, ubuntu-24.04-arm] - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -37,7 +38,7 @@ jobs: - name: Download TDLib if: matrix.feature == 'local-tdlib' || matrix.feature == 'pkg-config' run: | - gh release download --pattern 'tdlib-*-linux-x86_64.zip' + gh release download --pattern ${{ runner.arch == 'ARM64' && 'tdlib-*-linux-aarch64.zip' || 'tdlib-*-linux-x86_64.zip' }} unzip -q *.zip -d . - name: Set pkg-config environment variables if: matrix.feature == 'pkg-config' diff --git a/tdlib-rs/build.rs b/tdlib-rs/build.rs index 62f43ac..3e56c72 100644 --- a/tdlib-rs/build.rs +++ b/tdlib-rs/build.rs @@ -73,6 +73,7 @@ fn copy_local_tdlib() { /// Build the project using the generic build configuration. /// The current supported platforms are: /// - Linux x86_64 +/// - Linux aarch64 /// - Windows x86_64 /// - MacOS x86_64 /// - MacOS aarch64 @@ -82,7 +83,10 @@ fn generic_build() { let include_dir = format!("{}/include", prefix); let lib_dir = format!("{}/lib", prefix); let lib_path = { - #[cfg(all(target_os = "linux", target_arch = "x86_64"))] + #[cfg(any( + all(target_os = "linux", target_arch = "x86_64"), + all(target_os = "linux", target_arch = "aarch64") + ))] { format!("{}/libtdjson.so.{}", lib_dir, TDLIB_VERSION) } diff --git a/tdlib-rs/src/build.rs b/tdlib-rs/src/build.rs index debb8ef..317d9ff 100644 --- a/tdlib-rs/src/build.rs +++ b/tdlib-rs/src/build.rs @@ -160,7 +160,10 @@ fn generic_build(lib_path: Option) { let include_dir = format!("{}/include", prefix); let lib_dir = format!("{}/lib", prefix); let mut_lib_path = { - #[cfg(all(target_os = "linux", target_arch = "x86_64"))] + #[cfg(any( + all(target_os = "linux", target_arch = "x86_64"), + all(target_os = "linux", target_arch = "aarch64") + ))] { format!("{}/libtdjson.so.{}", lib_dir, TDLIB_VERSION) }