Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete build description in readme #473

Merged
merged 8 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 105 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,125 @@ In October/November 2022, these componentes were collected into a mono-repo agai

## Building AD4M

### Prerequisites
### Build tools

- Install Rust by visiting [here](https://www.rust-lang.org/tools/install) (ADAM Layer currently uses rust version 1.71.1)
- Install Deno by visiting [here](https://deno.land/manual@v1.36.4/getting_started/installation)
- Install Go by visiting [here](https://go.dev/doc/install) (ADAM Layer currently uses go version: go1.18)
- Install Node by visiting [here](https://nodejs.org/en/download)
- Install PNPM by visiting [here](https://pnpm.io/installation)
#### npm & pnpm
We use `pnpm` as the root build tool.
Since we also need node for some build steps and tests,
start by installing [Node)(https://nodejs.org/en/download) version 18.
Depending on your operating system and choice, either by downloading the installer
or through [nvm](https://github.com/nvm-sh/nvm) (which we recommend for POSIX systems).

### Build (CLI & Libs):
Then install `pnpm` through

```
npm install -g pnpm
```
(alternatively by visiting [here](https://pnpm.io/installation))

### Deno
The legacy JS ad4m-executor code, as well as ADAM Languages are run in ADAM's Deno runtime and thus are be build
and bundled using the Deno cmd tool, which needs to be installed on the host system.
Just follow the [installation instructions at https://deno.land/manual@v1.36.4/getting_started/installation](https://deno.land/manual@v1.36.4/getting_started/installation).

### Rust

Make sure you have `rustup` installed (follow instructions [here](https://www.rust-lang.org/tools/install)).
Use rustup to install the latest stable Rust version.

ADAM currently needs at least Rust version:
```
1.77.0
```

### Rust WASM target for Holochain based Languages
For building Holochain DNAs, which are part of the ADAM bootstrap languages included here
you need your Rust toolchain to be able to compile to WASM.

Run the following command to install the WASM target:
```
rustup target add wasm32-unknown-unknown
```


### Other dependencies

#### Go
Holochain currently depends on [Go](https://go.dev) being installed at version 1.21 or later.
Follow the installation instructions on [https://go.dev/doc/install](https://go.dev/doc/install).

Make sure `go` is in your `$PATH` before you continue. Output of `go version` should look like this:
```
go version go1.21.0 darwin/arm64
```

#### Platform specific dependencies
Run the following commands depending on your operating system to get all the system libraries installed that are needed by some of the Rust crates that Holochain and ADAM depend on.

##### macOS
Ensure you have [Homebrew](https://brew.sh/) installed and then run:
```
brew install protobuf cmake
```

##### Linux (Ubuntu / Debian)
```
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf protobuf-compiler cmake
```

##### Windows
Ensure you have [Chocolatey](https://chocolatey.org/) installed and then run:
```
choco install strawberryperl protoc cmake curl cygwin gnuwin32-m4 msys2 make mingw
```


#### hc
Holochain commandline tool `hc` is needed for building Holochain Languages.
Install the right version we're currently using in ADAM by running:

```
cargo install holochain_cli@=0.3.0-beta-dev.39
```


### Build:

In order to build everyting that goes into the `ad4m` and `ad4m-executor` binaries, including all the boostrap Languages, run:
```
pnpm install
lucksus marked this conversation as resolved.
Show resolved Hide resolved
pnpm run build
```

## Testing (Full test run of all packages)
You can also exclude the bootstrap Languages (which will get downloaded through the Language-language on startup anyways, if those are unchanged) and run this instead:

```
pnpm install
lucksus marked this conversation as resolved.
Show resolved Hide resolved
pnpm test
pnpm run build-libs
```

## Building ad4m launcher

In order to build and package the ADAM Launcher, run:
```
pnpm install
lucksus marked this conversation as resolved.
Show resolved Hide resolved
pnpm run package-ad4m
```

(Note that the last step of this might/will fail if you don't have the code signing keys. You can ignore that last error and find bundles in `target/release`.)

## Testing

Full test run of all packages:
```
pnpm install
lucksus marked this conversation as resolved.
Show resolved Hide resolved
pnpm test
```

Only integration tests:
```
pnpm install
lucksus marked this conversation as resolved.
Show resolved Hide resolved
pnpm build
cd tests/js
pnpm install
pnpm run test-main
```