forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_llvm_changes.py
More file actions
executable file
·48 lines (39 loc) · 1.4 KB
/
push_llvm_changes.py
File metadata and controls
executable file
·48 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# Copyright 2021 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
# Copy local llvm library changes into the upstream llvm tree.
# This is the logical inverse of update_compiler_rt.py, update_libcxx.py
# and update_libcxxabi.py which copy changes form the upstream llvm
# into emscripten.
import glob
import os
import sys
import shutil
script_dir = os.path.abspath(os.path.dirname(__file__))
emscripten_root = os.path.dirname(os.path.dirname(script_dir))
default_llvm_dir = os.path.join(os.path.dirname(emscripten_root), 'llvm-project')
copy_dirs = [
'compiler-rt',
'libcxx',
'libcxxabi',
'libunwind',
]
def main():
if len(sys.argv) > 1:
upstream_root = os.path.join(os.path.abspath(sys.argv[1]))
else:
upstream_root = default_llvm_dir
if not os.path.exists(upstream_root):
print(f'llvm tree not found: {upstream_root}')
return 1
for dir in copy_dirs:
assert os.path.exists(os.path.join(upstream_root, dir))
for dir in copy_dirs:
local_dir = os.path.join(script_dir, dir)
upstream_dir = os.path.join(upstream_root, dir)
print(f'copying {local_dir} -> {upstream_dir}')
shutil.copytree(local_dir, upstream_dir, dirs_exist_ok=True)
if __name__ == '__main__':
main()