diff --git a/lib/compiler/Maker.zig b/lib/compiler/Maker.zig index 6cbe61a1b3509d633c48e083cdc6fdf853d306c9..b36f6e4e7da2388d368b6d1684c893f362c57a32 100644 --- a/lib/compiler/Maker.zig +++ b/lib/compiler/Maker.zig @@ -648,20 +648,31 @@ pub fn main(init: process.Init.Minimal) !void { .sub_path = "zig-out", }; - const install_lib_path: Path = if (override_lib_dir) |cwd_relative| .{ - .root_dir = .cwd(), - .sub_path = cwd_relative, - } else try install_prefix_path.join(arena, "lib"); + // These three overrides are meant to be relative to the install prefix, + // not current working directory, unless absolute paths are used. + const install_lib_path: Path = if (override_lib_dir) |lib_dir| + if (Dir.path.isAbsolute(lib_dir)) .{ + .root_dir = .cwd(), + .sub_path = lib_dir, + } else try install_prefix_path.join(arena, lib_dir) + else + try install_prefix_path.join(arena, "lib"); - const install_bin_path: Path = if (override_bin_dir) |cwd_relative| .{ - .root_dir = .cwd(), - .sub_path = cwd_relative, - } else try install_prefix_path.join(arena, "bin"); + const install_bin_path: Path = if (override_bin_dir) |bin_dir| + if (Dir.path.isAbsolute(bin_dir)) .{ + .root_dir = .cwd(), + .sub_path = bin_dir, + } else try install_prefix_path.join(arena, bin_dir) + else + try install_prefix_path.join(arena, "bin"); - const install_include_path: Path = if (override_include_dir) |cwd_relative| .{ - .root_dir = .cwd(), - .sub_path = cwd_relative, - } else try install_prefix_path.join(arena, "include"); + const install_include_path: Path = if (override_include_dir) |include_dir| + if (Dir.path.isAbsolute(include_dir)) .{ + .root_dir = .cwd(), + .sub_path = include_dir, + } else try install_prefix_path.join(arena, include_dir) + else + try install_prefix_path.join(arena, "include"); const now = Io.Clock.Timestamp.now(io, .awake);