Commit9cfdafbcRecorded25 Jul 2026Repositorycore-channel

Establish the core Sigil channel

Changed
 .gitignore                     |  7 +++++++
 README.md                      | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 bootstrap                      | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 demo/env.sgl                   |  2 ++
 recipes/collision-a.sgl        |  7 +++++++
 recipes/collision-b.sgl        |  7 +++++++
 recipes/emacs-nox.sgl          | 39 +++++++++++++++++++++++++++++++++++++++
 recipes/hello.sgl              | 10 ++++++++++
 recipes/ncurses.sgl            | 21 +++++++++++++++++++++
 recipes/vim.sgl                | 30 ++++++++++++++++++++++++++++++
 recipes/zlib.sgl               | 10 ++++++++++
 scripts/gate-concurrency.sh    | 30 ++++++++++++++++++++++++++++++
 scripts/gate-crosscheckout.sh  | 17 +++++++++++++++++
 scripts/gate-crosspath.sh      |  5 +++++
 scripts/gate-hash-verify.sh    | 25 +++++++++++++++++++++++++
 seed/MANIFEST                  |  3 +++
 seed/MANIFEST.sources          |  7 +++++++
 seed/scripts/build-seed.sh     | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 seed/scripts/gate-crosspath.sh | 39 +++++++++++++++++++++++++++++++++++++++
 seed/scripts/package-seed.sh   | 10 ++++++++++
 seed/scripts/verify-sources.sh |  9 +++++++++
 toolchain/MANIFEST             |  2 ++
 toolchain/setup.sh             | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 23 files changed, 517 insertions(+)
