| 1 |
#! /bin/bash |
| 2 |
# |
| 3 |
# Copyright 2018 Google LLC |
| 4 |
# |
| 5 |
# Use of this source code is governed by a BSD-style license that can be |
| 6 |
# found in the LICENSE file. |
| 7 |
# |
| 8 |
# Builds the mesa driver and copies it to /OUT |
| 9 |
# This script uses the environement variable $MESA_VERSION |
| 10 |
# to dermine which version to download and build. |
| 11 |
|
| 12 |
set -ex |
| 13 |
|
| 14 |
if [[ -z "${MESA_VERSION}" ]]; then |
| 15 |
printf "MESA_VERSION environment variable must be provided." |
| 16 |
exit 1 |
| 17 |
fi |
| 18 |
|
| 19 |
pushd /tmp |
| 20 |
|
| 21 |
curl https://archive.mesa3d.org//mesa-${MESA_VERSION}.tar.xz -o mesa.tar.xz |
| 22 |
tar xf mesa.tar.xz |
| 23 |
cd mesa-${MESA_VERSION}/ |
| 24 |
|
| 25 |
ls -al |
| 26 |
|
| 27 |
meson build/ |
| 28 |
meson configure --prefix="${PWD}/build/install" build/ -D 'dri-drivers-path=.' |
| 29 |
ninja -C build/ |
| 30 |
ninja -C build/ install |
| 31 |
|
| 32 |
# Copy all the .so files into one a single directory to make things simpler. |
| 33 |
find build/install -name "*.so" | xargs -I{} -n1 cp {} /OUT |
| 34 |
|
| 35 |
# Change "library_path" to "./libvulkan_intel.so" and write it out |
| 36 |
# in the root of the /OUT directory. |
| 37 |
jq < build/install/share/vulkan/icd.d/intel_icd.x86_64.json '.ICD.library_path="./libvulkan_intel.so"' > /OUT/intel_icd.x86_64.json |
| 38 |
|
| 39 |
popd |