2020-06-17 02:36:26 +03:00
|
|
|
# Installing
|
|
|
|
|
|
|
|
- [Installing from source](#installing-from-source)
|
2020-07-08 22:39:41 +03:00
|
|
|
- [Installing from a package manager](#installing-from-a-package-manager)
|
2020-06-17 02:36:26 +03:00
|
|
|
|
|
|
|
## Installing from source
|
2020-05-18 16:45:12 +03:00
|
|
|
|
2020-05-28 22:06:35 +03:00
|
|
|
The easiest way to install is via the existing generated Scheme code.
|
|
|
|
The requirements are:
|
2020-05-20 00:56:27 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- A Scheme compiler; either Chez Scheme (default), or Racket.
|
2023-02-10 01:49:49 +03:00
|
|
|
- `bash`, `GNU make`, `gcc` or `clang`, `sha256sum` and `GMP`. On Linux, you probably already
|
2021-07-31 09:10:52 +03:00
|
|
|
have these. On macOS and major BSD flavours, you can install them using a
|
2021-07-26 21:25:57 +03:00
|
|
|
package manager: for instance, on macOS, you can install with the
|
|
|
|
`brew install coreutils gmp` and on OpenBSD, with the `pkg_add coreutils
|
2021-07-31 09:10:52 +03:00
|
|
|
bash gmake gmp` command. You specifically need the dev GMP library, which
|
|
|
|
means on some systems the package you need to install will be named
|
2023-02-10 01:49:49 +03:00
|
|
|
something more like `libgmp3-dev`. macOS ships with `clang` whereas `gcc` is more
|
|
|
|
common for other \*nix distributions.
|
2020-05-20 00:56:27 +03:00
|
|
|
|
|
|
|
On Windows, it has been reported that installing via `MSYS2` works
|
2021-03-15 17:21:50 +03:00
|
|
|
[MSYS2](https://www.msys2.org/). On Windows older than Windows 8, you may need to
|
2020-06-02 05:30:44 +03:00
|
|
|
set an environment variable `OLD_WIN=1` or modify it in `config.mk`.
|
|
|
|
|
|
|
|
On Raspberry Pi, you can bootstrap via Racket.
|
2020-05-20 00:56:27 +03:00
|
|
|
|
|
|
|
By default, code generation is via Chez Scheme. You can use Racket instead,
|
2020-05-23 20:40:57 +03:00
|
|
|
by setting the environment variable `IDRIS2_CG=racket` before running `make`.
|
2020-05-28 22:06:35 +03:00
|
|
|
If you install Chez Scheme from source files, building it locally,
|
|
|
|
make sure you run `./configure --threads` to build multithreading support in.
|
2020-05-20 00:56:27 +03:00
|
|
|
|
2020-06-17 12:14:54 +03:00
|
|
|
**NOTE**: On FreeBSD, OpenBSD and NetBSD you need to use `gmake` command instead
|
|
|
|
of `make` in the following steps.
|
|
|
|
|
2022-08-28 23:53:52 +03:00
|
|
|
**NOTE**: If you're running macOS on Apple Silicon (arm64) you will need to
|
|
|
|
install the Racket fork of chez scheme as described below. If you install gmp
|
|
|
|
via homebrew, you will also need to `export CPATH=/opt/homebrew/include`.
|
2020-12-12 21:35:16 +03:00
|
|
|
|
2021-04-19 13:18:42 +03:00
|
|
|
### 1: Set installation target directory
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2021-06-28 13:47:47 +03:00
|
|
|
- Change the `PREFIX` in `config.mk` to the absolute path of your chosen
|
|
|
|
installation destination. The default is to install in `$HOME/.idris2`
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2020-12-29 19:36:12 +03:00
|
|
|
If you have an existing Idris 2, go to Step 3. Otherwise, read on...
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2020-05-19 18:24:23 +03:00
|
|
|
Make sure that:
|
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- `$PREFIX/bin` is in your `PATH`
|
2020-05-19 18:24:23 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
### 2: Installing without an existing Idris 2
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2020-08-17 10:16:22 +03:00
|
|
|
You can build from pre-built Chez Scheme source, as long as you have Chez Scheme
|
|
|
|
installed (or, alternatively, Racket). To do this, enter one of the following:
|
2020-05-18 18:02:30 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- `make bootstrap SCHEME=chez`
|
|
|
|
- `make bootstrap-racket`
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
`chez` is the executable name of the Chez Scheme compiler. You may need to
|
2020-05-18 16:43:12 +03:00
|
|
|
replace this with the executable for Chez Scheme on your system. This could be
|
2020-05-19 23:05:52 +03:00
|
|
|
`scheme`, `chezscheme` or `chezscheme9.5` or something else, depending on your
|
|
|
|
system and the Chez Scheme version.
|
2020-05-18 16:43:12 +03:00
|
|
|
|
|
|
|
This builds an Idris 2 compiler from scheme code output from a working Idris 2
|
|
|
|
compiler (which isn't necessarily up to date, but is up to date enough to
|
2020-05-20 12:38:56 +03:00
|
|
|
build the current repository). It then rebuilds using the result, and runs
|
|
|
|
the tests.
|
2020-05-19 01:31:25 +03:00
|
|
|
|
2020-05-20 12:38:56 +03:00
|
|
|
If all is well, to install, type:
|
2020-05-18 20:02:56 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- `make install`
|
2020-05-18 20:02:56 +03:00
|
|
|
|
2023-02-10 01:49:49 +03:00
|
|
|
If you are building with Racket, you'll need to run `IDRIS2_CG=racket make install`.
|
|
|
|
|
2020-08-17 10:16:22 +03:00
|
|
|
### 3: Installing with an existing Idris 2
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2021-08-30 19:11:17 +03:00
|
|
|
If you have the latest *released* version of Idris 2
|
2022-10-27 18:32:16 +03:00
|
|
|
(0.5.1 at the time of writing) installed:
|
2020-05-20 15:31:04 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- `make all`
|
|
|
|
- `make install`
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2021-08-31 20:41:03 +03:00
|
|
|
### 4: (Optional) Installing Idris 2 library documentation
|
|
|
|
|
|
|
|
After `make install`, type `make install-libdocs` to install Idris 2 library documentation. After
|
|
|
|
that, the index file can be found here: ``idris2 --libdir`/docs/index.html`.``
|
|
|
|
|
|
|
|
### 5: (Optional) Self-hosting step
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2020-05-20 13:40:01 +03:00
|
|
|
As a final step, you can rebuild from the newly installed Idris 2 to verify
|
2020-06-17 02:36:26 +03:00
|
|
|
that everything has worked correctly. Assuming that `idris2` is in your
|
2020-05-20 13:40:01 +03:00
|
|
|
`PATH`.
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- `make clean` -- to make sure you're building everything with the new version
|
2021-06-28 13:47:47 +03:00
|
|
|
- `make all && make install` -- OR
|
|
|
|
`make all IDRIS2_BOOT='idris2 --codegen racket' && make install`
|
|
|
|
if using Racket.
|
2020-05-18 16:43:12 +03:00
|
|
|
|
2021-08-31 20:41:03 +03:00
|
|
|
### 6: Running tests
|
2020-05-19 21:52:31 +03:00
|
|
|
|
|
|
|
After `make all`, type `make test` to check everything works. This uses the
|
|
|
|
executable in `./build/exec`.
|
2020-05-20 18:38:46 +03:00
|
|
|
|
2021-08-31 20:41:03 +03:00
|
|
|
### 7: (Optional) Enabling incremental compilation
|
2021-06-27 18:35:43 +03:00
|
|
|
|
|
|
|
If you are working on Idris, incremental compilation means that rebuilds are
|
|
|
|
much faster, at the cost of runtime performance being slower. To enable
|
2023-02-10 01:49:49 +03:00
|
|
|
incremental compilation for the Chez backend, set the environment variable
|
2021-06-27 18:35:43 +03:00
|
|
|
`IDRIS2_INC_CGS=chez`, or set the `--inc chez` flag in `idris2.ipkg`.
|
|
|
|
|
2021-08-31 20:41:03 +03:00
|
|
|
### 8: (Optional) Installing the Idris 2 API
|
2020-05-20 18:38:46 +03:00
|
|
|
|
|
|
|
You'll only need this if you're developing support tools, such as an external
|
|
|
|
code generator. To do so, once everything is successfully installed, type:
|
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
- `make install-api`
|
2020-05-20 18:38:46 +03:00
|
|
|
|
2021-10-23 05:04:07 +03:00
|
|
|
The API will only work if you've completed the self-hosting step (step 5), since
|
2021-04-19 13:18:42 +03:00
|
|
|
the intermediate code versions need to be consistent throughout. Otherwise, you
|
|
|
|
will get an `Error in TTC: TTC data is in an older format` error.
|
2020-06-17 02:36:26 +03:00
|
|
|
|
2021-08-31 20:41:03 +03:00
|
|
|
### 9: (Optional) Shell Auto-completion
|
2021-05-11 07:09:23 +03:00
|
|
|
|
|
|
|
Idris2 supports tab auto-completion for Bash-like shells.
|
|
|
|
|
|
|
|
#### For Bash Users
|
|
|
|
|
|
|
|
From within bash, run the following command:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
eval "$(idris2 --bash-completion-script idris2)"
|
|
|
|
```
|
|
|
|
|
|
|
|
You can also add it to your `.bashrc` file.
|
|
|
|
|
|
|
|
#### For ZSH Users
|
2021-06-28 13:47:47 +03:00
|
|
|
|
2021-05-11 07:09:23 +03:00
|
|
|
From within ZSH, run the following commands:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
autoload -U +X compinit && compinit
|
|
|
|
autoload -U +X bashcompinit && bashcompinit
|
|
|
|
eval "$(idris2 --bash-completion-script idris2)"
|
|
|
|
```
|
|
|
|
|
|
|
|
You can also add them to your `.zshrc` file.
|
|
|
|
|
2020-08-19 04:01:14 +03:00
|
|
|
### Troubleshooting
|
|
|
|
|
|
|
|
If you get the message `variable make-thread-parameter is not bound` while
|
|
|
|
bootstrapping via Chez Scheme, or while running the tests when bootstrapping via
|
|
|
|
Racket, then your copy of Chez Scheme was built without thread support. Pass
|
|
|
|
`--threads` to `./configure` while building Chez Scheme to correct the issue.
|
|
|
|
|
2020-06-17 02:36:26 +03:00
|
|
|
## Installing from a package manager
|
|
|
|
|
|
|
|
### Installing using Homebrew
|
|
|
|
|
|
|
|
If you are Homebrew user you can install Idris 2 together with all the requirements
|
2020-07-31 03:00:12 +03:00
|
|
|
by running the following command:
|
2020-06-17 02:36:26 +03:00
|
|
|
|
2021-05-11 07:09:23 +03:00
|
|
|
```sh
|
|
|
|
brew install idris2
|
|
|
|
```
|
2020-07-31 03:00:12 +03:00
|
|
|
|
|
|
|
### Installing from nix
|
|
|
|
|
2021-06-28 13:47:47 +03:00
|
|
|
If you are a [nix](https://nixos.org/features.html) user you can install Idris
|
|
|
|
2 together with all the requirements by running the following command:
|
2020-07-31 03:00:12 +03:00
|
|
|
|
2021-05-11 07:09:23 +03:00
|
|
|
```sh
|
|
|
|
nix-env -i idris2
|
|
|
|
```
|
2021-01-22 16:30:42 +03:00
|
|
|
|
2021-01-15 20:20:52 +03:00
|
|
|
### Install from nix flakes
|
|
|
|
|
2021-06-28 13:47:47 +03:00
|
|
|
If you are a [nix flakes](https://nixos.wiki/wiki/Flakes) user you can install
|
|
|
|
Idris 2 together with all the requirements by running the following command:
|
2021-01-15 20:20:52 +03:00
|
|
|
|
2021-05-11 07:09:23 +03:00
|
|
|
```sh
|
|
|
|
nix profile install github:idris-lang/Idris2
|
|
|
|
```
|
2021-03-15 17:21:50 +03:00
|
|
|
|
|
|
|
## Running in text editor
|
|
|
|
|
|
|
|
### Run on emacs using nix flakes
|
|
|
|
|
2021-06-28 13:47:47 +03:00
|
|
|
If you are a [nix flakes](https://nixos.wiki/wiki/Flakes) user you can run
|
|
|
|
Idris 2 in emacs by running the following command:
|
2021-03-15 17:21:50 +03:00
|
|
|
|
2021-05-11 07:09:23 +03:00
|
|
|
```sh
|
2021-06-28 13:47:47 +03:00
|
|
|
nix run github:idris-lang/Idris2#emacs-with-idris idrisCode.idr
|
2021-05-11 07:09:23 +03:00
|
|
|
```
|
2022-08-28 23:53:52 +03:00
|
|
|
|
|
|
|
### Installing Chez Scheme on Apple Silicon
|
|
|
|
|
|
|
|
The official version of chez scheme does not yet support Apple Silicon. So, on
|
|
|
|
macOS with Apple Silicon (e.g. M1 and M2 macs), you will need to build and install
|
|
|
|
the Racket fork of chez scheme.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git clone git@github.com:racket/ChezScheme.git
|
|
|
|
cd ChezScheme
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
arch=tarm64osx
|
|
|
|
./configure --pb
|
|
|
|
make ${arch}.bootquick
|
|
|
|
./configure --threads
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
```
|
|
|
|
|