stitch

Note taking for messy minimalists

git clone git://mccd.space/stitch
commit 1b4ed54a85c31a032fbc841c62f674c3a8f2764b
parent 0f36dee9ed3225662e551fce165e30867b246656
Author: Marc Coquand <marc@mccd.space>
Date:   Fri, 17 May 2024 15:07:04 -0500

Fix binary release

Diffstat:
MDockerfile | 5+++--
MREADME | 15+++++++++------
Mbin/dune | 5++---
Mlib/grep.ml | 5++++-
4 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/Dockerfile b/Dockerfile
@@ -4,7 +4,7 @@ FROM alpine:edge AS builder
 RUN apk add --no-cache make m4 which patch sudo wget git pkgconfig \
 	gcc g++ musl-dev linux-headers libffi libffi-dev pcre perl python3 \
 	gmp-dev pcre-dev xz-dev gmp xz coreutils \
-	ocaml ocaml-compiler-libs ocaml-ocamldoc opam ocaml-findlib openssh
+	ocaml ocaml-compiler-libs ocaml-ocamldoc opam ocaml-findlib openssh rsync
 RUN chmod +s `which bwrap`
 
 RUN addgroup -g 1000 -S ocaml && adduser -u 1000 -D -S ocaml -G ocaml
@@ -16,9 +16,10 @@ RUN eval `opam env --switch=4.14.2`
 
 RUN  opam install --yes dune && eval `opam env --switch=4.14.2`
 
-COPY --chown=ocaml:ocaml . /tmp/build 
+COPY --chown=ocaml:ocaml stitch.opam /tmp/build/
 WORKDIR /tmp/build
 RUN git config --global --add safe.directory /tmp/build
 
 RUN opam install . --update-invariant --yes
+COPY . .
 CMD eval `opam env` && dune build --profile release
diff --git a/README b/README
@@ -82,8 +82,8 @@ _________________
 1.5 DEVELOPMENT
 ~~~~~~~~~~~~~~~
 
-  To set up the project for local development, easiest way is to just install Nix, direnv 
-  and enable nix flakes. Then to compile:
+  To set up the project for local development, easiest way is to  
+  just install Nix, direnv and enable nix flakes. Then to compile:
 
   dune build
 
@@ -95,17 +95,20 @@ _________________
 
   dune exec -- stitch --help=groff
 
-  To prepare for release, we need to statically link the binary, which unless you use a 
-  musl based distro it will not do out of the box. 
+  To prepare for release, we need to statically link the binary, which 
+  unless you use a musl based distro it will not do out of the box. 
 
-  There is a Dockerfile included that prepares the release, use it with podman:
+  There is a Dockerfile included that prepares the release, use it with 
+  podman:
 
   podman pull docker.io/alpine:edge
   podman build . -t stitch:latest
   mkdir release
   podman run -v ./release:/tmp/build/_build:U stitch:latest
   
-  Binary will be found in ./_build/default/bin/stitch
+  Binary will be found in ./release/install/default/bin/stitch and 
+  manpages in ./release/install/default/man/man1/stitch.1
+ 
 
 
 1.6 ROADMAP
diff --git a/bin/dune b/bin/dune
@@ -16,11 +16,10 @@
 
 ; Rule to generate a man page for stitch
 (rule
-  (target        stitch.1)
-  (action (with-outputs-to %{target} (run stitch --help=groff)))
+  (target stitch.1)
+  (action (with-stdout-to %{target} (run stitch --help=groff)))
 )
 
-; Install the man page
 (install
  (section  man)
  (files    stitch.1)
diff --git a/lib/grep.ml b/lib/grep.ml
@@ -1,4 +1,7 @@
-let execution_directory = Sys.getenv "STITCH_DIRECTORY"
+let execution_directory =
+  Sys.getenv_opt "STITCH_DIRECTORY" |> Option.value ~default:"/anywhere"
+
+
 let grep_cmd = Sys.getenv_opt "STICH_GREP_CMD" |> Option.value ~default:"grep"
 
 let tag_pattern =