travis: make Meson find the proper llvm-config
authorAndres Gomez <agomez@igalia.com>
Wed, 28 Feb 2018 21:18:59 +0000 (23:18 +0200)
committerAndres Gomez <agomez@igalia.com>
Thu, 1 Mar 2018 10:21:30 +0000 (12:21 +0200)
Travis CI has moved to LLVM 5.0, and meson is detecting automatically
the available version in /usr/local/bin based on the PATH env variable
order preference.

As for 0.44.x, Meson cannot receive the path to the llvm-config binary
as a configuration parameter. See
https://github.com/mesonbuild/meson/issues/2887 and
https://github.com/dcbaker/meson/commit/7c8b6ee3fa42f43c9ac7dcacc61a77eca3f1bcef

We want to use the custom (APT) installed version. Therefore, let's
make Meson find our wanted version sooner than the one at
/usr/local/bin

Once this is corrected, we would still need a patch similar to:
https://lists.freedesktop.org/archives/mesa-dev/2017-December/180217.html

v2: Create the link only to the specificly wanted LLVM version (Gert).

Cc: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: Dylan Baker <dylan@pnwbakers.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Juan A. Suarez Romero <jasuarez@igalia.com>
Cc: Gert Wollny <gw.fossdev@gmail.com>
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-and-Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
.travis.yml

index 0ec08e5bff7465a21ebd795664485634726c6991..823111ca539b3c1f28c3003518babe3398dbdd10 100644 (file)
@@ -34,6 +34,8 @@ matrix:
         - LABEL="meson Vulkan"
         - BUILD=meson
         - MESON_OPTIONS="-Ddri-drivers= -Dgallium-drivers="
+        - LLVM_VERSION=4.0
+        - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
       addons:
         apt:
           sources:
@@ -573,8 +575,28 @@ script:
       scons $SCONS_TARGET && eval $SCONS_CHECK_COMMAND;
     fi
 
-  - if test "x$BUILD" = xmeson; then
-      export CFLAGS="$CFLAGS -isystem`pwd`";
-      meson _build $MESON_OPTIONS;
-      ninja -C _build;
+  - |
+    if test "x$BUILD" = xmeson; then
+
+      # Travis CI has moved to LLVM 5.0, and meson is detecting
+      # automatically the available version in /usr/local/bin based on
+      # the PATH env variable order preference.
+      #
+      # As for 0.44.x, Meson cannot receive the path to the
+      # llvm-config binary as a configuration parameter. See
+      # https://github.com/mesonbuild/meson/issues/2887 and
+      # https://github.com/dcbaker/meson/commit/7c8b6ee3fa42f43c9ac7dcacc61a77eca3f1bcef
+      #
+      # We want to use the custom (APT) installed version. Therefore,
+      # let's make Meson find our wanted version sooner than the one
+      # at /usr/local/bin
+      #
+      # Once this is corrected, we would still need a patch similar
+      # to:
+      # https://lists.freedesktop.org/archives/mesa-dev/2017-December/180217.html
+      test -f /usr/bin/$LLVM_CONFIG && ln -s /usr/bin/$LLVM_CONFIG $HOME/prefix/bin/llvm-config
+
+      export CFLAGS="$CFLAGS -isystem`pwd`"
+      meson _build $MESON_OPTIONS
+      ninja -C _build
     fi