Skip to content

Commit 2a62d93

Browse files
committed
Add MacOS Build Instructions
Here we add detailed build instructions to make it possible to build the ash compiler on MacOS from source using `ghcup` and `cabal`. There are a number of small changes, but they are necessary for a proper build. We document this in a new section of the MacOS README for Ash.
1 parent 047d502 commit 2a62d93

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ cabal.sandbox.config
66
.DS_Store
77
*~
88
travis.log
9+
dist-newstyle
10+
cabal.project.local

cabal.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
profiling: False
22
library-profiling: True
3+
overwrite-policy: always

cabal.project

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
with-compiler: ghc-9.0.2
2+
packages: .

elm.cabal

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ Category: Compiler, Language
2323
Cabal-version: >=1.9
2424
Build-type: Simple
2525

26+
Data-files:
27+
reactor/elm.json
28+
reactor/check.py
29+
reactor/src/*.elm
30+
reactor/src/Index/*.elm
31+
reactor/src/mock.txt
32+
reactor/assets/favicon.ico
33+
reactor/assets/styles.css
34+
reactor/assets/source-sans-pro.ttf
35+
reactor/assets/source-code-pro.ttf
36+
37+
2638
source-repository head
2739
type: git
2840
location: git://github.com/elm/compiler.git

installers/mac/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,45 @@ So the point of running `sudo mv elm /usr/local/bin/` is to turn the `elm` binar
7373

7474
<br/>
7575

76+
## Installing from Source
77+
78+
First, install ghcup in homebrew (or you may manage your own ghc compiler):
79+
80+
```sh
81+
> brew install ghcup
82+
```
83+
84+
Then set the following versions:
85+
86+
```sh
87+
> ghcup set ghc 9.0.2
88+
> ghcup install cabal
89+
```
90+
91+
You may need to ensure a proper link to llvm@13. Run:
92+
93+
```sh
94+
brew install llvm@13
95+
```
96+
97+
and then in the `ash-compiler` root directory, run:
98+
99+
```
100+
echo "program-options\n ghc-options: \"$(pkg-config --cflags libffi)\"" > cabal.project.local
101+
```
102+
103+
Now you should be able to build with:
104+
105+
```
106+
cabal build elm
107+
```
108+
109+
And you can install the elm executable via:
110+
111+
```
112+
cabal install elm --overwrite-policy=always
113+
```
114+
76115
## Uninstall
77116

78117
The following commands should remove everything:

0 commit comments

Comments
 (0)