From c4a315f962bbf7b8eaf2f68620f1ef85463d9f8f Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Jul 15 2024 23:07:44 +0000 Subject: Switch to a host extension --- diff --git a/mesa-asahi-flatpak.spec b/mesa-asahi-flatpak.spec index 8347412..da4f8f4 100644 --- a/mesa-asahi-flatpak.spec +++ b/mesa-asahi-flatpak.spec @@ -18,7 +18,7 @@ Release: 1 License: MIT URL: http://www.mesa3d.org -Source0: org.freedesktop.Platform.GL.asahi.yml +Source0: org.freedesktop.Platform.GL.host.yml Source1: bwrapwrapper Source10: https://gitlab.freedesktop.org/asahi/mesa/-/archive/%{git_tag}/mesa-%{git_tag}.tar.bz2 @@ -50,7 +50,7 @@ sed \ -e "s,\%SRC_SPIRV_TOOLS,%SOURCE13,g" \ -e "s,\%SRC_LIBCLC,%SOURCE14,g" \ -e "s,\%SRC_MESON,%SOURCE15,g" \ - %SOURCE0 > org.freedesktop.Platform.GL.asahi.yml + %SOURCE0 > org.freedesktop.Platform.GL.host.yml cp %SOURCE1 . chmod +x bwrapwrapper @@ -62,19 +62,15 @@ flatpak install --assumeyes --user flathub --sideload-repo=/usr/share/flatpak-si 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} %build -FLATPAK_BWRAP=$PWD/bwrapwrapper flatpak-builder --disable-rofiles-fuse --extra-sources=%{_sourcedir} build org.freedesktop.Platform.GL.asahi.yml +FLATPAK_BWRAP=$PWD/bwrapwrapper flatpak-builder --disable-rofiles-fuse --extra-sources=%{_sourcedir} build org.freedesktop.Platform.GL.host.yml %install -mkdir -p %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.asahi/$(flatpak --default-arch)/ -mv build/files %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.asahi/$(flatpak --default-arch)/%{sdk_ver} -ln -s share/glvnd share/vulkan %{buildroot}%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.asahi/$(flatpak --default-arch)/%{sdk_ver}/ - -mkdir -p %{buildroot}%{_prefix}/lib/environment.d -echo 'FLATPAK_GL_DRIVERS=asahi' > %{buildroot}%{_prefix}/lib/environment.d/50-asahi-flatpak-extension-%{sdk_ver}.conf +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}/ %files -%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.asahi/ -%{_prefix}/lib/environment.d/50-asahi-flatpak-extension-%{sdk_ver}.conf +%{_sharedstatedir}/flatpak/extension/org.freedesktop.Platform.GL.host/ %changelog * Mon Jul 15 2024 Hector Martin - 24.2.0~asahipre20240527-1 diff --git a/org.freedesktop.Platform.GL.asahi.yml b/org.freedesktop.Platform.GL.asahi.yml deleted file mode 100644 index 77c99de..0000000 --- a/org.freedesktop.Platform.GL.asahi.yml +++ /dev/null @@ -1,203 +0,0 @@ -# Based on https://github.com/orowith2os/mesa-asahi-flatpak - -id: org.freedesktop.Platform.GL.asahi -branch: '23.08' -runtime: org.freedesktop.Platform -sdk: org.freedesktop.Sdk -runtime-version: '23.08' -build-extension: true -sdk-extensions: - - org.freedesktop.Sdk.Extension.llvm18 -build-options: - prepend-path: /usr/lib/sdk/llvm18/bin - prepend-ld-library-path: /usr/lib/sdk/llvm18/lib - - -x-arch-build-options: - x86_64: &x86_64-build-options - prefix: /usr/lib/x86_64-linux-gnu/GL/asahi - prepend-pkg-config-path: /usr/lib/x86_64-linux-gnu/GL/asahi/lib/pkgconfig - libdir: /usr/lib/x86_64-linux-gnu/GL/asahi/lib - append-path: /usr/lib/x86_64-linux-gnu/GL/asahi/bin - prepend-ld-library-path: /usr/lib/x86_64-linux-gnu/GL/asahi/lib - env: - PYTHONPATH: /usr/lib/x86_64-linux-gnu/GL/asahi/lib/python3.11/site-packages/ - - # Needs https://github.com/flatpak/flatpak-builder/issues/381 to be resolved before this can actually be used. Until then, only 64-bit builds. - i386: - prefix: /usr/lib/i386-linux-gnu/GL/asahi - prepend-pkg-config-path: /usr/lib/i386-linux-gnu/GL/asahi/lib/pkgconfig - libdir: /usr/lib/i386-linux-gnu/GL/asahi/lib - append-path: /usr/lib/i386-linux-gnu/GL/asahi/bin - prepend-ld-library-path: /usr/lib/i386-linux-gnu/GL/asahi/lib - env: - PYTHONPATH: /usr/lib/i386-linux-gnu/GL/asahi/lib/python3.11/site-packages/ - - # org.freedesktop.Sdk.Compat.arm is deprecated, so only build for aarch64. - aarch64: &aarch64-build-options - prefix: /usr/lib/aarch64-linux-gnu/GL/asahi - prepend-pkg-config-path: /usr/lib/aarch64-linux-gnu/GL/asahi/lib/pkgconfig - libdir: /usr/lib/aarch64-linux-gnu/GL/asahi/lib - append-path: /usr/lib/aarch64-linux-gnu/GL/asahi/bin - prepend-ld-library-path: /usr/lib/aarch64-linux-gnu/GL/asahi/lib - env: - PYTHONPATH: /usr/lib/aarch64-linux-gnu/GL/asahi/lib/python3.11/site-packages/ - -cleanup: - - /include - - /lib/dri/armada-drm_dri.so - - /lib/dri/exynos_dri.so - - /lib/dri/gm12u320_dri.so - - /lib/dri/hdlcd_dri.so - - /lib/dri/hx8357d_dri.so - - /lib/dri/ili9163_dri.so - - /lib/dri/ili9225_dri.so - - /lib/dri/ili9341_dri.so - - /lib/dri/ili9486_dri.so - - /lib/dri/imx-dcss_dri.so - - /lib/dri/imx-drm_dri.so - - /lib/dri/imx-lcdif_dri.so - - /lib/dri/ingenic-drm_dri.so - - /lib/dri/kirin_dri.so - - /lib/dri/komeda_dri.so - - /lib/dri/mali-dp_dri.so - - /lib/dri/mcde_dri.so - - /lib/dri/mediatek_dri.so - - /lib/dri/meson_dri.so - - /lib/dri/mi0283qt_dri.so - - /lib/dri/mxsfb-drm_dri.so - - /lib/dri/panel-mipi-dbi_dri.so - - /lib/dri/pl111_dri.so - - /lib/dri/rcar-du_dri.so - - /lib/dri/repaper_dri.so - - /lib/dri/rockchip_dri.so - - /lib/dri/rzg2l-du_dri.so - - /lib/dri/ssd130x_dri.so - - /lib/dri/st7586_dri.so - - /lib/dri/st7735r_dri.so - - /lib/dri/sti_dri.so - - /lib/dri/stm_dri.so - - /lib/dri/sun4i-drm_dri.so - - /lib/dri/udl_dri.so - - /lib/dri/zynqmp-dpsub_dri.so - - /lib/cmake - - /lib/pkgconfig - - /share/aclocal - - /share/man - - '*.la' - - '*.a' -modules: - - name: spirv-tools - build-options: - arch: - x86_64: *x86_64-build-options - aarch64: *aarch64-build-options - buildsystem: cmake-ninja - config-opts: - # spirv-tools pkg-config file cannot handle absolute path - - -DCMAKE_INSTALL_LIBDIR=lib - sources: - - type: archive - path: %SRC_SPIRV_TOOLS - - type: archive - path: %SRC_SPIRV_HEADERS - dest: external/spirv-headers - - - name: spirv-llvm-translator-tools - build-options: - arch: - x86_64: *x86_64-build-options - aarch64: *aarch64-build-options - buildsystem: cmake-ninja - config-opts: - - -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/run/build/spirv-llvm-translator-tools/spirv-headers - sources: - - type: archive - path: %SRC_SPIRV_LLVM_TRANSLATOR - - type: archive - path: %SRC_SPIRV_HEADERS - dest: spirv-headers - - - name: libclc - build-options: - arch: - x86_64: *x86_64-build-options - aarch64: *aarch64-build-options - buildsystem: cmake-ninja - subdir: libclc - config-opts: - - -DLIBCLC_TARGETS_TO_BUILD=spirv-mesa3d-;spirv64-mesa3d- - sources: - - type: archive - path: %SRC_LIBCLC - - type: shell - # Fix finding llvm-spirv and pkgconfig file - commands: - - sed -ie 's/NO_DEFAULT_PATH//' libclc/CMakeLists.txt - - sed -ie 's,{CMAKE_INSTALL_DATADIR}/pkgconfig,{CMAKE_INSTALL_LIBDIR}/pkgconfig,' libclc/CMakeLists.txt - - - name: meson - build-options: - arch: - x86_64: *x86_64-build-options - aarch64: *aarch64-build-options - - buildsystem: simple - build-commands: - - python -mpip install . --prefix "${FLATPAK_DEST}" --ignore-installed --no-build-isolation --no-index - sources: - - type: archive - path: %SRC_MESON - cleanup: - - "*" - - - name: mesa - build-options: - arch: - x86_64: *x86_64-build-options - aarch64: *aarch64-build-options - - # From upstream: Build only minimal debug info to reduce size - cflags: -g1 -I/usr/include/drm - cxxflags: -g1 - - buildsystem: meson - config-opts: - - -Dbuildtype=release - - -Db_ndebug=true - - -Db_lto=false - - -Dplatforms=x11,wayland - - -Dgallium-drivers=swrast,virgl,kmsro,asahi - - -Dvulkan-drivers=swrast - - # Will this one mess the builds up? Dunno, but upstream Asahi builds with it like this. - - -Dvulkan-layers= - - - -Ddri3=enabled - - -Degl=enabled - - -Dgallium-extra-hud=true - - -Dgallium-opencl=disabled - - -Dgallium-rusticl=false - - -Dgallium-va=disabled - - -Dgallium-vdpau=disabled - - -Dgallium-xa=disabled - - -Dgbm=enabled - - -Dgles1=disabled - - -Dgles2=enabled - - -Dglx=dri - - -Dlibunwind=disabled - - -Dllvm=enabled - - -Dosmesa=true - - -Dshared-glapi=enabled - - -Dmicrosoft-clc=disabled - - -Dvalgrind=enabled - - sources: - - type: archive - path: %SRC_MESA - - # 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/asahi/lib/ diff --git a/org.freedesktop.Platform.GL.host.yml b/org.freedesktop.Platform.GL.host.yml new file mode 100644 index 0000000..2145fc7 --- /dev/null +++ b/org.freedesktop.Platform.GL.host.yml @@ -0,0 +1,203 @@ +# Based on https://github.com/orowith2os/mesa-asahi-flatpak + +id: org.freedesktop.Platform.GL.host +branch: '23.08' +runtime: org.freedesktop.Platform +sdk: org.freedesktop.Sdk +runtime-version: '23.08' +build-extension: true +sdk-extensions: + - org.freedesktop.Sdk.Extension.llvm18 +build-options: + prepend-path: /usr/lib/sdk/llvm18/bin + prepend-ld-library-path: /usr/lib/sdk/llvm18/lib + + +x-arch-build-options: + x86_64: &x86_64-build-options + prefix: /usr/lib/x86_64-linux-gnu/GL/host + prepend-pkg-config-path: /usr/lib/x86_64-linux-gnu/GL/host/lib/pkgconfig + libdir: /usr/lib/x86_64-linux-gnu/GL/host/lib + append-path: /usr/lib/x86_64-linux-gnu/GL/host/bin + prepend-ld-library-path: /usr/lib/x86_64-linux-gnu/GL/host/lib + env: + PYTHONPATH: /usr/lib/x86_64-linux-gnu/GL/host/lib/python3.11/site-packages/ + + # Needs https://github.com/flatpak/flatpak-builder/issues/381 to be resolved before this can actually be used. Until then, only 64-bit builds. + i386: + prefix: /usr/lib/i386-linux-gnu/GL/host + prepend-pkg-config-path: /usr/lib/i386-linux-gnu/GL/host/lib/pkgconfig + libdir: /usr/lib/i386-linux-gnu/GL/host/lib + append-path: /usr/lib/i386-linux-gnu/GL/host/bin + prepend-ld-library-path: /usr/lib/i386-linux-gnu/GL/host/lib + env: + PYTHONPATH: /usr/lib/i386-linux-gnu/GL/host/lib/python3.11/site-packages/ + + # org.freedesktop.Sdk.Compat.arm is deprecated, so only build for aarch64. + aarch64: &aarch64-build-options + prefix: /usr/lib/aarch64-linux-gnu/GL/host + prepend-pkg-config-path: /usr/lib/aarch64-linux-gnu/GL/host/lib/pkgconfig + libdir: /usr/lib/aarch64-linux-gnu/GL/host/lib + append-path: /usr/lib/aarch64-linux-gnu/GL/host/bin + prepend-ld-library-path: /usr/lib/aarch64-linux-gnu/GL/host/lib + env: + PYTHONPATH: /usr/lib/aarch64-linux-gnu/GL/host/lib/python3.11/site-packages/ + +cleanup: + - /include + - /lib/dri/armada-drm_dri.so + - /lib/dri/exynos_dri.so + - /lib/dri/gm12u320_dri.so + - /lib/dri/hdlcd_dri.so + - /lib/dri/hx8357d_dri.so + - /lib/dri/ili9163_dri.so + - /lib/dri/ili9225_dri.so + - /lib/dri/ili9341_dri.so + - /lib/dri/ili9486_dri.so + - /lib/dri/imx-dcss_dri.so + - /lib/dri/imx-drm_dri.so + - /lib/dri/imx-lcdif_dri.so + - /lib/dri/ingenic-drm_dri.so + - /lib/dri/kirin_dri.so + - /lib/dri/komeda_dri.so + - /lib/dri/mali-dp_dri.so + - /lib/dri/mcde_dri.so + - /lib/dri/mediatek_dri.so + - /lib/dri/meson_dri.so + - /lib/dri/mi0283qt_dri.so + - /lib/dri/mxsfb-drm_dri.so + - /lib/dri/panel-mipi-dbi_dri.so + - /lib/dri/pl111_dri.so + - /lib/dri/rcar-du_dri.so + - /lib/dri/repaper_dri.so + - /lib/dri/rockchip_dri.so + - /lib/dri/rzg2l-du_dri.so + - /lib/dri/ssd130x_dri.so + - /lib/dri/st7586_dri.so + - /lib/dri/st7735r_dri.so + - /lib/dri/sti_dri.so + - /lib/dri/stm_dri.so + - /lib/dri/sun4i-drm_dri.so + - /lib/dri/udl_dri.so + - /lib/dri/zynqmp-dpsub_dri.so + - /lib/cmake + - /lib/pkgconfig + - /share/aclocal + - /share/man + - '*.la' + - '*.a' +modules: + - name: spirv-tools + build-options: + arch: + x86_64: *x86_64-build-options + aarch64: *aarch64-build-options + buildsystem: cmake-ninja + config-opts: + # spirv-tools pkg-config file cannot handle absolute path + - -DCMAKE_INSTALL_LIBDIR=lib + sources: + - type: archive + path: %SRC_SPIRV_TOOLS + - type: archive + path: %SRC_SPIRV_HEADERS + dest: external/spirv-headers + + - name: spirv-llvm-translator-tools + build-options: + arch: + x86_64: *x86_64-build-options + aarch64: *aarch64-build-options + buildsystem: cmake-ninja + config-opts: + - -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/run/build/spirv-llvm-translator-tools/spirv-headers + sources: + - type: archive + path: %SRC_SPIRV_LLVM_TRANSLATOR + - type: archive + path: %SRC_SPIRV_HEADERS + dest: spirv-headers + + - name: libclc + build-options: + arch: + x86_64: *x86_64-build-options + aarch64: *aarch64-build-options + buildsystem: cmake-ninja + subdir: libclc + config-opts: + - -DLIBCLC_TARGETS_TO_BUILD=spirv-mesa3d-;spirv64-mesa3d- + sources: + - type: archive + path: %SRC_LIBCLC + - type: shell + # Fix finding llvm-spirv and pkgconfig file + commands: + - sed -ie 's/NO_DEFAULT_PATH//' libclc/CMakeLists.txt + - sed -ie 's,{CMAKE_INSTALL_DATADIR}/pkgconfig,{CMAKE_INSTALL_LIBDIR}/pkgconfig,' libclc/CMakeLists.txt + + - name: meson + build-options: + arch: + x86_64: *x86_64-build-options + aarch64: *aarch64-build-options + + buildsystem: simple + build-commands: + - python -mpip install . --prefix "${FLATPAK_DEST}" --ignore-installed --no-build-isolation --no-index + sources: + - type: archive + path: %SRC_MESON + cleanup: + - "*" + + - name: mesa + build-options: + arch: + x86_64: *x86_64-build-options + aarch64: *aarch64-build-options + + # From upstream: Build only minimal debug info to reduce size + cflags: -g1 -I/usr/include/drm + cxxflags: -g1 + + buildsystem: meson + config-opts: + - -Dbuildtype=release + - -Db_ndebug=true + - -Db_lto=false + - -Dplatforms=x11,wayland + - -Dgallium-drivers=swrast,virgl,kmsro,asahi + - -Dvulkan-drivers=swrast + + # Will this one mess the builds up? Dunno, but upstream Asahi builds with it like this. + - -Dvulkan-layers= + + - -Ddri3=enabled + - -Degl=enabled + - -Dgallium-extra-hud=true + - -Dgallium-opencl=disabled + - -Dgallium-rusticl=false + - -Dgallium-va=disabled + - -Dgallium-vdpau=disabled + - -Dgallium-xa=disabled + - -Dgbm=enabled + - -Dgles1=disabled + - -Dgles2=enabled + - -Dglx=dri + - -Dlibunwind=disabled + - -Dllvm=enabled + - -Dosmesa=true + - -Dshared-glapi=enabled + - -Dmicrosoft-clc=disabled + - -Dvalgrind=enabled + + sources: + - type: archive + path: %SRC_MESA + + # 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/