recipes: xorg/mesa: upgraded to version 19.0.4, improving compatibility with Musl
[dragora.git] / recipes / xorg / mesa / recipe
blob23b94e25c46d3ac1ae2a06acbbdd7ae2bc3e8814
1 # Build recipe for mesa.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2019 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 program=mesa
19 version=19.0.4
20 release=1
22 # Set 'outdir' for a nice and well-organized output directory
23 outdir="${outdir}/${arch}/xorg/mesa"
25 tarname=${program}-${version}.tar.gz
27 # Remote source(s)
28 fetch=http://mesa.freedesktop.org/archive/$tarname
30 description="
31 Mesa is an OpenGL compatible 3-D graphics library.
33 The Mesa project began as an open-source implementation of the OpenGL
34 specification - a system for rendering interactive 3D graphics.
37 homepage=http://www.mesa3d.org/
38 license=MIT
40 # Source documentation
41 docs="VERSION"
42 docsdir="${docdir}/${program}-${version}"
44 build()
46     set -e
48     unpack "${tardir}/$tarname"
50     cd "$srcdir"
52     # To increment compatibility with Musl (Thanks to "Alpine Linux")
53     patch -p1 < "${worktree}/patches/mesa/adjust-cache-deflate-buffer.patch"
54     patch -p1 < "${worktree}/patches/mesa/musl-fix-includes.patch"
56     # Set sane permissions
57     chmod -R u+w,go-w,a+rX-s .
59     ./configure CPPFLAGS="-D_XOPEN_SOURCE=700" \
60     CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
61      $configure_args --enable-autotools \
62      --libdir=/usr/lib${libSuffix} \
63      --infodir=$infodir \
64      --mandir=$mandir \
65      --docdir=$docsdir \
66      --disable-debug \
67      --disable-llvm \
68      --disable-gallium-llvm \
69      --disable-xvmc \
70      --disable-glx-tls \
71      --enable-glx \
72      --enable-texture-float \
73      --enable-gles1 \
74      --enable-gles2 \
75      --enable-gbm \
76      --enable-shared-glapi \
77      --enable-gallium-extra-hud \
78      --enable-dri \
79      --enable-dri3 \
80      --enable-gallium-osmesa \
81      --enable-xa \
82      --enable-nine \
83      --enable-xlib-lease \
84      --enable-lmsensors \
85      --with-gallium-drivers="i915,nouveau,r600,swrast" \
86      --with-platforms="drm,x11" \
87      --with-dri-driverdir=/usr/lib${libSuffix}/xorg/modules/dri \
88      --build="$(cc -dumpmachine)"
90     make -j${jobs} V=1
91     make -j${jobs} DESTDIR="$destdir" install-strip
93     # Handle .new files via graft(1), if any
94     if test -d "${destdir}/etc"
95     then
96         touch "${destdir}/etc/.graft-config"
97     fi
99     # Compress info documents deleting index file for the package
100     if test -d "${destdir}/$infodir"
101     then
102         rm -f "${destdir}/${infodir}/dir"
103         lzip -9 "${destdir}/${infodir}"/*
104     fi
106     # Compress and link man pages (if needed)
107     if test -d "${destdir}/$mandir"
108     then
109         (
110             cd "${destdir}/$mandir"
111             find . -type f -exec lzip -9 '{}' +
112             find . -type l | while read -r file
113             do
114                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
115                 rm -- "$file"
116             done
117         )
118     fi
120     # Copy documentation
121     mkdir -p "${destdir}${docsdir}"
122     cp -p $docs "${destdir}${docsdir}"/