Diff
.gitignoreadded
@@ -0,0 +1,7 @@
+1
seed/seed-x86_64-linux.tar.gz
+2
seed/seed-x86_64-linux.tar.gz.sha256
+3
seed/out/
+4
seed/sources/
+5
toolchain/bin/
+6
toolchain/zig-x86_64-linux-0.16.0/
+7
toolchain/zig-x86_64-linux-0.16.0.tar.xz
README.mdadded
@@ -0,0 +1,55 @@
+1
# core-channel
+2
+3
`core-channel` is the authoring repository behind Sigil's `core/` package
+4
scope. A channel is a versioned directory of recipes plus the pinned build
+5
inputs needed to realize them. The repository contains recipes and manifests;
+6
generated toolchains, source archives, build output, and the seed tarball are
+7
deliberately not committed.
+8
+9
## Clone, bootstrap, enter
+10
+11
On x86_64 Linux, a checkout becomes a working `--channel` directory with:
+12
+13
```sh
+14
./bootstrap
+15
SIGIL_CHANNEL="$PWD" sigil env shell -f demo/env.sgl -- hello
+16
```
+17
+18
`bootstrap` downloads the seed and Zig archives from their manifest URLs,
+19
verifies their SHA-256 hashes before installation, and refuses altered or
+20
unexpected content. It requires `sh`, `sha256sum`, `tar`, and either `curl` or
+21
`wget` on the host.
+22
+23
Recipes are published under the `core/` scope by filename: for example,
+24
`recipes/hello.sgl` resolves as `core/hello`. An environment names exact recipe
+25
versions; `sigil env` resolves the recipe closure, realizes missing outputs,
+26
and builds a shell PATH from the verified results. Recipe changes and input
+27
hash changes are reviewed as source changes in this repository.
+28
+29
## Repository layout
+30
+31
- `recipes/`: reviewed package recipes.
+32
- `seed/MANIFEST`: pinned downloadable seed artifact.
+33
- `seed/MANIFEST.sources` and `seed/scripts/`: pinned seed sources and the
+34
reproducible seed build.
+35
- `toolchain/MANIFEST`: pinned Zig distribution.
+36
- `bootstrap`: verified materialization of ignored binary inputs.
+37
- `scripts/gate-*`: permanent reproducibility, isolation, tamper, and
+38
concurrency checks.
+39
+40
Release `seed-v1` must carry `seed-x86_64-linux.tar.gz` with the exact hash in
+41
`seed/MANIFEST`. The release asset is produced with
+42
`seed/scripts/build-seed.sh`; it is never added to Git.
+43
+44
## Gates
+45
+46
```sh
+47
scripts/gate-hash-verify.sh
+48
scripts/gate-crosscheckout.sh
+49
scripts/gate-crosspath.sh
+50
SIGIL_BIN="$(command -v sigil)" scripts/gate-concurrency.sh
+51
```
+52
+53
The fresh-clone gate accepts `SIGIL_BOOTSTRAP_SEED_URL` and
+54
`SIGIL_BOOTSTRAP_ZIG_URL` solely to test unpublished release assets or local
+55
mirrors. Overrides change locations, never expected hashes.
bootstrapadded
@@ -0,0 +1,50 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+5
+6
fetch() {
+7
manifest=$1
+8
base=$2
+9
override=${3:-}
+10
+11
while IFS=' ' read -r expected url file rest; do
+12
case "$expected" in ''|'#'*) continue ;; esac
+13
[ -z "${rest:-}" ] || { echo "bootstrap: malformed manifest row: $manifest" >&2; exit 1; }
+14
target="$base/$file"
+15
source=$url
+16
[ -z "$override" ] || source=$override
+17
mkdir -p "$(dirname -- "$target")"
+18
+19
if [ -f "$target" ]; then
+20
actual=$(sha256sum "$target" | awk '{print $1}')
+21
[ "$actual" = "$expected" ] && continue
+22
echo "bootstrap: cached hash mismatch, fetching $file again" >&2
+23
fi
+24
+25
tmp="$target.part.$$"
+26
rm -f "$tmp"
+27
trap 'rm -f "$tmp"' EXIT HUP INT TERM
+28
if command -v curl >/dev/null 2>&1; then
+29
curl --fail --location --silent --show-error "$source" --output "$tmp"
+30
elif command -v wget >/dev/null 2>&1; then
+31
wget -q "$source" -O "$tmp"
+32
else
+33
echo "bootstrap: curl or wget is required" >&2
+34
exit 1
+35
fi
+36
actual=$(sha256sum "$tmp" | awk '{print $1}')
+37
[ "$actual" = "$expected" ] || {
+38
echo "bootstrap: REFUSING $file: sha256 mismatch; expected $expected, got $actual" >&2
+39
exit 1
+40
}
+41
mv "$tmp" "$target"
+42
trap - EXIT HUP INT TERM
+43
done < "$manifest"
+44
}
+45
+46
fetch "$root/seed/MANIFEST" "$root/seed" "${SIGIL_BOOTSTRAP_SEED_URL:-}"
+47
fetch "$root/toolchain/MANIFEST" "$root/toolchain" "${SIGIL_BOOTSTRAP_ZIG_URL:-}"
+48
"$root/toolchain/setup.sh"
+49
echo "bootstrap: channel ready at $root"
+50
demo/env.sgladded
@@ -0,0 +1,2 @@
+1
(environment packages: (list (pkg "hello" version: "2.12.2")))
+2
recipes/collision-a.sgladded
@@ -0,0 +1,7 @@
+1
(recipe
+2
name: "collision-a"
+3
version: "1.0.0"
+4
source: (url "https://ftp.gnu.org/gnu/hello/hello-2.12.2.tar.gz"
+5
sha256: "5a9a996dc292cc24dcf411cee87e92f6aae5b8d13bd9c6819b4c7a9dce0818ab")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
phases: (list (configure args: ("--prefix=/out")) (make) (install)))
recipes/collision-b.sgladded
@@ -0,0 +1,7 @@
+1
(recipe
+2
name: "collision-b"
+3
version: "1.0.0"
+4
source: (url "https://ftp.gnu.org/gnu/hello/hello-2.12.2.tar.gz"
+5
sha256: "5a9a996dc292cc24dcf411cee87e92f6aae5b8d13bd9c6819b4c7a9dce0818ab")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
phases: (list (configure args: ("--prefix=/out")) (make) (install)))
recipes/emacs-nox.sgladded
@@ -0,0 +1,39 @@
+1
(recipe
+2
name: "emacs-nox"
+3
version: "30.2"
+4
source: (url "https://ftp.gnu.org/gnu/emacs/emacs-30.2.tar.xz"
+5
sha256: "b3f36f18a6dd2715713370166257de2fae01f9d38cfe878ced9b1e6ded5befd9")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
deps: (list "8f7a34a579fc6badbc317fad048127801f1b0a747d7da90b4603c7297ab8df97"
+8
"1e93cdda62486ac8260d381af70ffc8c7a1dc601277662f63bbb528802bd7d07")
+9
divergences: (list
+10
(allow file-glob: "libexec/emacs/*/*.pdmp"
+11
max-differing-bytes: 64))
+12
phases: (list
+13
(configure args: ("--prefix=/out"
+14
"--without-x"
+15
"--with-x-toolkit=no"
+16
"--without-native-compilation"
+17
"--without-tree-sitter"
+18
"--without-sqlite3"
+19
"--without-libsystemd"
+20
"--without-gnutls"
+21
"--without-xml2"
+22
"--without-harfbuzz"
+23
"--without-cairo"
+24
"--without-dbus"
+25
"--without-gif"
+26
"--without-jpeg"
+27
"--without-png"
+28
"--without-rsvg"
+29
"--without-tiff"
+30
"--without-webp"
+31
"--without-xpm"
+32
"--without-sound"
+33
"--without-gpm"
+34
"--without-selinux"
+35
"--without-modules"
+36
"--without-pop"
+37
"--without-mailutils"))
+38
(make)
+39
(install)))
recipes/hello.sgladded
@@ -0,0 +1,10 @@
+1
(recipe
+2
name: "hello"
+3
version: "2.12.2"
+4
source: (url "https://ftp.gnu.org/gnu/hello/hello-2.12.2.tar.gz"
+5
sha256: "5a9a996dc292cc24dcf411cee87e92f6aae5b8d13bd9c6819b4c7a9dce0818ab")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
phases: (list
+8
(configure args: ("--prefix=/out"))
+9
(make)
+10
(install)))
recipes/ncurses.sgladded
@@ -0,0 +1,21 @@
+1
(recipe
+2
name: "ncurses"
+3
version: "6.6"
+4
source: (url "https://ftp.gnu.org/gnu/ncurses/ncurses-6.6.tar.gz"
+5
sha256: "355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
phases: (list
+8
(configure args: ("--prefix=/out"
+9
"--without-ada"
+10
"--without-tests"
+11
"--without-cxx"
+12
"--without-cxx-binding"
+13
"--without-debug"
+14
"--disable-stripping"
+15
"--without-shared"
+16
"--with-normal"
+17
"--enable-widec"
+18
"--with-default-terminfo-dir=/out/share/terminfo"
+19
"--with-terminfo-dirs=/out/share/terminfo"))
+20
(make)
+21
(install args: ("ticdir=/tmp/sigil-channel/build/out/share/terminfo"))))
recipes/vim.sgladded
@@ -0,0 +1,30 @@
+1
(recipe
+2
name: "vim"
+3
version: "9.1.1164"
+4
source: (url "https://github.com/vim/vim/archive/refs/tags/v9.1.1164.tar.gz"
+5
sha256: "101526fa580d015edc5b5fb059d8b396cd8b05c29b0ec9ceb2a8763083293979")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
deps: (list "8f7a34a579fc6badbc317fad048127801f1b0a747d7da90b4603c7297ab8df97")
+8
phases: (list
+9
(configure args: ("--prefix=/out"
+10
"--with-features=normal"
+11
"--with-tlib=ncursesw"
+12
"--enable-multibyte"
+13
"--disable-gui"
+14
"--without-x"
+15
"--disable-gtk2-check"
+16
"--disable-gnome-check"
+17
"--disable-motif-check"
+18
"--disable-athena-check"
+19
"--disable-fontset"
+20
"--disable-acl"
+21
"--disable-gpm"
+22
"--disable-canberra"
+23
"--disable-libsodium"
+24
"--disable-selinux"
+25
"--disable-nls"
+26
"--disable-netbeans"
+27
"--with-compiledby=Sigil"))
+28
(make args: ("VIMRCLOC=/out/share/vim"
+29
"VIMRUNTIMEDIR=/out/share/vim/vim91"))
+30
(install)))
recipes/zlib.sgladded
@@ -0,0 +1,10 @@
+1
(recipe
+2
name: "zlib"
+3
version: "1.3.1"
+4
source: (url "https://zlib.net/fossils/zlib-1.3.1.tar.gz"
+5
sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23")
+6
buildenv: "894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb"
+7
phases: (list
+8
(configure args: ("--prefix=/out"))
+9
(make)
+10
(install)))
scripts/gate-concurrency.shadded
@@ -0,0 +1,30 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
sigil_bin=${SIGIL_BIN:?set SIGIL_BIN to the production sigil binary}
+5
channel=${SIGIL_CHANNEL:-$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)}
+6
recipe=${1:-zlib}
+7
gate_root=$(mktemp -d /tmp/sigil-channel-concurrency.XXXXXX)
+8
store=$gate_root/store
+9
+10
realize_pair() {
+11
label=$1
+12
"$sigil_bin" external-build realize "$recipe" --channel "$channel" --store "$store" \
+13
>"$gate_root/$label.a" 2>"$gate_root/$label.a.err" &
+14
pid_a=$!
+15
"$sigil_bin" external-build realize "$recipe" --channel "$channel" --store "$store" \
+16
>"$gate_root/$label.b" 2>"$gate_root/$label.b.err" &
+17
pid_b=$!
+18
wait "$pid_a"
+19
wait "$pid_b"
+20
hash_a=$(tail -n 1 "$gate_root/$label.a")
+21
hash_b=$(tail -n 1 "$gate_root/$label.b")
+22
test "$hash_a" = "$hash_b"
+23
printf '%s statuses=0,0 hash=%s\n' "$label" "$hash_a"
+24
}
+25
+26
# The first pair intentionally starts with neither source nor derivation in the
+27
# fresh store. The second pair retains the original warm-hit race coverage.
+28
realize_pair cold
+29
realize_pair warm
+30
printf 'transcripts=%s\n' "$gate_root"
scripts/gate-crosscheckout.shadded
@@ -0,0 +1,17 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+5
sigil_bin=${SIGIL_BIN:?set SIGIL_BIN to a sigil binary with env support}
+6
scratch=$(mktemp -d /tmp/sigil-channel-clone.XXXXXX)
+7
trap 'rm -rf "$scratch"' EXIT HUP INT TERM
+8
git clone --quiet --no-hardlinks "$repo" "$scratch/core-channel"
+9
+10
SIGIL_BOOTSTRAP_SEED_URL="${SIGIL_BOOTSTRAP_SEED_URL:-}" \
+11
SIGIL_BOOTSTRAP_ZIG_URL="${SIGIL_BOOTSTRAP_ZIG_URL:-}" \
+12
"$scratch/core-channel/bootstrap"
+13
+14
HOME="$scratch/home" SIGIL_CHANNEL="$scratch/core-channel" \
+15
"$sigil_bin" env --store "$scratch/store" shell \
+16
-f "$scratch/core-channel/demo/env.sgl" -- hello
+17
echo "cross-checkout gate: fresh clone, bootstrap, and sigil env shell green"
scripts/gate-crosspath.shadded
@@ -0,0 +1,5 @@
+1
#!/bin/sh
+2
set -eu
+3
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+4
exec "$root/seed/scripts/gate-crosspath.sh" "$@"
+5
scripts/gate-hash-verify.shadded
@@ -0,0 +1,25 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+5
scratch=$(mktemp -d /tmp/sigil-channel-hash.XXXXXX)
+6
trap 'rm -rf "$scratch"' EXIT HUP INT TERM
+7
git clone --quiet --no-hardlinks "$repo" "$scratch/channel"
+8
+9
manifest="$scratch/channel/seed/MANIFEST"
+10
awk 'BEGIN { changed=0 }
+11
/^#/ || NF == 0 { print; next }
+12
changed == 0 { sub(/^./, "0"); changed=1 }
+13
{ print }
+14
' "$manifest" > "$manifest.tampered"
+15
mv "$manifest.tampered" "$manifest"
+16
+17
set +e
+18
SIGIL_BOOTSTRAP_SEED_URL="${SIGIL_BOOTSTRAP_SEED_URL:?set SIGIL_BOOTSTRAP_SEED_URL to the seed archive}" \
+19
SIGIL_BOOTSTRAP_ZIG_URL="${SIGIL_BOOTSTRAP_ZIG_URL:-}" \
+20
"$scratch/channel/bootstrap" >"$scratch/out" 2>&1
+21
status=$?
+22
set -e
+23
[ "$status" -ne 0 ] || { echo "hash gate: bootstrap accepted a tampered hash" >&2; exit 1; }
+24
grep -q 'REFUSING.*sha256 mismatch' "$scratch/out"
+25
echo "hash gate: tampered manifest refused"
seed/MANIFESTadded
@@ -0,0 +1,3 @@
+1
# sha256 url file
+2
894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb https://codeberg.org/sigil/core-channel/releases/download/seed-v1/seed-x86_64-linux.tar.gz seed-x86_64-linux.tar.gz
+3
seed/MANIFEST.sourcesadded
@@ -0,0 +1,7 @@
+1
# sha256 url file
+2
3311dff32e746499f4df0d5df04d7eb396382d7e108bb9250e7b519b837043a4 https://busybox.net/downloads/busybox-1.37.0.tar.bz2 sources/busybox-1.37.0.tar.bz2
+3
8814ba072182b605d156d7589c19a43b89fc58ea479b9355146160946f8cf6e9 https://ftp.gnu.org/gnu/make/make-4.4.1.tar.lz sources/make-4.4.1.tar.lz
+4
1ac1656debb27497563036f7bffc281490f83f9b8457c0d60bcfb638fb6b6171 https://distfiles.ariadne.space/pkgconf/pkgconf-1.9.5.tar.xz sources/pkgconf-1.9.5.tar.xz
+5
5a9a996dc292cc24dcf411cee87e92f6aae5b8d13bd9c6819b4c7a9dce0818ab https://ftp.gnu.org/gnu/hello/hello-2.12.2.tar.gz sources/hello-2.12.2.tar.gz
+6
+7
# deterministic output: 894ca74bdb03c25d79f00ce915bbe25c56eba192334963c69e1846e6c84526cb seed-x86_64-linux.tar.gz
seed/scripts/build-seed.shadded
@@ -0,0 +1,71 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
seed=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+5
repo=$(CDPATH= cd -- "$seed/.." && pwd)
+6
work=/tmp/sigil-channel/seed-build
+7
rm -rf "$work"
+8
mkdir -p "$work"
+9
export ZIG_GLOBAL_CACHE_DIR="$work/zig-global-cache"
+10
export ZIG_LOCAL_CACHE_DIR="$work/zig-local-cache"
+11
export KCONFIG_NOTIMESTAMP=1
+12
export SOURCE_DATE_EPOCH=0
+13
jobs=${JOBS:-$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)}
+14
cc="$repo/toolchain/bin/x86_64-linux-musl-cc"
+15
ar="$repo/toolchain/bin/x86_64-linux-musl-ar"
+16
ranlib="$repo/toolchain/bin/x86_64-linux-musl-ranlib"
+17
copy_strip="$repo/toolchain/bin/copy-strip"
+18
map_flags="-g0 -ffile-prefix-map=$work=. -fdebug-prefix-map=$work=. -ffile-prefix-map=$repo=. -fdebug-prefix-map=$repo=."
+19
+20
"$seed/scripts/verify-sources.sh"
+21
rm -rf "$seed/out"
+22
mkdir -p "$seed/out/bin"
+23
+24
tar -C "$work" -xf "$seed/sources/make-4.4.1.tar.lz"
+25
(
+26
cd "$work/make-4.4.1"
+27
CC="$cc" AR="$ar" RANLIB="$ranlib" LD="$cc" CFLAGS="$map_flags" ./configure --disable-nls --without-guile --disable-dependency-tracking LDFLAGS="-static -s"
+28
CC="$cc" CFLAGS="$map_flags" ./build.sh
+29
cp make "$work/bootstrap-make"
+30
)
+31
make="$work/bootstrap-make"
+32
+33
tar -C "$work" -xf "$seed/sources/busybox-1.37.0.tar.bz2"
+34
(
+35
cd "$work/busybox-1.37.0"
+36
# Zig 0.16's linker rejects GNU ld's diagnostic-only --warn-common flag.
+37
sed -i 's/-Wl,--warn-common //g; /-Wl,--warn-common \\/d; s@echo "-Wl,-Map,$EXE.map -Wl,--verbose"@echo ""@' scripts/trylink
+38
"$make" defconfig HOSTCC="$cc"
+39
sed -i 's/^# CONFIG_STATIC is not set$/CONFIG_STATIC=y/' .config
+40
sed -i 's/^CONFIG_TC=y$/# CONFIG_TC is not set/' .config
+41
sed -i 's/^CONFIG_EXTRA_LDFLAGS=""$/CONFIG_EXTRA_LDFLAGS="-s"/' .config
+42
"$make" -j"$jobs" CC="$cc" HOSTCC="$cc" AR="$ar" RANLIB="$ranlib" STRIP="$copy_strip" KCFLAGS="$map_flags" HOSTCFLAGS="$map_flags"
+43
cp busybox "$seed/out/bin/busybox"
+44
)
+45
+46
(
+47
cd "$work/make-4.4.1"
+48
cp make "$seed/out/bin/make"
+49
)
+50
+51
tar -C "$work" -xf "$seed/sources/pkgconf-1.9.5.tar.xz"
+52
(
+53
cd "$work/pkgconf-1.9.5"
+54
CC="$cc" AR="$ar" RANLIB="$ranlib" LD="$cc" CFLAGS="$map_flags" ./configure \
+55
--prefix=/usr \
+56
--with-pkg-config-dir=/usr/lib/pkgconfig:/usr/share/pkgconfig \
+57
--with-system-libdir=/usr/lib \
+58
--with-system-includedir=/usr/include \
+59
--disable-shared --enable-static --disable-dependency-tracking LDFLAGS="-static -s"
+60
"$make" -j"$jobs"
+61
cp pkgconf "$seed/out/bin/pkgconf"
+62
)
+63
+64
ln -s pkgconf "$seed/out/bin/pkg-config"
+65
"$seed/out/bin/busybox" --list | while IFS= read -r applet; do
+66
case "$applet" in busybox|make|pkgconf|pkg-config|'['|'[[') continue ;; esac
+67
ln -s busybox "$seed/out/bin/$applet"
+68
done
+69
+70
"$seed/scripts/package-seed.sh"
+71
"$seed/out/bin/busybox" echo "seed binaries built for static musl target"
seed/scripts/gate-crosspath.shadded
@@ -0,0 +1,39 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
seed=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+5
repo=$(CDPATH= cd -- "$seed/.." && pwd)
+6
scratch=$(mktemp -d /tmp/sigil-channel-crosspath.XXXXXX)
+7
clone="$scratch/clone"
+8
cleanup() { rm -rf "$scratch"; }
+9
trap cleanup EXIT HUP INT TERM
+10
+11
fetch_sources() {
+12
target=$1
+13
mkdir -p "$target/seed/sources"
+14
while IFS=' ' read -r hash url file rest; do
+15
case "$hash" in ''|'#'*) continue ;; esac
+16
curl --fail --location --silent --show-error "$url" --output "$target/seed/$file"
+17
actual=$(sha256sum "$target/seed/$file" | awk '{print $1}')
+18
[ "$actual" = "$hash" ] || { echo "source hash mismatch: $file" >&2; exit 1; }
+19
done < "$target/seed/MANIFEST.sources"
+20
}
+21
+22
fetch_sources "$repo"
+23
"$seed/scripts/build-seed.sh"
+24
primary=$(awk '{print $1}' "$seed/seed-x86_64-linux.tar.gz.sha256")
+25
+26
git clone --quiet --no-hardlinks "$repo" "$clone"
+27
SIGIL_BOOTSTRAP_SEED_URL="${SIGIL_BOOTSTRAP_SEED_URL:-}" \
+28
SIGIL_BOOTSTRAP_ZIG_URL="${SIGIL_BOOTSTRAP_ZIG_URL:-}" "$clone/bootstrap"
+29
fetch_sources "$clone"
+30
"$clone/seed/scripts/build-seed.sh"
+31
rebuilt=$(awk '{print $1}' "$clone/seed/seed-x86_64-linux.tar.gz.sha256")
+32
+33
echo "primary=$primary"
+34
echo "crosspath=$rebuilt"
+35
if [ "$primary" != "$rebuilt" ]; then
+36
echo "cross-path seed hash mismatch" >&2
+37
exit 1
+38
fi
+39
echo "MATCH"
seed/scripts/package-seed.shadded
@@ -0,0 +1,10 @@
+1
#!/bin/sh
+2
set -eu
+3
seed=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+4
archive="$seed/seed-x86_64-linux.tar.gz"
+5
SOURCE_DATE_EPOCH=0 tar --sort=name --format=gnu --mtime='@0' --owner=0 --group=0 --numeric-owner -C "$seed/out" -cf - . | gzip -n > "$archive"
+6
(
+7
cd "$seed"
+8
sha256sum seed-x86_64-linux.tar.gz > seed-x86_64-linux.tar.gz.sha256
+9
)
+10
cat "$archive.sha256"
seed/scripts/verify-sources.shadded
@@ -0,0 +1,9 @@
+1
#!/bin/sh
+2
set -eu
+3
seed=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+4
while read -r hash url file; do
+5
case "$hash" in ''|'#'*) continue ;; esac
+6
actual=$(sha256sum "$seed/$file" | awk '{print $1}')
+7
[ "$actual" = "$hash" ] || { echo "sha256 mismatch: $file" >&2; exit 1; }
+8
echo "verified $file"
+9
done < "$seed/MANIFEST"
toolchain/MANIFESTadded
@@ -0,0 +1,2 @@
+1
# sha256 url file
+2
70e49664a74374b48b51e6f3fdfbf437f6395d42509050588bd49abe52ba3d00 https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz zig-x86_64-linux-0.16.0.tar.xz
toolchain/setup.shadded
@@ -0,0 +1,61 @@
+1
#!/bin/sh
+2
set -eu
+3
+4
root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+5
archive="$root/zig-x86_64-linux-0.16.0.tar.xz"
+6
expected=$(awk 'NF && $1 !~ /^#/ { print $1; exit }' "$root/MANIFEST")
+7
actual=$(sha256sum "$archive" | awk '{print $1}')
+8
[ "$actual" = "$expected" ] || { echo "zig sha256 mismatch" >&2; exit 1; }
+9
+10
rm -rf "$root/zig-x86_64-linux-0.16.0" "$root/bin"
+11
tar -C "$root" -xf "$archive"
+12
mkdir -p "$root/bin"
+13
ln -s ../zig-x86_64-linux-0.16.0/zig "$root/bin/zig"
+14
cat > "$root/bin/x86_64-linux-musl-cc" <<'EOF'
+15
#!/bin/sh
+16
set -eu
+17
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+18
export ZIG_GLOBAL_CACHE_DIR=${ZIG_GLOBAL_CACHE_DIR:-/tmp/sigil-channel/zig-global-cache}
+19
export ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR:-/tmp/sigil-channel/zig-local-cache}
+20
exec "$here/zig" cc -target x86_64-linux-musl "$@"
+21
EOF
+22
chmod +x "$root/bin/x86_64-linux-musl-cc"
+23
cat > "$root/bin/x86_64-linux-musl-ar" <<'EOF'
+24
#!/bin/sh
+25
set -eu
+26
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+27
exec "$here/zig" ar "$@"
+28
EOF
+29
cat > "$root/bin/x86_64-linux-musl-ranlib" <<'EOF'
+30
#!/bin/sh
+31
set -eu
+32
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+33
exec "$here/zig" ranlib "$@"
+34
EOF
+35
chmod +x "$root/bin/x86_64-linux-musl-ar" "$root/bin/x86_64-linux-musl-ranlib"
+36
ln -s x86_64-linux-musl-ar "$root/bin/ar"
+37
ln -s x86_64-linux-musl-ranlib "$root/bin/ranlib"
+38
cat > "$root/bin/ld" <<'EOF'
+39
#!/bin/sh
+40
set -eu
+41
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+42
exec "$here/zig" ld.lld "$@"
+43
EOF
+44
chmod +x "$root/bin/ld"
+45
cat > "$root/bin/copy-strip" <<'EOF'
+46
#!/bin/sh
+47
set -eu
+48
out=
+49
input=
+50
while [ "$#" -gt 0 ]; do
+51
case "$1" in
+52
-o) out=$2; shift 2 ;;
+53
-*) shift ;;
+54
*) input=$1; shift ;;
+55
esac
+56
done
+57
[ -n "$input" ]
+58
if [ -n "$out" ]; then cp "$input" "$out"; fi
+59
EOF
+60
chmod +x "$root/bin/copy-strip"
+61
"$root/bin/zig" version