Commit ca1c185eb6
Changed files (1)
lib
std
zig
system
lib/std/zig/system/NativePaths.zig
@@ -135,6 +135,32 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
// zlib.h is in /usr/include (added above)
// libz.so.1 is in /lib/x86_64-linux-gnu (added here)
try self.addLibDirFmt("/lib/{s}", .{triple});
+
+ // NOTE: distro like guix doesn't use FHS, so it relies on envorinment
+ // variables (C_INCLUDE_PATH, CPLUS_INCLUDE_PATH and LIBRARY_PATH) to
+ // search for headers and libraries
+ // NOTE: we use os.getenv here since this part won't be executed on
+ // windows, to get rid of unnecessary error handling
+ if (std.os.getenv("C_INCLUDE_PATH")) |c_include_path| {
+ var it = mem.tokenize(u8, c_include_path, ":");
+ while (it.next()) |dir| {
+ try self.addIncludeDir(dir);
+ }
+ }
+
+ if (std.os.getenv("CPLUS_INCLUDE_PATH")) |cplus_include_path| {
+ var it = mem.tokenize(u8, cplus_include_path, ":");
+ while (it.next()) |dir| {
+ try self.addIncludeDir(dir);
+ }
+ }
+
+ if (std.os.getenv("LIBRARY_PATH")) |library_path| {
+ var it = mem.tokenize(u8, library_path, ":");
+ while (it.next()) |dir| {
+ try self.addLibDir(dir);
+ }
+ }
}
return self;