From 1f61a4f08701de271cf339c1cf4819383ecdb7e2 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Dec 06 2024 15:15:33 +0000 Subject: Enable RustiCL --- diff --git a/.gitignore b/.gitignore index a1046c3..ece9ab2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .build* /*.tar.bz2 /*.tar.gz +/*.tar.xz .flatpak-builder diff --git a/mesa-asahi-flatpak.spec b/mesa-asahi-flatpak.spec index 2d5ebbc..b8764e7 100644 --- a/mesa-asahi-flatpak.spec +++ b/mesa-asahi-flatpak.spec @@ -15,7 +15,7 @@ Name: mesa-asahi-%{sdk_ver}-flatpak Summary: Mesa graphics libraries Flatpak overlay Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)} -Release: 1 +Release: 2 License: MIT URL: http://www.mesa3d.org @@ -37,6 +37,9 @@ BuildRequires: flatpak-builder BuildRequires: fdo-runtime-%{sdk_ver}-flatpak BuildRequires: fdo-sdk-%{sdk_ver}-flatpak BuildRequires: fdo-sdk-extension-llvm%{llvm_major}-%{sdk_ver}-flatpak +BuildRequires: fdo-sdk-extension-rust-stable-%{sdk_ver}-flatpak +# Missing from the Flatpak rust SDK extension, but the Fedora one works +BuildRequires: bindgen-cli # We don't want any automatic provides/requires since this is a Flatpak, not a system app %global __provides_exclude_from ^.*$ @@ -73,25 +76,35 @@ flatpak remote-modify --user --collection-id=org.flathub.Stable flathub flatpak install --assumeyes --user flathub --sideload-repo=/usr/share/flatpak-sideload/fdo-sdk-%{sdk_ver}/ org.freedesktop.Sdk//%{sdk_ver} flatpak install --assumeyes --user flathub --sideload-repo=/usr/share/flatpak-sideload/fdo-runtime-%{sdk_ver}/ org.freedesktop.Platform//%{sdk_ver} flatpak install --assumeyes --user flathub --sideload-repo=/usr/share/flatpak-sideload/fdo-sdk-extension-llvm%{llvm_major}-%{sdk_ver}/ org.freedesktop.Sdk.Extension.llvm%{llvm_major}//%{sdk_ver} +flatpak install --assumeyes --user flathub --sideload-repo=/usr/share/flatpak-sideload/fdo-sdk-extension-rust-stable-%{sdk_ver}/ org.freedesktop.Sdk.Extension.rust-stable//%{sdk_ver} %build FLATPAK_BWRAP=$PWD/bwrapwrapper flatpak-builder --disable-rofiles-fuse --extra-sources=%{_sourcedir} build org.freedesktop.Platform.GL.host.yml -# add DT_RUNPATH to ensure that libgallium-*.so is found even with a stae ld.so.cache +# add DT_RUNPATH to ensure that libgallium-*.so is found even with a stale ld.so.cache # https://github.com/flatpak/flatpak/issues/5948 -patchelf --add-rpath /usr/lib/aarch64-linux-gnu/GL/host/lib/ build/files/lib/libEGL_mesa.so.0.0.0 -patchelf --add-rpath /usr/lib/aarch64-linux-gnu/GL/host/lib/ build/files/lib/libGLX_mesa.so -patchelf --add-rpath /usr/lib/aarch64-linux-gnu/GL/host/lib/ build/files/lib/gbm/dri_gbm.so +patchelf --add-rpath /usr/lib/%{_arch}-linux-gnu/GL/host/lib/ build/files/lib/libEGL_mesa.so.0.0.0 +patchelf --add-rpath /usr/lib/%{_arch}-linux-gnu/GL/host/lib/ build/files/lib/libGLX_mesa.so +patchelf --add-rpath /usr/lib/%{_arch}-linux-gnu/GL/host/lib/ build/files/lib/gbm/dri_gbm.so +patchelf --add-rpath /usr/lib/%{_arch}-linux-gnu/GL/host/lib/ build/files/lib/libRusticlOpenCL.so.1.0.0 +patchelf --add-rpath /usr/lib/%{_arch}-linux-gnu/GL/host/lib/ build/files/lib/libclang-cpp.so.18.1 + +# Make icd lib path absolute so it can be found without the ld.so cache update +sed -i -e "s,^,/usr/lib/%{_arch}-linux-gnu/GL/host/lib/," build/files/etc/OpenCL/vendors/rusticl.icd %install mkdir -p %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.host/$(flatpak --default-arch)/ mv build/files %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.host/$(flatpak --default-arch)/%{sdk_ver} -ln -s share/glvnd share/vulkan %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.host/$(flatpak --default-arch)/%{sdk_ver}/ +ln -s share/glvnd share/vulkan etc/OpenCL %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.host/$(flatpak --default-arch)/%{sdk_ver}/ %files %{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.host/ %changelog +* Fri Dec 06 2024 Asahi Lina - 25.0.0~asahipre20241204-2 +- Enable RustiCL +- Fix paths in the x86_64 build + * Wed Dec 04 2024 Asahi Lina - 25.0.0~asahipre20241204-1 - Bump to mesa-asahi-20241204 diff --git a/org.freedesktop.Platform.GL.host.yml b/org.freedesktop.Platform.GL.host.yml index 9106bfd..a96d86f 100644 --- a/org.freedesktop.Platform.GL.host.yml +++ b/org.freedesktop.Platform.GL.host.yml @@ -8,8 +8,9 @@ runtime-version: '24.08' build-extension: true sdk-extensions: - org.freedesktop.Sdk.Extension.llvm18 + - org.freedesktop.Sdk.Extension.rust-stable build-options: - prepend-path: /usr/lib/sdk/llvm18/bin + prepend-path: /usr/lib/sdk/llvm18/bin:/usr/lib/sdk/rust-stable/bin prepend-ld-library-path: /usr/lib/sdk/llvm18/lib @@ -112,6 +113,7 @@ modules: buildsystem: cmake-ninja config-opts: - -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/run/build/spirv-llvm-translator-tools/spirv-headers + - -DBUILD_SHARED_LIBS:BOOL=ON sources: - type: archive path: %SRC_SPIRV_LLVM_TRANSLATOR @@ -154,6 +156,7 @@ modules: - name: mesa build-options: + prepend-path: /run/build/mesa arch: x86_64: *x86_64-build-options aarch64: *aarch64-build-options @@ -175,7 +178,7 @@ modules: - -Degl=enabled - -Dgallium-extra-hud=true - -Dgallium-opencl=disabled - - -Dgallium-rusticl=false + - -Dgallium-rusticl=true - -Dgallium-va=disabled - -Dgallium-vdpau=disabled - -Dgallium-xa=disabled @@ -198,9 +201,14 @@ modules: - type: file path: %SRC_WL_PROTOCOLS dest: 'subprojects/packagecache' + - type: file + path: /usr/bin/bindgen # We might need to make this do some arch-specific stuff later for i386 builds, but as of the time of writing we only do 64-bit builds so we'll be fine. - name: llvm buildsystem: simple build-commands: - cp /usr/lib/sdk/llvm18/lib/libLLVM.so.18.1 /usr/lib/$(uname -m)-linux-gnu/GL/host/lib/ + - cp /usr/lib/sdk/llvm18/lib/libclang-cpp.so.18.1 /usr/lib/$(uname -m)-linux-gnu/GL/host/lib/ + - mkdir -p /usr/lib/$(uname -m)-linux-gnu/GL/host/lib/clang/18/include/ + - cp /usr/lib/sdk/llvm18/lib/clang/18/include/opencl-c{,-base}.h /usr/lib/$(uname -m)-linux-gnu/GL/host/lib/clang/18/include/