catala/INSTALL.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

114 lines
3.5 KiB
Markdown
Raw Normal View History

2020-12-14 12:59:15 +03:00
# Building and installing the Catala language
2020-06-02 11:26:30 +03:00
## Requirements
2021-09-27 22:06:14 +03:00
### With Docker
The Catala compiler is written using OCaml. The repository provides a `Dockerfile`
to build a Docker image with all the dependencies required to build the Catala compiler.
Start by installing Docker: https://docs.docker.com/get-docker/
Then build the Docker image:
2022-07-20 13:00:02 +03:00
docker build . --target dev-build-context -t catala
2021-09-27 22:06:14 +03:00
2022-07-20 13:00:02 +03:00
Finally, start a shell inside a new container created from the newly built image:
2021-09-27 22:06:14 +03:00
2022-07-20 13:00:02 +03:00
docker run -it --name catala catala
2021-09-27 22:06:14 +03:00
### With nix
The repository provides nix files to build or develop the catala compiler.
Once [nix is installed](https://nixos.org/manual/nix/stable/#ch-installing-binary),
it is possible to enter a development shell:
nix-shell
or to build the Catala compiler, documentation and runtime library:
nix-build release.nix
Dependencies not yet in nixpkgs (`bindlib` and `unionFind` at the moment of writing)
are hardcoded inside the `.nix` directory. The `default.nix` should be compatible with
nixpkgs, if it finds a maintainer.
### With opam
2021-09-27 22:06:14 +03:00
2020-12-14 12:59:15 +03:00
The Catala compiler is written using OCaml. First, you have to install `opam`,
OCaml's distribution and package manager. Follow the [instructions on the `opam`
2021-03-02 20:27:39 +03:00
website](https://opam.ocaml.org/doc/Install.html).
2020-06-02 11:26:30 +03:00
2021-03-02 20:27:39 +03:00
Next, you will need to use the correct version of OCaml. Catala has been tested
2022-07-20 13:00:02 +03:00
with OCaml compiler versions that are at least 4.13.0. To switch to OCaml 4.13.0.,
2020-12-14 12:59:15 +03:00
just use:
2020-06-02 11:26:30 +03:00
2022-07-20 13:00:02 +03:00
opam switch 4.13.0
2020-06-02 11:26:30 +03:00
2022-07-20 13:00:02 +03:00
If you get a `No switch 4.13.0 is currently installed` error message, follow
the hint and enter `opam switch create 4.13.0`.
2020-12-14 12:59:15 +03:00
2021-09-27 22:06:14 +03:00
## Dependencies
2022-07-20 13:00:02 +03:00
You can skip this step if you used the *Docker* option above, it is already taken
care of.
Next, install all the packages that Catala depends on with
2020-06-02 11:26:30 +03:00
2020-12-21 20:15:53 +03:00
make dependencies
2020-06-02 11:26:30 +03:00
2021-05-22 23:55:41 +03:00
This should ensure everything is set up for developing on the Catala compiler!
2020-06-02 11:26:30 +03:00
**Warning**: this command does not include the `z3` dependency required to enable
the proof platform feature of Catala. If you wish to enable support for the
proof platform and the `Proof` command of the Catala compiler, you should
2022-07-20 13:00:02 +03:00
instead execute `make dependencies-with-z3` prior to building the compiler.
2022-02-02 13:37:45 +03:00
Other features of the Catala repository also require the following executables
2022-07-20 13:00:02 +03:00
to be present. On debian, arch or apline-based distributions, the above command
should already take care of them.
2020-06-02 11:26:30 +03:00
2022-07-19 13:27:01 +03:00
groff virtualenv python3 pip rsync colordiff pygmentize nodejs npm
2020-06-02 11:26:30 +03:00
2020-12-14 12:59:15 +03:00
## Build
2020-06-02 11:26:30 +03:00
The project is distributed as a Dune artifact. Use standard dune commands to build
and install the library. Makefile aliases are here to help you: running
make build
builds the compiler from its OCaml sources.
2020-12-14 12:59:15 +03:00
## Install
2021-03-02 20:27:39 +03:00
The installation of the Catala compiler is handled through `opam`. Since the
Catala compiler is not yet published to the `opam` repository, you can install
a local version from this Git repository by using
2020-12-14 12:59:15 +03:00
opam install ./
2021-03-02 20:27:39 +03:00
To uninstall, use
2020-12-14 12:59:15 +03:00
opam unpin catala
2020-06-02 11:26:30 +03:00
### Generating website assets
The Catala website features assets generated by the Catala compiler. They are
2021-03-02 20:27:39 +03:00
needed to build the website. To produce them, simply run
2020-12-14 12:59:15 +03:00
make website-assets
2021-03-02 20:27:39 +03:00
Then, use a helper script to copy them over to the `assets` directory of the
2020-12-14 12:59:15 +03:00
Catala website.
2020-06-02 11:26:30 +03:00
./generate_website_assets.sh <path-to-catala-website>/assets
2022-07-19 13:27:01 +03:00
You will need the `groff` executable to generate the HTML versions of the man
2020-06-02 11:26:30 +03:00
pages, as well as the `rsync` executable to transfer files (preferred to `cp`)
because it also works with a remote server.
## Syntax highlighting
2022-09-20 11:50:43 +03:00
See the [dedicated `README.md`](./syntax_highlighting/README.md).