mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2025-12-25 21:20:41 +00:00
30 lines
868 B
Python
30 lines
868 B
Python
#!/usr/bin/python3
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import typing
|
|
|
|
COMPLIER_PATH = "@COMPILER@"
|
|
|
|
def main(argv: typing.List[str]):
|
|
cwd = os.getcwd()
|
|
# Remove `-Minform=inform`. It is added by meson automatically.
|
|
# Remove `-lflang` and `-lpgmath`. It exists in classic-flang but doesn't exist in flang-new.
|
|
# Replace `-Oz` to `-O2`. `-Oz` is not supported by flang-new.
|
|
# Replace `-module` to `-J`. See https://github.com/llvm/llvm-project/issues/66969
|
|
argv_new = []
|
|
for arg in argv[1:]:
|
|
if arg in ["-Minform=inform", "-lflang", "-lpgmath"]:
|
|
pass
|
|
elif arg == "-Oz":
|
|
argv_new.append("-O2")
|
|
elif arg == "-module":
|
|
argv_new.append("-J")
|
|
else:
|
|
argv_new.append(arg)
|
|
args = [COMPLIER_PATH] + argv_new
|
|
subprocess.check_call(args, env=os.environ, cwd=cwd, text=True)
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv)
|