From 62d123dc34a85b87708193774f9eb126a2cd7d1a Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Thu, 24 Jan 2019 12:25:44 +0100 Subject: [PATCH] ci: Include missing utils.sh script Signed-off-by: Robert Foss --- ci/util.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 ci/util.sh diff --git a/ci/util.sh b/ci/util.sh new file mode 100755 index 0000000..293df42 --- /dev/null +++ b/ci/util.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Try to find locally defined paths for external resources +CI_CONFIG="$HOME/.virgl-ci.conf" +if [ -f "$CI_CONFIG" ]; then + . "$CI_CONFIG" +fi + +# Test paths for existence, if found assign to variable +# try_paths() MESA_PATH ../mesa /mesa +try_paths() +{ + VARIABLE_NAME=$1 + shift + for VARIABLE_PATH in "$@" + do + if [ -d "$VARIABLE_PATH" ]; then + VARIABLE_PATH="$(realpath $VARIABLE_PATH)" + eval "export $VARIABLE_NAME=\"$VARIABLE_PATH\"" + return + fi + done +} + +PROJECT_PATH="$(dirname $(readlink -f "$0"))/../.." + +try_paths VIRGL_PATH \ + "$VIRGL_PATH" \ + "/virglrenderer" \ + "${PROJECT_PATH}/virglrenderer" + +try_paths CTS_PATH \ + "$CTS_PATH" \ + "/VK-GL-CTS" \ + "${PROJECT_PATH}/VK-GL-CTS" + +try_paths MESA_PATH \ + "$MESA_PATH" \ + "/local_mesa" \ + "${PROJECT_PATH}/mesa" \ No newline at end of file