mirror of
https://abf.rosa.ru/djam/llvm.git
synced 2025-02-24 00:32:49 +00:00
clang-gcc-wrapper: rework how to set custom CFLAGS to remove
This commit is contained in:
parent
9b928d93ae
commit
6c24bf93b0
3 changed files with 16 additions and 5 deletions
|
@ -1,3 +1,6 @@
|
|||
# CFLAGS that are known to be not suppported by clang
|
||||
%noclang_optflags -fvar-tracking-assignments -frecord-gcc-switches
|
||||
|
||||
%clang_gcc_wrapper() \
|
||||
# clang wrapper to remove compiler flags that clang does not know \
|
||||
# how-to in Russian: https://nixtux.ru/768 \
|
||||
|
@ -18,4 +21,5 @@ CPP="clang++" \
|
|||
echo "$CLANG" | grep -q "$BIN_DIR" \
|
||||
echo "$CLANGXX" | grep -q "$BIN_DIR" \
|
||||
export CLANG CLANGXX CC CXX CPP \
|
||||
export NOCLANG_OPTFLAGS="%{noclang_optflags}" \
|
||||
%{nil}
|
||||
|
|
|
@ -3,22 +3,29 @@
|
|||
# Remove flags that clang does not know but which cannot be removed properly
|
||||
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9567
|
||||
|
||||
set -efu
|
||||
|
||||
echo_err() {
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
# You may define a custom regexp to remove
|
||||
REMOVE_CFLAGS="${REMOVE_CFLAGS:-"-fvar-tracking-assignments|-frecord-gcc-switches"}"
|
||||
# %noclang_optflags
|
||||
NOCLANG_OPTFLAGS="${NOCLANG_OPTFLAGS:-}"
|
||||
# which flags to remove in addition to %noclang_optflags,
|
||||
# set custom REMOVE_CFLAGS in %build or redefine %noclang_optflags
|
||||
REMOVE_CFLAGS="${REMOVE_CFLAGS:-}"
|
||||
# convert flags list to regexp
|
||||
REMOVE="$(echo "$NOCLANG_OPTFLAGS $REMOVE_CFLAGS" | sed -e 's, ,|,g')"
|
||||
|
||||
# _CLANG_ must be changed to /usr/bin/clang++ and then to /usr/bin/clang in another copy of this wrapper
|
||||
if echo "$@" | grep -qE -- "${REMOVE_CFLAGS}"
|
||||
if echo "$@" | grep -qE -- "${REMOVE}"
|
||||
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 -r -e "s,${REMOVE_CFLAGS},,g")"
|
||||
new_args="$(echo "$@" | sed -r -e "s,${REMOVE},,g")"
|
||||
echo_err "DEBUG: new arguements are: "
|
||||
echo_err "========================="
|
||||
echo_err ${new_args}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
Summary: Low Level Virtual Machine (LLVM)
|
||||
Name: llvm
|
||||
Version: %{major_ver}.%{minor_ver}
|
||||
Release: 2
|
||||
Release: 3
|
||||
License: NCSA
|
||||
Group: Development/Other
|
||||
Url: http://llvm.org
|
||||
|
|
Loading…
Add table
Reference in a new issue