instow

:)
git clone https://git.sr.ht/~ashymad/instow
Log | Files | Refs | LICENSE

commit 624ca8681b89d2aaf7cd913da29704f90027ba5b
parent 41651c31992a8d08759dd167f588634469c1cf11
Author: Szymon Mikulicz <szymon.mikulicz@posteo.net>
Date:   Wed, 18 Mar 2026 09:53:46 +0100

Finally fix the bootstrap

Diffstat:
Mbootstrap.sh | 23+++++++----------------
Msrc/main.janet | 7+++++--
2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/bootstrap.sh b/bootstrap.sh @@ -2,15 +2,6 @@ set -e -sedi() { - file="$1" - shift - - sed "$@" "$file" > "$file".tmp - cat "$file".tmp > "$file" - rm "$file".tmp -} - BOOTDIR="$PWD" PREFIX="${PREFIX:-$HOME/.local}" @@ -25,26 +16,24 @@ ROOTDIR="$(mktemp -d)" pushd "$SRCDIR" echo "[1/9] Cloning janet repo" -git clone https://github.com/janet-lang/janet +[ -d janet ] || git clone https://github.com/janet-lang/janet echo "[2/9] Building janet" PREFIX="" DESTDIR="$ROOTDIR" make -C janet -j$(nproc) install echo "[3/9] Cloning jpm repo" -git clone https://github.com/janet-lang/jpm +[ -d jpm ] || git clone https://github.com/janet-lang/jpm pushd jpm echo "[4/9] Building jpm" -PREFIX="" DESTDIR="$ROOTDIR" JANET_PATH="lib/janet" "$ROOTDIR/bin/janet" ./bootstrap.janet - +PREFIX="$ROOTDIR" DESTDIR="$ROOTDIR" JANET_PATH="$ROOTDIR/lib/janet" "$ROOTDIR/bin/janet" ./bootstrap.janet +cp -r "$ROOTDIR/$ROOTDIR/"* "$ROOTDIR/" popd popd -sedi "$ROOTDIR/bin/jpm" '1s@^@#!/usr/bin/env janet\n@' - echo "[5/9] Building instowl" -"$ROOTDIR/bin/janet" "$ROOTDIR/bin/jpm" --headerpath="$ROOTDIR/include" build +"$ROOTDIR/bin/jpm" --headerpath="$ROOTDIR/include" build pushd "$SRCDIR/janet" @@ -55,6 +44,8 @@ popd pushd "$SRCDIR/jpm" echo "[7/9] Instowling jpm" +mkdir -p "$PKGDIR/jpm/lib/janet/jpm" +stow -d "$PKGDIR" jpm JPM="$ROOTDIR/bin/jpm" "$BOOTDIR/instowl.local" popd diff --git a/src/main.janet b/src/main.janet @@ -74,7 +74,6 @@ (string/join [a b] "=")) (defn main [& args] - (do (def home (os/getenv "HOME")) (def target (path/join home ".local")) (def stowdir (path/join target "pkg")) @@ -94,6 +93,7 @@ "CXX" (os/getenv "CXX") "CFLAGS" (os/getenv "CFLAGS")}) + (var ret 0) (var state :init) (var errormsg "Unknown") (var prefix target) @@ -243,6 +243,7 @@ :error (do + (set ret 1) (printf "\x1b[2K{%s}⸉!⸊→%s" state errormsg) (set state :cleanup)) @@ -254,4 +255,6 @@ :cleanup (do (file/rmrf (string/join [destdir])) - (set state :exit)))))) + (set state :exit)))) +ret +)