preparing_the_build.md 2.96 KB
Newer Older
1 2
Preparing the build
===================
Ticki's avatar
Ticki committed
3 4 5

Woah! You made it so far, all the way to here. Congrats! Now we gotta build Redox.

6 7 8
Using the bootstrap Script
--------------------------

Emanuele Antonio Faraone's avatar
Emanuele Antonio Faraone committed
9
If you're on a Linux or macOS computer, you can just run the bootstrapping script, which does the build preparation for you. Change to the folder where you want the source code to live and run the following command:
Ticki's avatar
Ticki committed
10

11
```sh
Ticki's avatar
Ticki committed
12 13 14
$ curl -sf https://raw.githubusercontent.com/redox-os/redox/master/bootstrap.sh -o bootstrap.sh && bash -e bootstrap.sh
```

Nagy Tibor's avatar
Nagy Tibor committed
15
This script fetches build dependencies using a package manager for your platform and clones the Redox code from GitHub. It checks whether you might already have a dependency and skips the installation in this case. On some systems this is simply done by checking whether the binary exists and doesn't take into account which version of the program you have. This can lead to build errors if you have old versions already installed. In this case, please install the skipped dependencies manually.
16 17 18 19

Manual Setup
------------

20
### Cloning the repository
Ticki's avatar
Ticki committed
21

22
Change to the folder where you want your copy of Redox to be stored and issue the following command:
23

jeff's avatar
jeff committed
24
 ```sh
25 26
 $ git clone https://github.com/redox-os/redox.git --origin upstream --recursive && \
    cd redox && git submodule update --recursive --init
jeff's avatar
jeff committed
27
 ```
28

jeff's avatar
jeff committed
29
 Give it a while. Redox is big.
30

jeff's avatar
jeff committed
31

32
### Installing the build dependencies
Ticki's avatar
Ticki committed
33

34
I assume you have a package manager, which you know how to use (if not, you have to install the build dependencies even more manually). We need the following deps: `make` (probably already installed), `nasm` (the assembler, we use in the build process), `qemu` (the hardware emulator, we will use. If you want to run Redox on real hardware, you should read the `fun` chapter):)
Ticki's avatar
Ticki committed
35

36 37 38
Linux Users:

```
Chris Overcash's avatar
Chris Overcash committed
39
$ [your package manager] install cmake make nasm qemu pkg-config libfuse-dev
40 41 42 43 44 45 46 47 48 49
```

MacOS Users using MacPorts:

```
$ sudo port install make nasm qemu gcc49 pkg-config osxfuse x86_64-elf-gcc
```

MacOS Users using Homebrew:

Ticki's avatar
Ticki committed
50
```
51
$ brew install make nasm qemu gcc49 pkg-config Caskroom/cask/osxfuse
52
$ brew install redox-os/gcc_cross_compilers/x86_64-elf-gcc
Ticki's avatar
Ticki committed
53 54
```

55 56 57
Setting Up Nightly Rust
-----------------------

58
The following step is not required _if_ you already have a functioning Rust nightly installation. Nightly is required.
Ticki's avatar
Ticki committed
59

60
We will use `rustup` to manage our Rust versions:
Ticki's avatar
Ticki committed
61

62
```sh
63
$ curl https://sh.rustup.rs -sSf | sh
Ticki's avatar
Ticki committed
64 65
```

66
You may need to run rustup to install the recommended nightly version.
67

Paul Sajna's avatar
Paul Sajna committed
68 69 70 71 72
There is one more tool we need from Rust to install Redox. It is called Xargo. Xargo allows us to have a custom `libstd`
```sh
$ cargo install xargo
```

73 74 75 76 77 78
Once it is installed, add its install directory to your path by running the following
```sh
$ export PATH=${PATH}:~/.cargo/bin
```
This line can be added to your shell start-up file, like .bashrc, so that it is automatically set up for you in future.

79 80 81
Next steps
----------

82
Once this is all set up, we can finally [compile Redox](getting_started/compiling_redox.html).