OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 |
| 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 import logging, os, re, shutil |
| 8 from autotest_lib.client.bin import test, utils |
| 9 |
| 10 # changing this version number will force a delete of piglit/ and remake |
| 11 version = 1 |
| 12 |
| 13 # TODO(ihf) piglit only builds on x86, Tegra2 only supports GLES |
| 14 def setup(topdir): |
| 15 sysroot = os.environ['SYSROOT'] |
| 16 logging.debug('INFO: piglit sysroot = %s' % sysroot) |
| 17 tarball = 'piglit.tar.gz' |
| 18 srcdir = os.path.join(topdir, 'src') |
| 19 tarball_path = os.path.join(srcdir, tarball) |
| 20 dst_path = os.path.join(topdir, 'piglit') |
| 21 # in-source build, clean/overwrite destination |
| 22 shutil.rmtree(dst_path, ignore_errors=True) |
| 23 if re.search('x86', sysroot.lower()): |
| 24 utils.extract_tarball_to_dir(tarball_path, dst_path) |
| 25 # patch in a single config file for now |
| 26 shutil.copyfile(os.path.join(srcdir, 'cros-driver.tests'), |
| 27 os.path.join(dst_path, 'tests/cros-driver.tests')) |
| 28 os.chdir(dst_path) |
| 29 # we have to tell cmake where to find glut |
| 30 cmd = 'cmake -DCMAKE_FIND_ROOT_PATH=' + sysroot |
| 31 cmd = cmd + ' -DGLUT_INCLUDE_DIR=' + sysroot + '/usr/include' |
| 32 cmd = cmd + ' -DGLUT_glut_LIBRARY=' + sysroot + '/usr/lib/libglut.so' |
| 33 utils.run(cmd) |
| 34 utils.make('-j %d' % utils.count_cpus()) |
| 35 utils.run('strip bin/*') |
| 36 os.chdir(topdir) |
| 37 else: |
| 38 logging.warning('WARNING: Skip piglit build. OpenGL/x86 boards only') |
| 39 dst_path = os.path.join(topdir, 'piglit') |
| 40 # still create an empty directory |
| 41 if not os.path.exists(dst_path): |
| 42 os.makedirs(dst_path) |
| 43 |
| 44 pwd = os.getcwd() |
| 45 # delete piglit directory when new version is set |
| 46 utils.update_version(pwd+'/piglit', False, version, setup, pwd) |
OLD | NEW |