Ticket #32251: patch-SConstruct.diff
File patch-SConstruct.diff, 2.3 KB (added by ak.ml@…, 13 years ago) |
---|
-
SConstruct
old new 21 21 22 22 SConsignFile() # no .scsonsign into $PREFIX please 23 23 24 if sys.platform == "darwin": 25 default_prefix = '/opt/local/' 26 else: 27 default_prefix = '/usr/local/' 24 default_prefix = '@PREFIX@/' 28 25 29 26 opts = Variables() 30 27 opts.Add(PathVariable('prefix', 'autotools-style installation prefix', default_prefix, validator=PathVariable.PathIsDirCreate)) … … 45 42 numpy_path = numpy.get_include() 46 43 env.Append(CPPPATH=numpy_path) 47 44 45 env['CXX'] = os.environ.get('CXX', 'g++') 48 46 49 47 if sys.platform == "win32": 50 48 # official python shipped with no pc file on windows so get from current python 51 49 from distutils import sysconfig 52 50 pre,inc = sysconfig.get_config_vars('exec_prefix', 'INCLUDEPY') 53 51 env.Append(CPPPATH=inc, LIBPATH=pre+'\libs', LIBS='python'+sys.version[0]+sys.version[2]) 54 elif sys.platform == "darwin":55 env.ParseConfig('python-config --cflags')56 env.ParseConfig('python-config --ldflags')57 52 else: 58 53 # some distros use python2.5-config, others python-config2.5 59 54 try: 60 55 env.ParseConfig(python + '-config --cflags') 61 env.ParseConfig(python + '-config --ldflags') 56 ldflags = env.backtick(python + '-config --ldflags').split() 57 58 print 'ldflags: ', ldflags 59 60 # Put all options after -u in LINKFLAGS 61 try: 62 idx = ldflags.index('-u') 63 env.Append(LINKFLAGS=ldflags[idx:]) 64 del ldflags[idx:] 65 except ValueError: 66 idx = -1 67 68 print 'ldflags fixed:', ldflags 69 70 env.MergeFlags(' '.join(ldflags)) 71 72 print 'CXX: ', env['CXX'] 73 print 'CCFLAGS: ', env['CCFLAGS'] 74 print 'LIBS: ', env['LIBS'] 75 print 'LINKFLAGS:', env['LINKFLAGS'] 62 76 except OSError: 63 77 print 'going to try python-config instead' 64 78 env.ParseConfig('python-config --ldflags') … … 81 95 82 96 def burn_python_version(target, source, env): 83 97 # make sure we run the python version that we built the extension modules for 84 s = '#! /usr/bin/env' + python + '\n'98 s = '#!@PREFIX@/bin/' + python + '\n' 85 99 s += 5*'#\n' 86 100 s += '# DO NOT EDIT - edit %s instead\n' % source[0] 87 101 s += 5*'#\n'