Esempio n. 1
0
def get_test_environment(envi):
    env= bug_fixes.clone_env(envi)
    env.Replace(LINKFLAGS=env['IMP_BIN_LINKFLAGS'])
    env.Replace(LIBS=utility.get_env_paths(envi, 'libs'))
    if env['IMP_USE_RPATH']:
        dylinkflags=[]
        for p in env['LIBPATH']:
            if p[0] != '#':
                env.Prepend(RPATH=[p])
    env['IMP_OUTER_ENVIRONMENT']= envi
    return env
Esempio n. 2
0
def _propagate_variables(env):
    """enforce dependencies between variables"""
    env['IMP_BUILD_STATIC']= env['static']
    env['IMP_BUILD_DYNAMIC']= env['dynamic']
    if env['python'] != "no" and not env.get('PYTHON', None):
        env['IMP_PROVIDE_PYTHON']= True
        if env['python'] =="auto":
            env['PYTHON']=env['python']
        else:
            env['PYTHON']=env['python']
    else:
        env['IMP_PROVIDE_PYTHON']=False
        if env['wine']:
            env['PYTHON']="w32python"
        else:
            env['PYTHON']="python"
    env['IMP_PROVIDE_PYTHON']= env['python']
    env['IMP_USE_PLATFORM_FLAGS']= env['platformflags']
    env['IMP_USE_RPATH']= env['rpath']
    if env['pythonsosuffix'] != 'default':
        env['IMP_PYTHON_SO']=env['pythonsosuffix']
    elif env['IMP_PROVIDE_PYTHON'] and not env['IMP_USE_PLATFORM_FLAGS']:
        print >> sys.stderr, "Do not know suffix for python lib, please provide pythonsosuffix"
        env.Exit(1)
    if env['wine']:
        env['IMP_BUILD_STATIC']=False
        env['IMP_PYTHON_SO']='.pyd'

    if env['PLATFORM']!= 'posix' and env['PLATFORM'] != 'darwin' and env['IMP_USE_RPATH']:
        env['IMP_USE_RPATH']=False
        print >> sys.stderr, "WARNING rpath not supported on platform "+ env['PLATFORM']

    if not env['IMP_BUILD_DYNAMIC']:
        env['IMP_PROVIDE_PYTHON']=False
    if not env['IMP_BUILD_DYNAMIC'] and not env['IMP_BUILD_STATIC']:
        print >> sys.stderr, "One of dynamic or static libraries must be supported."
        env.Exit(1)
    if env.get('pythonpath', None):
        env['PYTHONPATH'] = env['pythonpath']
    else:
        env['PYTHONPATH']=''
    if env.get('cxxcompiler', None):
        env['CXX']=env['cxxcompiler']
    if env.get('ar', None):
        env['AR']= env['ar']
    if env.get('ranlib', None):
        env['RANLIB']= env['ranlib']
    if env.get("swigprogram", None):
        env['SWIG']= env["swigprogram"]
    if env.get('cxxflags', None):
        env.Append(CXXFLAGS = env['cxxflags'].split())
    else:
        env.Append(CXXFLAGS=[])

    for t in ['includepath', 'libpath', 'datapath','pythonpath', 'swigpath', 'ldlibpath']:
        r=utility.get_abspaths(env, t, env.get(t, ""))
        env[t]=os.path.pathsep.join(r)

    if env.get('pythoncxxflags', None):
        env.Append(IMP_PYTHON_CXXFLAGS = env['pythoncxxflags'].split())
    elif env.get('cxxflags', None):
        env.Append(IMP_PYTHON_CXXFLAGS = env['cxxflags'].split())
    else:
        env.Append(IMP_PYTHON_CXXFLAGS=[])
    if env.get('bincxxflags', None):
        env.Append(IMP_BIN_CXXFLAGS = env['bincxxflags'].split())
    elif env.get('cxxflags', None):
        env.Append(IMP_BIN_CXXFLAGS = env['cxxflags'].split())
    else:
        env.Append(IMP_BIN_CXXFLAGS=[])

    if env.get('linkflags', None):
        env.Append(IMP_LINKFLAGS=env['linkflags'].split())
    else:
        env.Append(IMP_LINKFLAGS=[])
    if env.get('pythonlinkflags', None):
        env.Append(IMP_PYTHON_LINKFLAGS=env['pythonlinkflags'].split())
    else:
        env.Append(IMP_PYTHON_LINKFLAGS=[])

    if env.get('shliblinkflags', None):
        env.Append(IMP_SHLIB_LINKFLAGS=env['shliblinkflags'].split())
    else:
        env.Append(IMP_SHLIB_LINKFLAGS=[])

    if env.get('arliblinkflags', None):
        env.Append(IMP_ARLIB_LINKFLAGS=env['arliblinkflags'].split())
    else:
        env.Append(IMP_ARLIB_LINKFLAGS=[])


    if env.get('binlinkflags', None):
        env.Append(IMP_BIN_LINKFLAGS=env['binlinkflags'].split())
    else:
        env.Append(IMP_BIN_LINKFLAGS=[])

    if env.get('includepath') is not None:
        env.Prepend(CPPPATH=utility.get_env_paths(env, 'includepath'))
    else:
        env.Append(CPPPATH=[])

    if env.get('libpath') is not None:
        env.Prepend(LIBPATH=utility.get_env_paths(env, 'libpath'))
    else:
        env.Append(LIBPATH=[])
    if env.get('libs') is not None:
        env.Append(LIBS=utility.get_env_paths(env, 'libs'))
    else:
        env.Append(LIBS=[])

    if env.get('ldlibpath') is not None and env.get('ldlibpath') != '':
        env['ENV']['LD_LIBRARY_PATH'] = env['ldlibpath']

    if env.get('environment') is not None:
        for pair in env.get('environment').split(','):
            if pair != "":
                if pair.find("=") != -1:
                    (name, value)= pair.split("=")
                    env['ENV'][name]=value
                else:
                    env['ENV'][pair]=""