summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6207a9b6331a270952db818b99f4a186278efa1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Maintainer: Echo J. <aidas957 at gmail dot com>
# shellcheck shell=bash disable=SC2034,SC2164

pkgname=lib32-vulkan-nouveau-git
pkgdesc="Nouveau Vulkan (NVK) Mesa driver with some additions (32-bit Git version)"
pkgver=25.0.branchpoint.r1199.gc64b8c8
pkgrel=1
arch=('x86_64')
depends=('lib32-libdrm' 'lib32-libxcb' 'lib32-libxshmfence' 'lib32-libx11' 'lib32-spirv-tools' 'lib32-systemd'
         'lib32-vulkan-icd-loader' 'lib32-wayland' 'lib32-zlib' 'lib32-zstd')
makedepends=('cbindgen' 'elfutils' 'git' 'glslang' 'libclc' 'lib32-clang' 'lib32-libunwind' 'lib32-libxrandr'
             'lib32-llvm' 'lib32-rust-libs' 'lib32-spirv-llvm-translator' 'meson>=1.3.0rc2' 'python-mako'
             'python-packaging' 'python-yaml' 'rust-bindgen' 'systemd' 'wayland-protocols' 'xorgproto') # Meson 1.3.0-rc1 has weird crate issues
optdepends=('lib32-vulkan-mesa-layers: Additional Vulkan layers'
            'linux>=6.6.arch1: Minimum required kernel for new uAPI support')
provides=('lib32-vulkan-driver')
conflicts=('lib32-vulkan-nouveau')
url="https://gitlab.freedesktop.org/mesa/mesa"
license=('MIT AND BSD-3-Clause AND SGI-B-2.0')
source=("git+${url}.git")
sha512sums=('SKIP')
install="${pkgname}.install"

prepare() {
  # HACK: Don't copy Mesa's driconf defaults (they're useless for this standalone driver)
  # TODO: replace this with a build option if possible
  cd mesa
  sed -i 's/install_data/#install_data/' src/util/meson.build

  # HACK: Disable xcb-util-keysyms dependency
  # NVK doesn't support the tracing features enabled by it so it's useless for us right now
  sed -i 's/with_xcb_keysyms = dep_xcb_keysyms.found()/with_xcb_keysyms = false/' meson.build

  ### Misc stuff ###

  # Mark this NVK package with a signature (so I could track who's using it for bug report purposes)
  sed -i 's/"Mesa " PACKAGE_VERSION/"Mesa DodoNVK " PACKAGE_VERSION/' src/nouveau/vulkan/nvk_physical_device.c
}

pkgver() {
  cd mesa
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  # Auto-download Rust crates for NAK/NIL (avoids adding extra code for crate handling)
  _nvk_crate="--force-fallback-for=paste,syn"

  # HACK: Remove crate library files before build
  # (This prevents build errors after a Rust update with dirty builds: https://github.com/mesonbuild/meson/issues/10706)
  [ -d build ] && find build -iname "*.rlib" -delete
  [ -d build/subprojects ] && find build/subprojects -iname "*.so" -delete

  # HACK: Force the 32-bit Rust target for bindgen
  # (This makes bindgen produce the correct 32-bit struct sizes)
  # FIXME: This probably breaks non-x86 compilation
  export TARGET=i686-unknown-linux-gnu

  # As you can see, I optimized the build options pretty well 🐸
  arch-meson mesa build \
    --cross-file lib32 \
    --reconfigure \
    --wrap-mode=nofallback \
    ${_nvk_crate} \
    -D b_ndebug=false \
    -D platforms=x11,wayland \
    -D gallium-drivers= \
    -D vulkan-drivers=nouveau \
    -D vulkan-layers= \
    -D egl=disabled \
    -D gallium-extra-hud=false \
    -D gallium-nine=false \
    -D gallium-opencl=disabled \
    -D gallium-va=disabled \
    -D gallium-vdpau=disabled \
    -D gallium-xa=disabled \
    -D gbm=disabled \
    -D gles1=disabled \
    -D gles2=disabled \
    -D glvnd=disabled \
    -D glx=disabled \
    -D libunwind=enabled \
    -D llvm=enabled \
    -D lmsensors=disabled \
    -D osmesa=false \
    -D shared-glapi=disabled \
    -D microsoft-clc=disabled \
    -D valgrind=disabled \
    -D android-libbacktrace=disabled \
    -D intel-rt=disabled \
    -D xmlconfig=disabled \
    -D expat=disabled

  meson compile -C build
}

package() {
  meson install -C build --destdir "${pkgdir}"

  install -Dm644 mesa/docs/license.rst -t "${pkgdir}/usr/share/licenses/${pkgname}"
}