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 12import argparse 13import glob 14import os 15import shutil 16import subprocess 17import sys 18 19 20def create_asset(target_dir, gl_path): 21 """Create the asset.""" 22 23 cmd = [ 24 'sudo','apt-get','install', 25 'libgles2-mesa-dev', 26 'libegl1-mesa-dev' 27 ] 28 print 'About to run:' 29 print ' '.join(cmd) 30 print 'Press Enter to Continue' 31 raw_input() 32 subprocess.check_call(cmd) 33 34 35 lib_dir = os.path.join(target_dir, 'lib') 36 os.mkdir(lib_dir) 37 38 to_copy = glob.glob(os.path.join(gl_path,'libGL*')) 39 to_copy.extend(glob.glob(os.path.join(gl_path,'libEGL*'))) 40 to_copy.extend(glob.glob(os.path.join(gl_path,'libmali*'))) 41 for f in to_copy: 42 shutil.copy(f, lib_dir) 43 44 include_dir = os.path.join(target_dir, 'include') 45 os.mkdir(include_dir) 46 shutil.copytree('/usr/include/EGL', os.path.join(include_dir, 'EGL')) 47 shutil.copytree('/usr/include/KHR', os.path.join(include_dir, 'KHR')) 48 shutil.copytree('/usr/include/GLES2', os.path.join(include_dir, 'GLES2')) 49 shutil.copytree('/usr/include/GLES3', os.path.join(include_dir, 'GLES3')) 50 51 52def main(): 53 if 'linux' not in sys.platform: 54 print >> sys.stderr, 'This script only runs on Linux.' 55 sys.exit(1) 56 parser = argparse.ArgumentParser() 57 parser.add_argument('--target_dir', '-t', required=True) 58 parser.add_argument('--lib_path', '-l', required=True) 59 args = parser.parse_args() 60 create_asset(args.target_dir, args.lib_path) 61 62 63if __name__ == '__main__': 64 main() 65