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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
# Maintainer: Denis Benato <benato.denis96 [at] gmail dot com>
# Maintainer: Chris Lane <aur at chrislane dot com>
# Maintainer: DexterHaxxor <fox@dexterhaxxor.dev>
# Contributor: Reza Jahanbakhshi <reza.jahanbakhshi at gmail dot com
# Contributor: Lone_Wolf <lone_wolf@klaas-de-kat.nl>
# Contributor: Armin K. <krejzi at email dot com>
# Contributor: Kristian Klausen <klausenbusk@hotmail.com>
# Contributor: Egon Ashrafinia <e.ashrafinia@gmail.com>
# Contributor: Tavian Barnes <tavianator@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Antti "Tera" Oja <antti.bofh@gmail.com>
# Contributor: Diego Jose <diegoxter1006@gmail.com>
pkgbase=lib32-mesa-amdonly-gaming-git
pkgver=25.0.0_devel.197468.dc1fe83aa52.d41d8cd
options=(!lto) # LTO is bad for mesa, makes random applications crash on my system
pkgname=(
'lib32-amdonly-gaming-vulkan-mesa-layers-git'
'lib32-amdonly-gaming-opencl-clover-mesa-git'
'lib32-amdonly-gaming-opencl-rusticl-mesa-git'
'lib32-amdonly-gaming-vulkan-radeon-git'
'lib32-amdonly-gaming-vulkan-swrast-git'
'lib32-amdonly-gaming-libva-mesa-driver-git'
'lib32-amdonly-gaming-mesa-vdpau-git'
'lib32-amdonly-gaming-mesa-git'
)
pkgrel=1
pkgdesc="An open-source implementation of the OpenGL specification (32-bit)"
url="https://www.mesa3d.org/"
arch=('x86_64')
license=('LicenseRef-mesa')
makedepends=(
'lib32-clang'
'lib32-expat'
'lib32-libdrm'
'lib32-libelf'
'lib32-libglvnd'
'lib32-libva'
'lib32-libvdpau'
'lib32-libx11'
'lib32-libxdamage'
'lib32-libxml2'
'lib32-libxrandr'
'lib32-libxshmfence'
'lib32-libxxf86vm'
'lib32-llvm'
'lib32-lm_sensors'
'lib32-rust-libs'
'lib32-spirv-llvm-translator'
'lib32-spirv-tools'
'lib32-systemd'
'lib32-vulkan-icd-loader'
'lib32-wayland'
'lib32-zstd'
# shared between mesa and lib32-mesa
'git'
'clang'
'cmake'
'elfutils'
'glslang'
'libclc'
'meson'
'python-mako'
'python-ply'
'python-yaml'
'rust-bindgen'
'wayland-protocols'
'xorgproto'
)
source=(
'mesa::git+https://gitlab.freedesktop.org/mesa/mesa.git#branch=main'
'LICENSE'
)
b2sums=('SKIP'
'cc60238726b35133b5b729fb4ed1e76e04136588533615d84b4a54656d5b41727d5e7ff06ef4de3eb102eed6669d6c5c5cb8ac9fbdf6fc25aa477877c5c3ba87')
# NINJAFLAGS is an env var used to pass commandline options to ninja
# NOTE: It's your responbility to validate the value of $NINJAFLAGS. If unsure, don't set it.
pkgver() {
cd mesa
local _ver
_ver=$(<VERSION)
local _patchver
local _patchfile
for _patchfile in "${source[@]}"; do
_patchfile="${_patchfile%%::*}"
_patchfile="${_patchfile##*/}"
[[ $_patchfile = *.patch ]] || continue
_patchver="${_patchver}$(md5sum ${srcdir}/${_patchfile} | cut -c1-32)"
done
_patchver="$(echo -n $_patchver | md5sum | cut -c1-7)"
echo ${_ver/-/_}.$(git rev-list --count HEAD).$(git rev-parse --short HEAD).${_patchver}
}
prepare() {
# although removing _build folder in build() function feels more natural,
# that interferes with the spirit of makepkg --noextract
if [ -d _build ]; then
rm -rf _build
fi
local _patchfile
for _patchfile in "${source[@]}"; do
_patchfile="${_patchfile%%::*}"
_patchfile="${_patchfile##*/}"
[[ $_patchfile = *.patch ]] || continue
echo "Applying patch $_patchfile..."
patch --directory=mesa --forward --strip=1 --input="${srcdir}/${_patchfile}"
done
}
build() {
local meson_options=(
--cross-file lib32
-D android-libbacktrace=disabled
-D b_ndebug=true
-D b_lto=false
-D egl=enabled
-D gallium-drivers=radeonsi,llvmpipe,softpipe,zink
-D gallium-extra-hud=true
-D gallium-nine=true
-D gallium-opencl=icd
-D gallium-rusticl=true
-D gallium-va=enabled
-D gallium-vdpau=enabled
-D gallium-xa=disabled
-D gbm=enabled
-D gles1=disabled
-D gles2=enabled
-D glvnd=enabled
-D glx=dri
-D intel-rt=disabled
-D libunwind=disabled
-D llvm=enabled
-D lmsensors=enabled
-D microsoft-clc=disabled
-D osmesa=true
-D platforms=x11,wayland
-D rust_std=2021
-D shared-glapi=enabled
-D valgrind=disabled
-D video-codecs=all
-D vulkan-drivers=amd,swrast
-D vulkan-layers=device-select,overlay
-D vulkan-beta=true
--wrap-mode=nofallback
)
# Build only minimal debug info to reduce size
#CFLAGS+=' -g1'
#CXXFLAGS+=' -g1'
export BINDGEN_EXTRA_CLANG_ARGS="-m32"
arch-meson mesa build "${meson_options[@]}"
meson configure build --no-pager # Print config
#if [ ! -f "build/build.ninja.bak" ]; then
# cp build/build.ninja build/build.ninja.back
#fi
# Evil: Hack build to make proc-macro crate native
# Should become unnecessary with Meson 1.3
#sed -e '/^rule rust_COMPILER$/irule rust_HACK\n command = rustc -C linker=gcc $ARGS $in\n deps = gcc\n depfile = $targetdep\n description = Compiling native Rust source $in\n' \
# -e '/^build src\/gallium\/frontends\/rusticl\/librusticl_proc_macros\.so:/s/rust_COMPILER/rust_HACK/' \
# -e '/^ LINK_ARGS =/s/ src\/gallium\/frontends\/rusticl\/librusticl_proc_macros\.so//' \
# -i build/build.ninja
meson compile $NINJAFLAGS -C build
# fake installation to be seperated into packages
# outside of fakeroot but mesa doesn't need to chown/mod
DESTDIR="${srcdir}/fakeinstall" meson install -C build
}
_install() {
local src f dir
for src; do
f="${src#fakeinstall/}"
dir="${pkgdir}/${f%/*}"
install -m755 -d "${dir}"
mv -v "${src}" "${dir}/"
done
}
_libdir=usr/lib32
package_lib32-amdonly-gaming-vulkan-mesa-layers-git() {
pkgdesc="Mesa's Vulkan layers (32-bit)"
depends=(
'lib32-libdrm'
'lib32-libxcb'
'lib32-wayland'
'amdonly-gaming-vulkan-mesa-layers-git'
)
conflicts=(
'lib32-vulkan-mesa-layers'
'lib32-vulkan-mesa-layer'
)
provides=(
'lib32-vulkan-mesa-layers'
)
rm -rv fakeinstall/usr/share/vulkan/explicit_layer.d
rm -rv fakeinstall/usr/share/vulkan/implicit_layer.d
_install fakeinstall/$_libdir/libVkLayer_*.so
rm -v fakeinstall/usr/bin/mesa-overlay-control.py
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-opencl-clover-mesa-git() {
pkgdesc="OpenCL support with clover for mesa drivers (32-bit)"
depends=(
'lib32-clang'
'lib32-expat'
'lib32-libdrm'
'lib32-libelf'
'lib32-spirv-llvm-translator'
'lib32-zstd'
'libclc'
'amdonly-gaming-opencl-clover-mesa-git'
)
optdepends=('opencl-headers: headers necessary for OpenCL development')
provides=(
'lib32-opencl-driver'
'lib32-opencl-clover-mesa'
)
conflicts=(
'lib32-opencl-mesa'
'lib32-opencl-clover-mesa'
)
rm -v fakeinstall/etc/OpenCL/vendors/mesa.icd
_install fakeinstall/$_libdir/libMesaOpenCL*
_install fakeinstall/$_libdir/gallium-pipe
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-opencl-rusticl-mesa-git() {
pkgdesc="OpenCL support with rusticl for mesa drivers (32-bit)"
depends=(
'lib32-clang'
'lib32-expat'
'lib32-libdrm'
'lib32-libelf'
'lib32-lm_sensors'
'lib32-spirv-llvm-translator'
'lib32-zstd'
'libclc'
'amdonly-gaming-opencl-rusticl-mesa-git'
)
optdepends=('opencl-headers: headers necessary for OpenCL development')
provides=(
'lib32-opencl-rusticl-mesa'
'lib32-opencl-driver'
)
conflicts=(
'lib32-opencl-rusticl-mesa'
'lib32-opencl-mesa'
)
rm -v fakeinstall/etc/OpenCL/vendors/rusticl.icd
_install fakeinstall/$_libdir/libRusticlOpenCL*
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-vulkan-radeon-git() {
pkgdesc="Radeon's Vulkan mesa driver (32-bit)"
depends=(
'lib32-libdrm'
'lib32-libelf'
'lib32-libx11'
'lib32-libxshmfence'
'lib32-llvm-libs'
'lib32-systemd'
'lib32-wayland'
'lib32-xcb-util-keysyms'
'lib32-zstd'
'amdonly-gaming-vulkan-radeon-git'
)
optdepends=('lib32-vulkan-mesa-layers: additional vulkan layers')
provides=(
'lib32-vulkan-driver'
'lib32-vulkan-radeon'
)
conflicts=('lib32-vulkan-radeon')
rm -v fakeinstall/usr/share/drirc.d/00-radv-defaults.conf
_install fakeinstall/usr/share/vulkan/icd.d/radeon_icd*.json
_install fakeinstall/$_libdir/libvulkan_radeon.so
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-vulkan-swrast-git() {
pkgdesc="Vulkan software rasteriser driver (32-bit)"
depends=(
'lib32-libdrm'
'lib32-libx11'
'lib32-libxshmfence'
'lib32-llvm-libs'
'lib32-systemd'
'lib32-wayland'
'lib32-xcb-util-keysyms'
'lib32-zstd'
)
optdepends=('lib32-vulkan-mesa-layers: additional vulkan layers')
conflicts=(
'lib32-vulkan-mesa'
'lib32-vulkan-swrast'
)
provides=(
'lib32-vulkan-driver'
'lib32-vulkan-swrast'
)
_install fakeinstall/usr/share/vulkan/icd.d/lvp_icd*.json
_install fakeinstall/$_libdir/libvulkan_lvp.so
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-libva-mesa-driver-git() {
pkgdesc="VA-API drivers (32-bit)"
depends=(
'lib32-expat'
'lib32-libdrm'
'lib32-libelf'
'lib32-libx11'
'lib32-libxshmfence'
'lib32-llvm-libs'
'lib32-zstd'
)
provides=('lib32-libva-driver')
conflicts=('lib32-libva-mesa-driver')
_install fakeinstall/$_libdir/dri/*_drv_video.so
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-mesa-vdpau-git() {
pkgdesc="VDPAU drivers (32-bit)"
depends=(
'lib32-expat'
'lib32-libdrm'
'lib32-libelf'
'lib32-libx11'
'lib32-libxshmfence'
'lib32-llvm-libs'
'lib32-zstd'
)
provides=(
'lib32-vdpau-driver'
'lib32-mesa-vdpau'
)
conflicts=('lib32-mesa-vdpau')
_install fakeinstall/$_libdir/vdpau
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
package_lib32-amdonly-gaming-mesa-git() {
depends=(
'lib32-libdrm'
'lib32-libelf'
'lib32-libglvnd'
'lib32-libxdamage'
'lib32-libxshmfence'
'lib32-libxxf86vm'
'lib32-llvm-libs'
'lib32-lm_sensors'
'lib32-vulkan-icd-loader'
'lib32-wayland'
'lib32-zstd'
'amdonly-gaming-mesa-git'
)
optdepends=(
'opengl-man-pages: for the OpenGL API man pages'
)
provides=(
'lib32-mesa'
'lib32-mesa-libgl'
'lib32-opengl-driver'
)
conflicts=(
'lib32-mesa'
'lib32-mesa-libgl'
)
rm -v fakeinstall/usr/share/drirc.d/00-mesa-defaults.conf
rm -v fakeinstall/usr/share/glvnd/egl_vendor.d/50_mesa.json
# ati-dri, nouveau-dri, intel-dri, svga-dri, swrast, swr
_install fakeinstall/$_libdir/dri/*_dri.so
_install fakeinstall/$_libdir/gbm/dri_gbm.so*
_install fakeinstall/$_libdir/d3d
_install fakeinstall/$_libdir/lib{gbm,glapi}.so*
_install fakeinstall/$_libdir/libOSMesa.so*
_install fakeinstall/$_libdir/libgallium*.so*
# only needed when gallium-xa is enabled
#_install fakeinstall/$_libdir/libxatracker.so*
rm -rv fakeinstall/usr/include
_install fakeinstall/$_libdir/pkgconfig
# libglvnd support
_install fakeinstall/$_libdir/libGLX_mesa.so*
_install fakeinstall/$_libdir/libEGL_mesa.so*
# indirect rendering
ln -sr "$pkgdir"/$_libdir/libGLX_{mesa,indirect}.so.0
# make sure there are no files left to install
find fakeinstall -depth -print0 | xargs -0 rmdir
install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}
# vim:set ts=2 sw=2 et:
|