Files
ports/lib/arch.py
2026-10-15 03:21:46 +00:00

49 lines
1.3 KiB
Python

import os
from . import packie
all: dict[str, dict[str, str]] = {
"aarch64-semios-linux": {
"CC": "clang -target aarch64-unknown-linux-musl",
"CXX": "clang++ -target aarch64-unknown-linux-musl",
"CFLAGS": "-O3 -flto=thin",
"CXXFLAGS": "-O3 -flto=thin",
"LDFLAGS": "-flto=thin",
"GOOS": "linux",
"GOARCH": "arm64",
},
"x86_64-semios-linux": {
"CC": "clang -target x86_64-unknown-linux-musl",
"CXX": "clang++ -target x86_64-unknown-linux-musl",
"CFLAGS": "-O3 -march=x86-64-v3 -flto=thin",
"CXXFLAGS": "-O3 -march=x86-64-v3 -flto=thin",
"LDFLAGS": "-flto=thin",
"RUSTFLAGS": "-Ctarget-cpu=x86_64-v3",
"GOOS": "linux",
"GOARCH": "amd64",
"GOAMD64": "v3",
},
"riscv64-semios-linux": {
"CC": "clang -target riscv64-unknown-linux-musl",
"CXX": "clang++ -target riscv64-unknown-linux-musl",
"CFLAGS": "-O3 -flto=thin",
"CXXFLAGS": "-O3 -flto=thin",
"LDFLAGS": "-flto=thin",
"GOOS": "linux",
"GOARCH": "riscv64",
},
}
_target: str = packie.host_arch()
def get_target():
return _target
def set_target(arch: str):
global _target
_target = arch
for key in all[_target].keys():
if not os.environ.get(key):
os.environ[key] = all[_target][key]