Skip to content

Commit

Permalink
Merge 06d8076 into 10e3482
Browse files Browse the repository at this point in the history
  • Loading branch information
eunovm committed Sep 16, 2019
2 parents 10e3482 + 06d8076 commit ba10e22
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions clade/extensions/opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@
"-isystem",
"-idirafter",
"-imacros",
"-isysroot"
]

gcc_optimization_opts = [
Expand Down Expand Up @@ -519,6 +520,11 @@ def filter_opts(opts, get_storage_path=None):
return []

filtered_opts = []

# Do not overwrite absolute paths within options except for the one corresponding to isysroot when this option is
# specified.
is_isysroot = any(opt.startswith('-isysroot') for opt in opts)

opts = iter(opts)
for opt in opts:
if not s_regex.match(opt):
Expand All @@ -534,18 +540,19 @@ def filter_opts(opts, get_storage_path=None):

continue

name = m.group(1)
path = m.group(2)

if path:
if get_storage_path and os.path.isabs(path):
if (not is_isysroot and get_storage_path and os.path.isabs(path)) or (is_isysroot and name == '-isysroot'):
opt = opt.replace(path, get_storage_path(path))

filtered_opts.append(opt)
elif opt in requires_value["CC"]:
filtered_opts.append(opt)
path = next(opts)

if get_storage_path and os.path.isabs(path):
if (not is_isysroot and get_storage_path and os.path.isabs(path)) or (is_isysroot and name == '-isysroot'):
path = get_storage_path(path)

filtered_opts.append(path)
Expand Down

0 comments on commit ba10e22

Please sign in to comment.