Add ZIG_SYSROOT env var
Allows Zig's sysroot to be set by $ZIG_SYSROOT env var, this is useful for wrapper scripts.
os.getenv isnt cross platform
it looks like you should add it to here
https://github.com/ziglang/zig/blob/8802ec583b376101ee7fcb0a64cf937b90dc6130/src/introspect.zig#L147-L155
then you can do EnvVar.ZIG_SYSROOT.isSet() or get() in main.
for the build runner it looks like graph has an env map, i assume you should use that
https://github.com/ziglang/zig/blob/8802ec583b376101ee7fcb0a64cf937b90dc6130/lib/build_runner.zig#L71
@xdBronch Thanks for letting me know, I'm not a Windows dev so I didn't know that would be a problem. I've adjusted the code so it uses the cross platform way to get the env var.
I see you updated your comment, I've now changed it to use the env map and the env var enum.
yeah my bad, realized its not terribly useful to just say dont use something
Do we actually need this at all? Would it not be better to promote having libc.txt setup instead? Zig should parse libc.txt inferring sysroot and all relevant system include/lib dirs automatically. Unless I am missing the point of your change, then you could re-use ZIG_LIBC env var too https://github.com/ziglang/zig/blob/5005c6243a37f7fc9f23dae298b0dafa085fa044/src/main.zig#L983.
@kubkon I mainly did it this way because I needed to only change the system root but didn't want to write out an entire libc config file.