Skip to content

Commit

Permalink
readme: add instructions to install package with opam (#94)
Browse files Browse the repository at this point in the history
* readme: add instructions to install package with opam

This is necessary to compile OCaml projects dependent on aslp.

* add first-time steps
  • Loading branch information
katrinafyi authored Jul 1, 2024
1 parent 44de990 commit c683d6e
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ This interpreter consists of a single directory organized as follows
### Installing with Nix

ASLp can be installed as a Nix package from https://github.com/katrinafyi/pac-nix.
_asli_ provides the base ASLp and _aslp_ provides ASLp bundled with ARM's specifications.
The _aslp_ provides ASLp bundled with ARM's specifications.
If you don't plan on modifying the tool, this is a fast and easy way to get started.
If installed via Nix, the following installation steps are not necessary.

### Installing dependencies

Expand All @@ -95,9 +96,17 @@ Platform specific instructions:
sudo zypper install ocaml opam ocaml-ocaml-compiler-libs-devel
```

Platform independent instructions:
First-time only (if you have not previously set up an opam switch environment):

```bash
opam init # answer y/n depending on your preference
opam switch create ocaml.4.14.2 # or later
eval `opam env`
```

Platform-independent instructions:

```bash
# Install dependencies from asli.opam file
opam install --deps-only --with-test ./asli.opam

Expand All @@ -107,11 +116,9 @@ Platform independent instructions:

# On OSX, you may need to use this command to install zarith
env CFLAGS="-I$HOME/homebrew/include/" LDFLAGS="-L$HOME/homebrew/lib/" opam install zarith
eval `opam config env`
```

You also need to execute this command
You may also need to execute this command

```
MacOS: export DYLD_LIBRARY_PATH=`opam config var z3:lib`
Expand All @@ -130,6 +137,19 @@ To build the ASL lexer and ASL interpreter, execute this command.
If you get a lot of linker errors involving Z3, double-check that you installed
the right version.

### Building for use in other projects

If you need to use ASLp or libASL as a dependency in another OCaml project,
these steps will install the package in a location discoverable by opam and dune.

After installing dependencies and testing the build, run these commands in this directory:
```
opam pin . -k path
opam install .
```
Once complete, you can verify the package is installed by running `ocamlfind query asli`.


### Using ASL lexer

This displays a list of tokens in an ASL file including the indent
Expand Down

0 comments on commit c683d6e

Please sign in to comment.