Commit e2c77b79 authored by André Anjos's avatar André Anjos 💬
Browse files

Re-organise system includes so shortest is last

parent fe049742
......@@ -95,7 +95,8 @@ def generate_self_macros(extname, version):
return retval
def reorganize_isystem(args):
"""Re-organizes the -isystem includes so that more specific paths come first"""
"""Re-organizes the -isystem includes so that more specific paths come
first"""
remainder = []
includes = []
......@@ -113,6 +114,11 @@ def reorganize_isystem(args):
includes = uniq(includes[::-1])[::-1]
# sort includes so that the shortest system includes go last
# this algorithm will ensure '/usr/include' comes after other
# overwrites
includes.sort(key=lambda item: (-len(item), item))
retval = [tuple(remainder)] + [('-isystem', k) for k in includes]
from itertools import chain
return list(chain.from_iterable(retval))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment