summaryrefslogtreecommitdiff
path: root/bin/bootstrap.py
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-11-03 11:51:34 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-11-03 13:32:23 +0100
commitd1ea1f3591a0bdd1ef7f0d988ab91b8bdf847436 (patch)
tree9e27ce7963b7b664cc68eb303ca71219a9b42097 /bin/bootstrap.py
parentfb928dec553dbdb455e9cbc0381834056974b52f (diff)
downloadjustbuild-d1ea1f3591a0bdd1ef7f0d988ab91b8bdf847436.tar.gz
also honor additional flags in the early bootstrap phase
Diffstat (limited to 'bin/bootstrap.py')
-rwxr-xr-xbin/bootstrap.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/bin/bootstrap.py b/bin/bootstrap.py
index dcbd8586..f07b66af 100755
--- a/bin/bootstrap.py
+++ b/bin/bootstrap.py
@@ -61,6 +61,8 @@ CONF_STRING = json.dumps(CONF)
AR="ar"
CC="clang"
CXX="clang++"
+CFLAGS = []
+CXXFLAGS = []
if "AR" in CONF:
AR=CONF["AR"]
@@ -68,8 +70,12 @@ if "CC" in CONF:
CC=CONF["CC"]
if "CXX" in CONF:
CXX=CONF["CXX"]
+if "ADD_CFLAGS" in CONF:
+ CFLAGS=CONF["ADD_CFLAGS"]
+if "ADD_CXXFLAGS" in CONF:
+ CXXFLAGS=CONF["ADD_CXXFLAGS"]
-BOOTSTRAP_CC = [CXX, "-std=c++20", "-DBOOTSTRAP_BUILD_TOOL"]
+BOOTSTRAP_CC = [CXX] + CXXFLAGS + ["-std=c++20", "-DBOOTSTRAP_BUILD_TOOL"]
# relevant directories (global variables)
@@ -109,6 +115,9 @@ def get_archive(*, distfile, fetch):
subprocess.run(["wget", "-O", target, fetch])
return target
+def quote(args):
+ return ' '.join(["'" + arg.replace("'", "'\\''") + "'"
+ for arg in args])
def run(cmd, *, cwd, **kwargs):
print("Running %r in %r" % (cmd, cwd), flush=True)
@@ -161,8 +170,10 @@ def setup_deps(src_wrkdir):
os.symlink(os.path.normpath(include_dir),
os.path.join(include_location, include_name))
if "build" in hints:
- run(["sh", "-c", hints["build"].format(cc=CC, cxx=CXX, ar=AR)],
- cwd=subdir)
+ run(["sh", "-c", hints["build"].format(
+ cc=CC, cxx=CXX, ar=AR,
+ cflags=quote(CFLAGS), cxxflags=quote(CXXFLAGS),
+ )], cwd=subdir)
if "link" in hints:
link_flags.extend(["-L", subdir])
if "link" in hints: