authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-06-08 22:57:37+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-06-12 17:51:29+01:00
loge28b699cbfa4390366d68784b896ee2662af411d
treee5e8726d7ddf595856e809dbfe2d67496e088100
parentac745edbbd6687c5898bb3a50bf9d31d86e57b9e
signaturelock-open Commit is signed but in an unrecognized format.

libs: fix caching behavior

glibc, freebsd, and netbsd all do caching manually, because of the fact that they emit multiple files which they want to cache as a block. Therefore, the individual sub-compilation on a cache miss should be using `CacheMode.none` so that we can specify the output paths for each sub-compilation as being in the shared output directory.

3 files changed, 12 insertions(+), 6 deletions(-)

src/libs/freebsd.zig+4-2
...@@ -1073,12 +1073,14 @@ fn buildSharedLib(...@@ -1073,12 +1073,14 @@ fn buildSharedLib(
1073 .dirs = comp.dirs.withoutLocalCache(),1073 .dirs = comp.dirs.withoutLocalCache(),
1074 .thread_pool = comp.thread_pool,1074 .thread_pool = comp.thread_pool,
1075 .self_exe_path = comp.self_exe_path,1075 .self_exe_path = comp.self_exe_path,
1076 .cache_mode = .incremental,1076 // Because we manually cache the whole set of objects, we don't cache the individual objects
1077 // within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path.
1078 .cache_mode = .none,
1077 .config = config,1079 .config = config,
1078 .root_mod = root_mod,1080 .root_mod = root_mod,
1079 .root_name = lib.name,1081 .root_name = lib.name,
1080 .libc_installation = comp.libc_installation,1082 .libc_installation = comp.libc_installation,
1081 .emit_bin = .yes_cache,1083 .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
1082 .verbose_cc = comp.verbose_cc,1084 .verbose_cc = comp.verbose_cc,
1083 .verbose_link = comp.verbose_link,1085 .verbose_link = comp.verbose_link,
1084 .verbose_air = comp.verbose_air,1086 .verbose_air = comp.verbose_air,
src/libs/glibc.zig+4-2
...@@ -1239,12 +1239,14 @@ fn buildSharedLib(...@@ -1239,12 +1239,14 @@ fn buildSharedLib(
1239 .dirs = comp.dirs.withoutLocalCache(),1239 .dirs = comp.dirs.withoutLocalCache(),
1240 .thread_pool = comp.thread_pool,1240 .thread_pool = comp.thread_pool,
1241 .self_exe_path = comp.self_exe_path,1241 .self_exe_path = comp.self_exe_path,
1242 .cache_mode = .incremental,1242 // Because we manually cache the whole set of objects, we don't cache the individual objects
1243 // within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path.
1244 .cache_mode = .none,
1243 .config = config,1245 .config = config,
1244 .root_mod = root_mod,1246 .root_mod = root_mod,
1245 .root_name = lib.name,1247 .root_name = lib.name,
1246 .libc_installation = comp.libc_installation,1248 .libc_installation = comp.libc_installation,
1247 .emit_bin = .yes_cache,1249 .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
1248 .verbose_cc = comp.verbose_cc,1250 .verbose_cc = comp.verbose_cc,
1249 .verbose_link = comp.verbose_link,1251 .verbose_link = comp.verbose_link,
1250 .verbose_air = comp.verbose_air,1252 .verbose_air = comp.verbose_air,
src/libs/netbsd.zig+4-2
...@@ -737,12 +737,14 @@ fn buildSharedLib(...@@ -737,12 +737,14 @@ fn buildSharedLib(
737 .dirs = comp.dirs.withoutLocalCache(),737 .dirs = comp.dirs.withoutLocalCache(),
738 .thread_pool = comp.thread_pool,738 .thread_pool = comp.thread_pool,
739 .self_exe_path = comp.self_exe_path,739 .self_exe_path = comp.self_exe_path,
740 .cache_mode = .incremental,740 // Because we manually cache the whole set of objects, we don't cache the individual objects
741 // within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path.
742 .cache_mode = .none,
741 .config = config,743 .config = config,
742 .root_mod = root_mod,744 .root_mod = root_mod,
743 .root_name = lib.name,745 .root_name = lib.name,
744 .libc_installation = comp.libc_installation,746 .libc_installation = comp.libc_installation,
745 .emit_bin = .yes_cache,747 .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
746 .verbose_cc = comp.verbose_cc,748 .verbose_cc = comp.verbose_cc,
747 .verbose_link = comp.verbose_link,749 .verbose_link = comp.verbose_link,
748 .verbose_air = comp.verbose_air,750 .verbose_air = comp.verbose_air,