1 # Build recipe for mesa.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2023 Matias Fonzo <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Exit immediately on any error
25 # Define a category for the output of the package name
28 tarname=${program}-${version}.tar.xz
31 fetch=https://archive.mesa3d.org/$tarname
34 Mesa is an OpenGL compatible 3-D graphics library.
36 The Mesa project began as an open-source implementation of the OpenGL
37 specification - a system for rendering interactive 3D graphics.
40 homepage=https://www.mesa3d.org/
43 # Source documentation
44 docs="CODEOWNERS README.rst VERSION"
45 docsdir="${docdir}/${program}-${version}"
49 unpack "${tardir}/$tarname"
53 # To provide a few xdemos (Thanks to BLFS!)
54 patch -p1 < "${worktree}/patches/mesa/mesa-22.2.4-add_xdemos-1.patch"
56 # Apply patches to increment compatibility with Musl
57 patch -Np1 -i "${worktree}/patches/mesa/musl-endian.patch"
58 patch -Np1 -i "${worktree}/patches/mesa/musl.patch"
59 patch -Np1 -i "${worktree}/patches/mesa/musl-stacksize.patch"
60 patch -Np1 -i "${worktree}/patches/mesa/megadriver-symlinks.patch"
62 # Set sane permissions
63 chmod -R u+w,go-w,a+rX-s .
69 CPPFLAGS="$QICPPFLAGS" \
70 CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
71 meson setup $configure_args \
72 --libdir /usr/lib${libSuffix} \
75 -Ddri-drivers-path=/usr/lib${libSuffix}/dri \
78 -Dgallium-drivers=auto \
80 -Dgallium-xa=enabled \
90 -Dshared-llvm=enabled \
91 -Dshared-glapi=enabled \
98 DESTDIR="$destdir" ninja -j${jobs} install
100 unset -v MESA_GIT_SHA1_OVERRIDE
104 # Handle .new files via graft(1), if any
105 if test -d "${destdir}/etc"
107 touch "${destdir}/etc/.graft-config"
109 touch "${destdir}/usr/share/drirc.d/.graft-config"
111 # Compress and link man pages (if needed)
112 if test -d "${destdir}/$mandir"
115 cd "${destdir}/$mandir"
116 find . -type f -exec lzip -9 {} +
117 find . -type l | while read -r file
119 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
126 mkdir -p "${destdir}/$docsdir"
127 cp -p $docs "${destdir}/$docsdir"