Ticket #278: SConstruct.compile_flags-2.0branch.patch

File SConstruct.compile_flags-2.0branch.patch, 3.3 kB (added by arnonym, 2 years ago)

Fullfill distributors dreams of custom flags?

  • SConstruct

    old new  
    11#! /usr/bin/python 
    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# 
    88# This file is part of FFADO 
     
    6161  this is on by default. 
    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        ) 
    6971 
    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'] 
     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']) 
    9685 
    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'] ) 
    106  
    10786Help( """ 
    10887For building ffado you can set different options as listed below. You have to 
    10988specify them only once, scons will save the last value you used and re-use 
     
    459438        print "Doing a 32-bit build" 
    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 
    465444# end of processor-specific section