Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/build.scons

Issue 11079003: Clean up NaCl's SCons build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # -*- python -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # TODO(polina): for Mac build check if no longer need .r files and/or document
7 # target browsers for each bundle target.
8
9 Import('env')
10
11 if not env.Bit('mac'):
12 env['COMPONENT_STATIC'] = False
13
14
15 plugin_env = env.Clone()
16 if env.Bit('linux'):
17 plugin_env.Append(
18 CCFLAGS=['-fPIC', '-Wno-long-long',],
19 CPPDEFINES = ['XP_UNIX', 'MOZ_X11'],
20 )
21 if not env.Bit('asan'):
22 plugin_env.Append(
23 # Catch unresolved symbols in libraries.
24 LINKFLAGS=['-Wl,-z,defs'],
25 )
26
27 # We usually try to build things statically, but the plugin is a .so
28 plugin_env.FilterOut(LINKFLAGS=['-static'])
29
30 if env.Bit('mac'):
31 plugin_env.Append(
32 CCFLAGS=['-Wno-long-long',
33 # warning: Basically all of our 2d Mac stuff is deprecated.
34 '-Wno-deprecated',
35 '-Wno-deprecated-declarations'],
36 CPPDEFINES = [
37 'XP_MACOSX',
38 'XP_UNIX',
39 ['TARGET_API_MAC_CARBON', '1'],
40 # TODO(robertm): NO_X11 may be obsolete
41 'NO_X11',
42 'USE_SYSTEM_CONSOLE',
43 ],
44 FRAMEWORKS = ['Carbon'],
45 # TODO(jrg): it's a little awkward to, when you want a bundle:
46 # 1) add -bundle to your LINKFLAGS
47 # 2) create a "program" (which shows up in all_programs target)
48 # 3) create a bundle out of it, specifying the bundle extension
49 # Ideally that all happens inside a CompleteBundlePseudoBuilder().
50 LINKFLAGS = ['-bundle', '-framework', 'Foundation']
51 )
52
53 if env.Bit('windows'):
54 plugin_env.Append(
55 CPPDEFINES = ['XP_WIN', 'WIN32', '_WINDOWS'],
56 )
57
58 common_inputs = [
59 'file_downloader.cc',
60 'json_manifest.cc',
61 'local_temp_file.cc',
62 'module_ppapi.cc',
63 'nacl_subprocess.cc',
64 'nexe_arch.cc',
65 'plugin.cc',
66 'pnacl_coordinator.cc',
67 'pnacl_resources.cc',
68 'pnacl_translate_thread.cc',
69 'scriptable_plugin.cc',
70 'sel_ldr_launcher_chrome.cc',
71 'service_runtime.cc',
72 'srpc_client.cc',
73 'srpc_params.cc',
74 'temporary_file.cc',
75 'utility.cc',
76 ]
77
78 if env.Bit('target_x86'):
79 common_inputs += ['arch_x86/sandbox_isa.cc']
80 elif env.Bit('target_arm'):
81 common_inputs += ['arch_arm/sandbox_isa.cc']
82 else:
83 # Unrecognized architecture - this is a build failure.
84 print "Unrecognized architecture: %s" % env['TARGET_ARCHITECTURE']
85 Return()
86
87 # The libraries used by both the PPAPI plugin. They and the PPAPI specific
88 # libraries must come before OS libraries, because they may generate references
89 # that are resolved by the OS libraries. E.g., libimc.a contains
90 # references to symbols from librt.so.
91 common_libs = [
92 'nonnacl_util',
93 'nonnacl_srpc',
94 'gio_wrapped_desc',
95 'nrd_xfer',
96 'nacl_perf_counter',
97 'nacl_base',
98 'imc',
99 'weak_ref',
100 'platform',
101 'platform_qual_lib',
102 'reverse_service',
103 'gio',
104 'jsoncpp',
105 'sel',
106 'simple_service',
107 'thread_interface',
108 'env_cleanser',
109 'nacl_error_code',
110 ]
111
112 os_libs = [ ]
113 if plugin_env.Bit('linux'):
114 os_libs += ['dl', 'rt']
115
116 if plugin_env.Bit('windows'):
117 os_libs += ['gdi32', 'user32', ]
118
119
120 ###############################################################################
121 # PPAPI Plugin Build
122 ###############################################################################
123
124 # We build a shared library with this build script to allow easier build
125 # testing. This library can also be loaded into Chrome using --no-sandbox
126 # --register-pepper-plugins="path/to/library;application/x-nacl".
127 #
128 # The .gyp files include rules used to link the plugin statically into Chrome.
129 # (This is still work in progress as of mid-Nov 2010.)
130 #
131
132 ppNaClPlugin = 'ppNaClPlugin'
133
134 ppapi_libs = common_libs + [ 'ppapi_cpp', 'ppapi_browser', 'nonnacl_srpc' ]
135 if plugin_env['SHARED_LIBS_SPECIAL']:
136 plugin_env.Append(LIBS=[l + '_shared' for l in ppapi_libs] + os_libs)
137 else:
138 plugin_env.Append(LIBS=ppapi_libs + os_libs)
139
140 if not env.Bit('mac'): # linux, windows, arm
141 # This builds with
142 # MODE=... ppNaClPlugin sel_ldr
143 # with the output going to
144 # scons-out/.../staging/libppNaClPlugin.so on Linux and
145 # scons-out/.../staging/ppNaClPlugin.dll on Windows.
146 ppapi_plugin = plugin_env.ComponentLibrary(ppNaClPlugin,
147 common_inputs,
148 no_import_lib=True)
149 else: # mac
150 # This builds with
151 # MODE=... scons-out/.../staging/ppNaClPlugin.bundle sel_ldr
152 # This places both ppNaClPlugin.bundle/ and sel_ldr into staging/.
153 # One must either set $NACL_SEL_LDR=path/to/sel_ldr or manually
154 # copy sel_ldr to path/to/ppNaClPlugin.bundle/Contents/Resources/.
155 # (the 2nd option has been disabled:
156 # see ../nonnacl_util/osx/get_plugin_dirname.mm).
157 REZ = '/Developer/Tools/Rez'
158 plugin_env.Command(target='ppNaClPlugin.rsrc',
159 source='osx_ppapi/ppNaClPlugin.r',
160 action=[Action(REZ + ' -o ${TARGET} ${SOURCE} -useDF')])
161 ppapi_plugin = plugin_env.ComponentProgram(ppNaClPlugin,
162 common_inputs,
163 no_import_lib=True)
164 # Bundle pattern can be found in
165 # site_scons/site_tools/target_platform_mac.py
166 bundle_name = '${STAGING_DIR}/' + ppNaClPlugin + '.bundle'
167 plugin_env.Bundle(bundle_name,
168 BUNDLE_EXE = ppapi_plugin,
169 BUNDLE_PKGINFO_FILENAME = 0,
170 BUNDLE_RESOURCES = 'ppNaClPlugin.rsrc',
171 BUNDLE_INFO_PLIST = 'osx_ppapi/Info.plist')
172
173 plugin_env.Alias('plugin', plugin_env.GetPPAPIPluginPath(False))
174
175
176 ###############################################################################
177 # PPAPI Plugin Test
178 ###############################################################################
179
180 # Rather than link ppNaClPlugin statically, this unittest uses the dynamic
181 # library. Note that these tests do not yet run on ARM.
182 unittest_sources = ['dylib_unittest.cc', 'plugin_unittest.cc']
183 if env.Bit('target_x86'):
184 if env.Bit('linux'):
185 unittest = env.ComponentProgram('ppapi_plugin_unittest',
186 unittest_sources,
187 no_import_lib=True,
188 EXTRA_LIBS=['dl'])
189 elif env.Bit('mac'):
190 unittest = env.ComponentProgram('ppapi_plugin_unittest', unittest_sources)
191 elif env.Bit('windows'):
192 unittest = env.ComponentProgram('ppapi_plugin_unittest',
193 unittest_sources,
194 no_import_lib=True)
195 node = env.CommandTest('ppapi_plugin_unittest.out',
196 command=[unittest,
197 ppapi_plugin,
198 env['BUILD_ISA_NAME']])
199 env.AddNodeToTestSuite(node, ['small_tests'], 'run_ppapi_plugin_unittest')
200
201
202 # TODO(polina,sehr): add a test for the PPAPI plugin on ARM.
OLDNEW
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/nacl.scons ('k') | ppapi/native_client/tests/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698