Debian Codegraph @

compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py

raw
1 #!/usr/bin/env python3
2
3 import os, sys, subprocess
4
5 output = None
6 output_type = "executable"
7
8 args = sys.argv[1:]
9 while args:
10 arg = args.pop(0)
11 if arg == "-shared":
12 output_type = "shared"
13 elif arg == "-dynamiclib":
14 output_type = "dylib"
15 elif arg == "-c":
16 output_type = "object"
17 elif arg == "-S":
18 output_type = "assembly"
19 elif arg == "-o":
20 output = args.pop(0)
21
22 if output == None:
23 print("No output file name!")
24 sys.exit(1)
25
26 ret = subprocess.call(sys.argv[1:])
27 if ret != 0:
28 sys.exit(ret)
29
30 # If we produce a dylib, ad-hoc sign it.
31 if output_type in ["shared", "dylib"]:
32 ret = subprocess.call(["codesign", "-s", "-", output])