-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-mesa.sh
106 lines (91 loc) · 2.11 KB
/
build-mesa.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#! /bin/sh
#
# Syntax:
# sh build-mesa.sh [DEVDIR=/fancy/dev/dir] [UNINSTALL=yes]
#
# Ackn:
# xmixahlx
# https://forum.pine64.org/showthread.php?tid=8953
# v0.2020202.2020
# BUILD MESA-GIT AND INSTALL TO /USR/LOCAL
# RERUN TO UPDATE
## COMMAND LINE ARGUMENTS
for args do
case $args in
?*=?*) var=`expr "$args" : '\([^=]*\)'`
val=`expr "$args" : '[^=]*=\(.*\)'`
eval "$var"="'$val'" ;;
*) exec >&2
s="[DEVDIR=/fancy/build/folder] [UNINSTALL=yes] [GIT_PULL=no] [CLEAN=no]"
echo "Usage: /bin/sh `basename $0` $s"
exit 2
esac
done
## VARS
: ${DEVDIR:=/usr/local/src/build}
PKGDIR="$DEVDIR/mesa"
if test yes = "$UNINSTALL"
then (
## UNINSTALL
echo set -ex
echo cd "'$PKGDIR'"
echo ninja -C pbp-build uninstall
echo ldconfig
) | sudo -s
else (
## REQS
echo echo
echo echo +++ Make sure that deb-src is enabled in /etc/apt/sources.list
echo echo
echo set -ex
echo apt update
echo apt -y install meson ccache git build-essential cmake
echo apt -y build-dep mesa libcairo2-dev
echo mkdir -p "'$DEVDIR'"
echo chown `id -u` "'$DEVDIR'"
) | sudo -s &&
(
set -ex
cd "$DEVDIR"
## GET/UPDATE
test -f "$PKGDIR/.gitignore" ||
git clone --depth=1 https://gitlab.freedesktop.org/mesa/mesa.git
## UPDATE (RERUN)
cd "$PKGDIR"
git clean -f
test no = "$GIT_PULL" || {
git checkout master
git reset --hard
git pull origin master
git branch `date "+%Y%m%d%H%M%S-bullt"` || true
}
) &&
(
set -ex
cd "$PKGDIR"
## CONFIGURE
rm -Rf pbp-build
meson pbp-build \
-Dprefix=/usr/local \
-Dbuildtype=release \
-Dplatforms=x11,wayland,drm,surfaceless \
-Dgallium-drivers=panfrost,kmsro,swrast \
-Dllvm=false \
-Dlibunwind=false
## BUILD
ninja -C pbp-build
) &&
(
echo set -ex
echo cd "'$PKGDIR'"
## INSTALL & CLEAN
echo ninja -C pbp-build install
echo ldconfig
test no = "$CLEAN" || {
echo rm -Rf pbp-build
}
) | sudo -s &&
# RESTART XORG OR WAYLAND
echo "+++ Done - restart Xorg or Wayland now :)"
fi
# ENJOY