INSTALL.md 5.01 KB
Newer Older
1 2 3 4
# ACGtk: an ACG development toolkit

# INSTALL

5
**ACGtk** is a software package ([2008-2018 INRIA](http://www.inria.fr)©) for the development of abstract categorial grammars. This distribution provides two executables (possibly with the `.opt` extension, see the (INSTALL)[INSTALL] file: `acgc` and `acg` (or, instead, their native counterparts: `acgc.opt` and `acg.opt`).
6 7 8 9 10 11 12 13

It is distributed with the *CeCILL* license (see the [LICENSE](LICENSE.en) file or http://www.cecill.info). Contributors are listed in the (AUTHORS)[AUTHORS] file.

A list of related publications is available at the [ACG web page](http://calligramme.loria.fr/acg).

## Prerequisites

In order to compile the ACG toolkit, you need:
14
* `ocaml` (>=3.07) installed (http://ocaml.org/)
15
* `dune` installed (https://github.com/ocaml/dune)
16
* `menhir` installed (http://gallium.inria.fr/~fpottier/menhir/)
17
* `ANSITerminal` (>=0.6.5) installed (https://github.com/Chris00/ANSITerminal)
18 19
* `fmt` installed (http://erratique.ch/software/fmt)
* `logs` installed (http://erratique.ch/software/logs)
20 21 22 23
* `cairo2` (>=0.4.6) installed (https://github.com/Chris00/ocaml-cairo)
* `easy-format` installed (https://github.com/mjambon/easy-format). Required by biniou
* `biniou` (>=1.0.6) installed (https://github.com/mjambon/biniou). Required by yojson
* `yojson` (>=1.1.8) installed (https://github.com/mjambon/yojson). Required by ocf
24 25 26 27
* `ocf` (>=0.4.0) installed (http://zoggy.github.io/ocf/)

For best results (correct rendering of symbols in the graphical output), please also install the free DejaVu fonts (http://dejavu-fonts.org).

28 29 30 31 32 33 34 35 36 37 38 39 40
**Note:** These packages contain Ocaml libraries or binaries. They may depend on external non-Ocaml libraries, in particular `cairo` and `freetype`. The way to install them depend on your OS. Unfortunately, their name also depend on your OS (for instance, what is required for `cairo` on Debian is `libcairo2-dev`, while it's `cairo` on Mac OS).

To know the required packages on your OS in order to install ACGtk, you can run:
```
opam list --rec --required-by acgtk --external
```
and look at the output corresponding to your system (on OSX, it seems that the package name is the same whether you use `homebrew` or `port` to install your packages).

Or you can use the `depexts` OPAM package to install them automatically:
```
opam install depext
opam depext acgtk
```
41 42 43

## Installation with OPAM (preferred)

44
A fast and easy way to install all important ocaml libraries is to use [opam](http://opam.ocaml.org/).
45 46 47 48

The installation typically goes that way:
1. first install [OCaml](http://ocaml.org/) using your prefered distribution/packaging mode
2. then install opam
49
3. don't forget to [add the required library in your path](http://opam.ocaml.org/doc/Usage.html#opam-switch) running ``eval `opam config env` ``
50 51 52 53 54 55 56 57 58 59
4. then continue with the ACG toolkit installation running `opam install acgtk`


This will install in the `.opam/OCAML_VERSION/bin` directory (where `OCAML_VERSION` is the OCaml version that you are using with opam. It can be `system` in case you are not using a compiler installed by opam, or a version number (such as 4.05.0) otherwise) the binaries `acgc`, `acgc.opt`, `acg`, and `acg.opt`.


It will also install in the `.opam/OCAML_VERSION/share/acgtk` directory:
1. the [emacs](emacs) directory 
2. the [examples](examples) directory

60 61 62 63
### Building ACGtk (Skip this part if you installed acgtk as described above)

Alternatively, if you want to compile acgtk by yourself
1. first install the required libraries with the command
64
```opam install dune menhir ANSITerminal fmt logs cairo2 easy-format bibiou yojson ocf```
65 66 67 68 69 70 71
2. Download the ACGtk sources from http://acg.loria.fr/

To build the ACG toolkit, first run:
```dune build```
then
```dune install```

72 73 74 75 76 77 78 79

## ACG emacs mode

There is an ACG emacs mode `acg.el` in the [emacs](emacs) directory.

### Quick way to have it work

Copy the following lines in your .emacs
80

81
```emacs
82 83 84 85 86 87 88 89 90 91 92
(setq load-path (cons "EMACS_DIR_PATH" load-path))
(setq auto-mode-alist (cons '("\\.acg" . acg-mode) auto-mode-alist))
(autoload 'acg-mode "acg" "Major mode for editing ACG definitions" t)
```
where `EMACS_DIR_PATH` is `.opam/OCAML_VERSION/share/acgtk/emacs`

### Site distribution
   
1. Copy `acg.el` under an `acg` directory in your site-lisp directory (typically `/usr/share/emacs/site-lisp/` or `/usr/local/share/emacs/site-lisp/`)

2. Create a `50acg.el` file into the `/etc/emacs/site-start.d` directory and copy the following lines in it:
93
	```emacs
94 95 96 97 98 99 100 101
   (setq load-path (cons "EMACS_DIR_PATH" load-path))
   (setq auto-mode-alist (cons '("\\.acg" . acg-mode) auto-mode-alist))
   (autoload 'acg-mode "acg" "Major mode for editing ACG definitions" t)
   ```
   where `EMACS_DIR_PATH` is the acg directory in your site-lisp directory (typically `/usr/share/emacs/site-lisp/acg`)

## Examples

102
Example files are given in the [examples](examples) directory. Read the [examples/README.md](examples/README.md) file.
103 104 105 106 107


## For developpers

You can get the documented API in all `./src` subdirectories getting there and running:
108
```bash
109 110 111
make doc
```
It will create a doc subdirectory with html files.