Changeset 1852

Show
Ignore:
Timestamp:
06/13/10 07:33:24 (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
  • branches/libffado-2.0/SConstruct

    r1829 r1852  
    22# -*- coding: utf-8 -*- 
    33# 
    4 # Copyright (C) 2007-2008 Arnold Krille 
    5 # Copyright (C) 2007-2008 Pieter Palmers 
     4# Copyright (C) 2007, 2008, 2010 Arnold Krille 
     5# Copyright (C) 2007, 2008 Pieter Palmers 
    66# Copyright (C) 2008 Jonathan Woithe 
    77# 
     
    6262  If you just want to use ffado with jack without the tools, you can disable this.\ 
    6363""", True ), 
    64     BoolOption( "BUILD_STATIC_TOOLS", "Build a statically linked version of the FFADO tools.", False ), 
    65     EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'powerpc64', 'none' ), ignorecase=2), 
    66     BoolOption( "ENABLE_OPTIMIZATIONS", "Enable optimizations and the use of processor specific extentions (MMX/SSE/...).", False ), 
     64        BoolOption( "BUILD_STATIC_TOOLS", "Build a statically linked version of the FFADO tools.", False ), 
     65        EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'powerpc64', 'none' ), ignorecase=2), 
     66        BoolOption( "ENABLE_OPTIMIZATIONS", "Enable optimizations and the use of processor specific extentions (MMX/SSE/...).", False ), 
     67        BoolOption( "PEDANTIC", "Enable -Werror and more pedantic options during compile.", False ), 
     68        ( "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!" ), 
    6769 
    6870        ) 
     
    7072## Load the builders in config 
    7173buildenv=os.environ 
    72 vars_to_check = [ 
    73         'PATH', 
    74         'PKG_CONFIG_PATH', 
    75         'LD_LIBRARY_PATH', 
    76         'XDG_CONFIG_DIRS', 
    77         'XDG_DATA_DIRS', 
    78         'HOME', 
    79         'CC', 
    80         'CFLAGS', 
    81         'CCFLAGS', 
    82         'CXX', 
    83         'CXXFLAGS', 
    84         'CPPFLAGS', 
    85 ] 
    86 for var in vars_to_check: 
    87         if os.environ.has_key(var): 
    88                 buildenv[var]=os.environ[var] 
    89         else: 
    90                 buildenv[var]='' 
    9174 
    9275env = Environment( tools=['default','scanreplace','pyuic','pyuic4','dbus','doxygen','pkgconfig'], toolpath=['admin'], ENV = buildenv, options=opts ) 
    9376 
    94 if os.environ.has_key('LDFLAGS'): 
    95         env.MergeFlags = os.environ['LDFLAGS'] 
    96  
    97 # grab OS CFLAGS / CCFLAGS 
    98 env['OS_CFLAGS']=[] 
    99 if os.environ.has_key('CFLAGS'): 
    100         env['OS_CFLAGS'] = os.environ['CFLAGS'] 
    101         env.MergeFlags( os.environ['CFLAGS'] ) 
    102 env['OS_CCFLAGS']=[] 
    103 if os.environ.has_key('CCFLAGS'): 
    104         env['OS_CCFLAGS'] = os.environ['CCFLAGS'] 
    105         env.MergeFlags( os.environ['CCFLAGS'] ) 
     77if env.has_key('COMPILE_FLAGS') and len(env['COMPILE_FLAGS']) > 0: 
     78        print ''' 
     79 * Usage of additional flags is not supported by the ffado-devs. 
     80 * Use at own risk! 
     81 * 
     82 * Currentl value is '%s' 
     83 ''' % env['COMPILE_FLAGS'] 
     84        env.MergeFlags(env['COMPILE_FLAGS']) 
    10685 
    10786Help( """ 
     
    460439        env.MergeFlags( "-m32" ) 
    461440 
    462 if needs_fPIC or '-fPIC' in env['OS_CFLAGS'] or "-fPIC" in env['OS_CCFLAGS']
     441if needs_fPIC or ( env.has_key('COMPILE_FLAGS') and '-fPIC' in env['COMPILE_FLAGS'] )
    463442    env.MergeFlags( "-fPIC" ) 
    464443