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

Side by Side Diff: mojo/go/go.py

Issue 1276653003: Update version of Go to 1.5 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: go.mobile no longer needed Created 5 years, 4 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
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 """ 6 """
7 This script invokes the go build tool. 7 This script invokes the go build tool.
8 Must be called as follows: 8 Must be called as follows:
9 python go.py [--android] <go-tool> <build directory> <output file> 9 python go.py [--android] <go-tool> <build directory> <output file>
10 <src directory> <CGO_CFLAGS> <CGO_LDFLAGS> <go-binary options> 10 <src directory> <CGO_CFLAGS> <CGO_LDFLAGS> <go-binary options>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ndk_path = os.path.join(src_root, 'third_party', 'android_tools', 'ndk') 71 ndk_path = os.path.join(src_root, 'third_party', 'android_tools', 'ndk')
72 if sys.platform.startswith('linux'): 72 if sys.platform.startswith('linux'):
73 arch = 'linux-x86_64' 73 arch = 'linux-x86_64'
74 elif sys.platform == 'darwin': 74 elif sys.platform == 'darwin':
75 arch = 'darwin-x86_64' 75 arch = 'darwin-x86_64'
76 else: 76 else:
77 raise Exception('unsupported platform: ' + sys.platform) 77 raise Exception('unsupported platform: ' + sys.platform)
78 ndk_cc = os.path.join(ndk_path, 'toolchains', NDK_TOOLCHAIN, 78 ndk_cc = os.path.join(ndk_path, 'toolchains', NDK_TOOLCHAIN,
79 'prebuilt', arch, 'bin', 'arm-linux-androideabi-gcc') 79 'prebuilt', arch, 'bin', 'arm-linux-androideabi-gcc')
80 sysroot = os.path.join(ndk_path, 'platforms', NDK_PLATFORM, 'arch-arm') 80 sysroot = os.path.join(ndk_path, 'platforms', NDK_PLATFORM, 'arch-arm')
81 env['CGO_CFLAGS'] += ' --sysroot %s' % sysroot
82 env['CGO_LDFLAGS'] += ' --sysroot %s' % sysroot
81 env['CC'] = '%s --sysroot %s' % (ndk_cc, sysroot) 83 env['CC'] = '%s --sysroot %s' % (ndk_cc, sysroot)
82 84
83 call_result = subprocess.call([go_tool] + go_options, env=env) 85 call_result = subprocess.call([go_tool] + go_options, env=env)
84 if call_result != 0: 86 if call_result != 0:
85 return call_result 87 return call_result
86 out_files = sorted([ f for f in os.listdir('.') if os.path.isfile(f)]) 88 out_files = sorted([ f for f in os.listdir('.') if os.path.isfile(f)])
87 if (len(out_files) > 0): 89 if (len(out_files) > 0):
88 shutil.move(out_files[0], out_file) 90 shutil.move(out_files[0], out_file)
89 os.chdir(old_directory) 91 os.chdir(old_directory)
90 try: 92 try:
91 shutil.rmtree(build_dir, True) 93 shutil.rmtree(build_dir, True)
92 except Exception: 94 except Exception:
93 pass 95 pass
94 96
95 if __name__ == '__main__': 97 if __name__ == '__main__':
96 sys.exit(main()) 98 sys.exit(main())
OLDNEW
« examples/go/echo_server.go ('K') | « examples/go/http_server.go ('k') | mojo/go/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698