Commit 6212ca1a authored by firm's avatar firm
Browse files

Fixed dictionary lookup by program name, which may contain a suffix

parent 8d39b02f
...@@ -365,6 +365,20 @@ setprocgroup = yes ...@@ -365,6 +365,20 @@ setprocgroup = yes
ignore_sigint = no ignore_sigint = no
test_sponsor = IPD Snelting test_sponsor = IPD Snelting
""" """
"""
Program names may end with a _s or _t suffix.
If a dictionary doesn't contain an entry for those specific keys, we want
to trim that suffix from the program name and try again.
"""
def get_by_prog(d, prog, default=None):
if prog in d:
return d[prog]
suf = prog.rfind("_")
if suf >= 0:
return d.get(prog[:suf], default)
return default
def get_portability(options, prog, lang): def get_portability(options, prog, lang):
if lang == "c": if lang == "c":
port = "CPORTABILITY" port = "CPORTABILITY"
...@@ -382,18 +396,19 @@ def get_portability(options, prog, lang): ...@@ -382,18 +396,19 @@ def get_portability(options, prog, lang):
target_arch = options.target_architecture target_arch = options.target_architecture
compat_flags = COMPATIBILITY_FLAGS.get(prog, "") compat_flags = get_by_prog(COMPATIBILITY_FLAGS, prog, "")
if not TARGET_ARCH_FLAGS.has_key(target_arch): if not TARGET_ARCH_FLAGS.has_key(target_arch):
print "No architecture-dependent flags defined for architecture '%s'" % target_arch print "No architecture-dependent flags defined for architecture '%s'" % target_arch
exit(1) exit(1)
target_flags = TARGET_ARCH_FLAGS[target_arch].get(prog, "") target_flags = get_by_prog(TARGET_ARCH_FLAGS[target_arch], prog, "")
compiler_flags = "" compiler_flags = ""
for comp in COMPILER_FLAGS: for comp in COMPILER_FLAGS:
if comp in compiler: # Also allow stuff like sparc-leon-linux-gnu-gcc or cparser-test if comp in compiler: # Also allow stuff like sparc-leon-linux-gnu-gcc or cparser-test
compiler_flags = COMPILER_FLAGS[comp].get(prog, "") compiler_flags = get_by_prog(COMPILER_FLAGS[comp], prog, "")
break break
# filter(None, list) == filter(id, list)
flags = ' '.join(filter(None, [compat_flags, target_flags, compiler_flags])) flags = ' '.join(filter(None, [compat_flags, target_flags, compiler_flags]))
if flags == '': if flags == '':
return None return None
...@@ -501,7 +516,7 @@ def generate_spec_config(options, progs): ...@@ -501,7 +516,7 @@ def generate_spec_config(options, progs):
if prog in progs: if prog in progs:
port = get_portability(options, prog, lang) port = get_portability(options, prog, lang)
if port is not None: if port is not None:
contents.append(prog + "=default=default=default:") contents.append(prog + ":")
contents.append(port) contents.append(port)
contents.append("notes%03d = %s: %s" % (notes, prog, port)) contents.append("notes%03d = %s: %s" % (notes, prog, port))
notes = notes + 1 notes = notes + 1
......
Markdown is supported
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