| ... | @@ -384,20 +384,17 @@ fn applyArgs(b: *Build, args: anytype) !void { | ... | @@ -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 | // Random bytes to make unique. Refresh this with new random bytes when | 391 | // Random bytes to make unique. Refresh this with new random bytes when |
| 389 | // implementation is modified in a non-backwards-compatible way. | 392 | // implementation is modified in a non-backwards-compatible way. |
| 390 | var hash = Hasher.init("ZaEsvQ5ClaA2IdH9"); | 393 | hash.add(@as(u32, 0xd8cb0055)); |
| 391 | hash.update(b.dep_prefix); | 394 | hash.addBytes(b.dep_prefix); |
| 392 | // TODO additionally update the hash with `args`. | 395 | // TODO additionally update the hash with `args`. |
| 393 | | 396 | const digest = hash.final(); |
| 394 | var digest: [16]u8 = undefined; | 397 | const install_prefix = try b.cache_root.join(b.allocator, &.{ "i", &digest }); |
| 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 }); | | |
| 401 | b.resolveInstallPrefix(install_prefix, .{}); | 398 | b.resolveInstallPrefix(install_prefix, .{}); |
| 402 | } | 399 | } |
| 403 | | 400 | |