11---
2- title : Install Plinth standalone compiler
2+ title : Build Plinth from source
33permalink : /how-to/build/
44---
5- This guide explains how to get ` uplc-ghc ` , the
6- [ Plinth standalone compiler] ({% link explanation/standalone-compiler.md %}).
5+ This guide explains how to build ` uplc-ghc ` , the
6+ [ Plinth standalone compiler] ({% link explanation/standalone-compiler.md %}),
7+ from source. Most users do not need this: the recommended way to get
8+ ` uplc-ghc ` is to
9+ [ install a released binary via ghcup] ({% link how-to/install.md %}). Build
10+ from source when you work on the compiler itself, or when no binary
11+ distribution covers your platform.
712
8- The recommended way is to [ install a released binary via
9- ghcup] ( #installing-via-ghcup ) . [ Build from source] ( #building-from-source ) when
10- you work on the compiler itself, or when no binary distribution covers your
11- platform.
12-
13- ## Installing via ghcup
14-
15- ` uplc-ghc ` is distributed as a custom tool named ` plinth ` for
16- [ ghcup] ( https://www.haskell.org/ghcup/ ) , the standard installer for Haskell
17- toolchains. You need ghcup 0.2.1.0 or newer (check with ` ghcup --version ` ).
18-
19- Add the Plinth release channel, then install and activate the tool:
20-
21- ``` console
22- $ ghcup config add-release-channel https://raw.githubusercontent.com/input-output-hk/ghc-plinth/ghcup-channel/ghcup-plinth.yaml
23- $ ghcup install plinth latest
24- $ ghcup set plinth latest
25- ```
26-
27- ` ghcup install ` downloads the binary distribution for your platform and
28- installs it under ghcup's own directory; ` ghcup set ` then symlinks ` uplc-ghc `
29- into ghcup's ` bin ` directory (` ~/.ghcup/bin ` by default), which is already on
30- ` PATH ` for ghcup users. Verify with:
31-
32- ``` console
33- $ uplc-ghc --version
34- ```
35-
36- Installing ` plinth ` does not affect any GHC installed by ghcup: the tool ships
37- only the ` uplc-* ` binaries, so your regular ` ghc ` is left untouched.
38-
39- Binary distributions are published for:
40-
41- - Linux, x86_64 and aarch64 (glibc, and musl/Alpine)
42- - macOS, Apple Silicon
43- - Windows, x86_64
44-
45- List the available versions with ` ghcup list -t plinth ` . Once installed, head
46- over to [ Use uplc-ghc in a project] ({% link how-to/use.md %}).
47-
48- ## Building from source
49-
50- ### Prerequisites
13+ ## Prerequisites
5114
5215` plinth-build.sh ` expects the following tools on ` PATH ` :
5316
@@ -64,7 +27,7 @@ over to [Use uplc-ghc in a project]({% link how-to/use.md %}).
6427` happy ` and ` alex ` are built locally into ` _build/tools/ ` if they are not
6528found, so they are effectively optional. The others must be present.
6629
67- ### 1. Clone with submodules
30+ ## 1. Clone with submodules
6831
6932The ` plutus ` submodule provides ` plutus-tx ` , ` plutus-tx-plugin ` , and
7033` plutus-core ` , so clone recursively:
@@ -79,7 +42,7 @@ If you already cloned without `--recurse-submodules`, fetch them with:
7942$ git submodule update --init --recursive
8043```
8144
82- ### 2. Run the build script
45+ ## 2. Run the build script
8346
8447From the root of the repository:
8548
@@ -90,7 +53,7 @@ $ ./plinth-build.sh
9053The script bootstraps GHC and then builds ` uplc-ghc ` . What it produces is
9154described under [ Build outputs] ( #build-outputs ) below.
9255
93- ### Build options
56+ ## Build options
9457
9558` plinth-build.sh ` is controlled by environment variables. The two most common
9659force a full rebuild or select the release flavour:
@@ -110,7 +73,7 @@ It also honours tool-location overrides such as `GHC`, `CABAL`, `HAPPY`,
11073` FLAVOUR ` , when you need to point it at specific tools or change the build
11174flavour.
11275
113- ### Build outputs
76+ ## Build outputs
11477
11578When ` plinth-build.sh ` finishes it has produced two things.
11679
0 commit comments