Debugging: Add code to print backtrace for guest on SIGSEGV
[nativeclient.git] / nonnacl_util / build.scons
blobbc5f9cedf62074a97a7ec77fae09d3d6931c83b2
1 # Copyright 2008, Google Inc.
2 # All rights reserved.
3
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7
8 #     * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 #     * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 #     * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
17
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 import os
32 import platform
33 import sys
34 Import('env')
36 if env.Bit('linux'):
37     env.Append(
38         CCFLAGS=[
39             '-mno-align-double',
40             '-fPIC',
41         ],
42         CPPDEFINES = [
43             'XP_UNIX',
44         ],
45     )
46     # Setup gtk hermetically.
47     env['GTK_DIR'] = '$SOURCE_ROOT/googleclient/third_party/gtk'
48     # 32-bit builds on 64-bit machines require symlinks to the local version
49     # in /usr/lib32 for the following libraries related to gtk:
50     #   libatk-1.0.so
51     #   libgtk-x11-2.0.so
52     #   libgdk-x11-2.0.so
53     #   libgdk_pixbuf-2.0.so
54     #   libpangocairo-1.0.so
55     #   libpango-1.0.so
56     #   libcairo-1.0.so
57     #   libgobject-2.0.so
58     #   libgmodule-2.0.so
59     #   libglib-2.0.so
60     #   libX11.so
62     # Optionally use pkg-config to get gtk.
63     # On 64-bit assume we want to use pkgconfig.
64     if (int(os.environ.get('GTK_FROM_PKGCONFIG', '1')) or
65         platform.architecture()[0]=='64bit'):
66       # Use pkg-config to use a local copy of gtk.
67       try:
68         env.ParseConfig('pkg-config gtk+-2.0 --cflags --libs')
69       except OSError:
70         print 'libgtk2.0-dev is required.'
71         print 'Please run: sudo apt-get install libgtk2.0-dev'
72         sys.exit(1)
74     else:
75       # Set things up based on the layout of the bundled gtk.
76       env.Append(
77           LIBPATH = '$GTK_DIR/linux/lib',
78           LIBS = 'gtk-x11-2.0',
79           CPPPATH = [
80              '$GTK_DIR/include/gtk-2.0',
81              '$GTK_DIR/include/glib-2.0',
82              '$GTK_DIR/include/cairo',
83              '$GTK_DIR/include/pango-1.0',
84              '$GTK_DIR/include/atk-1.0',
85              '$GTK_DIR/lib/glib-2.0/include',
86              '$GTK_DIR/lib/gtk-2.0/include',
87           ],
88       )
91 if env.Bit('mac'):
92     env.Append(
93         CCFLAGS=[
94             '-mno-align-double',
95         ],
96         CPPDEFINES = [
97             'XP_MACOSX',
98             'XP_UNIX',
99             ['TARGET_API_MAC_CARBON', '1'],
100             'NO_X11',
101             'USE_SYSTEM_CONSOLE',
102         ],
103     )
106 if env.Bit('windows'):
107     env.Append(
108         CCFLAGS = [
109             '/EHsc',
110         ],
111         CPPDEFINES = [
112             'XP_WIN', 'WIN32', '_WINDOWS'
113         ],
114     )
115     env.Tool('atlmfc_vc80')
118 nonnacl_util_inputs = [
119   'sel_ldr_launcher.cc',
122 if env.Bit('windows'):
123   nonnacl_util_inputs += [
124       'win/sel_ldr_launcher_win.cc',
125   ]
126 elif env.Bit('linux'):
127   nonnacl_util_inputs += [
128       'linux/sel_ldr_launcher_linux.cc',
129       'linux/get_plugin_dirname.cc',
130   ]
131   sel_mon_inputs = [
132       'linux/sel_mon.cc',
133   ]
134 else:
135   nonnacl_util_inputs += [
136       'linux/sel_ldr_launcher_linux.cc',
137       'osx/get_plugin_dirname.mm',
138   ]
140 nonnacl_util_inputs = env.ComponentObject(nonnacl_util_inputs)
142 nonnacl_util_c_inputs = nonnacl_util_inputs + [ 'sel_ldr_launcher_c.cc' ]
144 env.ComponentLibrary('nonnacl_util', nonnacl_util_inputs)
145 env.ComponentLibrary('nonnacl_util_c', nonnacl_util_c_inputs)
147 if env.Bit('linux'):
148   env.ComponentProgram('sel_mon', sel_mon_inputs)