authorgravatar for sentrycraft123@gmail.comJan200101 <sentrycraft123@gmail.com> 2020-08-31 18:10:44+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-31 17:44:43-04:00
log2148336a8145c5db66bb0ea11ad02dd0813942f0
tree5636abef3f73d2750b4fc386ec0c662ed6772604
parent8dc58a4e944e5d319079a56802ce0824096bd7b5

follow filesystem hierarchy standard when adding lib directories


1 files changed, 4 insertions(+), 3 deletions(-)

lib/std/zig/system.zig+4-3
...@@ -88,6 +88,7 @@ pub const NativePaths = struct {...@@ -88,6 +88,7 @@ pub const NativePaths = struct {
8888
89 if (!is_windows) {89 if (!is_windows) {
90 const triple = try Target.current.linuxTriple(allocator);90 const triple = try Target.current.linuxTriple(allocator);
91 const qual = Target.current.cpu.arch.ptrBitWidth();
9192
92 // TODO: $ ld --verbose | grep SEARCH_DIR93 // TODO: $ ld --verbose | grep SEARCH_DIR
93 // the output contains some paths that end with lib64, maybe include them too?94 // the output contains some paths that end with lib64, maybe include them too?
...@@ -95,17 +96,17 @@ pub const NativePaths = struct {...@@ -95,17 +96,17 @@ pub const NativePaths = struct {
95 // TODO: some of these are suspect and should only be added on some systems. audit needed.96 // TODO: some of these are suspect and should only be added on some systems. audit needed.
9697
97 try self.addIncludeDir("/usr/local/include");98 try self.addIncludeDir("/usr/local/include");
99 try self.addLibDirFmt("/usr/local/lib{}", .{qual});
98 try self.addLibDir("/usr/local/lib");100 try self.addLibDir("/usr/local/lib");
99 try self.addLibDir("/usr/local/lib64");
100101
101 try self.addIncludeDirFmt("/usr/include/{}", .{triple});102 try self.addIncludeDirFmt("/usr/include/{}", .{triple});
102 try self.addLibDirFmt("/usr/lib/{}", .{triple});103 try self.addLibDirFmt("/usr/lib/{}", .{triple});
103104
104 try self.addIncludeDir("/usr/include");105 try self.addIncludeDir("/usr/include");
106 try self.addLibDirFmt("/lib{}", .{qual});
105 try self.addLibDir("/lib");107 try self.addLibDir("/lib");
106 try self.addLibDir("/lib64");108 try self.addLibDirFmt("/usr/lib{}", .{qual});
107 try self.addLibDir("/usr/lib");109 try self.addLibDir("/usr/lib");
108 try self.addLibDir("/usr/lib64");
109110
110 // example: on a 64-bit debian-based linux distro, with zlib installed from apt:111 // example: on a 64-bit debian-based linux distro, with zlib installed from apt:
111 // zlib.h is in /usr/include (added above)112 // zlib.h is in /usr/include (added above)