|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# Copyright 2023 The Emscripten Authors. All rights reserved. |
| 3 | +# Emscripten is available under two separate licenses, the MIT license and the |
| 4 | +# University of Illinois/NCSA Open Source License. Both these licenses can be |
| 5 | +# found in the LICENSE file. |
| 6 | + |
| 7 | +import os |
| 8 | +import sys |
| 9 | +import shutil |
| 10 | + |
| 11 | +script_dir = os.path.abspath(os.path.dirname(__file__)) |
| 12 | +emscripten_root = os.path.dirname(os.path.dirname(script_dir)) |
| 13 | +default_llvm_dir = os.path.join(os.path.dirname(emscripten_root), 'llvm-project') |
| 14 | +local_root = os.path.join(script_dir, 'libunwind') |
| 15 | +local_src = os.path.join(local_root, 'src') |
| 16 | +local_inc = os.path.join(local_root, 'include') |
| 17 | + |
| 18 | + |
| 19 | +def main(): |
| 20 | + if len(sys.argv) > 1: |
| 21 | + llvm_dir = os.path.join(os.path.abspath(sys.argv[1])) |
| 22 | + else: |
| 23 | + llvm_dir = default_llvm_dir |
| 24 | + upstream_root = os.path.join(llvm_dir, 'libunwind') |
| 25 | + upstream_src = os.path.join(upstream_root, 'src') |
| 26 | + upstream_inc = os.path.join(upstream_root, 'include') |
| 27 | + assert os.path.exists(upstream_inc) |
| 28 | + assert os.path.exists(upstream_src) |
| 29 | + |
| 30 | + # Remove old version |
| 31 | + shutil.rmtree(local_src) |
| 32 | + shutil.rmtree(local_inc) |
| 33 | + |
| 34 | + shutil.copytree(upstream_src, local_src) |
| 35 | + shutil.copytree(upstream_inc, local_inc) |
| 36 | + shutil.copy2(os.path.join(upstream_root, 'LICENSE.TXT'), local_root) |
| 37 | + |
| 38 | + |
| 39 | +if __name__ == '__main__': |
| 40 | + main() |
0 commit comments