2 # Copyright 2008, Google Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 """Build tool setup for Linux.
33 This module is a SCons tool which should be include in the topmost windows
35 It is used as follows:
36 env = base_env.Clone(tools = ['component_setup'])
37 linux_env = base_env.Clone(tools = ['target_platform_linux'])
41 def ComponentPlatformSetup(env
, builder_name
):
42 """Hook to allow platform to modify environment inside a component builder.
45 env: Environment to modify
46 builder_name: Name of the builder
48 if env
.get('ENABLE_EXCEPTIONS'):
49 env
.FilterOut(CCFLAGS
=['-fno-exceptions'])
50 env
.Append(CCFLAGS
=['-fexceptions'])
52 #------------------------------------------------------------------------------
56 # NOTE: SCons requires the use of this name, which fails gpylint.
57 """SCons entry point for this tool."""
66 # Set target platform bits
67 env
.SetBits('linux', 'posix')
70 TARGET_PLATFORM
='LINUX',
71 COMPONENT_PLATFORM_SETUP
=ComponentPlatformSetup
,
72 CCFLAG_INCLUDE
='-include', # Command line option to include a header
74 # Code coverage related.
75 COVERAGE_CCFLAGS
=['-ftest-coverage', '-fprofile-arcs'],
78 '$COVERAGE_MCOV --directory "$TARGET_ROOT" --output "$TARGET"',
79 ('$COVERAGE_GENHTML --output-directory $COVERAGE_HTML_DIR '
80 '$COVERAGE_OUTPUT_FILE'),
85 HOST_PLATFORMS
=['LINUX'],
86 CPPDEFINES
=['OS_LINUX=OS_LINUX'],
90 '-O0', # turn off optimizations
91 '-g', # turn on debugging info
94 # Settings for optimized
95 CCFLAGS_OPTIMIZED
=['-O2'],
97 # Settings for component_builders
98 COMPONENT_LIBRARY_LINK_SUFFIXES
=['.so', '.a'],
99 COMPONENT_LIBRARY_DEBUG_SUFFIXES
=[],