ocaml-jst has a dune-based build system which is different from upstream OCaml. To get started, you’ll need a working install of OCaml 4.14 and dune, e.g. via OPAM:
$ opam switch create 4.14.0
$ eval $(opam env)
$ opam install dune
You should also install merlin:
$ opam install merlin
and follow its instructions for how to set up your editor.
Once you have OCaml and dune, you can build and test ocaml-jst with:
$ ./configure --prefix=/where/to/install
$ make -f Makefile.jst runtest-upstream
Other useful Makefile targets are:
$ make -f Makefile.jst compiler
to build without running the testsuite, or:
$ make -f Makefile.jst hacking
to start a continuously polling build of the compiler.
Note that the dune-based build system is entirely separate from the main
Makefile, and so you will need to use make -f Makefile.jst install
to install after building.
As demonstrated above, you can
$ make -f Makefile.jst runtest-upstream
to run the entire testsuite. As a shorter synonym, you may also
$ make -f Makefile.jst test
If you want to run just one test or one test directory, you can
$ make -f Makefile.jst test-one TEST=<<test file here>>
$ make -f Makefile.jst test-one DIR=<<test dir here>>
where the test file or test dir are specified with respect to the
testsuite/tests
directory. For example:
$ make -f Makefile.jst test-one TEST=typing-local/local.ml
$ make -f Makefile.jst test-one DIR=typing-local
OCaml 4.14 makes type_expr
abstract, and thus normal debug printing
of types no longer works. However, there is now an installable printer
for types, which we can use to see the types. Here are the instructions:
-
Use the old
Makefile
, not the newMakefile.jst
. This is an infelicity we hope to fix. -
In the
tools
directory, runmake debug_printers.cmo
. -
In the debugger, execute some instructions, with e.g.
run
orstep
. This forces the debugger to load the compiler code, required for the next step. -
Execute
source tools/debug_printers
to install the printers.