summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorEric Engestrom <eric@igalia.com>2023-03-17 20:48:32 +0000
committerMarge Bot <emma+marge@anholt.net>2023-03-22 17:28:07 +0000
commitdc53b3917346239f22b35facd2fdea4bb4cbb72f (patch)
tree603c21e5c5f243dd76cfc995578df82f2221e929 /.gitlab-ci
parent6a0f12ba5f10fe82fd26304a56cb4f7b60119902 (diff)
ci: add linker wrapper for clang
Signed-off-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21997>
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/build/clang++-link-werror.sh21
-rwxr-xr-x.gitlab-ci/build/clang-link-werror.sh21
2 files changed, 42 insertions, 0 deletions
diff --git a/.gitlab-ci/build/clang++-link-werror.sh b/.gitlab-ci/build/clang++-link-werror.sh
new file mode 100755
index 00000000000..938327a65a1
--- /dev/null
+++ b/.gitlab-ci/build/clang++-link-werror.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+if command -V ccache >/dev/null 2>/dev/null; then
+ CCACHE=ccache
+else
+ CCACHE=
+fi
+
+if [ "$(ps -p $(ps -p $PPID -o ppid --no-headers) -o comm --no-headers)" != ninja ]; then
+ # Not invoked by ninja (e.g. for a meson feature check)
+ exec $CCACHE clang++ "$@"
+fi
+
+if [ "$(eval printf "'%s'" "\"\${$(($#-1))}\"")" = "-c" ]; then
+ # Not invoked for linking
+ exec $CCACHE clang++ "$@"
+fi
+
+# Compiler invoked by ninja for linking. Add -Werror to turn compiler warnings into errors
+# with LTO. (meson's werror should arguably do this, but meanwhile we need to)
+exec $CCACHE clang++ "$@" -Werror
diff --git a/.gitlab-ci/build/clang-link-werror.sh b/.gitlab-ci/build/clang-link-werror.sh
new file mode 100755
index 00000000000..0486782e8bd
--- /dev/null
+++ b/.gitlab-ci/build/clang-link-werror.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+if command -V ccache >/dev/null 2>/dev/null; then
+ CCACHE=ccache
+else
+ CCACHE=
+fi
+
+if [ "$(ps -p $(ps -p $PPID -o ppid --no-headers) -o comm --no-headers)" != ninja ]; then
+ # Not invoked by ninja (e.g. for a meson feature check)
+ exec $CCACHE clang "$@"
+fi
+
+if [ "$(eval printf "'%s'" "\"\${$(($#-1))}\"")" = "-c" ]; then
+ # Not invoked for linking
+ exec $CCACHE clang "$@"
+fi
+
+# Compiler invoked by ninja for linking. Add -Werror to turn compiler warnings into errors
+# with LTO. (meson's werror should arguably do this, but meanwhile we need to)
+exec $CCACHE clang "$@" -Werror