-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathemstrip.py
More file actions
executable file
·36 lines (27 loc) · 987 Bytes
/
emstrip.py
File metadata and controls
executable file
·36 lines (27 loc) · 987 Bytes
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
#!/usr/bin/env python3
# Copyright 2022 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.
"""Wrapper script around `llvm-strip`.
It also supports taking a JS file as an argument and running 'llvm-strip' on
the corresponding Wasm file. This is convenient for some build systems that
expect to strip the output of a compile.
"""
import os
import sys
from tools import shared
def run():
llvm_strip = shared.llvm_tool_path('llvm-strip')
new_args = []
for arg in sys.argv[1:]:
base, ext = os.path.splitext(arg)
if ext == '.js' and os.path.isfile(arg):
wasm_file = base + '.wasm'
if os.path.isfile(wasm_file):
new_args.append(wasm_file)
continue
new_args.append(arg)
shared.exec_process([llvm_strip] + new_args)
if __name__ == '__main__':
run()