From 2cba9bf200829e9144fbd86b9853a480bc1bdd72 Mon Sep 17 00:00:00 2001 From: Rishav Sanjay Date: Fri, 31 Jul 2026 03:26:35 +0530 Subject: [PATCH 1/7] build Android arm64-v8a wheel --- .github/workflows/compile.yml | 111 +++++++++++++++++++++++++++++++++- README.md | 6 ++ 2 files changed, 116 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 664b528..6431d68 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -119,10 +119,119 @@ jobs: with: name: tinymesa-whl-${{ matrix.tag }}-${{ matrix.os }} path: dist/ + android: + name: Build tinymesa mesa-25.2.7 for Android arm64-v8a + runs-on: ubuntu-22.04 + env: + MESA_TAG: mesa-25.2.7 + ANDROID_API: '25' + NDK_VERSION: 29.0.14206865 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup tinymesa + uses: ./.github/actions/setup + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + - name: Install Android NDK + run: sdkmanager "ndk;${NDK_VERSION}" + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.88.0 + targets: aarch64-linux-android + - name: Install bindgen + run: cargo install --locked --version 0.72.1 bindgen-cli + - name: Clone mesa + run: git clone --depth 1 --branch ${MESA_TAG} https://gitlab.freedesktop.org/mesa/mesa.git ${{ github.workspace }}/mesa + - name: Build host mesa_clc + run: | + cd ${{ github.workspace }}/mesa + export CLANG_PATH=$(which clang-20) + meson setup build-compiler \ + -Dprefix=${{ runner.temp }}/mesa-compiler \ + -Dbuildtype=release \ + -Dstrip=true \ + -Dplatforms="[]" \ + -Dgallium-drivers="[]" \ + -Dvulkan-drivers="[]" \ + -Dmesa-clc=enabled \ + -Dinstall-mesa-clc=true + meson install -C build-compiler + echo "${{ runner.temp }}/mesa-compiler/bin" >> "$GITHUB_PATH" + - name: Patch mesa + run: ./apply_patches.py ${{ github.workspace }}/mesa ${MESA_TAG} + - name: Build Android wheel + env: + LIBCLANG_PATH: /usr/lib/llvm-20/lib + run: | + NDK=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION} + TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64 + cat > ${{ runner.temp }}/android-aarch64.ini < Date: Tue, 11 Aug 2026 23:55:16 +0530 Subject: [PATCH 2/7] remove nak --- README.md | 4 +--- meson.build | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9152d23..bc98178 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,4 @@ Builds are automatically generated upon new releases of mesa (checked daily). ### Android -Android `arm64-v8a` wheels target API 25 and contain `libtinymesa.so` with -the same NIR, NAK, and IR3 compiler API as the desktop build. The optional -LLVMpipe-based `libtinymesa_cpu.so` is not included. +Android arm64 wheels target API 25 and include NIR and IR3 support. NAK and LLVMpipe are not included. diff --git a/meson.build b/meson.build index 5e182ec..2fab834 100644 --- a/meson.build +++ b/meson.build @@ -52,6 +52,10 @@ foreach sym : ir3_symbols ir3_link_args += '-Wl,-u,' + symbol_prefix + sym endforeach -shared_library('tinymesa', link_whole : [ _libnir ], link_args : nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common ], dependencies : [ idep_nak ]) -shared_library('tinymesa_cpu', link_whole : [ _libnir ], link_args : lvp_link_args+nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common, libgallium ], dependencies : [ idep_nak ]) +if host_machine.system() == 'android' + shared_library('tinymesa', link_whole : [ _libnir ], link_args : ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common ]) +else + shared_library('tinymesa', link_whole : [ _libnir ], link_args : nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common ], dependencies : [ idep_nak ]) + shared_library('tinymesa_cpu', link_whole : [ _libnir ], link_args : lvp_link_args+nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common, libgallium ], dependencies : [ idep_nak ]) +endif From ddd0a6d7afb752ece948aad2840ab9000f0c4735 Mon Sep 17 00:00:00 2001 From: Rishav Sanjay Date: Tue, 11 Aug 2026 23:58:14 +0530 Subject: [PATCH 3/7] clean up --- .github/workflows/compile.yml | 99 ++++++++--------------------------- 1 file changed, 22 insertions(+), 77 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 6431d68..92346c8 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -120,12 +120,8 @@ jobs: name: tinymesa-whl-${{ matrix.tag }}-${{ matrix.os }} path: dist/ android: - name: Build tinymesa mesa-25.2.7 for Android arm64-v8a + name: Build tinymesa mesa-25.2.7 on Android arm64 runs-on: ubuntu-22.04 - env: - MESA_TAG: mesa-25.2.7 - ANDROID_API: '25' - NDK_VERSION: 29.0.14206865 steps: - name: Checkout repository uses: actions/checkout@v4 @@ -134,94 +130,43 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: Install Android NDK - run: sdkmanager "ndk;${NDK_VERSION}" - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: 1.88.0 - targets: aarch64-linux-android - - name: Install bindgen - run: cargo install --locked --version 0.72.1 bindgen-cli + run: sdkmanager "ndk;29.0.14206865" - name: Clone mesa - run: git clone --depth 1 --branch ${MESA_TAG} https://gitlab.freedesktop.org/mesa/mesa.git ${{ github.workspace }}/mesa - - name: Build host mesa_clc - run: | - cd ${{ github.workspace }}/mesa - export CLANG_PATH=$(which clang-20) - meson setup build-compiler \ - -Dprefix=${{ runner.temp }}/mesa-compiler \ - -Dbuildtype=release \ - -Dstrip=true \ - -Dplatforms="[]" \ - -Dgallium-drivers="[]" \ - -Dvulkan-drivers="[]" \ - -Dmesa-clc=enabled \ - -Dinstall-mesa-clc=true - meson install -C build-compiler - echo "${{ runner.temp }}/mesa-compiler/bin" >> "$GITHUB_PATH" + run: git clone --depth 1 --branch mesa-25.2.7 https://gitlab.freedesktop.org/mesa/mesa.git ${{ github.workspace }}/mesa - name: Patch mesa - run: ./apply_patches.py ${{ github.workspace }}/mesa ${MESA_TAG} - - name: Build Android wheel - env: - LIBCLANG_PATH: /usr/lib/llvm-20/lib + run: ./apply_patches.py ${{ github.workspace }}/mesa mesa-25.2.7 + - name: Build mesa + shell: bash run: | - NDK=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION} - TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64 - cat > ${{ runner.temp }}/android-aarch64.ini < ${{ runner.temp }}/android.ini < Date: Wed, 26 Aug 2026 00:47:35 +0530 Subject: [PATCH 4/7] fix readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bc98178..7fd979c 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,6 @@ Builds are automatically generated upon new releases of mesa (checked daily). ### Android -Android arm64 wheels target API 25 and include NIR and IR3 support. NAK and LLVMpipe are not included. +Android arm64-v8a wheels target API 25 and currently ship +`libtinymesa.so` with NIR + IR3/freedreno support. NAK is not included, +and `libtinymesa_cpu.so`/LLVMpipe is not built. From 61109f07eccc77063ee923c0d9ea7260c0a4521e Mon Sep 17 00:00:00 2001 From: Rishav Sanjay Date: Wed, 26 Aug 2026 04:42:38 +0530 Subject: [PATCH 5/7] use ndk --- .github/workflows/compile.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 92346c8..64da1ca 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -127,10 +127,10 @@ jobs: uses: actions/checkout@v4 - name: Setup tinymesa uses: ./.github/actions/setup - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - name: Install Android NDK - run: sdkmanager "ndk;29.0.14206865" + - name: Verify Android NDK + shell: bash + run: | + test -x "${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android25-clang" - name: Clone mesa run: git clone --depth 1 --branch mesa-25.2.7 https://gitlab.freedesktop.org/mesa/mesa.git ${{ github.workspace }}/mesa - name: Patch mesa From 057d9653b08f5a79646be56398b8d4c48e90e256 Mon Sep 17 00:00:00 2001 From: Rishav Sanjay Date: Wed, 26 Aug 2026 23:00:03 +0530 Subject: [PATCH 6/7] add android.ini --- .github/workflows/compile.yml | 18 ++---------------- android.ini | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 android.ini diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 64da1ca..b8757e4 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -138,23 +138,9 @@ jobs: - name: Build mesa shell: bash run: | - TOOLCHAIN=${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64 - cat > ${{ runner.temp }}/android.ini < Date: Sun, 30 Aug 2026 06:27:54 +0530 Subject: [PATCH 7/7] target Android API 30 --- .github/workflows/compile.yml | 6 +++--- README.md | 17 +++++++++++++++-- android.ini | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index b8757e4..ea822ba 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -130,7 +130,7 @@ jobs: - name: Verify Android NDK shell: bash run: | - test -x "${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android25-clang" + test -x "${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang" - name: Clone mesa run: git clone --depth 1 --branch mesa-25.2.7 https://gitlab.freedesktop.org/mesa/mesa.git ${{ github.workspace }}/mesa - name: Patch mesa @@ -140,7 +140,7 @@ jobs: run: | export PATH="${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH" cd ${{ github.workspace }}/mesa - meson setup build/ --cross-file=${{ github.workspace }}/android.ini -Db_staticpic=true -Dplatforms=android -Dplatform-sdk-version=25 -Dandroid-stub=true -Dandroid-libbacktrace=disabled -Dgallium-drivers="[]" -Dvulkan-drivers=freedreno -Dfreedreno-kmds=kgsl -Dllvm=disabled -Dshader-cache=disabled -Dzstd=disabled -Dzlib=disabled -Dopengl=false -Degl=disabled -Dgbm=disabled -Dvideo-codecs="[]" + meson setup build/ --cross-file=${{ github.workspace }}/android.ini -Db_staticpic=true -Dplatforms=android -Dplatform-sdk-version=30 -Dandroid-stub=true -Dandroid-libbacktrace=disabled -Dgallium-drivers="[]" -Dvulkan-drivers=freedreno -Dfreedreno-kmds=kgsl -Dllvm=disabled -Dshader-cache=disabled -Dzstd=disabled -Dzlib=disabled -Dopengl=false -Degl=disabled -Dgbm=disabled -Dvideo-codecs="[]" meson compile -C build tinymesa - name: Build wheel run: | @@ -151,7 +151,7 @@ jobs: fi ./build_wheel.py "${VERSION_ARG[@]}" \ - --platform android_25_arm64_v8a \ + --platform android_30_arm64_v8a \ mesa-25.2.7 ${{ github.workspace }}/mesa/build/src/tinymesa/libtinymesa.so - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index 7fd979c..f4d9817 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ libvulkan_lvp.so (interpreter => None) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 + ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ``` ### tinymesa: ``` @@ -85,6 +86,18 @@ Builds are automatically generated upon new releases of mesa (checked daily). ### Android -Android arm64-v8a wheels target API 25 and currently ship -`libtinymesa.so` with NIR + IR3/freedreno support. NAK is not included, +Android arm64-v8a wheels require Android 11 (API 30) or newer and currently +ship `libtinymesa.so` with NIR + IR3/freedreno support. NAK is not included, and `libtinymesa_cpu.so`/LLVMpipe is not built. + +Termux Python currently advertises an Android API 24 platform tag, so plain +`pip install tinymesa` will reject the API 30 wheel even on newer devices. +Install it explicitly with: + +```sh +python -m pip install \ + --platform android_30_arm64_v8a \ + --only-binary=:all: \ + --target "$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')" \ + tinymesa +``` diff --git a/android.ini b/android.ini index 72c79fc..6f5d3b3 100644 --- a/android.ini +++ b/android.ini @@ -1,7 +1,7 @@ [binaries] ar = 'llvm-ar' -c = 'aarch64-linux-android25-clang' -cpp = 'aarch64-linux-android25-clang++' +c = 'aarch64-linux-android30-clang' +cpp = 'aarch64-linux-android30-clang++' strip = 'llvm-strip' [host_machine]