Most developers do not need to do this. When the prebuilt compiler binaries are available, that is the recommended path. Build from source if you need to track an unreleased branch, target an unsupported platform, or hack on the compiler itself.

These instructions cover recent macOS (verified on macOS 12 Monterey). Apple Silicon and Intel are both supported.

I. Install ADAPT

  1. Install git and clone the ADAPT toolkit repository.
    brew install git
    git clone https://github.com/adapt-toolkit/adapt.git
    
  2. Enter the repository.
    cd adapt
    

II. Build the toolchain

Pick one of the two paths below.

Docker build

  1. Install Docker Desktop if you do not already have it (instructions).

  2. Build the dependencies image locally. This is a one-time step that bakes in the compiler toolchain (gcc, clang, rust, emsdk) and runs setup.sh to initialise the git submodules and compile the C/C++ external libraries (libsodium, wolfssl, utf8proc, libgmp, nitroattest) into a SHA-keyed cache inside the image. Subsequent per-build containers restore those artefacts from the cache instead of recompiling them.
    docker build . -f docker/build-dependencies/Dockerfile -t adaptframework/build-dependencies:latest
    
  3. Run the build(s) you need.
    docker-compose up build-gpp-native
    docker-compose up build-clang-native
    docker-compose up build-emcc-wasm
    docker-compose up build-gpp-native-debug
    docker-compose up build-clang-native-debug
    docker-compose up build-emcc-wasm-debug
    

Native build

  1. Install Xcode.

  2. Install the MUFL compiler dependencies.
    ./setup.sh --install-compiler
    
  3. Restart your shell.

  4. Install the remaining dependencies.
    ./setup.sh --install-rust
    ./setup.sh --install-emsdk
    
  5. Activate the Rust and Emscripten environments.
    source ~/.cargo/env
    source ../emsdk/emsdk_env.sh
    
  6. Configure the repository and build dependencies.
    ./setup.sh
    
  7. Run the build(s) you need.
    ./scripts/build-gpp-native.sh
    ./scripts/build-gpp-native-debug.sh
    ./scripts/build-clang-native.sh
    ./scripts/build-clang-native-debug.sh
    ./scripts/build-emcc-wasm.sh
    ./scripts/build-emcc-wasm-debug.sh
    
  8. Run the tests relevant to your build.
    ./scripts/test-gpp-native.sh
    ./scripts/test-gpp-native-debug.sh
    ./scripts/test-clang-native.sh
    ./scripts/test-clang-native-debug.sh
    ./scripts/test-emcc-wasm.sh
    ./scripts/test-emcc-wasm-debug.sh
    

After a successful build, mufl and mufl-compile are available in build.macos.release/bindings/. Add it to your PATH to mirror the prebuilt binary install.

III. Optional: install the language server

To enable in-editor diagnostics for MUFL, see Install the language server.