blob: 374c02abe2e3b99692727bf9c3dd566642da33e0 [file] [log] [blame]
#!/usr/bin/python
import os
import sys
script_dir = os.path.dirname(__file__)
skia_src = os.path.abspath(os.environ.get('SKIA_SRC', os.path.join( script_dir, "..", "..")))
gyp_source_dir = os.path.join(skia_src, 'third_party', 'externals', 'gyp')
WEBTRY_CACHE_DEFAULT = os.path.join(script_dir, "..", "..", "..", "cache")
WEBTRY_INOUT_DEFAULT = os.path.join(script_dir, "..", "..", "..", "inout")
sys.path.insert(0, os.path.abspath(os.path.join(gyp_source_dir, 'pylib')))
import gyp
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: gyp_for_webtry [code hash value]"
sys.exit(-1)
args = sys.argv[2:]
if not os.environ.get('GYP_GENERATORS'):
os.environ['GYP_GENERATORS'] = 'ninja'
args.append('--check')
args.append('-I%s/gyp/common.gypi' % skia_src)
args.extend(['--depth', '.'])
webtry_cache_dir = os.path.abspath(os.environ.get('WEBTRY_CACHE', WEBTRY_CACHE_DEFAULT))
webtry_inout_dir = os.path.abspath(os.environ.get('WEBTRY_INOUT', WEBTRY_INOUT_DEFAULT))
args.append('-Goutput_dir=%s' % webtry_inout_dir)
args.append(os.path.join(webtry_cache_dir, '%s.gyp' % sys.argv[1]))
# gyp is really picky about the current working directory having src/ under it
os.chdir(webtry_cache_dir)
os.environ['CC'] = '../../skia/experimental/webtry/safec'
os.environ['CXX'] = '../../skia/experimental/webtry/safec++'
os.environ['LD'] = '../../skia/experimental/webtry/safec++'
sys.exit(gyp.main(args))