From 1b4ed54a85c31a032fbc841c62f674c3a8f2764b Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Fri, 17 May 2024 15:07:04 -0500 Subject: Fix binary release --- Dockerfile | 5 +++-- README | 15 +++++++++------ bin/dune | 5 ++--- lib/grep.ml | 5 ++++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 937fbcf..b5c3395 100644 --- 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 index 09ad900..3f7c386 100644 --- 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 index 3031405..b255cb0 100644 --- 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 index 7ec4c95..2e55b40 100644 --- 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 = -- cgit v1.2.3