Changeset 1853

Show
Ignore:
Timestamp:
06/13/10 07:34:09 (2 years ago)
Author:
arnonym
Message:

Make it easier for distributions to define their own additional built-flags. (Importing all the various shell-variables is a pain in the a** with scons as the gcc-tools of scons overwrite half of them.)

See #278

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/SConstruct

    r1830 r1853  
    11#! /usr/bin/python 
     2# -*- coding: utf-8 -*- 
    23# 
    34# Copyright (C) 2007, 2008, 2010 Arnold Krille 
     
    7475    BoolOption( "ENABLE_OPTIMIZATIONS", "Enable optimizations and the use of processor specific extentions (MMX/SSE/...).", False ), 
    7576    BoolOption( "PEDANTIC", "Enable -Werror and more pedantic options during compile.", False ), 
     77    ( "COMPILE_FLAGS", "Add additional flags to the environment.\nOnly meant for distributors and gentoo-users who want to over-optimize their built.\n Using this is not supported by the ffado-devs!" ), 
    7678 
    7779    ) 
     
    7981## Load the builders in config 
    8082buildenv=os.environ 
    81 vars_to_check = [ 
    82     'PATH', 
    83     'PKG_CONFIG_PATH', 
    84     'LD_LIBRARY_PATH', 
    85     'XDG_CONFIG_DIRS', 
    86     'XDG_DATA_DIRS', 
    87     'HOME', 
    88     'CC', 
    89     'CFLAGS', 
    90     'CXX', 
    91     'CXXFLAGS', 
    92     'CPPFLAGS', 
    93 ] 
    94 for var in vars_to_check: 
    95     if os.environ.has_key(var): 
    96         buildenv[var]=os.environ[var] 
    97     else: 
    98         buildenv[var]='' 
    9983 
    10084env = Environment( tools=['default','scanreplace','pyuic','pyuic4','dbus','doxygen','pkgconfig'], toolpath=['admin'], ENV = buildenv, options=opts ) 
    10185 
    102 if os.environ.has_key('LDFLAGS'): 
    103     env['LINKFLAGS'] = os.environ['LDFLAGS'] 
    104  
    105 # grab OS CFLAGS / CCFLAGS 
    106 env['OS_CFLAGS']=[] 
    107 if os.environ.has_key('CFLAGS'): 
    108     env['OS_CFLAGS'] = os.environ['CFLAGS'] 
    109 env['OS_CCFLAGS']=[] 
    110 if os.environ.has_key('CCFLAGS'): 
    111     env['OS_CCFLAGS'] = os.environ['CCFLAGS'] 
     86if env.has_key('COMPILE_FLAGS') and len(env['COMPILE_FLAGS']) > 0: 
     87    print ''' 
     88 * Usage of additional flags is not supported by the ffado-devs. 
     89 * Use at own risk! 
     90 * 
     91 * Currentl value is '%s' 
     92 ''' % env['COMPILE_FLAGS'] 
     93    env.MergeFlags(env['COMPILE_FLAGS']) 
    11294 
    11395Help( """ 
     
    505487        env.MergeFlags( "-m32" ) 
    506488 
    507 if needs_fPIC or '-fPIC' in env['OS_CFLAGS'] or "-fPIC" in env['OS_CCFLAGS']
     489if needs_fPIC or ( env.has_key('COMPILE_FLAGS') and '-fPIC' in env['COMPILE_FLAGS'] )
    508490    env.MergeFlags( "-fPIC" ) 
    509491