From 7e973cce52caeadaa9dcd4b5b6b7f53372e0aa0e Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 29 Jun 2026 14:49:56 +0100 Subject: [PATCH] depends: Make tarball creation from local directory reproducible This guarantees `$(package)_sha256_hash` reproducibility regardless of the default behavior of `$(build_TAR)`. Fixes caching on some systems, for example, on FreeBSD. --- depends/funcs.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/depends/funcs.mk b/depends/funcs.mk index f6221ef18f8..85e28792358 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -47,7 +47,11 @@ endef define fetch_local_dir_sha256 if ! [ -f $($(1)_source) ] || [ -n "$$(find $($(1)_local_dir) -newer $($(1)_source) | head -n1)" ]; then \ mkdir -p $(dir $($(1)_source)) && \ - $(build_TAR) -c -f $($(1)_source) -C $($(1)_local_dir) . && \ + ( \ + cd $($(1)_local_dir) && \ + find . -print0 | TZ=UTC xargs -0r $(build_TOUCH) && \ + find . | LC_ALL=C sort | $(build_TAR) --no-recursion -c -f $($(1)_source) -T - \ + ) && \ rm -f $($(1)_fetched); \ fi && \ if ! [ -f $($(1)_fetched) ] || [ -n "$$(find $($(1)_source) -newer $($(1)_fetched))" ]; then \