comparison graphics/mesa/mesa.sh @ 264:99bc133dd404

graphics/mesa: initial import, closes #1281
author David Demelier <markand@malikania.fr>
date Thu, 21 Mar 2019 21:15:00 +0100
parents
children 0c8bd6c16d43
comparison
equal deleted inserted replaced
263:16aaf65523de 264:99bc133dd404
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 PKGNAME=mesa
19 PKGVERSION=18.3.5
20 PKGREVISION=1
21 PKGLICENSE="CUSTOM"
22 PKGSUMMARY="opensource OpenGL implementation"
23 PKGDOWNLOAD="https://mesa.freedesktop.org/archive/$PKGNAME-$PKGVERSION.tar.xz"
24 PKGDEPENDS=""
25 PKGOPTIONS="DRM LLVM WAYLAND X"
26
27 : ${CC:=gcc}
28 : ${CFLAGS:=-O2}
29 : ${CXX:=g++}
30 : ${CXXFLAGS:=-O2}
31 : ${LDFLAGS:=}
32 : ${DRM:=yes}
33 : ${LLVM:=yes}
34 : ${WAYLAND:=yes}
35 : ${X:=yes}
36
37 with_platforms=""
38 with_gallium_drivers="r300,r600,virgl,svga,swrast"
39 with_vulkan_drivers="intel"
40
41 if [ "$DRM" = "yes" ]; then
42 with_platforms="drm,$platforms"
43 fi
44
45 if [ "$LLVM" = "yes" ]; then
46 PKGDEPENDS="dev/llvm:build $PKGDEPENDS"
47 with_llvm="-D llvm=true"
48 with_gallium_drivers="radeonsi,$with_gallium_drivers"
49 with_vulkan_drivers="amd,$with_vulkan_drivers"
50 else
51 with_llvm="-D llvm=false"
52 fi
53
54 if [ "$WAYLAND" = "yes" ]; then
55 with_platforms="wayland,$with_platforms"
56 fi
57
58 if [ "$X" = "yes" ]; then
59 with_platforms="x11,$with_platforms"
60 with_dri="-D dri3=true"
61 with_glx="-D glx=dri"
62 else
63 with_dri="-D dri3=false"
64 with_glx="-D glx=disabled"
65 fi
66
67 build()
68 {
69 rm -rf $PKGNAME-$PKGVERSION
70 tar xvaf $PKGNAME-$PKGVERSION.tar.xz
71 pushd $PKGNAME-$PKGVERSION
72
73 # https://git.alpinelinux.org/aports/plain/main/mesa/musl-fix-includes.patch
74 patch -p1 < ../musl.patch
75 CC="$CC" \
76 CFLAGS="$CFLAGS" \
77 CXX="$CXX" \
78 CXXFLAGS="$CXXFLAGS" \
79 LDFLAGS="$LDFLAGS" \
80 meson \
81 --prefix /usr \
82 --buildtype release \
83 --default-library shared \
84 -D egl=true \
85 -D bpm=true \
86 -D platforms=$with_platforms \
87 -D gallium-drivers=$with_gallium_drivers \
88 -D vulkan-drivers=$with_vulkan_drivers \
89 $with_llvm \
90 $with_dri \
91 $with_glx \
92 . build
93 ninja -C build
94 DESTDIR=$DESTDIR ninja -C build install
95
96 popd
97 rm -rf $PKGNAME-$PKGVERSION
98 }
99