From c883ce4439697ca7e1dc1d92b7d934287ffe7c1e Mon Sep 17 00:00:00 2001 From: maxjivi05 Date: Sun, 25 Oct 2026 19:47:41 -0400 Subject: [PATCH] CI builds the MaliBridge client as a component The components job checks out external/MaliBridge and builds the guest ICD, its manifest and the self-test as the vkbridge recipe; a submodule counts in a recipe's identity by its pinned commit. --- .github/workflows/build.yml | 15 +++++++++++++++ tools/components/prepare.py | 3 +++ tools/components/recipes.json | 15 +++++++++++++++ tools/components/recipes/vkbridge.sh | 4 ++++ tools/tests/test_component_prepare.py | 20 ++++++++++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 tools/components/recipes/vkbridge.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d39651c0b..75a28f7935 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -149,6 +149,8 @@ jobs: run: test "$(git rev-parse 'HEAD^{tree}')" = "$SOURCE_TREE" - name: Resolve the pinned Android NDK run: bash tools/ci/resolve-ndk.sh + - name: Check out MaliBridge + run: git submodule update --init external/MaliBridge - name: Plan component identities id: plan @@ -212,6 +214,7 @@ jobs: ${{ steps.preloads.outputs.cache-hit != 'true' && 'runtime' || '' }} ${{ steps.component-preloads.outputs.arm64 != 'true' && 'arm64-preloads' || '' }} ${{ steps.comet.outputs.cache-hit != 'true' && 'comet' || '' }} + vkbridge run: python3 tools/components/prepare.py tools - name: Build changed ARM64 preloads @@ -222,6 +225,9 @@ jobs: if: steps.preloads.outputs.cache-hit != 'true' run: python3 tools/components/prepare.py runtime + - name: Build the Mali bridge's Linux side + run: python3 tools/components/prepare.py vkbridge + - name: Fetch the Debian image the preloads build in if: steps.component-preloads.outputs.x86 != 'true' env: @@ -253,6 +259,12 @@ jobs: run: | set -euo pipefail bash tools/linuxfs/check-preloads.sh app/src/main/assets/linuxfs + D=app/src/main/assets/linuxfs + VKB="$D/usr/local/lib/vkbridge/libvulkan_droidbridge.so" + test -f "$VKB" && test -f "$D/usr/local/share/vkbridge/droidbridge_icd.json" && test -f "$D/usr/local/bin/droiddeck-vkbridge-smoke" + VKB_NEED=$(readelf -d "$VKB" | sed -n 's/.*NEEDED.*\[\(.*\)\]/\1/p' | grep -vx 'libc.so.6' | grep -vx 'ld-linux-aarch64.so.1' || true) + [ -z "$VKB_NEED" ] || { echo "::error::the bridge ICD needs $VKB_NEED"; exit 1; } + [ "$(readelf -Ws "$VKB" | awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {sub(/@.*/, "", $8); print $8}' | grep -c '^vk_icd')" = 3 ] || { echo "::error::the bridge ICD does not export the loader interface"; exit 1; } - name: Build GOG Galaxy companion if: steps.comet.outputs.cache-hit != 'true' @@ -504,6 +516,9 @@ jobs: echo "::warning::built proot pack $sha does not match tools/packs/proot/release.env ($PROOT_PACK_SHA256). This build publishes the pack it just built. Source builds keep downloading the pinned pack until release.env is updated." fi + - name: Check out MaliBridge + run: git submodule update --init external/MaliBridge + - name: Build id: build env: diff --git a/tools/components/prepare.py b/tools/components/prepare.py index 064b452bee..fbcd27394d 100644 --- a/tools/components/prepare.py +++ b/tools/components/prepare.py @@ -35,6 +35,9 @@ def identity(name, root=ROOT): for name_ in sorted(set(paths)): if '__pycache__' in name_ or name_.endswith(('.pyc', '.md')): continue + if (root / name_).is_dir(): + values[name_] = subprocess.check_output(['git', 'ls-files', '--stage', '--', name_], cwd=root, text=True).split()[1] + continue content = (root / name_).read_bytes() if b'\0' not in content: content = content.replace(b'\r\n', b'\n') diff --git a/tools/components/recipes.json b/tools/components/recipes.json index 602fb379ec..993fd787af 100644 --- a/tools/components/recipes.json +++ b/tools/components/recipes.json @@ -222,5 +222,20 @@ "cmake", "xz-utils" ] + }, + "vkbridge": { + "script": "tools/components/recipes/vkbridge.sh", + "inputs": [ + "external/MaliBridge", + "tools/components/recipes/vkbridge.sh" + ], + "outputs": [ + "app/src/main/assets/linuxfs/usr/local/lib/vkbridge/libvulkan_droidbridge.so", + "app/src/main/assets/linuxfs/usr/local/share/vkbridge/droidbridge_icd.json", + "app/src/main/assets/linuxfs/usr/local/bin/droiddeck-vkbridge-smoke" + ], + "packages": [ + "gcc-aarch64-linux-gnu" + ] } } diff --git a/tools/components/recipes/vkbridge.sh b/tools/components/recipes/vkbridge.sh new file mode 100644 index 0000000000..10b4b521c8 --- /dev/null +++ b/tools/components/recipes/vkbridge.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +test -f external/MaliBridge/scripts/build-client-linux.sh +bash external/MaliBridge/scripts/build-client-linux.sh app/src/main/assets/linuxfs aarch64-linux-gnu-gcc diff --git a/tools/tests/test_component_prepare.py b/tools/tests/test_component_prepare.py index b513c8fe75..d86fff9b3c 100644 --- a/tools/tests/test_component_prepare.py +++ b/tools/tests/test_component_prepare.py @@ -57,6 +57,26 @@ class ComponentPrepareTest(unittest.TestCase): script.write_text(script.read_text() + '\nprintf changed\n') self.assertNotEqual(changed, components.identity('fake', self.root)) + def test_identity_follows_a_submodule_commit(self): + library = self.root / 'library' + subprocess.run(['git', 'init', '-q', str(library)], check=True) + def commit(text): + (library / 'source.c').write_text(text) + subprocess.run(['git', '-C', str(library), 'add', '.'], check=True) + subprocess.run(['git', '-C', str(library), '-c', 'user.name=Test Developer', '-c', 'user.email=test@example.test', + 'commit', '-qm', text], check=True) + return subprocess.check_output(['git', '-C', str(library), 'rev-parse', 'HEAD'], text=True).strip() + first = commit('int a;\n') + subprocess.run(['git', '-C', str(self.root), 'add', 'library'], check=True) + spec = dict(script='tools/components/recipes/fake.sh', inputs=['library'], outputs=[]) + (self.root / components.REGISTRY).write_text(json.dumps(dict(fake=spec))) + original = components.identity('fake', self.root) + commit('int b;\n') + self.assertEqual(original, components.identity('fake', self.root)) + subprocess.run(['git', '-C', str(self.root), 'add', 'library'], check=True) + self.assertNotEqual(original, components.identity('fake', self.root)) + self.assertNotEqual(first, subprocess.check_output(['git', '-C', str(library), 'rev-parse', 'HEAD'], text=True).strip()) + def test_tool_requirements_are_installed_in_one_union(self): definitions = dict(one=dict(packages=['gcc', 'cmake']), two=dict(packages=['gcc', 'qemu-user'])) with patch.object(components, 'registry', return_value=definitions), patch.object(components.subprocess, 'run') as run: