recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / xorg / mesa / recipe
blob93511e1bf39cbaa22171f10466d4ff265b6765b9
1 # Build recipe for mesa.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2021 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=21.2.5
23 release=3
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="README* REVIEWERS VERSION"
45 docsdir="${docdir}/${program}-${version}"
47 build()
49     unpack "${tardir}/$tarname"
51     cd "$srcdir"
53     # To increment compatibility with Musl (Thanks to "Alpine Linux")
54     patch -p1 < "${worktree}/patches/mesa/musl-fix-includes.patch"
55     patch -p1 < "${worktree}/patches/mesa/add-use-elf-tls.patch"
57     # To provide a few xdemos (Thanks to BLFS!)
58     patch -p1 < "${worktree}/patches/mesa/mesa-21.2.4-add_xdemos-1.patch"
60     MESA_GIT_SHA1_OVERRIDE='53b2b224dc2de982c37915a0ad218e33365ff75e'
61     export MESA_GIT_SHA1_OVERRIDE
62     python3 bin/git_sha1_gen.py --output include/git_sha1.h
64     # Set sane permissions
65     chmod -R u+w,go-w,a+rX-s .
67     case $arch in
68     amd64 | x32 | i?86 )
69         _extra_options="-Dglx-read-only-text=true"
70         ;;
71     esac
73     rm -rf BUILD
74     mkdir BUILD
75     cd BUILD
77     CPPFLAGS="$QICPPFLAGS -D_XOPEN_SOURCE=700" \
78     CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
79     meson setup $configure_args \
80      --libdir /usr/lib${libSuffix} \
81      --buildtype=release \
82      --strip \
83      -Dplatforms=x11 \
84      -Ddri-drivers="i915,i965,r100,r200,nouveau" \
85      -Dgallium-drivers="nouveau,r300,r600,svga,radeonsi,swrast,virgl,iris,crocus" \
86      -Dglx=dri \
87      -Dosmesa=true \
88      -Dllvm=enabled \
89      -Dshared-llvm=enabled \
90      -Dgallium-xvmc=enabled \
91      -Dgallium-va=enabled \
92      -Dgallium-xa=disabled \
93      -Dgallium-vdpau=enabled \
94      -Dgles1=enabled \
95      -Dgles2=enabled \
96      -Dopengl=true \
97      -Dlmsensors=enabled \
98      -Dgallium-nine=true \
99      -Dvalgrind=disabled \
100      $_extra_options \
101      ..
103     ninja -j${jobs}
104     DESTDIR="$destdir" ninja -j${jobs} install
106     unset -v MESA_GIT_SHA1_OVERRIDE _extra_options
108     cd ../
110     # Handle .new files via graft(1), if any
111     if test -d "${destdir}/etc"
112     then
113         touch "${destdir}/etc/.graft-config"
114     fi
115     touch "${destdir}/usr/share/drirc.d/.graft-config"
117     # Compress and link man pages (if needed)
118     if test -d "${destdir}/$mandir"
119     then
120         (
121             cd "${destdir}/$mandir"
122             find . -type f -exec lzip -9 {} +
123             find . -type l | while read -r file
124             do
125                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
126                 rm -- "$file"
127             done
128         )
129     fi
131     # Copy documentation
132     mkdir -p "${destdir}/$docsdir"
133     cp -p $docs "${destdir}/$docsdir"