Ticket #68: built-in.conf.2.diff
File built-in.conf.2.diff, 2.2 KB (added by , 14 years ago) |
---|
-
lib/python/soclib_cc/config/built-in.conf
25 25 Retrieves platform information and make it look-like systemc's 26 26 lib-xxx thing. 27 27 """ 28 import sys 29 pf = sys.platform 28 import os 30 29 31 # Strip numeric suffix from platform name 32 while pf[-1] in "0123456789": 33 pf = pf[:-1] 30 def _guess_directory(): 31 systemc = os.getenv('SYSTEMC') 32 if systemc: 33 candidates = filter(lambda x:x.startswith('lib-'), 34 os.listdir(systemc)) 35 if len(candidates) == 1: 36 return candidates[0][4:] 37 return None 34 38 35 if pf == 'darwin': pf = 'macosx' 36 return pf 39 def _suffix(triple): 40 '''SystemC lib directory suffix oracle''' 41 from fnmatch import fnmatch 42 for pattern, value in ( 43 ("sparc-sun-solaris*", 'gccsparcOS5'), 44 ("x86_64*linux*", 'linux64' ), 45 ("*linux*", 'linux' ), 46 ("i?86-apple-macosx*", 'macosx' ), 47 ("powerpc-apple-macosx*", 'macosx' ), 48 ("x86_64*freebsd*", 'freebsd64' ), 49 ("amd64*freebsd*", 'freebsd64' ), 50 ("*freebsd*", 'freebsd' ), 51 ("*cygwin*", 'cygwin' ), 52 ("*mingw*", 'mingw' ), 53 ("*hpux11*", 'gcchpux11' ), 54 ): 55 if fnmatch(triple, pattern): 56 return value 57 return None 37 58 59 def _machine_triple(): 60 '''triple like the one produced by config.guess''' 61 import subprocess 62 try: 63 proc = subprocess.Popen(['gcc', '-dumpmachine'], shell = False, stdout = subprocess.PIPE) 64 out, err = proc.communicate() 65 except: 66 out = '' 67 return out 68 69 return _suffix(_machine_triple()) or _guess_directory() or '' 70 38 71 config.systemc = Library( 39 72 name = 'systemc', 40 73 vendor = 'OSCI',