#!/usr/bin/env python3

import os.path
import subprocess
import sys

cargo = os.path.expanduser("~/.cargo/bin/cargo")

args = []
sys.argv.pop(0)
for arg in sys.argv:

    if arg == "cdylib":
        arg = "staticlib"    

    args.append(arg)

    if arg == "rustc":
        args += ["--target", "aarch64-apple-ios"]

cmd = [cargo]+args
print(cmd, file=sys.stderr)

subprocess.run(cmd, stdout=sys.stdout, stderr=sys.stderr)

sys.exit(0)