OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 |
| 3 # Copyright (c) 2009 The Chromium 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 # usage: action_jsconfig.py JS_ENGINE OUTPUT_DIR CONFIG_H_IN FILES_TO_COPY |
| 8 # JS_ENGINE may be v8 at present. jsc will be added in the future. |
| 9 # CONFIG_H_DIR is the directory to put config.h in. |
| 10 # OUTPUT_DIR is the directory to put other files in. |
| 11 # CONFIG_H_IN is the path to config.h.in upon which config.h will be based. |
| 12 # FILES_TO_COPY is a list of additional headers to be copied. It may be empty. |
| 13 |
| 14 import errno |
| 15 import os |
| 16 import os.path |
| 17 import shutil |
| 18 import sys |
| 19 |
| 20 assert len(sys.argv) >= 5 |
| 21 js_engine = sys.argv[1] |
| 22 config_h_dir = sys.argv[2] |
| 23 output_dir = sys.argv[3] |
| 24 config_h_in_path = sys.argv[4] |
| 25 files_to_copy = sys.argv[5:] |
| 26 |
| 27 config_h_path = os.path.join(config_h_dir, 'config.h') |
| 28 |
| 29 assert js_engine == 'v8' |
| 30 |
| 31 config_h_in_file = open(config_h_in_path) |
| 32 config_h_in_contents = config_h_in_file.read() |
| 33 config_h_in_file.close() |
| 34 |
| 35 config_h_file = open(config_h_path, 'w') |
| 36 print >>config_h_file, config_h_in_contents |
| 37 if js_engine == 'v8': |
| 38 print >>config_h_file, '#define WTF_USE_V8_BINDING 1' |
| 39 print >>config_h_file, '#define WTF_USE_NPOBJECT 1' |
| 40 config_h_file.close() |
| 41 |
| 42 for file in files_to_copy: |
| 43 # This is not strictly right for jsc headers, which will want to be in one |
| 44 # more subdirectory named JavaScriptCore. |
| 45 basename = os.path.basename(file) |
| 46 destination = os.path.join(output_dir, basename) |
| 47 shutil.copy(file, destination) |
OLD | NEW |