| ... | ... | @@ -384,20 +384,17 @@ fn applyArgs(b: *Build, args: anytype) !void { |
| 384 | 384 | }, |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | | const Hasher = std.crypto.auth.siphash.SipHash128(1, 3); |
| 387 | |
| 388 | // Create an installation directory local to this package. This will be used when |
| 389 | // dependant packages require a standard prefix, such as include directories for C headers. |
| 390 | var hash = b.cache.hash; |
| 388 | 391 | // Random bytes to make unique. Refresh this with new random bytes when |
| 389 | 392 | // implementation is modified in a non-backwards-compatible way. |
| 390 | | var hash = Hasher.init("ZaEsvQ5ClaA2IdH9"); |
| 391 | | hash.update(b.dep_prefix); |
| 393 | hash.add(@as(u32, 0xd8cb0055)); |
| 394 | hash.addBytes(b.dep_prefix); |
| 392 | 395 | // TODO additionally update the hash with `args`. |
| 393 | | |
| 394 | | var digest: [16]u8 = undefined; |
| 395 | | hash.final(&digest); |
| 396 | | var hash_basename: [digest.len * 2]u8 = undefined; |
| 397 | | _ = std.fmt.bufPrint(&hash_basename, "{s}", .{std.fmt.fmtSliceHexLower(&digest)}) catch |
| 398 | | unreachable; |
| 399 | | |
| 400 | | const install_prefix = try b.cache_root.join(b.allocator, &.{ "i", &hash_basename }); |
| 396 | const digest = hash.final(); |
| 397 | const install_prefix = try b.cache_root.join(b.allocator, &.{ "i", &digest }); |
| 401 | 398 | b.resolveInstallPrefix(install_prefix, .{}); |
| 402 | 399 | } |
| 403 | 400 | |