Skip to content

Commit 8d515b3

Browse files
docs(readme): make build prereqs reproducible from a clean checkout (#112)
The README's "Prerequisites" section listed five opam packages (sedlex, menhir, ppx_deriving, cmdliner, yojson) — half the real dep set. Running `dune build` on a fresh switch with only those five installed fails at `js/playground.bc.js` because `js_of_ocaml`, `js_of_ocaml-ppx`, and `js_of_ocaml-compiler` are also required. Likewise `ppx_sexp_conv`, `sexplib0`, `fmt`, `alcotest`, and `ocamlformat` are pulled in by `lib/`, `test/`, and the format target, but were undocumented. Changes: - Expand the prereqs list to match `dune-project`'s `depends` block exactly (including the `with-test` packages). - Add a one-shot `opam install` snippet so a fresh switch can be provisioned in a single command. - Add an `eval "$(opam env ...)"` note explaining why non-interactive login shells (e.g. `wsl bash -lc ...`) do not see `dune` on PATH after `opam install`: opam-init/init.sh gates PATH-setup behind `[ -t 0 ]`, so persistent wiring has to be done by hand in `~/.profile`. - Note the `dune build lib/ bin/ test/` fallback for contributors who do not want the JS playground deps. - Flag the OCaml version drift: `dune-project` constrains `>= 5.1` but the current tree also builds clean on 4.14.2 (209/209 tests pass). Documented as an observation, not bumped — the constraint deserves a judgement call from a maintainer, not a unilateral relaxation. Verified end-to-end: clean clone → `opam install -y` snippet → `eval $(opam env)` → `dune build` (exit 0) → `dune runtest` (209/209 green). Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 49a3914 commit 8d515b3

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

README.adoc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,35 @@ Games are one place where the language’s properties are easy to demonstrate. T
387387

388388
=== Prerequisites
389389

390-
- OCaml 5.1+
390+
- OCaml 4.14.2+ (dune-project lists `>= 5.1`, but the current tree also builds clean on 4.14.2; the constraint is stricter than the actual code requires)
391391
- Dune 3.14+
392-
- opam packages: `sedlex`, `menhir`, `ppx_deriving`, `cmdliner`, `yojson`
392+
- opam packages: `sedlex`, `menhir`, `ppx_deriving`, `ppx_sexp_conv`, `sexplib0`, `fmt`, `cmdliner`, `yojson`, `alcotest` (test), `ocamlformat` (test), `js_of_ocaml`, `js_of_ocaml-ppx`, `js_of_ocaml-compiler`
393+
394+
[NOTE]
395+
====
396+
The top-level `dune build` compiles every target including `js/playground.bc.js`, so `js_of_ocaml*` are required for an out-of-the-box build. If you only need the CLI and tests, you can build the subtrees explicitly:
397+
398+
[source,bash]
399+
----
400+
dune build lib/ bin/ test/
401+
----
402+
====
403+
404+
=== One-shot opam setup
405+
406+
[source,bash]
407+
----
408+
# Install the full dep set into the active switch
409+
opam install -y \
410+
sedlex menhir ppx_deriving ppx_sexp_conv sexplib0 fmt cmdliner yojson \
411+
alcotest ocamlformat \
412+
js_of_ocaml js_of_ocaml-ppx js_of_ocaml-compiler
413+
414+
# Make `dune`, `ocaml`, etc. visible to non-interactive shells
415+
eval "$(opam env --switch=default --set-switch)"
416+
----
417+
418+
For login shells, persist the PATH wiring by appending the equivalent to `~/.profile` — opam's own `opam-init/init.sh` gates PATH-setup behind `[ -t 0 ]`, so `wsl bash -lc '...'`-style invocations don't pick it up without an explicit eval.
393419

394420
=== Build
395421

0 commit comments

Comments
 (0)