clang-gcc-wrapper: allow to set custom regexp of CFLAGS to remove

This commit is contained in:
Mikhail Novosyolov 2019-12-24 00:05:56 +03:00
parent 9f8de3e365
commit 9b928d93ae
2 changed files with 10 additions and 8 deletions

View file

@ -1,27 +1,29 @@
#!/bin/sh
# Author: mikhailnov
# Clean flags that clang does not know to fix building QtWebEngine with clang
# Remove flags that clang does not know but which cannot be removed properly
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9567
echo_err() {
echo "$@" 1>&2
}
# You may define a custom regexp to remove
REMOVE_CFLAGS="${REMOVE_CFLAGS:-"-fvar-tracking-assignments|-frecord-gcc-switches"}"
# _CLANG_ must be changed to /usr/bin/clang++ and then to /usr/bin/clang in another copy of this wrapper
if echo "$@" | grep -qE 'fvar-tracking-assignments|frecord-gcc-switches'
if echo "$@" | grep -qE -- "${REMOVE_CFLAGS}"
then
echo_err "DEBUG: clang-wrapper: arguements will be cut-out!"
echo_err "DEBUG: arguements were: "
echo_err "========================="
echo_err "$@"
echo_err "========================="
new_args="$(echo "$@" | sed -e 's/-fvar-tracking-assignments//g' -e 's/-frecord-gcc-switches//g')"
echo_err "DEBUG: new arguements are with and without expansion: "
new_args="$(echo "$@" | sed -r -e "s,${REMOVE_CFLAGS},,g")"
echo_err "DEBUG: new arguements are: "
echo_err "========================="
echo_err ${new_args}
echo_err "========================="
echo_err "${new_args}"
# https://stackoverflow.com/a/37141139 (??)
_CLANG_ ${new_args} || _CLANG_ "${new_args}"
_CLANG_ ${new_args}
else
_CLANG_ "$@"
fi

View file

@ -29,7 +29,7 @@
Summary: Low Level Virtual Machine (LLVM)
Name: llvm
Version: %{major_ver}.%{minor_ver}
Release: 1
Release: 2
License: NCSA
Group: Development/Other
Url: http://llvm.org