1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
From: YOKOTA Hiroshi <qykth-git@users.noreply.github.com>
Date: Sat, 23 Nov 2019 17:48:46 +0900
Subject: Hardening Qt code
Forwarded: not-needed
Allow hardening flags from debhelper.
---
setup/build.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/setup/build.py b/setup/build.py
index 956ad75..b7bb4ce 100644
--- a/setup/build.py
+++ b/setup/build.py
@@ -265,6 +265,10 @@ def init_env(debug=False, sanitize=False, compiling_for='native'):
base_cflags = shlex.split(os.environ.get('CFLAGS', ''))
base_cxxflags = shlex.split(os.environ.get('CXXFLAGS', ''))
base_ldflags = shlex.split(os.environ.get('LDFLAGS', ''))
+
+ base_cflags += shlex.split(os.environ.get('CPPFLAGS', ''))
+ base_cxxflags += shlex.split(os.environ.get('CPPFLAGS', ''))
+
cflags += base_cflags
ldflags += base_ldflags
cflags += ['-fvisibility=hidden']
@@ -746,6 +750,15 @@ sip-file = {os.path.basename(sipf)!r}
cwd = os.getcwd()
try:
os.chdir(os.path.join(src_dir, 'build'))
+ for q in walk('.'):
+ if os.path.basename(q) in ('Makefile',):
+ with open(q, 'r+') as f:
+ raw = f.read()
+ raw = raw.replace('CFLAGS =', 'CFLAGS = ' + os.environ.get('CFLAGS', '') + ' ' + os.environ.get('CPPFLAGS', ''))
+ raw = raw.replace('CXXFLAGS =', 'CXXFLAGS = ' + os.environ.get('CXXFLAGS', '') + ' ' + os.environ.get('CPPFLAGS', ''))
+ raw = raw.replace('LFLAGS =', 'LFLAGS = ' + os.environ.get('LDFLAGS', ''))
+ f.seek(0), f.truncate()
+ f.write(raw)
env = os.environ.copy()
if is_macos_universal_build:
env['ARCHS'] = 'x86_64 arm64'
|