Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve building from source instructions #621

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
59 changes: 54 additions & 5 deletions _gitbook/installation/from_source_repository.md
@@ -1,17 +1,66 @@
# From sources

If you want to contribute then you might want to install Crystal from sources. But Crystal is written in Crystal itself! So you first need to use one of the previous described methods to have a running compiler.
If you want to contribute (or simply run the very latest Crystal) then you will want to build Crystal from sources. But since Crystal is written in Crystal - you can't compile Crystal unless you've already compiled Crystal! Don't worry, you simply need to use a pre-built Crystal compiler for your platform to bootstrap the process.

You will also need LLVM 3.5 present in the path. If you are using Mac and the Homebrew formula, this will be automatically configured for you if you install Crystal adding `--with-llvm` flag.
## Pre-requisites

Then clone the repository:
You'll first need to use one of the previous installation methods to install a pre-built Crystal compiler. (since you need Crystal to compile Crystal)

You will also need LLVM 3.5 present in the path. If you are using Mac and the Homebrew formula, this will have been automatically configured for you if you installed Crystal using the `--with-llvm` flag.

## Getting the code

Just clone the repository and you're ready to start hacking.

```
git clone https://github.com/manastech/crystal.git
cd crystal
# hack away
```

and you're ready to start hacking.
## Building

To build your own version of the compiler:

```
make
```

To build your own version of the compiler, run `make`. The new compiler will be placed at `.build/crystal`.
The new compiler will be placed at `.build/crystal`.

Inside the repository you will also find a wrapper script at `bin/crystal`. This script will execute the global installed compiler or the one that you just compiled (if present).

## Running the specs

To ensure your compiler was built and is working properly you'll want to run the included specs.

```
make spec
```

The output should include a bunch of dots and asterisks and then a summary like the following:

```
<snip>
........................................................*..................*....
......................................................................................
..................................................
<snip>
Finished in 1:29 minutes
5734 examples, 0 failures, 0 errors, 15 pending
```

If there are failures or errors that likely indicates a problem with your compiler - or possibly you haven't updated any specs that might have been affected by changes you've made.

---

### Quick Steps

Once you have LLVM 3.5 and a working Crystal compiler:

```
git clone https://github.com/manastech/crystal.git
cd crystal
make crystal
make spec
```