From: Eduardo Habkost <ehabkost@redhat.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] perf: More portable way to make CFLAGS work with clang
Date: Fri, 5 Oct 2018 17:40:58 -0300 [thread overview]
Message-ID: <20181005204058.7966-3-ehabkost@redhat.com> (raw)
In-Reply-To: <20181005204058.7966-1-ehabkost@redhat.com>
The existing code that tries to make CFLAGS compatible with clang
doesn't work with Python 3.
Instead of trying to touch _sysconfigdata.build_time_vars
directly, change the dictionary returned by
disutils.sysconfig.get_config_vars(). This works on both Python
2 and Python 3.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
tools/perf/util/setup.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 261a55e7e1b2..63f758c655d5 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -9,12 +9,14 @@ def clang_has_option(option):
cc = getenv("CC")
if cc == "clang":
- from _sysconfigdata import build_time_vars
- build_time_vars["CFLAGS"] = sub("-specs=[^ ]+", "", build_time_vars["CFLAGS"])
- if not clang_has_option("-mcet"):
- build_time_vars["CFLAGS"] = sub("-mcet", "", build_time_vars["CFLAGS"])
- if not clang_has_option("-fcf-protection"):
- build_time_vars["CFLAGS"] = sub("-fcf-protection", "", build_time_vars["CFLAGS"])
+ from distutils.sysconfig import get_config_vars
+ vars = get_config_vars()
+ for var in ('CFLAGS', 'OPT'):
+ vars[var] = sub("-specs=[^ ]+", "", vars[var])
+ if not clang_has_option("-mcet"):
+ vars[var] = sub("-mcet", "", vars[var])
+ if not clang_has_option("-fcf-protection"):
+ vars[var] = sub("-fcf-protection", "", vars[var])
from distutils.core import setup, Extension
--
2.18.0.rc1.1.g3f1ff2140
next prev parent reply other threads:[~2018-10-05 20:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-05 20:40 [PATCH 0/2] tools/perf: Python 3 + clang build fixes Eduardo Habkost
2018-10-05 20:40 ` [PATCH 1/2] perf: Make clang_has_option() work on Python 3 Eduardo Habkost
2018-10-09 5:32 ` [tip:perf/core] perf python: " tip-bot for Eduardo Habkost
2018-10-05 20:40 ` Eduardo Habkost [this message]
2018-10-09 5:32 ` [tip:perf/core] perf python: More portable way to make CFLAGS work with clang tip-bot for Eduardo Habkost
2018-10-05 21:23 ` [PATCH 0/2] tools/perf: Python 3 + clang build fixes Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181005204058.7966-3-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.