Path: blob/main/system/lib/push_llvm_changes.py
4150 views
#!/usr/bin/env python31# Copyright 2021 The Emscripten Authors. All rights reserved.2# Emscripten is available under two separate licenses, the MIT license and the3# University of Illinois/NCSA Open Source License. Both these licenses can be4# found in the LICENSE file.56# Copy local llvm library changes into the upstream llvm tree.7# This is the logical inverse of update_compiler_rt.py, update_libcxx.py8# and update_libcxxabi.py which copy changes form the upstream llvm9# into emscripten.1011import glob12import os13import sys14import shutil1516script_dir = os.path.abspath(os.path.dirname(__file__))17emscripten_root = os.path.dirname(os.path.dirname(script_dir))18default_llvm_dir = os.path.join(os.path.dirname(emscripten_root), 'llvm-project')19copy_dirs = [20('compiler-rt', 'compiler-rt'),21('libcxx', 'libcxx'),22('libcxxabi', 'libcxxabi'),23('libunwind', 'libunwind'),24('llvm-libc', 'libc'),25]262728def main():29if len(sys.argv) > 1:30upstream_root = os.path.join(os.path.abspath(sys.argv[1]))31else:32upstream_root = default_llvm_dir33if not os.path.exists(upstream_root):34print(f'llvm tree not found: {upstream_root}')35return 13637for _, upstream_name in copy_dirs:38assert os.path.exists(os.path.join(upstream_root, upstream_name))3940for local_name, upstream_name in copy_dirs:41local_dir = os.path.join(script_dir, local_name)42upstream_dir = os.path.join(upstream_root, upstream_name)43print(f'copying {local_dir} -> {upstream_dir}')44shutil.copytree(local_dir, upstream_dir, dirs_exist_ok=True)454647if __name__ == '__main__':48main()495051