summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaulsnar2022-09-06 09:31:12 +0300
committerTechcable2022-09-06 00:20:46 -0700
commit87fa99ccddcb4473bc0df5647b461af95ca93f4f (patch)
tree14b4ade7c53e95791bc1e7577798244d55eeb295
parent88ef61600851942cfa111ced965eece1ff75be08 (diff)
downloadaur-87fa99ccddcb4473bc0df5647b461af95ca93f4f.tar.gz
package: Cache build artifacts locally for zig run and test
> Secondarily, while I appreciate that check really makes sure that Zig works, the way it's implemented currently litters the default Zig cache (located under $HOME by default) with build products. If I may suggest, isolating Zig to either not use a build cache at all or to keep it confined to the build environment would be preferrable. > - @paulsnar (on AUR) Luckily paulsnar fixed his own bug report, by emailing me a patch ;) Unfortunately, there is no way to disable caching right now (see zig issue #12317), so using a local cache is the best option. Elaborated-by: Techcable <Techcable@techcable.net>
-rw-r--r--PKGBUILD12
1 files changed, 9 insertions, 3 deletions
diff --git a/PKGBUILD b/PKGBUILD
index daf4da3c6fd5..6dae8db3a9c8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -79,11 +79,17 @@ RELATIVE_LANGREF_FILE="docs/langref.html";
RELATIVE_STDLIB_DOC_FILES=("docs/std/index.html" "docs/std/main.js" "docs/std/data.js");
check() {
hello_file="$(realpath ../hello.zig)"
+ # Zig caches (both local and global) can use up a lot of space.
+ # For these hello world examples (in a frequently updated package), this is very wasteful.
+ #
+ # Right now there is no way to disable the cache (see Zig issue #12317)
+ # Instead we shove everything in a local directory
+ cache_dir="${srcdir}/zig-cache"
cd "${srcdir}/zig-linux-${CARCH}-${pkgver//_/-}";
echo "Running Zig Hello World"
- ./zig run "$hello_file"
- ./zig test "$hello_file"
- echo "Checking for docs...."
+ ./zig run --cache-dir "$cache_dir" --global-cache-dir "$cache_dir" "$hello_file"
+ ./zig test --cache-dir "$cache_dir" --global-cache-dir "$cache_dir" "$hello_file"
+ rm -rf "$cache_dir";
local missing_docs=();
# Zig has had long-running issues with the location
# of the docs directory.