summaryrefslogtreecommitdiff
path: root/mesa-run
blob: f951c1c0f0ba0fca7fa640e0c71424353850d835 (plain)
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
#!/bin/bash

die() {
	echo "$1"
	exit 255
}

[[ -z ${builddir} ]] && die "builddir must be set"
prefix="${builddir}"/install

machine=$(uname -m)
case "$machine" in
x86_64)
	vk_icd="intel_icd.${machine}.json"
	vulkan_drivers=intel
	gallium_drivers=iris
	tools=drm-shim,intel
	extra_args+=(-Dintel-clc=enabled)
	;;
aarch64|arm*)
	vk_icd="freedreno_icd.${machine}.json"
	vulkan_drivers=freedreno
	gallium_drivers=freedreno
	tools=drm-shim,freedreno
	;;
esac

case "$1" in
wipe|wipeout)
	echo "Removing ${builddir}"
	exec meson setup --wipe "${builddir}"
	;;
configure)
	export LLVM_MAJOR_VERSION="17"
	export LLVM_CONFIG="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/llvm-config"
	#export CC="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/clang"
	#export CXX="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/clang++"
	#export CC_LD="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/lld"
	#export CXX_LD="${CC_LD}"

	args=(
		--pkg-config-path "/usr/lib/llvm/${LLVM_MAJOR_VERSION}/lib64/pkgconfig"
		-Dprefix="${prefix}"
		-Dc_args="${cflags}"
		-Dcpp_args="${cxxflags}"
		-Dtools="${tools}"
		-Dbuild-tests=true
		-Dvulkan-drivers="${vulkan_drivers}"
		-Dgallium-drivers="${gallium_drivers}"
		-Dgallium-rusticl=false
		-Dgallium-va=auto
		-Dgallium-xa=disabled
		-Dvideo-codecs="vc1dec,h264dec,h264enc,h265dec,h265enc"
		-Dvulkan-beta=true
		-Dbuildtype="${buildtype}"
		-Dbackend=ninja
		"${extra_args[@]}"
		"${builddir}"
	)
	exec meson setup --reconfigure "${args[@]}"
	;;
build)
	exec nj "${buildtype}" install
	;;
esac

if ! command -v jq &> /dev/null; then
	die "jq needs to be installed"
fi

libdir=$(jq -r '.[] | select(.name == "libdir").value' "${builddir}"/meson-info/intro-buildoptions.json)
export LD_LIBRARY_PATH="${prefix}/${libdir}:${LD_LIBRARY_PATH}"
export LIBGL_DRIVERS_PATH="${prefix}/${libdir}"/dri
export VK_ICD_FILENAMES="${prefix}"/share/vulkan/icd.d/"${vk_icd}"
exec "$@"