sel_ldr: Remove support for rodata segment at start of executable
[nativeclient.git] / npapi_plugin / build.scons
blob93eeda6c424b6e91f2c5593379c5cc744a7f71d2
1 # -*- python -*-
2 # Copyright 2008, Google Inc.
3 # All rights reserved.
4
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8
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
14 # distribution.
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.
18
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.
32 Import('env')
34 # TODO: there is an  unreferenced file ldt_unittest.cc in this directory
37 # NOTE: currently needed for env.ComponentObject magic below
38 env.Prepend(
39     CPPPATH=['$SOURCE_ROOT/googleclient/third_party/npapi/files/include']
42 # NOTE: needed for a bunch of includes from X11/Intrinsic.h
43 env.Prepend(
44     CPPPATH=['$SOURCE_ROOT/googleclient/third_party/libxt/include']
47 env.Append(
48     LIBS = [
49         'nonnacl_util',
50         'nonnacl_srpc',
51         'nrd_xfer',
52         'naclthread',
53         'gio',
54         'google_nacl_npruntime',
55         'google_nacl_imc_c',
56     ],
59 if not env.Bit('mac'):
60   env['COMPONENT_STATIC'] = False
63 if env.Bit('linux'):
64     # because of: nacl_av_priv.h:55: error: ISO C++ prohibits anonymous structs
65     # TODO: fix this
66     env.FilterOut(CCFLAGS=['-pedantic'])
68     env.Append(
69         CCFLAGS=[
70             '-mno-align-double',
71             '-fPIC',
72         ],
73         CPPDEFINES = [
74             'XP_UNIX', 'MOZ_X11',
75         ],
76         LIBS = [
77             'Xt',
78             'X11',
79         ],
80     )
83 if env.Bit('mac'):
84     env.Append(
85         CCFLAGS=[
86             '-mno-align-double',
87             '-Wno-error',
88         ],
89         CPPDEFINES = [
90             'XP_MACOSX',
91             'XP_UNIX',
92             ['TARGET_API_MAC_CARBON', '1'],
93             'NO_X11',
94             'USE_SYSTEM_CONSOLE',
95         ],
96         FRAMEWORKS = [
97             'Carbon',
98         ],
99         # TODO: it's a little awkward to, when you want a bundle:
100         #  1) add -bundle to your LINKFLAGS
101         #  2) create a "program" (which shows up in all_programs target)
102         #  3) create a bundle out of it, specifying the bundle extension
103         # Ideally that all happens inside a CompleteBundlePseudoBuilder().
104         LINKFLAGS = [
105             '-bundle', '-framework', 'Foundation'
106         ]
107     )
110 if env.Bit('windows'):
111     env.Append(
112         CCFLAGS = [
113             '/EHsc',
114         ],
115         CPPDEFINES = [
116             'XP_WIN', 'WIN32', '_WINDOWS'
117         ],
118         LIBS = [
119             'gdi32',
120             'user32',
121         ],
122     )
123     env.Tool('atlmfc_vc80')
126 nacl_npplugin_inputs = [
127     # TODO: we should put a scons file in third_party/npapi_plugin
128     #                which exports a library which is then linked in.
129     #                I tried this but got link time symbol clashes
130     # common files
131     env.ComponentObject('np_entry',
132                         '$MAIN_DIR/third_party/npapi_plugin/np_entry.cc'),
133     env.ComponentObject('npn_gate',
134                         '$MAIN_DIR/third_party/npapi_plugin/npn_gate.cc'),
135     'npp_gate.cc',
136     'npp_launcher.cc',
137     # NPAPI remote support
138     'npapi_bridge/npmodule.cc',
139     # SRPC support
140     'srpc/srpc.cc',
141     'srpc/npapi_native.cc',
142     'srpc/plugin.cc',
143     'srpc/ret_array.cc',
144     'srpc/connected_socket.cc',
145     'srpc/multimedia_socket.cc',
146     'srpc/shared_memory.cc',
147     'srpc/socket_address.cc',
148     'srpc/srpc_client.cc',
149     'srpc/service_runtime_interface.cc',
150     'srpc/srt_socket.cc',
151     'srpc/unknown_handle.cc',
152     'srpc/video.cc',
153     # generic URL-origin / same-domain handling
154     'origin.cc',
157 if env['TARGET_PLATFORM'] == 'WINDOWS':
158   nacl_npplugin_inputs += [
159       'npapi_bridge/win/npmodule_win.cc',
160       'nacl_plugin.def',
161       env.RES('nacl_plugin.rc'),
162   ]
163 else:
164   nacl_npplugin_inputs += [
165       'npapi_bridge/linux/npmodule_linux.cc'
166   ]
168 if env['TARGET_PLATFORM'] == 'MAC':
169   nacl_npplugin_inputs += [
170       'npapi_bridge/osx/npmodule_osx.cc'
171   ]
174 npGoogleNaClPlugin = 'npGoogleNaClPlugin'
176 if not env.Bit('mac'):
177   exe = env.ComponentLibrary(npGoogleNaClPlugin, nacl_npplugin_inputs,
178                              no_import_lib = True)
179 else:
180   REZ = '/Developer/Tools/Rez'
181   env.Command(target='npGoogleNaClPlugin.rsrc',
182               source='npGoogleNaClPlugin.r',
183               action=[Action(REZ + ' -o $TARGET $SOURCE -useDF')])
184   exe = env.ComponentProgram(npGoogleNaClPlugin, nacl_npplugin_inputs,
185                              no_import_lib = True)
186   # Bundle pattern can be found in
187   # //depot/googleclient/tools/hammer/site_scons/site_tools/target_platform_mac.py
188   env.Bundle('$STAGING_DIR/' + npGoogleNaClPlugin + '.bundle',
189              BUNDLE_EXE = exe[0],
190              BUNDLE_PKGINFO_FILENAME = 0,
191              BUNDLE_RESOURCES = 'npGoogleNaClPlugin.rsrc')