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

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

Issue 23576014: NaCl: Update revision in DEPS, r12098 -> r12120 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « DEPS ('k') | native_client_sdk/src/build_tools/nacl-mono-runtime.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Entry point for both build and try bots. 6 """Entry point for both build and try bots.
7 7
8 This script is invoked from XXX, usually without arguments 8 This script is invoked from XXX, usually without arguments
9 to package an SDK. It automatically determines whether 9 to package an SDK. It automatically determines whether
10 this SDK is for mac, win, linux. 10 this SDK is for mac, win, linux.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') 54 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py')
55 55
56 NACLPORTS_URL = 'https://naclports.googlecode.com/svn/trunk/src' 56 NACLPORTS_URL = 'https://naclports.googlecode.com/svn/trunk/src'
57 NACLPORTS_REV = 850 57 NACLPORTS_REV = 850
58 58
59 GYPBUILD_DIR = 'gypbuild' 59 GYPBUILD_DIR = 'gypbuild'
60 60
61 options = None 61 options = None
62 62
63 63
64 def GetGlibcToolchain(host_arch): 64 def GetGlibcToolchain():
65 tcdir = os.path.join(NACL_DIR, 'toolchain', '.tars') 65 tcdir = os.path.join(NACL_DIR, 'toolchain', '.tars')
66 tcname = 'toolchain_%s_%s.tar.bz2' % (getos.GetPlatform(), host_arch) 66 tcname = 'toolchain_%s_x86.tar.bz2' % getos.GetPlatform()
67 return os.path.join(tcdir, tcname) 67 return os.path.join(tcdir, tcname)
68 68
69 69
70 def GetNewlibToolchain(host_arch): 70 def GetNewlibToolchain():
71 tcdir = os.path.join(NACL_DIR, 'toolchain', '.tars') 71 tcdir = os.path.join(NACL_DIR, 'toolchain', '.tars')
72 tcname = 'naclsdk_%s_%s.tgz' % (getos.GetPlatform(), host_arch) 72 tcname = 'naclsdk_%s_x86.tgz' % getos.GetPlatform()
73 return os.path.join(tcdir, tcname) 73 return os.path.join(tcdir, tcname)
74 74
75 75
76 def GetPNaClToolchain(host_arch): 76 def GetPNaClToolchain():
77 tcdir = os.path.join(NACL_DIR, 'toolchain', '.tars') 77 tcdir = os.path.join(NACL_DIR, 'toolchain', '.tars')
78 tcname = 'naclsdk_pnacl_%s_%s.tgz' % (getos.GetPlatform(), host_arch) 78 tcname = 'naclsdk_pnacl_%s_x86.tgz' % getos.GetPlatform()
79 return os.path.join(tcdir, tcname) 79 return os.path.join(tcdir, tcname)
80 80
81 81
82 def GetToolchainNaClInclude(tcname, tcpath, arch): 82 def GetToolchainNaClInclude(tcname, tcpath, arch):
83 if arch == 'x86': 83 if arch == 'x86':
84 if tcname == 'pnacl': 84 if tcname == 'pnacl':
85 return os.path.join(tcpath, 'newlib', 'sdk', 'include') 85 return os.path.join(tcpath, 'newlib', 'sdk', 'include')
86 return os.path.join(tcpath, 'x86_64-nacl', 'include') 86 return os.path.join(tcpath, 'x86_64-nacl', 'include')
87 elif arch == 'arm': 87 elif arch == 'arm':
88 return os.path.join(tcpath, 'arm-nacl', 'include') 88 return os.path.join(tcpath, 'arm-nacl', 'include')
(...skipping 13 matching lines...) Expand all
102 if tcname == 'pnacl': 102 if tcname == 'pnacl':
103 tcname = 'pnacl_newlib' 103 tcname = 'pnacl_newlib'
104 if not xarch: 104 if not xarch:
105 xarch = '' 105 xarch = ''
106 return os.path.join(GetGypGenDir(xarch), 'tc_' + tcname, 'lib' + xarch) 106 return os.path.join(GetGypGenDir(xarch), 'tc_' + tcname, 'lib' + xarch)
107 107
108 108
109 def GetToolchainNaClLib(tcname, tcpath, xarch): 109 def GetToolchainNaClLib(tcname, tcpath, xarch):
110 if tcname == 'pnacl': 110 if tcname == 'pnacl':
111 return os.path.join(tcpath, 'newlib', 'sdk', 'lib') 111 return os.path.join(tcpath, 'newlib', 'sdk', 'lib')
112 if xarch == '32': 112 elif xarch == '32':
113 return os.path.join(tcpath, 'x86_64-nacl', 'lib32') 113 return os.path.join(tcpath, 'x86_64-nacl', 'lib32')
114 if xarch == '64': 114 elif xarch == '64':
115 return os.path.join(tcpath, 'x86_64-nacl', 'lib') 115 return os.path.join(tcpath, 'x86_64-nacl', 'lib')
116 if xarch == 'arm': 116 elif xarch == 'arm':
117 return os.path.join(tcpath, 'arm-nacl', 'lib') 117 return os.path.join(tcpath, 'arm-nacl', 'lib')
118 118
119 119
120 def GetToolchainDirName(tcname, xarch): 120 def GetToolchainDirName(tcname, xarch):
121 if xarch != 'arm': 121 if tcname == 'pnacl':
122 xarch = 'x86' 122 return '%s_%s' % (getos.GetPlatform(), tcname)
123 return '%s_%s_%s' % (getos.GetPlatform(), xarch, tcname) 123 elif xarch == 'arm':
124 return '%s_arm_%s' % (getos.GetPlatform(), tcname)
125 else:
126 return '%s_x86_%s' % (getos.GetPlatform(), tcname)
124 127
125 128
126 def GetGypToolchainLib(tcname, xarch): 129 def GetGypToolchainLib(tcname, xarch):
127 tcpath = os.path.join(GetGypGenDir(xarch), 'sdk', 'toolchain', 130 tcpath = os.path.join(GetGypGenDir(xarch), 'sdk', 'toolchain',
128 GetToolchainDirName(tcname, xarch)) 131 GetToolchainDirName(tcname, xarch))
129 return GetToolchainNaClLib(tcname, tcpath, xarch) 132 return GetToolchainNaClLib(tcname, tcpath, xarch)
130 133
131 134
132 def GetOutputToolchainLib(pepperdir, tcname, xarch): 135 def GetOutputToolchainLib(pepperdir, tcname, xarch):
133 tcpath = os.path.join(pepperdir, 'toolchain', 136 tcpath = os.path.join(pepperdir, 'toolchain',
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 'newlib/lib-bc-x86-64', 194 'newlib/lib-bc-x86-64',
192 'newlib/usr-bc-x86-64' 195 'newlib/usr-bc-x86-64'
193 # TODO(sbc): remove this once its really not needed. 196 # TODO(sbc): remove this once its really not needed.
194 # Currently we seem to rely on it at least for <bits/stat.h> 197 # Currently we seem to rely on it at least for <bits/stat.h>
195 #'newlib/sysroot', 198 #'newlib/sysroot',
196 ] 199 ]
197 for dirname in dirs_to_prune: 200 for dirname in dirs_to_prune:
198 buildbot_common.RemoveDir(os.path.join(root, dirname)) 201 buildbot_common.RemoveDir(os.path.join(root, dirname))
199 202
200 203
201 def BuildStepUntarToolchains(pepperdir, arch, toolchains): 204 def BuildStepUntarToolchains(pepperdir, toolchains):
202 buildbot_common.BuildStep('Untar Toolchains') 205 buildbot_common.BuildStep('Untar Toolchains')
203 platform = getos.GetPlatform() 206 platform = getos.GetPlatform()
204 tcname = platform + '_' + arch
205 tmpdir = os.path.join(OUT_DIR, 'tc_temp') 207 tmpdir = os.path.join(OUT_DIR, 'tc_temp')
206 buildbot_common.RemoveDir(tmpdir) 208 buildbot_common.RemoveDir(tmpdir)
207 buildbot_common.MakeDir(tmpdir) 209 buildbot_common.MakeDir(tmpdir)
208 210
209 if 'newlib' in toolchains: 211 if 'newlib' in toolchains:
210 # Untar the newlib toolchains 212 # Untar the newlib toolchains
211 tarfile = GetNewlibToolchain(arch) 213 tarfile = GetNewlibToolchain()
212 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], 214 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile],
213 cwd=NACL_DIR) 215 cwd=NACL_DIR)
214 216
215 # Then rename/move it to the pepper toolchain directory 217 # Then rename/move it to the pepper toolchain directory
216 srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk') 218 srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk')
217 newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib') 219 tcname = platform + '_x86_newlib'
220 newlibdir = os.path.join(pepperdir, 'toolchain', tcname)
218 buildbot_common.Move(srcdir, newlibdir) 221 buildbot_common.Move(srcdir, newlibdir)
219 222
220 if 'arm' in toolchains: 223 if 'arm' in toolchains:
221 # Copy the existing arm toolchain from native_client tree 224 # Copy the existing arm toolchain from native_client tree
222 arm_toolchain = os.path.join(NACL_DIR, 'toolchain', 225 tcname = platform + '_arm_newlib'
223 platform + '_arm_newlib') 226 arm_toolchain = os.path.join(NACL_DIR, 'toolchain', tcname)
224 arm_toolchain_sdk = os.path.join(pepperdir, 'toolchain', 227 arm_toolchain_sdk = os.path.join(pepperdir, 'toolchain',
225 os.path.basename(arm_toolchain)) 228 os.path.basename(arm_toolchain))
226 buildbot_common.CopyDir(arm_toolchain, arm_toolchain_sdk) 229 buildbot_common.CopyDir(arm_toolchain, arm_toolchain_sdk)
227 230
228 if 'glibc' in toolchains: 231 if 'glibc' in toolchains:
229 # Untar the glibc toolchains 232 # Untar the glibc toolchains
230 tarfile = GetGlibcToolchain(arch) 233 tarfile = GetGlibcToolchain()
234 tcname = platform + '_x86_glibc'
231 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], 235 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile],
232 cwd=NACL_DIR) 236 cwd=NACL_DIR)
233 237
234 # Then rename/move it to the pepper toolchain directory 238 # Then rename/move it to the pepper toolchain directory
235 srcdir = os.path.join(tmpdir, 'toolchain', tcname) 239 srcdir = os.path.join(tmpdir, 'toolchain', platform + '_x86')
236 glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') 240 glibcdir = os.path.join(pepperdir, 'toolchain', tcname)
237 buildbot_common.Move(srcdir, glibcdir) 241 buildbot_common.Move(srcdir, glibcdir)
238 242
239 # Untar the pnacl toolchains 243 # Untar the pnacl toolchains
240 if 'pnacl' in toolchains: 244 if 'pnacl' in toolchains:
241 tmpdir = os.path.join(tmpdir, 'pnacl') 245 tmpdir = os.path.join(tmpdir, 'pnacl')
242 buildbot_common.RemoveDir(tmpdir) 246 buildbot_common.RemoveDir(tmpdir)
243 buildbot_common.MakeDir(tmpdir) 247 buildbot_common.MakeDir(tmpdir)
244 tarfile = GetPNaClToolchain(arch) 248 tarfile = GetPNaClToolchain()
249 tcname = platform + '_pnacl'
245 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], 250 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile],
246 cwd=NACL_DIR) 251 cwd=NACL_DIR)
247 252
248 # Then rename/move it to the pepper toolchain directory 253 # Then rename/move it to the pepper toolchain directory
249 pnacldir = os.path.join(pepperdir, 'toolchain', tcname + '_pnacl') 254 pnacldir = os.path.join(pepperdir, 'toolchain', tcname)
250 buildbot_common.Move(tmpdir, pnacldir) 255 buildbot_common.Move(tmpdir, pnacldir)
251 PrunePNaClToolchain(pnacldir) 256 PrunePNaClToolchain(pnacldir)
252 257
253 buildbot_common.RemoveDir(tmpdir) 258 buildbot_common.RemoveDir(tmpdir)
254 259
255 if options.gyp and platform != 'win': 260 if options.gyp and platform != 'win':
256 # If the gyp options is specified we install a toolchain 261 # If the gyp options is specified we install a toolchain
257 # wrapper so that gyp can switch toolchains via a commandline 262 # wrapper so that gyp can switch toolchains via a commandline
258 # option. 263 # option.
259 bindir = os.path.join(pepperdir, 'toolchain', tcname, 'bin') 264 bindir = os.path.join(pepperdir, 'toolchain', tcname, 'bin')
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 buildbot_common.Run(['ninja', '-C', out_config_dir] + targets, cwd=SRC_DIR) 564 buildbot_common.Run(['ninja', '-C', out_config_dir] + targets, cwd=SRC_DIR)
560 565
561 566
562 def BuildStepBuildToolchains(pepperdir, toolchains): 567 def BuildStepBuildToolchains(pepperdir, toolchains):
563 buildbot_common.BuildStep('SDK Items') 568 buildbot_common.BuildStep('SDK Items')
564 569
565 GypNinjaBuild_NaCl(GYPBUILD_DIR) 570 GypNinjaBuild_NaCl(GYPBUILD_DIR)
566 GypNinjaBuild_Breakpad(GYPBUILD_DIR) 571 GypNinjaBuild_Breakpad(GYPBUILD_DIR)
567 572
568 platform = getos.GetPlatform() 573 platform = getos.GetPlatform()
569 tcname = platform + '_x86' 574 newlibdir = os.path.join(pepperdir, 'toolchain', platform + '_x86_newlib')
570 newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib') 575 glibcdir = os.path.join(pepperdir, 'toolchain', platform + '_x86_glibc')
571 glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') 576 armdir = os.path.join(pepperdir, 'toolchain', platform + '_arm_newlib')
572 pnacldir = os.path.join(pepperdir, 'toolchain', tcname + '_pnacl') 577 pnacldir = os.path.join(pepperdir, 'toolchain', platform + '_pnacl')
573 578
574 if set(toolchains) & set(['glibc', 'newlib']): 579 if set(toolchains) & set(['glibc', 'newlib']):
575 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR) 580 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR)
576 581
577 if 'arm' in toolchains: 582 if 'arm' in toolchains:
578 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm') 583 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm')
579 584
580 GypNinjaInstall(pepperdir, toolchains) 585 GypNinjaInstall(pepperdir, toolchains)
581 586
582 if 'newlib' in toolchains: 587 if 'newlib' in toolchains:
583 InstallNaClHeaders(GetToolchainNaClInclude('newlib', newlibdir, 'x86'), 588 InstallNaClHeaders(GetToolchainNaClInclude('newlib', newlibdir, 'x86'),
584 'newlib') 589 'newlib')
585 590
586 if 'glibc' in toolchains: 591 if 'glibc' in toolchains:
587 InstallNaClHeaders(GetToolchainNaClInclude('glibc', glibcdir, 'x86'), 592 InstallNaClHeaders(GetToolchainNaClInclude('glibc', glibcdir, 'x86'),
588 'glibc') 593 'glibc')
589 594
590 if 'arm' in toolchains: 595 if 'arm' in toolchains:
591 tcname = platform + '_arm_newlib'
592 armdir = os.path.join(pepperdir, 'toolchain', tcname)
593 InstallNaClHeaders(GetToolchainNaClInclude('newlib', armdir, 'arm'), 596 InstallNaClHeaders(GetToolchainNaClInclude('newlib', armdir, 'arm'),
594 'arm') 597 'arm')
595 598
596 if 'pnacl' in toolchains: 599 if 'pnacl' in toolchains:
597 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default. 600 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default.
598 for arch in ('ia32', 'arm'): 601 for arch in ('ia32', 'arm'):
599 # Fill in the latest native pnacl shim library from the chrome build. 602 # Fill in the latest native pnacl shim library from the chrome build.
600 build_dir = GYPBUILD_DIR + '-pnacl-' + arch 603 build_dir = GYPBUILD_DIR + '-pnacl-' + arch
601 GypNinjaBuild_Pnacl(build_dir, arch) 604 GypNinjaBuild_Pnacl(build_dir, arch)
602 if arch == 'ia32': 605 if arch == 'ia32':
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 help='build experimental examples and libraries', action='store_true', 875 help='build experimental examples and libraries', action='store_true',
873 dest='build_experimental') 876 dest='build_experimental')
874 parser.add_option('--skip-toolchain', help='Skip toolchain untar', 877 parser.add_option('--skip-toolchain', help='Skip toolchain untar',
875 action='store_true') 878 action='store_true')
876 parser.add_option('--mac_sdk', 879 parser.add_option('--mac_sdk',
877 help='Set the mac_sdk (e.g. 10.6) to use when building with ninja.', 880 help='Set the mac_sdk (e.g. 10.6) to use when building with ninja.',
878 dest='mac_sdk') 881 dest='mac_sdk')
879 882
880 global options 883 global options
881 options, args = parser.parse_args(args[1:]) 884 options, args = parser.parse_args(args[1:])
882 arch = 'x86'
883 885
884 generate_make.use_gyp = options.gyp 886 generate_make.use_gyp = options.gyp
885 if buildbot_common.IsSDKBuilder(): 887 if buildbot_common.IsSDKBuilder():
886 options.archive = True 888 options.archive = True
887 options.build_ports = True 889 options.build_ports = True
888 890
889 toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host'] 891 toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host']
890 print 'Building: ' + ' '.join(toolchains) 892 print 'Building: ' + ' '.join(toolchains)
891 893
892 if options.archive and options.skip_tar: 894 if options.archive and options.skip_tar:
(...skipping 15 matching lines...) Expand all
908 910
909 if 'NACL_SDK_ROOT' in os.environ: 911 if 'NACL_SDK_ROOT' in os.environ:
910 # We don't want the currently configured NACL_SDK_ROOT to have any effect 912 # We don't want the currently configured NACL_SDK_ROOT to have any effect
911 # of the build. 913 # of the build.
912 del os.environ['NACL_SDK_ROOT'] 914 del os.environ['NACL_SDK_ROOT']
913 915
914 if not options.skip_toolchain: 916 if not options.skip_toolchain:
915 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) 917 BuildStepCleanPepperDirs(pepperdir, pepperdir_old)
916 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) 918 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools'])
917 BuildStepDownloadToolchains() 919 BuildStepDownloadToolchains()
918 BuildStepUntarToolchains(pepperdir, arch, toolchains) 920 BuildStepUntarToolchains(pepperdir, toolchains)
919 921
920 BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) 922 BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision)
921 BuildStepBuildToolchains(pepperdir, toolchains) 923 BuildStepBuildToolchains(pepperdir, toolchains)
922 924
923 BuildStepUpdateHelpers(pepperdir, True) 925 BuildStepUpdateHelpers(pepperdir, True)
924 BuildStepUpdateUserProjects(pepperdir, toolchains, 926 BuildStepUpdateUserProjects(pepperdir, toolchains,
925 options.build_experimental, True) 927 options.build_experimental, True)
926 928
927 # Ship with libraries prebuilt, so run that first. 929 # Ship with libraries prebuilt, so run that first.
928 BuildStepBuildLibraries(pepperdir, 'src') 930 BuildStepBuildLibraries(pepperdir, 'src')
(...skipping 22 matching lines...) Expand all
951 BuildStepArchiveSDKTools() 953 BuildStepArchiveSDKTools()
952 954
953 return 0 955 return 0
954 956
955 957
956 if __name__ == '__main__': 958 if __name__ == '__main__':
957 try: 959 try:
958 sys.exit(main(sys.argv)) 960 sys.exit(main(sys.argv))
959 except KeyboardInterrupt: 961 except KeyboardInterrupt:
960 buildbot_common.ErrorExit('build_sdk: interrupted') 962 buildbot_common.ErrorExit('build_sdk: interrupted')
OLDNEW
« no previous file with comments | « DEPS ('k') | native_client_sdk/src/build_tools/nacl-mono-runtime.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698