Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Android NDK Build (Wrapper Variant)

on: [push]

jobs:
build-android-wrapper:
runs-on: ubuntu-latest

strategy:
matrix:
build-type: [debugoptimized, release]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Patch anon_file.c for memfd_create
run: |
# SDK 30+ has native memfd_create in NDK
sed -i 's/#if defined(HAVE_MEMFD_CREATE) \&\& !defined __TERMUX__/#if defined(HAVE_MEMFD_CREATE)/' src/util/anon_file.c
# sed -i '/with_gallium_drisw_kms = false/{n;s/if system_has_kms_drm/if false/;}' meson.build # Disables DRI in WSI
sed -i "s/dep_libudev = dependency('libudev', required : false)/dep_libudev = null_dep/g" meson.build

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install Build Dependencies
run: |
python -m pip install --upgrade pip
pip install mako PyYAML meson ninja packaging

- name: Generate Meson Cross File for NDK
run: |
export ANDROID_NDK_HOME="$ANDROID_NDK_LATEST_HOME"
export MESON_WORKING_DIR="$GITHUB_WORKSPACE"
envsubst < android.toml > android-cross.toml

- name: Generate Shims
run: |
unzip shims.zip -d ./

- name: Configure Meson
env:
PKG_CONFIG_LIBDIR: ${{ github.workspace }}/shims
run: |
meson setup _build \
--cross-file android-cross.toml \
-Dbuildtype=${{ matrix.build-type }} \
-Dplatforms=android,x11 \
-Dandroid-stub=true \
-Dandroid-libbacktrace=disabled \
-Dplatform-sdk-version=30 \
-Dglx=disabled \
-Dgbm=disabled \
-Degl=disabled \
-Dopengl=false \
-Dgles1=disabled \
-Dgles2=disabled \
-Dglvnd=disabled \
-Dllvm=disabled \
-Dvalgrind=disabled \
-Dgallium-drivers= \
-Dshared-glapi=disabled \
-Dzstd=disabled \
-Dvulkan-drivers=wrapper

- name: Compile Project
run: |
meson compile -C _build

- name: Upload Vulkan Wrapper Artifact
uses: actions/upload-artifact@v4
with:
name: libvulkan_wrapper-aarch64-${{ matrix.build-type }}
path: _build/src/vulkan/wrapper/libvulkan_wrapper.so
if-no-files-found: error
60 changes: 0 additions & 60 deletions .github/workflows/macos.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@

# Local dev build notes (not part of the fork)
BUILD-PIXEL7.md

# ARM64 build shims needed for the wrapper when cross compiling on x86-64
shims/

.zed/
44 changes: 44 additions & 0 deletions android.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[constants]
ndk_home = '$ANDROID_NDK_HOME'
working_dir = '$MESON_WORKING_DIR'
ndk_bin = ndk_home / 'toolchains/llvm/prebuilt/linux-x86_64/bin'
ndk_sysroot = ndk_home / 'toolchains/llvm/prebuilt/linux-x86_64/sysroot'

[binaries]
c = [ndk_bin / 'aarch64-linux-android30-clang', '-D__TERMUX__']
cpp = [ndk_bin / 'aarch64-linux-android30-clang++',
'-fno-exceptions',
'-fno-unwind-tables',
'-fno-asynchronous-unwind-tables',
'--start-no-unused-arguments',
'-static-libstdc++',
'--end-no-unused-arguments',
'-D__TERMUX__']
ar = ndk_bin / 'llvm-ar'
strip = ndk_bin / 'llvm-strip'
pkg-config = '/usr/bin/pkg-config'

[host_machine]
system = 'android'
cpu_family = 'aarch64'
cpu = 'aarch64'
endian = 'little'

[properties]
sys_root = ndk_sysroot
needs_exe_wrapper = true
pkg_config_libdir = working_dir / 'shims'

[built-in options]
c_args = ['-fno-emulated-tls', '-I' + working_dir / 'shims/include',
'-DHAVE_STRUCT_TIMESPEC', '-DHAVE_DLFCN_H', '-UHAVE_SECURE_GETENV', '-UHAVE_QSORT_S',
'-include', 'fcntl.h', '-include', 'time.h']
cpp_args = ['-fno-emulated-tls', '-I' + working_dir / 'shims/include',
'-DHAVE_STRUCT_TIMESPEC', '-DHAVE_DLFCN_H', '-UHAVE_SECURE_GETENV', '-UHAVE_QSORT_S',
'-include', 'fcntl.h', '-include', 'time.h', '-include', 'dlfcn.h']
c_link_args = ['-Wl,--allow-shlib-undefined',
'-L' + working_dir / 'shims',
'-L' + ndk_home / 'toolchains/llvm/prebuilt/linux-x86_64/lib/clang/18/lib/linux/aarch64']
cpp_link_args = ['-Wl,--allow-shlib-undefined',
'-L' + working_dir / 'shims',
'-L' + ndk_home / 'toolchains/llvm/prebuilt/linux-x86_64/lib/clang/18/lib/linux/aarch64']
Binary file added shims.zip
Binary file not shown.
Loading