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

Unified Diff: build/install-arm-sysroot.py

Issue 11468014: Download arm sysroot as part of gclient hooks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« DEPS ('K') | « DEPS ('k') | build/install-build-deps.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/install-arm-sysroot.py
diff --git a/build/install-arm-sysroot.py b/build/install-arm-sysroot.py
new file mode 100755
index 0000000000000000000000000000000000000000..583d14be1d1e8a995c051fecce85c90197a11523
--- /dev/null
+++ b/build/install-arm-sysroot.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Script to install arm choot image for cross building of arm chrome on linux.
+# This script can be run manually but is more often run as part of gclient
+# hooks. When run from hooks this script should be a no-op on non-linux
+# platforms.
+
+# The sysroot image could be constructed from scratch based on the current
+# state or precise/arm but for consistency we currently use a pre-built root
+# image which was originally designed for building trusted NaCl code. The image
+# will normally need to be rebuilt every time chrome's build dependancies are
+# changed.
+
+import os
+import sys
+
+
+script_dir = os.path.dirname(os.path.abspath(__file__))
+
+
+def main(args):
+ if '--linux-only' in args:
+ # This argument is passed when run from the gclient hooks.
+ # In this case we return early on non-linux platforms
+ # or if GYP_DEFINES doesn't include target_arch=arm
+ if sys.platform != 'linux2':
tony 2012/12/07 01:01:42 Please use sys.platform.startswith('linux'). See t
Sam Clegg 2012/12/07 18:29:37 Done.
+ return
+
+ if "target_arch=arm" not in os.environ.get('GYP_DEFINES', ''):
tony 2012/12/07 01:01:42 Is it OK that this doesn't run when someone uses ~
Sam Clegg 2012/12/07 18:29:37 Such people will want to run install-arm-sysroot.p
+ return 0
+
+ src_root = os.path.dirname(script_dir)
+ sysroot = os.path.join(src_root, 'arm-sysroot')
+ url_prefix = 'https://commondatastorage.googleapis.com/nativeclient-archive2/toolchain'
+ rev = 8001
+ url = "%s/%s/naclsdk_linux_arm-trusted.tgz" % (url_prefix, rev)
+
+ stamp = os.path.join(sysroot, ".stamp")
+ if os.path.exists(stamp):
+ with open(stamp) as s:
+ if s.read() == url:
+ print "ARM root image already up-to-date: %s" % sysroot
+ return 0
+
+ print "Installing ARM root image: %s" % sysroot
+ if not os.path.isdir(sysroot):
+ os.mkdir(sysroot)
+ tarball = os.path.join(sysroot, 'naclsdk_linux_arm-trusted.tgz')
+ rtn = os.system('curl -L "%s" -o "%s"' % (url, tarball))
+ if rtn:
+ return rtn
+ rtn = os.system('tar xf %s -C %s' % (tarball, sysroot))
+ if rtn:
+ return rtn
+ os.remove(tarball)
+ open(stamp, 'w').write(url)
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
« DEPS ('K') | « DEPS ('k') | build/install-build-deps.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698