Skip to content

Build Android

Build Android #50

Workflow file for this run

name: Build Android
on:
workflow_dispatch:
jobs:
build:
strategy:
matrix:
arch: [ "arm32", "aarch64", "x86_64"]
fail-fast: false
name: "Build for ${{matrix.arch}}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Up Environment
run: |
sudo apt update
sudo apt install -y libxrandr-dev libxxf86vm-dev libxcb-*-dev libx11-xcb-dev libxfixes-dev libdrm-dev libx11-dev
pip3 install mako meson ninja
- name: Set ndkver,sdkver and work_dir
run: |
echo "NDK_VER=android-ndk-r27c" >> $GITHUB_ENV
echo "SDK_VER=33" >> $GITHUB_ENV
echo "WORK_DIR=$(pwd)" >> $GITHUB_ENV
- name: Download and extract NDK
run: |
echo "Downloading android-ndk from google server ..."
curl https://dl.google.com/android/repository/${NDK_VER}-linux.zip --output ${NDK_VER}-linux.zip &> /dev/null
echo "Extracting android-ndk to a folder ..."
unzip ${NDK_VER}-linux.zip &> /dev/null
- name: Build
run: |
envsubst <android-drm-${{matrix.arch}} >build-crossfile-drm
git clone https://gitlab.freedesktop.org/mesa/drm.git
cd drm
meson setup "build-android" \
--prefix=/tmp/drm-static \
--cross-file "../build-crossfile-drm" \
-Ddefault_library=static \
-Dintel=disabled \
-Dradeon=disabled \
-Damdgpu=disabled \
-Dnouveau=disabled \
-Dvmwgfx=disabled \
-Dfreedreno=enabled \
-Dvc4=disabled \
-Detnaviv=disabled \
-Dfreedreno-kgsl=true
ninja -C "build-android" install
cd ..
envsubst <android-${{matrix.arch}} >build-crossfile
git clone --branch mesa-24.3.1 https://gitlab.freedesktop.org/mesa/mesa
git clone --branch 24.3.1 https://github.com/Vera-Firefly/mesa-build-fix
cp -rf mesa-build-fix/* mesa/
cd mesa
meson setup "build-android" \
--prefix=/tmp/mesa \
--cross-file "../build-crossfile" \
-Dplatforms=android \
-Dplatform-sdk-version=33 \
-Dandroid-stub=true \
-Dandroid-libbacktrace=disabled \
-Dandroid-strict=false \
-Dxlib-lease=disabled \
-Degl=disabled \
-Dgbm=disabled \
-Dglx=disabled \
-Dllvm=disabled \
-Dopengl=true \
-Dosmesa=true \
-Dvulkan-drivers= \
-Dgallium-drivers=panfrost,freedreno,zink \
-Dfreedreno-kmds=kgsl,msm \
-Dshared-glapi=false \
-Dtools=drm-shim \
-Dbuildtype=release
ninja -C "build-android" install
mkdir /tmp/mesa/output
mkdir /tmp/mesa/drm_shim
cp /tmp/mesa/lib/libOSMesa.so /tmp/mesa/output/libOSMesa_8.so
cp /tmp/mesa/lib/libxatracker.so /tmp/mesa/output/libxatracker.so
cp /tmp/mesa/lib/libfreedreno_noop_drm_shim.so /tmp/mesa/drm_shim/libfreedreno_noop_drm_shim.so
cp /tmp/mesa/lib/libpanfrost_noop_drm_shim.so /tmp/mesa/drm_shim/libpanfrost_noop_drm_shim.so
cd /tmp/mesa/lib
ls -a
- name: Upload Mesa libraries
uses: actions/upload-artifact@v4
with:
name: libOSMesa_${{matrix.arch}}
path: /tmp/mesa/output/libOSMesa_8.so
- name: Upload xatracker libraries
uses: actions/upload-artifact@v4
with:
name: libxatracker_${{matrix.arch}}
path: /tmp/mesa/output/libxatracker.so
- name: Upload drm_shim tools libraries
uses: actions/upload-artifact@v4
with:
name: Noop_drm_shim_${{matrix.arch}}
path: /tmp/mesa/drm_shim/*