| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 Replaces gyp files in tree with files from here that | 7 Replaces gyp files in tree with files from here that |
| 8 make the build use system libraries. | 8 make the build use system libraries. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 | 11 |
| 12 import os.path | 12 import os.path |
| 13 import shutil | 13 import shutil |
| 14 import sys | 14 import sys |
| 15 | 15 |
| 16 | 16 |
| 17 REPLACEMENTS = { | 17 REPLACEMENTS = { |
| 18 'use_system_bzip2': 'third_party/bzip2/bzip2.gyp', | 18 'use_system_bzip2': 'third_party/bzip2/bzip2.gyp', |
| 19 'use_system_expat': 'third_party/expat/expat.gyp', | 19 'use_system_expat': 'third_party/expat/expat.gyp', |
| 20 'use_system_flac': 'third_party/flac/flac.gyp', |
| 20 'use_system_harfbuzz': 'third_party/harfbuzz-ng/harfbuzz.gyp', | 21 'use_system_harfbuzz': 'third_party/harfbuzz-ng/harfbuzz.gyp', |
| 22 'use_system_icu': 'third_party/icu/icu.gyp', |
| 21 'use_system_jsoncpp': 'third_party/jsoncpp/jsoncpp.gyp', | 23 'use_system_jsoncpp': 'third_party/jsoncpp/jsoncpp.gyp', |
| 22 'use_system_libevent': 'third_party/libevent/libevent.gyp', | 24 'use_system_libevent': 'third_party/libevent/libevent.gyp', |
| 23 'use_system_libjpeg': 'third_party/libjpeg/libjpeg.gyp', | 25 'use_system_libjpeg': 'third_party/libjpeg/libjpeg.gyp', |
| 24 'use_system_libpng': 'third_party/libpng/libpng.gyp', | 26 'use_system_libpng': 'third_party/libpng/libpng.gyp', |
| 25 'use_system_libusb': 'third_party/libusb/libusb.gyp', | 27 'use_system_libusb': 'third_party/libusb/libusb.gyp', |
| 28 'use_system_libvpx': 'third_party/libvpx/libvpx.gyp', |
| 26 'use_system_libwebp': 'third_party/libwebp/libwebp.gyp', | 29 'use_system_libwebp': 'third_party/libwebp/libwebp.gyp', |
| 27 'use_system_libxml': 'third_party/libxml/libxml.gyp', | 30 'use_system_libxml': 'third_party/libxml/libxml.gyp', |
| 28 'use_system_libxslt': 'third_party/libxslt/libxslt.gyp', | 31 'use_system_libxslt': 'third_party/libxslt/libxslt.gyp', |
| 29 'use_system_opus': 'third_party/opus/opus.gyp', | 32 'use_system_opus': 'third_party/opus/opus.gyp', |
| 30 'use_system_re2': 'third_party/re2/re2.gyp', | 33 'use_system_re2': 'third_party/re2/re2.gyp', |
| 34 'use_system_speex': 'third_party/speex/speex.gyp', |
| 31 'use_system_sqlite': 'third_party/sqlite/sqlite.gyp', | 35 'use_system_sqlite': 'third_party/sqlite/sqlite.gyp', |
| 36 'use_system_v8': 'v8/tools/gyp/v8.gyp', |
| 32 'use_system_zlib': 'third_party/zlib/zlib.gyp', | 37 'use_system_zlib': 'third_party/zlib/zlib.gyp', |
| 33 } | 38 } |
| 34 | 39 |
| 35 | 40 |
| 36 def DoMain(argv): | 41 def DoMain(argv): |
| 37 my_dirname = os.path.dirname(__file__) | 42 my_dirname = os.path.dirname(__file__) |
| 38 source_tree_root = os.path.abspath( | 43 source_tree_root = os.path.abspath( |
| 39 os.path.join(my_dirname, '..', '..', '..')) | 44 os.path.join(my_dirname, '..', '..', '..')) |
| 40 | 45 |
| 41 for flag, path in REPLACEMENTS.items(): | 46 for flag, path in REPLACEMENTS.items(): |
| 42 # Accept arguments in gyp command-line syntax, and ignore other | 47 # Accept arguments in gyp command-line syntax, and ignore other |
| 43 # parameters, so that the caller can re-use command-line for this | 48 # parameters, so that the caller can re-use command-line for this |
| 44 # script and gyp. | 49 # script and gyp. |
| 45 if '-D%s=1' % flag not in argv: | 50 if '-D%s=1' % flag not in argv: |
| 46 continue | 51 continue |
| 47 | 52 |
| 48 # Copy the gyp file from directory of this script to target path. | 53 # Copy the gyp file from directory of this script to target path. |
| 49 shutil.copyfile(os.path.join(my_dirname, os.path.basename(path)), | 54 shutil.copyfile(os.path.join(my_dirname, os.path.basename(path)), |
| 50 os.path.join(source_tree_root, path)) | 55 os.path.join(source_tree_root, path)) |
| 51 | 56 |
| 52 return 0 | 57 return 0 |
| 53 | 58 |
| 54 | 59 |
| 55 if __name__ == '__main__': | 60 if __name__ == '__main__': |
| 56 sys.exit(DoMain(sys.argv)) | 61 sys.exit(DoMain(sys.argv)) |
| OLD | NEW |