Refresh reviewed MCP output export, four-drive owned playtests, bounded BASIC readiness, and pinned CMOC 0.1.101 source/patches. Preserve independent source-edition identity, empty libraries, notices and privacy boundaries. Validated 74 export/privacy checks, pinned dependency sources, and an independent unsigned universal Release build. A subsequent documentation-only correction removes an excluded qualification link; all build inputs remain identical.
42 lines
2.1 KiB
Python
42 lines
2.1 KiB
Python
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Check the actual CMOC indexed-load peephole rule in a source build."""
|
|
import argparse
|
|
import re
|
|
import subprocess
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("source_build", type=Path, help="build.py output's work/cmoc directory")
|
|
args = parser.parse_args()
|
|
src = args.source_build.resolve(strict=True) / "src"
|
|
version_match = re.search(r"^VERSION\s*=\s*([0-9]+\.[0-9]+\.[0-9]+)\s*$",
|
|
(src / "Makefile").read_text(), re.MULTILINE)
|
|
if not version_match:
|
|
parser.error("Cannot read configured CMOC version from src/Makefile")
|
|
version = version_match.group(1)
|
|
objects = sorted(path for path in src.glob("cmoc-*.o") if path.name != "cmoc-main.o")
|
|
if not objects:
|
|
parser.error("Build CMOC first; compiler objects are required")
|
|
architectures = subprocess.check_output(["lipo", "-archs", objects[0]], text=True).split()
|
|
if len(architectures) != 1 or architectures[0] not in ("arm64", "x86_64"):
|
|
parser.error("Rule check requires a single supported host architecture")
|
|
host_flags = ["-arch", architectures[0], "-mmacosx-version-min=14.0"]
|
|
fixture = Path(__file__).resolve().parent / "optimizer-rule.cpp"
|
|
with tempfile.TemporaryDirectory(prefix="vcc-cmoc-rule-") as work:
|
|
out = Path(work)
|
|
# Retain all normal compiler definitions and rename only its CLI entry
|
|
# in this extra object. The rule itself comes from unchanged build objects.
|
|
subprocess.run(["xcrun", "clang++", "-std=c++11", *host_flags, "-Dmain=vccCompilerDriverMain",
|
|
'-DPACKAGE="cmoc"', '-DVERSION="' + version + '"', '-DPKGDATADIR="."',
|
|
"-D__unix", "-I", src, "-c", src / "main.cpp", "-o", out / "driver.o"], check=True)
|
|
subprocess.run(["xcrun", "clang++", "-std=c++11", *host_flags, "-I", src, fixture,
|
|
out / "driver.o", *objects, "-o", out / "rule-check"], check=True)
|
|
subprocess.run([out / "rule-check"], check=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|