diff options
Diffstat (limited to 'infra/bots/assets/chromebook_x86_64_gles')
7 files changed, 184 insertions, 0 deletions
diff --git a/infra/bots/assets/chromebook_x86_64_gles/README.md b/infra/bots/assets/chromebook_x86_64_gles/README.md new file mode 100644 index 0000000000..0553d46476 --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/README.md @@ -0,0 +1,13 @@ +This asset is the necessary includes and libs to compile/link the gpu code +for x86_64 Chromebooks with gpu supports EGL and GLES. + +Zip up the /usr/lib64 folder on any x86_64 Chromebook (e.g. Pixelbook). Extract it somewhere +on the dev machine and use that folder as the input to create_and_upload: + + ./infra/bots/assets/chromebook_x86_64_gles/create_and_upload.py --lib_path [dir] + +This script installs the following GL packages and then bundles them with the +unzipped libs: + + libgles2-mesa-dev libegl1-mesa-dev + diff --git a/infra/bots/assets/chromebook_x86_64_gles/VERSION b/infra/bots/assets/chromebook_x86_64_gles/VERSION new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/VERSION @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/infra/bots/assets/chromebook_x86_64_gles/common.py b/infra/bots/assets/chromebook_x86_64_gles/common.py new file mode 100755 index 0000000000..caa0ad899c --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/common.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Common vars used by scripts in this directory.""" + + +import os +import sys + +FILE_DIR = os.path.dirname(os.path.abspath(__file__)) +INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) + +sys.path.insert(0, INFRA_BOTS_DIR) +from assets import assets + +ASSET_NAME = os.path.basename(FILE_DIR) + + +def run(cmd): + """Run a command, eg. "upload" or "download". """ + assets.main([cmd, ASSET_NAME] + sys.argv[1:]) diff --git a/infra/bots/assets/chromebook_x86_64_gles/create.py b/infra/bots/assets/chromebook_x86_64_gles/create.py new file mode 100755 index 0000000000..3070e1fdbb --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/create.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset.""" + + +import argparse +import glob +import os +import shutil +import subprocess +import sys + + +def create_asset(target_dir, gl_path): + """Create the asset.""" + + cmd = [ + 'sudo','apt-get','install', + 'libgles2-mesa-dev', + 'libegl1-mesa-dev' + ] + print 'About to run:' + print ' '.join(cmd) + print 'Press Enter to Continue' + raw_input() + subprocess.check_call(cmd) + + + lib_dir = os.path.join(target_dir, 'lib') + os.mkdir(lib_dir) + + to_copy = glob.glob(os.path.join(gl_path,'libGL*')) + to_copy.extend(glob.glob(os.path.join(gl_path,'libEGL*'))) + to_copy.extend(glob.glob(os.path.join(gl_path,'libdrm*'))) + for f in to_copy: + shutil.copy(f, lib_dir) + + include_dir = os.path.join(target_dir, 'include') + os.mkdir(include_dir) + shutil.copytree('/usr/include/EGL', os.path.join(include_dir, 'EGL')) + shutil.copytree('/usr/include/KHR', os.path.join(include_dir, 'KHR')) + shutil.copytree('/usr/include/GLES2', os.path.join(include_dir, 'GLES2')) + shutil.copytree('/usr/include/GLES3', os.path.join(include_dir, 'GLES3')) + + +def main(): + if 'linux' not in sys.platform: + print >> sys.stderr, 'This script only runs on Linux.' + sys.exit(1) + parser = argparse.ArgumentParser() + parser.add_argument('--target_dir', '-t', required=True) + parser.add_argument('--lib_path', '-l', required=True) + args = parser.parse_args() + create_asset(args.target_dir, args.lib_path) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/chromebook_x86_64_gles/create_and_upload.py b/infra/bots/assets/chromebook_x86_64_gles/create_and_upload.py new file mode 100755 index 0000000000..438d1af0d5 --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/create_and_upload.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset and upload it.""" + + +import argparse +import common +import os +import subprocess +import sys +import utils + + +def main(): + if 'linux' not in sys.platform: + print >> sys.stderr, 'This script only runs on Linux.' + sys.exit(1) + parser = argparse.ArgumentParser() + parser.add_argument('--gsutil') + parser.add_argument('--lib_path', '-l', required=True) + args = parser.parse_args() + + with utils.tmp_dir(): + cwd = os.getcwd() + create_script = os.path.join(common.FILE_DIR, 'create.py') + upload_script = os.path.join(common.FILE_DIR, 'upload.py') + + try: + subprocess.check_call(['python', create_script, + '-t', cwd, + '-l', args.lib_path]) + cmd = ['python', upload_script, '-t', cwd] + if args.gsutil: + cmd.extend(['--gsutil', args.gsutil]) + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + # Trap exceptions to avoid printing two stacktraces. + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/chromebook_x86_64_gles/download.py b/infra/bots/assets/chromebook_x86_64_gles/download.py new file mode 100755 index 0000000000..ca999e0378 --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/download.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Download the current version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('download') diff --git a/infra/bots/assets/chromebook_x86_64_gles/upload.py b/infra/bots/assets/chromebook_x86_64_gles/upload.py new file mode 100755 index 0000000000..bdfbda783e --- /dev/null +++ b/infra/bots/assets/chromebook_x86_64_gles/upload.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Upload a new version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('upload') |