• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# Copyright 2016 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""Create the asset."""
10
11
12from __future__ import print_function
13import argparse
14import glob
15import os
16import shutil
17import subprocess
18import sys
19
20
21def create_asset(target_dir, gl_path):
22  """Create the asset."""
23
24  cmd = [
25    'sudo','apt-get','install',
26    'libgles2-mesa-dev',
27    'libegl1-mesa-dev'
28  ]
29  print('About to run:')
30  print(' '.join(cmd))
31  print('Press Enter to Continue')
32  raw_input()
33  subprocess.check_call(cmd)
34
35
36  lib_dir = os.path.join(target_dir, 'lib')
37  os.mkdir(lib_dir)
38
39  to_copy = glob.glob(os.path.join(gl_path,'libGL*'))
40  to_copy.extend(glob.glob(os.path.join(gl_path,'libEGL*')))
41  to_copy.extend(glob.glob(os.path.join(gl_path,'libmali*')))
42  for f in to_copy:
43    shutil.copy(f, lib_dir)
44
45  include_dir = os.path.join(target_dir, 'include')
46  os.mkdir(include_dir)
47  shutil.copytree('/usr/include/EGL', os.path.join(include_dir, 'EGL'))
48  shutil.copytree('/usr/include/KHR', os.path.join(include_dir, 'KHR'))
49  shutil.copytree('/usr/include/GLES2', os.path.join(include_dir, 'GLES2'))
50  shutil.copytree('/usr/include/GLES3', os.path.join(include_dir, 'GLES3'))
51
52
53def main():
54  if 'linux' not in sys.platform:
55    print('This script only runs on Linux.', file=sys.stderr)
56    sys.exit(1)
57  parser = argparse.ArgumentParser()
58  parser.add_argument('--target_dir', '-t', required=True)
59  parser.add_argument('--lib_path', '-l', required=True)
60  args = parser.parse_args()
61  create_asset(args.target_dir, args.lib_path)
62
63
64if __name__ == '__main__':
65  main()
66