Skip to content

Commit ef3e4e3

Browse files
authored
Add libunwind to update scripts (#20091)
- Add libunwind to `push_llvm_changes.py` - Add `update_libunwind.py`
1 parent f15841d commit ef3e4e3

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

system/lib/push_llvm_changes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'compiler-rt',
2222
'libcxx',
2323
'libcxxabi',
24+
'libunwind',
2425
]
2526

2627

system/lib/update_libunwind.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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

Comments
 (0)