mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 15:42:10 +03:00
42 lines
1.1 KiB
Python
Executable File
42 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
|
|
def flag_filter(flag: str) -> bool:
|
|
# Workaround for <https://github.com/sfackler/rust-openssl/issues/2043>.
|
|
if flag == "-latomic":
|
|
return False
|
|
|
|
if flag == "-lc":
|
|
return False
|
|
if flag == "-Wl,-melf_i386":
|
|
return False
|
|
if "self-contained" in flag and "crt" in flag:
|
|
return False
|
|
return True
|
|
|
|
|
|
def main():
|
|
args = [flag for flag in sys.argv[1:] if flag_filter(flag)]
|
|
zig_target = os.environ["ZIG_TARGET"]
|
|
zig_cpu = os.environ.get("ZIG_CPU")
|
|
if zig_cpu:
|
|
zig_cpu_args = ["-mcpu=" + zig_cpu]
|
|
args = [x for x in args if not x.startswith("-march")]
|
|
else:
|
|
zig_cpu_args = []
|
|
|
|
# Disable atomics and use locks instead in OpenSSL.
|
|
# Zig toolchains do not provide atomics.
|
|
# This is a workaround for <https://github.com/deltachat/deltachat-core-rust/issues/4799>
|
|
args += ["-DBROKEN_CLANG_ATOMICS"]
|
|
|
|
subprocess.run(
|
|
["zig", "cc", "-target", zig_target, *zig_cpu_args, *args], check=True
|
|
)
|
|
|
|
|
|
main()
|