stages: 2/04-iso: Do not include kernel build/source tree in the LiveCD
[dragora.git] / recipes / xorg / mesa / recipe
blob8980ded95654386f9a4b9efc2c89b151668b8385
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
19 set -e
21 program=mesa
22 version=22.3.7
23 release=2
25 # Define a category for the output of the package name
26 pkgcategory=xorg_mesa
28 tarname=${program}-${version}.tar.xz
30 # Remote source(s)
31 fetch=https://archive.mesa3d.org/$tarname
33 description="
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/
41 license=MIT
43 # Source documentation
44 docs="CODEOWNERS README.rst VERSION"
45 docsdir="${docdir}/${program}-${version}"
47 build()
49     unpack "${tardir}/$tarname"
51     cd "$srcdir"
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 .
65     rm -rf BUILD
66     mkdir BUILD
67     cd BUILD
69     CPPFLAGS="$QICPPFLAGS" \
70     CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
71     meson setup $configure_args \
72      --libdir /usr/lib${libSuffix} \
73      --buildtype=release \
74      --strip \
75      -Ddri-drivers-path=/usr/lib${libSuffix}/dri \
76      -Dglx=dri \
77      -Dplatforms=x11 \
78      -Dgallium-drivers=auto \
79      -Dvulkan-drivers="" \
80      -Dgallium-xa=enabled \
81      -Dlmsensors=enabled \
82      -Degl=enabled \
83      -Dgles1=enabled \
84      -Dgles2=enabled \
85      -Ddri3=enabled \
86      -Dosmesa=true \
87      -Dopengl=true \
88      -Dgallium-nine=true \
89      -Dllvm=enabled \
90      -Dshared-llvm=enabled \
91      -Dshared-glapi=enabled \
92      -Dvalgrind=disabled \
93      -Db_lto=false \
94      -Dcpp_std=gnu++14 \
95      ..
97     ninja -j${jobs}
98     DESTDIR="$destdir" ninja -j${jobs} install
100     unset -v MESA_GIT_SHA1_OVERRIDE
102     cd ../
104     # Handle .new files via graft(1), if any
105     if test -d "${destdir}/etc"
106     then
107         touch "${destdir}/etc/.graft-config"
108     fi
109     touch "${destdir}/usr/share/drirc.d/.graft-config"
111     # Compress and link man pages (if needed)
112     if test -d "${destdir}/$mandir"
113     then
114         (
115             cd "${destdir}/$mandir"
116             find . -type f -exec lzip -9 {} +
117             find . -type l | while read -r file
118             do
119                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
120                 rm -- "$file"
121             done
122         )
123     fi
125     # Copy documentation
126     mkdir -p "${destdir}/$docsdir"
127     cp -p $docs "${destdir}/$docsdir"