README.md 3.97 KB
Newer Older
Julian Ospald's avatar
Julian Ospald committed
1 2 3
[![GitHub release](https://img.shields.io/github/release/haskell/ghcup.svg)](https://github.com/haskell/ghcup/releases)
[![Build Status](https://travis-ci.org/haskell/ghcup.svg?branch=master)](https://travis-ci.org/haskell/ghcup)
[![license](https://img.shields.io/github/license/haskell/ghcup.svg)](COPYING)
4

Sam Halliday's avatar
Sam Halliday committed
5
`ghcup` makes it easy to install specific versions of `ghc` on GNU/Linux, and can also bootstrap a fresh Haskell developer environment from scratch.
Julian Ospald's avatar
Julian Ospald committed
6
It follows the unix UNIX philosophy of [do one thing and do it well](https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well).
Julian Ospald's avatar
Julian Ospald committed
7

Sam Halliday's avatar
Sam Halliday committed
8
Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [pyenv](https://github.com/pyenv/pyenv) and [jenv](http://www.jenv.be).
9

Sam Halliday's avatar
Sam Halliday committed
10
*OS X users may prefer [futurice](https://haskell.futurice.com/) and Ubuntu users may prefer [hvr's ppa](https://launchpad.net/~hvr/+archive/ubuntu/ghc).*
11

Julian Ospald's avatar
Julian Ospald committed
12 13 14 15
## Table of Contents

   * [Installation](#installation)
   * [Usage](#usage)
Sam Halliday's avatar
Sam Halliday committed
16
   * [How](#how)
Julian Ospald's avatar
Julian Ospald committed
17 18 19
   * [Contributing](#contributing)
   * [Known problems](#known-problems)

Julian Ospald's avatar
Julian Ospald committed
20 21
## Installation

Julian Ospald's avatar
Julian Ospald committed
22 23 24
Just place the `ghcup` shell script into your `PATH` anywhere.

E.g.:
Julian Ospald's avatar
Julian Ospald committed
25

Julian Ospald's avatar
Julian Ospald committed
26
```sh
Julian Ospald's avatar
Julian Ospald committed
27
( mkdir -p ~/.ghcup/bin && curl https://raw.githubusercontent.com/haskell/ghcup/master/ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup) && echo "Success"
28 29
```

Julian Ospald's avatar
Julian Ospald committed
30 31 32
Then adjust your `PATH` in `~/.bashrc` (or similar, depending on your shell) like so, for example:

```sh
Julian Ospald's avatar
Julian Ospald committed
33
export PATH="$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH"
Julian Ospald's avatar
Julian Ospald committed
34 35
```

Julian Ospald's avatar
Julian Ospald committed
36 37
## Usage

38
See `ghcup --help`.
Julian Ospald's avatar
Julian Ospald committed
39

Julian Ospald's avatar
Julian Ospald committed
40 41 42
Generally this is meant to be used with [`cabal-install`](https://hackage.haskell.org/package/cabal-install), which
handles your haskell packages and can demand that [a specific version](https://cabal.readthedocs.io/en/latest/nix-local-build.html#cfg-flag---with-compiler)  of `ghc` is available, which `ghcup` can do.

Sam Halliday's avatar
Sam Halliday committed
43 44 45 46 47 48 49 50 51 52 53 54
## How

Installs a specified GHC version into `~/.ghcup/ghc/<ver>`, and places `ghc-<ver>` symlinks in `~/.ghcup/bin/`.

Optionally, an unversioned `ghc` link can point to a default version of your choice.

This uses precompiled GHC binaries that have been compiled on fedora/debian by [upstream GHC](https://www.haskell.org/ghc/download_ghc_8_6_1.html#binaries).

Alternatively, you can also tell it to compile from source (note that this might fail due to missing requirements).

In addition this script can also install `cabal-install`.

55 56 57 58 59 60 61
## Contributing

* PR or email
* this script is POSIX shell
* use [shellcheck](https://github.com/koalaman/shellcheck) and `checkbashisms.pl` from [debian devscripts](http://http.debian.net/debian/pool/main/d/devscripts/devscripts_2.18.4.tar.xz)
* whitespaces, no tabs

62 63 64 65 66 67 68 69 70 71 72
### Download locations

Download locations are maintained in the file [.download-urls](https://raw.githubusercontent.com/haskell/ghcup/master/.download-urls)
and may slightly be behind a very recent release or not tested
on all distro combinations.

In such a case, consider providing a PR to fix it.

Similarly, available versions are maintained in
[.available-versions](https://raw.githubusercontent.com/haskell/ghcup/master/.available-versions).

Sam Halliday's avatar
Sam Halliday committed
73
## Known problems
Julian Ospald's avatar
Julian Ospald committed
74

Sam Halliday's avatar
Sam Halliday committed
75
### Limited distributions supported
76

77
Currently only GNU/Linux distributions compatible with the [upstream GHC](https://www.haskell.org/ghc/download_ghc_8_6_1.html#binaries) binaries are supported.
Julian Ospald's avatar
Julian Ospald committed
78

79 80
### Precompiled binaries

Julian Ospald's avatar
Julian Ospald committed
81
Since this uses precompiled binaries you may run into
82
problems with *ncurses* and **missing libtinfo**, in case
Julian Ospald's avatar
Julian Ospald committed
83 84 85
your distribution doesn't use the legacy way of building
ncurses and has no compatibility symlinks in place.

86 87
Ask your distributor on how to solve this or
try to compile from source via `ghcup compile <version>`.
88 89 90

### Compilation

Julian Ospald's avatar
Julian Ospald committed
91
Although this script can compile GHC for you, it's just a very thin
92
wrapper around the build system. It makes no effort in trying
Julian Ospald's avatar
Julian Ospald committed
93
to figure out whether you have the correct toolchain and
94 95
the correct dependencies. Refer to [the official docs](https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux)
on how to prepare your environment for building GHC.