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

Side by Side Diff: native_client_sdk/src/build_tools/build_projects.py

Issue 240493003: Support static/dynamic for bionic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enable bionic static/dynamic and nacl_io test Created 6 years, 7 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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import multiprocessing 6 import multiprocessing
7 import optparse 7 import optparse
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import sys 10 import sys
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 with open(make_exe, 'wb') as f: 87 with open(make_exe, 'wb') as f:
88 f.write(urllib2.urlopen(make_url).read()) 88 f.write(urllib2.urlopen(make_url).read())
89 89
90 90
91 def ValidateToolchains(toolchains): 91 def ValidateToolchains(toolchains):
92 invalid_toolchains = set(toolchains) - set(VALID_TOOLCHAINS) 92 invalid_toolchains = set(toolchains) - set(VALID_TOOLCHAINS)
93 if invalid_toolchains: 93 if invalid_toolchains:
94 buildbot_common.ErrorExit('Invalid toolchain(s): %s' % ( 94 buildbot_common.ErrorExit('Invalid toolchain(s): %s' % (
95 ', '.join(invalid_toolchains))) 95 ', '.join(invalid_toolchains)))
96 96
97 def GetDeps(projects):
98 out = []
99 for proj in projects:
100 deplist = []
101 for targ in proj.get('TARGETS', []):
102 deplist.extend(targ.get('DEPS', []) + targ.get('LIBS', []))
103 localdeps = []
104 for dep in deplist:
105 localdeps.append(dep + '_ALL_TARGET')
106 if localdeps:
107 out.append('%s_DEPS:=%s' % (proj['NAME'], ' '.join(localdeps)))
binji 2014/04/28 21:01:22 I'd prefer appending a dict or tuple here and doin
noelallen1 2014/04/28 23:00:33 Done.
108 return out
109
97 110
98 def UpdateProjects(pepperdir, project_tree, toolchains, 111 def UpdateProjects(pepperdir, project_tree, toolchains,
99 clobber=False, configs=None, first_toolchain=False): 112 clobber=False, configs=None, first_toolchain=False):
100 if configs is None: 113 if configs is None:
101 configs = ['Debug', 'Release'] 114 configs = ['Debug', 'Release']
102 if not os.path.exists(os.path.join(pepperdir, 'tools')): 115 if not os.path.exists(os.path.join(pepperdir, 'tools')):
103 buildbot_common.ErrorExit('Examples depend on missing tools.') 116 buildbot_common.ErrorExit('Examples depend on missing tools.')
104 if not os.path.exists(os.path.join(pepperdir, 'toolchain')): 117 if not os.path.exists(os.path.join(pepperdir, 'toolchain')):
105 buildbot_common.ErrorExit('Examples depend on missing toolchains.') 118 buildbot_common.ErrorExit('Examples depend on missing toolchains.')
106 119
107 ValidateToolchains(toolchains) 120 ValidateToolchains(toolchains)
108 121
109 # Create the library output directories 122 # Create the library output directories
110 libdir = os.path.join(pepperdir, 'lib') 123 libdir = os.path.join(pepperdir, 'lib')
111 platform = getos.GetPlatform() 124 platform = getos.GetPlatform()
112 for config in configs: 125 for config in configs:
113 for arch in LIB_DICT[platform]: 126 for arch in LIB_DICT[platform]:
114 dirpath = os.path.join(libdir, '%s_%s_host' % (platform, arch), config) 127 dirpath = os.path.join(libdir, '%s_%s_host' % (platform, arch), config)
115 if clobber: 128 if clobber:
116 buildbot_common.RemoveDir(dirpath) 129 buildbot_common.RemoveDir(dirpath)
117 buildbot_common.MakeDir(dirpath) 130 buildbot_common.MakeDir(dirpath)
118 131
119 landing_page = None 132 landing_page = None
120 for branch, projects in project_tree.iteritems(): 133 for branch, projects in project_tree.iteritems():
121 dirpath = os.path.join(pepperdir, branch) 134 dirpath = os.path.join(pepperdir, branch)
122 if clobber: 135 if clobber:
123 buildbot_common.RemoveDir(dirpath) 136 buildbot_common.RemoveDir(dirpath)
124 buildbot_common.MakeDir(dirpath) 137 buildbot_common.MakeDir(dirpath)
125 targets = [desc['NAME'] for desc in projects] 138 targets = [desc['NAME'] for desc in projects]
139 deps = GetDeps(projects)
126 140
127 # Generate master make for this branch of projects 141 # Generate master make for this branch of projects
128 generate_make.GenerateMasterMakefile(pepperdir, 142 generate_make.GenerateMasterMakefile(pepperdir,
129 os.path.join(pepperdir, branch), 143 os.path.join(pepperdir, branch),
130 targets) 144 targets, deps)
131 145
132 if branch.startswith('examples') and not landing_page: 146 if branch.startswith('examples') and not landing_page:
133 landing_page = LandingPage() 147 landing_page = LandingPage()
134 148
135 # Generate individual projects 149 # Generate individual projects
136 for desc in projects: 150 for desc in projects:
137 srcroot = os.path.dirname(desc['FILEPATH']) 151 srcroot = os.path.dirname(desc['FILEPATH'])
138 generate_make.ProcessProject(pepperdir, srcroot, pepperdir, desc, 152 generate_make.ProcessProject(pepperdir, srcroot, pepperdir, desc,
139 toolchains, configs=configs, 153 toolchains, configs=configs,
140 first_toolchain=first_toolchain) 154 first_toolchain=first_toolchain)
141 155
142 if branch.startswith('examples'): 156 if branch.startswith('examples'):
143 landing_page.AddDesc(desc) 157 landing_page.AddDesc(desc)
144 158
145 if landing_page: 159 if landing_page:
146 # Generate the landing page text file. 160 # Generate the landing page text file.
147 index_html = os.path.join(pepperdir, 'examples', 'index.html') 161 index_html = os.path.join(pepperdir, 'examples', 'index.html')
148 index_template = os.path.join(SDK_RESOURCE_DIR, 'index.html.template') 162 index_template = os.path.join(SDK_RESOURCE_DIR, 'index.html.template')
149 with open(index_html, 'w') as fh: 163 with open(index_html, 'w') as fh:
150 out = landing_page.GeneratePage(index_template) 164 out = landing_page.GeneratePage(index_template)
151 fh.write(out) 165 fh.write(out)
152 166
153 # Generate top Make for examples 167 # Generate top Make for examples
154 targets = ['api', 'demo', 'getting_started', 'tutorial'] 168 targets = ['api', 'demo', 'getting_started', 'tutorial']
155 targets = [x for x in targets if 'examples/'+x in project_tree] 169 targets = [x for x in targets if 'examples/'+x in project_tree]
156 branch_name = 'examples' 170 branch_name = 'examples'
157 generate_make.GenerateMasterMakefile(pepperdir, 171 generate_make.GenerateMasterMakefile(pepperdir,
158 os.path.join(pepperdir, branch_name), 172 os.path.join(pepperdir, branch_name),
159 targets) 173 targets, [])
160 174
161 175
162 def BuildProjectsBranch(pepperdir, branch, deps, clean, config, args=None): 176 def BuildProjectsBranch(pepperdir, branch, deps, clean, config, args=None):
163 make_dir = os.path.join(pepperdir, branch) 177 make_dir = os.path.join(pepperdir, branch)
164 print "\nMake: " + make_dir 178 print "\nMake: " + make_dir
165 179
166 if getos.GetPlatform() == 'win': 180 if getos.GetPlatform() == 'win':
167 # We need to modify the environment to build host on Windows. 181 # We need to modify the environment to build host on Windows.
168 make = os.path.join(make_dir, 'make.bat') 182 make = os.path.join(make_dir, 'make.bat')
169 else: 183 else:
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 328
315 329
316 if __name__ == '__main__': 330 if __name__ == '__main__':
317 script_name = os.path.basename(sys.argv[0]) 331 script_name = os.path.basename(sys.argv[0])
318 try: 332 try:
319 sys.exit(main(sys.argv)) 333 sys.exit(main(sys.argv))
320 except parse_dsc.ValidationError as e: 334 except parse_dsc.ValidationError as e:
321 buildbot_common.ErrorExit('%s: %s' % (script_name, e)) 335 buildbot_common.ErrorExit('%s: %s' % (script_name, e))
322 except KeyboardInterrupt: 336 except KeyboardInterrupt:
323 buildbot_common.ErrorExit('%s: interrupted' % script_name) 337 buildbot_common.ErrorExit('%s: interrupted' % script_name)
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/build_tools/build_sdk.py » ('j') | native_client_sdk/src/build_tools/build_sdk.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698