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(
10731073 .dirs = comp.dirs.withoutLocalCache(),
10741074 .thread_pool = comp.thread_pool,
10751075 .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,
10771079 .config = config,
10781080 .root_mod = root_mod,
10791081 .root_name = lib.name,
10801082 .libc_installation = comp.libc_installation,
1081 .emit_bin = .yes_cache,
1083 .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
10821084 .verbose_cc = comp.verbose_cc,
10831085 .verbose_link = comp.verbose_link,
10841086 .verbose_air = comp.verbose_air,
src/libs/glibc.zig+4-2
......@@ -1239,12 +1239,14 @@ fn buildSharedLib(
12391239 .dirs = comp.dirs.withoutLocalCache(),
12401240 .thread_pool = comp.thread_pool,
12411241 .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,
12431245 .config = config,
12441246 .root_mod = root_mod,
12451247 .root_name = lib.name,
12461248 .libc_installation = comp.libc_installation,
1247 .emit_bin = .yes_cache,
1249 .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
12481250 .verbose_cc = comp.verbose_cc,
12491251 .verbose_link = comp.verbose_link,
12501252 .verbose_air = comp.verbose_air,
src/libs/netbsd.zig+4-2
......@@ -737,12 +737,14 @@ fn buildSharedLib(
737737 .dirs = comp.dirs.withoutLocalCache(),
738738 .thread_pool = comp.thread_pool,
739739 .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,
741743 .config = config,
742744 .root_mod = root_mod,
743745 .root_name = lib.name,
744746 .libc_installation = comp.libc_installation,
745 .emit_bin = .yes_cache,
747 .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
746748 .verbose_cc = comp.verbose_cc,
747749 .verbose_link = comp.verbose_link,
748750 .verbose_air = comp.verbose_air,