Ticket #32251: patch-SConstruct.diff

File patch-SConstruct.diff, 2.3 KB (added by ak.ml@…, 13 years ago)
  • SConstruct

    old new  
    2121
    2222SConsignFile() # no .scsonsign into $PREFIX please
    2323
    24 if sys.platform == "darwin":
    25     default_prefix = '/opt/local/'
    26 else:
    27     default_prefix = '/usr/local/'
     24default_prefix = '@PREFIX@/'
    2825
    2926opts = Variables()
    3027opts.Add(PathVariable('prefix', 'autotools-style installation prefix', default_prefix, validator=PathVariable.PathIsDirCreate))
     
    4542numpy_path = numpy.get_include()
    4643env.Append(CPPPATH=numpy_path)
    4744
     45env['CXX'] = os.environ.get('CXX', 'g++')
    4846
    4947if sys.platform == "win32":
    5048    # official python shipped with no pc file on windows so get from current python
    5149    from distutils import sysconfig
    5250    pre,inc = sysconfig.get_config_vars('exec_prefix', 'INCLUDEPY')
    5351    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')
    5752else:
    5853    # some distros use python2.5-config, others python-config2.5
    5954    try:
    6055        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']
    6276    except OSError:
    6377        print 'going to try python-config instead'
    6478        env.ParseConfig('python-config --ldflags')
     
    8195
    8296def burn_python_version(target, source, env):
    8397    # 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'
    8599    s += 5*'#\n'
    86100    s += '# DO NOT EDIT - edit %s instead\n' % source[0]
    87101    s += 5*'#\n'