Skip to content

Commit 40b2c23

Browse files
committed
Update sandbox to correctly set CC and CXX for Zig, add cache busting, and ensure zigcc wrappers are built
1 parent 728baa9 commit 40b2c23

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/sandbox.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ def main() -> int:
5353
f"--volume={os.getcwd()}/bin/zig-0.15.1:/mnt",
5454
# f"--env=CC=/mnt/zig cc -target {target}",
5555
# f"--env=CXX=/mnt/zig c++ -target {target}",
56-
# f"--env=CC=/mnt/zig-cc",
57-
# f"--env=CXX=/mnt/zig-c++",
56+
f"--env=CC=/mnt/zig-cc",
57+
f"--env=CXX=/mnt/zig-c++",
5858
# -Wp,-D_FORTIFY_SOURCE=2
5959
# https://github.com/giampaolo/psutil/blob/master/setup.py#L254
6060
# defaults to using python's flags
6161
# f"--env=CFLAGS=",
62+
f"--env=bustcachez=",
6263
"--env=CXXFLAGS=-Dundefined=64",
6364
f"--unsetenv=CC",
6465
f"--unsetenv=CXX",
@@ -145,6 +146,10 @@ def buildinputs(
145146
subprocess.check_call([MAKE, "bin/buildinputs"], cwd=ROOT_DIR)
146147
if not (ROOT_DIR / "bin/zig-0.15.1").exists():
147148
subprocess.check_call([MAKE, "bin/zig-0.15.1"], cwd=ROOT_DIR)
149+
if not (ROOT_DIR / "bin/zig-0.15.1/zigcc").exists():
150+
subprocess.check_call([MAKE, "build"], cwd=ROOT_DIR / "scripts/zigcc")
151+
shutil.copy(ROOT_DIR / "scripts/zigcc/bin/zigcc", ROOT_DIR / "bin/zig-0.15.1/zig-cc")
152+
shutil.copy(ROOT_DIR / "scripts/zigcc/bin/zigcc", ROOT_DIR / "bin/zig-0.15.1/zig-c++")
148153
stdout = subprocess.check_output([ROOT_DIR / "bin/buildinputs", str(dockerfile)],
149154
text=True, cwd=ROOT_DIR,
150155
env={"TARGETPLATFORM": platform, **os.environ})

0 commit comments

Comments
 (0)