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
6 changes: 4 additions & 2 deletions pkgbuilds/mesa-aurora/.omarchy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"source": "local",
"sync": false,
"rebuild_on": [
"libdisplay-info"
"libdisplay-info",
"llvm-libs"
],
"rebuilt_against": {
"aarch64": {
"libdisplay-info": "0.3.0-1"
"libdisplay-info": "0.3.0-1",
"llvm-libs": "23.1.4-1.1"
}
}
}
49 changes: 37 additions & 12 deletions pkgbuilds/mesa-aurora/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ epoch=1
# Development versions sort by real UTC date, full reachable commit count,
# then source hash. Hash-only same-day repins can downgrade existing packages.
pkgver=26.3.0_devel.20261029.231476.672657e05e6
pkgrel=1
pkgrel=2
pkgdesc='Aurora Asahi Gallium, Zink and Honeykrisp'
arch=('aarch64')
groups=('omarchy-platform-apple-silicon')
Expand All @@ -18,11 +18,14 @@ license=('MIT')
_commit=672657e05e6b382a0203975f7a26c46f9a674973
_src=mesa-omacom
# Matched to the DRM UAPI in omacom/linux-aurora integration/aurora.
# The drivers link neither LLVM nor SPIRV-Tools. Arch Linux ARM moves both
# (llvm-libs changes soname every major, SPIRV-Tools has no versioned soname),
# and a Mesa linked to the old ones leaves the Neo without a GPU until this
# package is rebuilt. Asahi needs LLVM only to precompile its CL shaders, so a
# first build makes those compilers and the packaged one uses them.
# The drivers never link SPIRV-Tools, which Arch Linux ARM moves without a
# versioned soname. Asahi needs LLVM only to precompile its CL shaders, so a
# first build makes those compilers and the packaged one uses them. llvmpipe, the
# fallback renderer for a Mac without a working GPU, links the system LLVM, like
# Arch's own mesa: one LLVM per process. mesa-aurora depends on 'libLLVM.so',
# which makepkg turns into the exact soname libgallium links (today libLLVM.so=23.1-64),
# so an LLVM major bump blocks the upgrade until this package is rebuilt for it,
# rather than leaving libgallium without its LLVM.
makedepends=('git' 'meson' 'ninja' 'python-mako' 'python-yaml' 'python-packaging' 'rust'
'rust-bindgen' 'clang' 'llvm' 'libclc' 'spirv-llvm-translator' 'spirv-tools'
'cbindgen' 'glslang' 'libdrm' 'expat' 'libglvnd'
Expand All @@ -35,7 +38,7 @@ source=("$_src::git+$url.git#commit=$_commit")
sha256sums=('SKIP')
options=('!debug')
_options=(-Dplatforms=x11,wayland
-Dgallium-drivers=asahi,zink,softpipe -Dvulkan-drivers=asahi
-Dgallium-drivers=asahi,zink,softpipe,llvmpipe -Dvulkan-drivers=asahi
-Degl=enabled -Dgbm=enabled -Dglx=dri -Dgles1=enabled -Dgles2=enabled
-Dglvnd=enabled -Dvideo-codecs=all -Dvulkan-layers=
-Dexpat=enabled -Dzstd=enabled -Dlmsensors=enabled -Dlibunwind=disabled -Dvalgrind=disabled)
Expand All @@ -56,30 +59,52 @@ build() {
"asahi_clc = '$srcdir/tools/src/asahi/clc/asahi_clc'" > tools.ini

_meson "$_src" build "${_options[@]}" --native-file tools.ini \
-Dllvm=disabled -Dspirv-tools=disabled -Dmesa-clc=system -Dprecomp-compiler=system \
-Dllvm=enabled -Dshared-llvm=enabled -Dspirv-tools=disabled \
-Dmesa-clc=system -Dprecomp-compiler=system \
-Dbuild-tests=true
meson compile -C build -j "${OMARCHY_BUILD_JOBS:-10}"
DESTDIR="$srcdir/mesa-stage" meson install -C build --no-rebuild
}
check() {
meson test -C build --print-errorlogs \
--num-processes "${OMARCHY_BUILD_JOBS:-10}" || return 1
# Nothing packaged may follow the system's LLVM or SPIRV-Tools.
# Only the Gallium megadriver, for llvmpipe, links LLVM, and exactly one LLVM.
# makepkg versions the 'libLLVM.so' depend only from executable files that
# link it, so libgallium must be one. Nothing packaged links SPIRV-Tools.
[[ -d $srcdir/mesa-stage ]] || return 1
local binary dependencies
local binary dependencies llvm llvmpipe=0
while IFS= read -r -d '' binary; do
dependencies=$(LC_ALL=C readelf -d "$binary") || return 1
if grep -Eq 'NEEDED.*(libLLVM|libSPIRV-Tools)' <<<"$dependencies"; then
if grep -Eq 'NEEDED.*libSPIRV-Tools' <<<"$dependencies"; then
echo "Unexpected compiler runtime dependency: $binary" >&2
return 1
fi
llvm=$(sed -nE 's/.*NEEDED.*\[(libLLVM[^]]*)\].*/\1/p' <<<"$dependencies")
[[ -n $llvm ]] || continue
if [[ $(basename "$binary") != libgallium-*.so ]]; then
echo "Only libgallium may link LLVM: $binary" >&2
return 1
fi
if ! [[ $llvm =~ ^libLLVM\.so\.[0-9]+\.[0-9]+$ ]]; then
echo "libgallium must link exactly one libLLVM.so.<major>.<minor>: $binary" >&2
return 1
fi
if [[ ! -x $binary ]]; then
echo "makepkg would not version the libLLVM.so depend from $binary" >&2
return 1
fi
llvmpipe=1
done < <(find "$srcdir/mesa-stage" -name '*.so*' -type f -print0)
if (( ! llvmpipe )); then
echo "libgallium does not link LLVM, so llvmpipe is missing" >&2
return 1
fi
}

package_mesa-aurora() {
pkgdesc='Aurora native Asahi Gallium and Zink OpenGL drivers'
depends=('expat' 'glibc' 'gcc-libs' 'libdrm' 'libglvnd' 'libx11' 'libxcb' 'libxext'
'libxshmfence' 'libxxf86vm' 'lm_sensors' 'wayland' 'zlib' 'zstd'
'libxshmfence' 'libxxf86vm' 'libLLVM.so' 'lm_sensors' 'wayland' 'zlib' 'zstd'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line the hold depends on. Please confirm from the CI artifact's .PKGINFO that it comes out as libLLVM.so=23.1-64.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed on cedcc6e's CI artifact (run 40611672833): depend = libLLVM.so=23.1-64.

'vulkan-mesa-implicit-layers')
provides=("mesa=$epoch:$pkgver" 'mesa-libgl' 'opengl-driver' 'libgbm.so')
conflicts=('mesa')
Expand Down
15 changes: 11 additions & 4 deletions tests/aurora-edge/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,17 @@ def test_every_recipe_is_apple_silicon_only(self):
for package in srcinfo(name).values():
self.assertEqual(package['groups'], ['omarchy-platform-apple-silicon'])

def test_mesa_follows_neither_llvm_nor_spirv_tools(self):
for package in srcinfo('mesa-aurora').values():
for dependency in ['llvm-libs', 'spirv-tools']:
self.assertNotIn(dependency, package['depends'])
def test_mesa_follows_llvm_by_soname_and_never_spirv_tools(self):
# llvmpipe links the system LLVM. mesa-aurora depends on 'libLLVM.so',
# which makepkg versions from libgallium's NEEDED soname, so an LLVM
# major bump blocks the upgrade instead of breaking libgallium.
packages = srcinfo('mesa-aurora')
for package in packages.values():
self.assertNotIn('spirv-tools', package['depends'])
self.assertNotIn('llvm-libs', package['depends'])
self.assertEqual([d for d in packages['mesa-aurora']['depends'] if d.startswith('libLLVM')],
['libLLVM.so'])
self.assertFalse([d for d in packages['vulkan-aurora']['depends'] if d.startswith('libLLVM')])

def test_mesa_epoch_and_existing_neo_versions_upgrade(self):
installed = {'mesa-aurora': '1:26.3.0_devel-932.a0bcbcb28528',
Expand Down
34 changes: 27 additions & 7 deletions tests/aurora-edge/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,37 @@ def test_headers_require_resolver_only_when_btf_enabled(self):

class MesaRecipeTests(unittest.TestCase):
def test_cpu_tests_fail_the_package_and_runtime_abi_is_checked(self):
# Only libgallium may link LLVM, exactly one libLLVM.so.<major>.<minor>,
# and it must be executable so makepkg versions the 'libLLVM.so' depend
# from it; it must link LLVM, or llvmpipe is missing. SPIRV-Tools stays
# out everywhere.
recipe = ROOT / 'pkgbuilds/mesa-aurora/PKGBUILD'
for test_status, runtime, reader_status, expected in [
(0, '', 0, 0), (1, '', 0, 1), (0, 'libLLVM.so.23', 0, 1),
(0, 'libSPIRV-Tools.so', 0, 1), (0, '', 1, 1)]:
with self.subTest(tests=test_status, runtime=runtime, reader=reader_status), tempfile.TemporaryDirectory() as temporary:
llvm23, llvm24 = 'libLLVM.so.23.1', 'libLLVM.so.24.1'
for test_status, gallium, other, reader_status, executable, expected in [
(0, llvm23, '', 0, True, 0),
(0, llvm24, '', 0, True, 0),
(1, llvm23, '', 0, True, 1),
(0, llvm23, '', 1, True, 1),
(0, llvm23, '', 0, False, 1),
(0, '', '', 0, True, 1),
(0, f'{llvm23} {llvm24}', '', 0, True, 1),
(0, llvm23, llvm23, 0, True, 1),
(0, llvm23, 'libSPIRV-Tools.so', 0, True, 1)]:
with self.subTest(tests=test_status, gallium=gallium, other=other, reader=reader_status, executable=executable), tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
stage = root / 'mesa-stage'
stage.mkdir()
(stage / 'driver.so').write_bytes(b'fixture')
result = shell('source "$1"\nsrcdir="$2"\nmeson() { printf \'%s\\n\' "$*"; return "$TEST_STATUS"; }\nreadelf() { [[ -z $RUNTIME ]] || echo "NEEDED $RUNTIME"; return "$READER_STATUS"; }\ncheck\n', recipe, root, env=dict(os.environ, TEST_STATUS=str(test_status),
RUNTIME=runtime, READER_STATUS=str(reader_status)))
gallium_file = stage / 'libgallium-26.3.0-devel.so'
gallium_file.write_bytes(b'fixture')
gallium_file.chmod(0o755 if executable else 0o644)
other_file = stage / 'libvulkan_asahi.so'
other_file.write_bytes(b'fixture')
other_file.chmod(0o755)
result = shell('source "$1"\nsrcdir="$2"\nmeson() { printf \'%s\\n\' "$*"; return "$TEST_STATUS"; }\n'
'readelf() { local needed=$OTHER; [[ ${2##*/} == libgallium-* ]] && needed=$GALLIUM; '
'for lib in $needed; do echo " 0x1 (NEEDED) Shared library: [$lib]"; done; return "$READER_STATUS"; }\ncheck\n',
recipe, root, env=dict(os.environ, TEST_STATUS=str(test_status),
GALLIUM=gallium, OTHER=other, READER_STATUS=str(reader_status)))
self.assertEqual(result.returncode, expected, result.stderr)
self.assertIn('test -C build --print-errorlogs', result.stdout)

Expand Down
Loading