From b779135e808bf9f80b2424e3b460aa1054f2318d Mon Sep 17 00:00:00 2001 From: Kait Lam Date: Thu, 27 Jun 2024 15:08:54 +1000 Subject: [PATCH 1/2] readme: add instructions to install package with opam This is necessary to compile OCaml projects dependent on aslp. --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8404ec7c..04f493f0 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ 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. ### Installing dependencies @@ -123,13 +123,26 @@ You also need to execute this command To build the ASL lexer and ASL interpreter, execute this command. -``` +``` make install ``` 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 in a downstream 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 From f6d66acf4ec6dd9a86c02caeb54dfb76a53283ee Mon Sep 17 00:00:00 2001 From: Kait Lam Date: Thu, 27 Jun 2024 15:19:31 +1000 Subject: [PATCH 2/2] add first-time steps --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 04f493f0..b61345ed 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ This interpreter consists of a single directory organized as follows ASLp can be installed as a Nix package from https://github.com/katrinafyi/pac-nix. 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 @@ -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 @@ -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` @@ -123,7 +130,7 @@ You also need to execute this command To build the ASL lexer and ASL interpreter, execute this command. -``` +``` make install ``` @@ -132,7 +139,7 @@ the right version. ### Building for use in other projects -If you need to use ASLp or libASL in a downstream OCaml project, +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: