mirror of
https://abf.rosa.ru/djam/llvm.git
synced 2025-02-24 08:42:51 +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_gcc_wrapper() \
|
||||||
# clang wrapper to remove compiler flags that clang does not know \
|
# clang wrapper to remove compiler flags that clang does not know \
|
||||||
# how-to in Russian: https://nixtux.ru/768 \
|
# how-to in Russian: https://nixtux.ru/768 \
|
||||||
|
@ -18,4 +21,5 @@ CPP="clang++" \
|
||||||
echo "$CLANG" | grep -q "$BIN_DIR" \
|
echo "$CLANG" | grep -q "$BIN_DIR" \
|
||||||
echo "$CLANGXX" | grep -q "$BIN_DIR" \
|
echo "$CLANGXX" | grep -q "$BIN_DIR" \
|
||||||
export CLANG CLANGXX CC CXX CPP \
|
export CLANG CLANGXX CC CXX CPP \
|
||||||
|
export NOCLANG_OPTFLAGS="%{noclang_optflags}" \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
|
@ -3,22 +3,29 @@
|
||||||
# Remove flags that clang does not know but which cannot be removed properly
|
# Remove flags that clang does not know but which cannot be removed properly
|
||||||
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9567
|
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9567
|
||||||
|
|
||||||
|
set -efu
|
||||||
|
|
||||||
echo_err() {
|
echo_err() {
|
||||||
echo "$@" 1>&2
|
echo "$@" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# You may define a custom regexp to remove
|
# %noclang_optflags
|
||||||
REMOVE_CFLAGS="${REMOVE_CFLAGS:-"-fvar-tracking-assignments|-frecord-gcc-switches"}"
|
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
|
# _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
|
then
|
||||||
echo_err "DEBUG: clang-wrapper: arguements will be cut-out!"
|
echo_err "DEBUG: clang-wrapper: arguements will be cut-out!"
|
||||||
echo_err "DEBUG: arguements were: "
|
echo_err "DEBUG: arguements were: "
|
||||||
echo_err "========================="
|
echo_err "========================="
|
||||||
echo_err "$@"
|
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 "DEBUG: new arguements are: "
|
||||||
echo_err "========================="
|
echo_err "========================="
|
||||||
echo_err ${new_args}
|
echo_err ${new_args}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
Summary: Low Level Virtual Machine (LLVM)
|
Summary: Low Level Virtual Machine (LLVM)
|
||||||
Name: llvm
|
Name: llvm
|
||||||
Version: %{major_ver}.%{minor_ver}
|
Version: %{major_ver}.%{minor_ver}
|
||||||
Release: 2
|
Release: 3
|
||||||
License: NCSA
|
License: NCSA
|
||||||
Group: Development/Other
|
Group: Development/Other
|
||||||
Url: http://llvm.org
|
Url: http://llvm.org
|
||||||
|
|
Loading…
Add table
Reference in a new issue