Files
omarchy-pkgs/pkgbuilds/omarchy-mlx/PKGBUILD
T
Joshua Warren 7d643349b2 Point omarchy-mlx sources at the renamed repo
GitHub archives now extract to omarchy-mlx-<ver> for every tag, so the
source filename and the build cd follow the omarchy-mlx name. Tarball
sha256 unchanged: 7ad98f7df4df54c1e194b2be1469200da767dc3e374d79e66dcb98bdbb958a9d.
2026-10-01 19:22:50 -05:00

114 lines
4.6 KiB
Bash

# Maintainer: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
pkgbase=omarchy-mlx
pkgname=(omarchy-mlx omarchy-mlx-vulkan)
pkgver=0.7.10
pkgrel=1
arch=('aarch64')
url='https://github.com/joshuaswarren/omarchy-mlx'
# The two packages publish together, so the tested wheel and the Vulkan driver
# it was qualified on can never skew.
_wheel=mlx_omarchy-0.32.4.dev202610012048+6cff5ea-cp314-cp314-linux_aarch64.whl
_vendor=omarchy-mlx-vendor-wheels-v$pkgver-cp314-aarch64.tar
# The Honeykrisp Vulkan driver: joshuaswarren/mesa-1 honeykrisp-omarchy-v3.
_mesa_commit=e7631595df6281748ea5e643d74db59c5f783b01
# The driver reports this in driverInfo as "git-<sha>"; the runtime compares it.
_mesa_sha=${_mesa_commit:0:10}
makedepends=('clang' 'elfutils' 'expat' 'glslang' 'libclc' 'libdrm' 'llvm' 'meson'
'python' 'python-mako' 'python-packaging' 'python-yaml'
'spirv-llvm-translator' 'spirv-tools' 'zstd')
options=('!debug' '!lto')
source=("omarchy-mlx-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
"$_wheel::$url/releases/download/v$pkgver/${_wheel//+/%2B}"
"$_vendor::$url/releases/download/v$pkgver/$_vendor"
"mesa-$_mesa_commit.tar.gz::https://github.com/joshuaswarren/mesa-1/archive/$_mesa_commit.tar.gz")
noextract=("$_wheel" "$_vendor")
sha256sums=('7ad98f7df4df54c1e194b2be1469200da767dc3e374d79e66dcb98bdbb958a9d'
'16a14856cf7ca7617750024518d307ee8de5c23246c9e3899e7f0f437839bb8e'
'ec804f658db59b2018b8aec0b1c683309f8dfd608ec1a114313da8838741823c'
'ae00b9568f1c57a7be7518b6f508354bc86c4494d83a82ef79bd0a799835c4b2')
prepare() {
rm -rf vendor
mkdir vendor
tar -xf "$_vendor" -C vendor --strip-components=1
[[ -f vendor/$_wheel ]] || cp "$_wheel" vendor/
}
build() {
# Vulkan driver only: no GL, no gallium drivers, no window systems, no layers.
# The tarball has no .git; git_sha1.h is generated at compile time from this.
export MESA_GIT_SHA1_OVERRIDE=$_mesa_sha
meson setup "mesa-1-$_mesa_commit" build-mesa \
--prefix=/usr \
--libdir=lib \
--buildtype=release \
-Db_ndebug=true \
-Dvulkan-drivers=asahi \
-Dgallium-drivers= \
-Dplatforms= \
-Dvulkan-layers= \
-Dopengl=false \
-Dgles1=disabled \
-Dgles2=disabled \
-Degl=disabled \
-Dgbm=disabled \
-Dglx=disabled \
-Dllvm=enabled \
-Dshared-llvm=enabled \
-Dvalgrind=disabled \
-Dbuild-tests=false
meson compile -C build-mesa
DESTDIR="$srcdir/mesa-stage" meson install -C build-mesa
# The system venv and launchers, built offline from the hash-locked wheels.
cd "omarchy-mlx-$pkgver"
MLX_OMARCHY_CONV_RING=0 bash install.sh --system \
--dest-root "$srcdir/stage" \
--vendor "$srcdir/vendor" \
--lock "$srcdir/vendor/requirements-lock.txt"
}
check() {
grep -aq "(git-$_mesa_sha)" "$srcdir/mesa-stage/usr/lib/libvulkan_asahi.so"
"$srcdir/stage/usr/lib/omarchy-mlx/venv/bin/python" \
-c 'import mlx.core, mlx_omarchy_paths, mlx_omarchy_serve'
}
package_omarchy-mlx() {
pkgdesc='MLX for Apple Silicon Macs: GPU inference through Vulkan, with ANE support'
license=('MIT')
groups=('omarchy-platform-apple-silicon')
depends=("omarchy-mlx-vulkan=$pkgver-$pkgrel" 'python>=3.14' 'python<3.15'
'blas' 'gcc-libs' 'glibc' 'lapack' 'openblas' 'vulkan-icd-loader')
optdepends=('omarchy-ane-abi: Apple Neural Engine execution on qualified chips (omarchy-ane-dkms)')
cp -a "$srcdir/stage/usr" "$pkgdir/usr"
}
package_omarchy-mlx-vulkan() {
pkgdesc='Honeykrisp Vulkan driver for omarchy-mlx only (private ICD, not used by other programs)'
license=('MIT AND BSD-3-Clause AND SGI-B-2.0')
groups=('omarchy-platform-apple-silicon')
depends=('expat' 'gcc-libs' 'glibc' 'libdrm' 'libelf' 'llvm-libs' 'spirv-tools' 'zstd')
conflicts=('mesa-honeykrisp-omarchy')
local dir=/usr/lib/omarchy-mlx/vulkan
install -Dm755 "$srcdir/mesa-stage/usr/lib/libvulkan_asahi.so" "$pkgdir$dir/libvulkan_asahi.so"
# The ICD manifest stays out of the loader's search path; only omarchy-mlx
# names it. library_path is absolute.
python - "$srcdir/mesa-stage/usr/share/vulkan/icd.d/asahi_icd.aarch64.json" \
"$pkgdir$dir/honeykrisp_icd.aarch64.json" "$dir/libvulkan_asahi.so" <<'PY'
import json, sys
src, dst, lib = sys.argv[1:]
manifest = json.load(open(src))
manifest["ICD"]["library_path"] = lib
with open(dst, "w") as f:
json.dump(manifest, f, indent=4)
f.write("\n")
PY
chmod 644 "$pkgdir$dir/honeykrisp_icd.aarch64.json"
printf '%s\n' "$_mesa_sha" | install -Dm644 /dev/stdin "$pkgdir$dir/mesa-git-sha"
install -Dm644 "$srcdir/mesa-1-$_mesa_commit/docs/license.rst" \
"$pkgdir/usr/share/licenses/$pkgname/license.rst"
}