mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
fix native path lookup on macOS
This commit is contained in:
parent
17c7a339d8
commit
f25de4c7a2
3 changed files with 6 additions and 10 deletions
|
|
@ -763,6 +763,9 @@ pub const EnvVar = enum {
|
|||
// Windows SDK integration
|
||||
PROGRAMDATA,
|
||||
|
||||
// Homebrew integration
|
||||
HOMEBREW_PREFIX,
|
||||
|
||||
pub fn isSet(ev: EnvVar, map: *const std.process.Environ.Map) bool {
|
||||
return map.contains(@tagName(ev));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ pub fn detect(
|
|||
}
|
||||
|
||||
// Check for homebrew paths
|
||||
if (std.posix.getenv("HOMEBREW_PREFIX")) |prefix| {
|
||||
if (std.zig.EnvVar.HOMEBREW_PREFIX.get(env_map)) |prefix| {
|
||||
try self.addLibDir(try std.fs.path.join(arena, &.{ prefix, "/lib" }));
|
||||
try self.addIncludeDir(try std.fs.path.join(arena, &.{ prefix, "/include" }));
|
||||
}
|
||||
|
|
@ -177,8 +177,6 @@ pub fn detect(
|
|||
|
||||
// Distros like guix don't use FHS, so they rely on environment
|
||||
// variables to search for headers and libraries.
|
||||
// We use os.getenv here since this part won't be executed on
|
||||
// windows, to get rid of unnecessary error handling.
|
||||
if (std.zig.EnvVar.C_INCLUDE_PATH.get(env_map)) |c_include_path| {
|
||||
var it = mem.tokenizeScalar(u8, c_include_path, ':');
|
||||
while (it.next()) |dir| {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,8 @@ const std = @import("std");
|
|||
const builtin = @import("builtin");
|
||||
|
||||
pub fn main(init: std.process.Init.Minimal) !void {
|
||||
if (builtin.target.os.tag == .windows) {
|
||||
return; // Windows env strings are WTF-16, so not supported by Zig's std.posix.getenv()
|
||||
}
|
||||
|
||||
if (builtin.target.os.tag == .wasi and !builtin.link_libc) {
|
||||
return; // std.posix.getenv is not supported on WASI due to the need of allocation
|
||||
}
|
||||
if (builtin.target.os.tag == .windows) return;
|
||||
if (builtin.target.os.tag == .wasi and !builtin.link_libc) return;
|
||||
|
||||
const environ = init.environ;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue