From 53b98f44a84e372125125c729be286f1c102a4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 6 Nov 2024 14:53:09 +0200 Subject: [PATCH] Update README --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c476cb..eabd237 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,29 @@ Building modern Zig from the original C++ implementation This repository explores building Zig from the C++ implementation without using binary blobs. [Forum post goes with this][1]. +Clone zig and prune binary files from history: + +``` +$ git clone --reference zig --dissociate https://github.com/ziglang/zig zig-nobinaries +$ cd zig-nobinaries +$ git filter-repo --prune-empty=never --prune-degenerate never --invert-paths --path-glob 'stage1/zig1.wasm*' --path stage1/zig1.c +``` + +Now build an isolated container with a bunch of zig historic dependencies: + ``` $ docker build -t zig-repro . $ docker run -ti --rm \ -v ~/code:/x \ -v /home/$USER/.cache/zig:/home/$USER/.cache/zig \ - -w /x \ + -w /x/zig \ zig-repro \ - sh -c "useradd -s /bin/bash $USER && cd zig && su $USER; bash" + sh -c "useradd -s /bin/bash -u $UID $USER && su $USER; bash" +``` + +And run the thing in the container: + +``` $ ../zig-repro/run ```