]> git.lizzy.rs Git - rust.git/blob - README.md
auto merge of #15249 : aochagavia/rust/rand, r=huonw
[rust.git] / README.md
1 # The Rust Programming Language
2
3 This is a compiler for Rust, including standard libraries, tools and
4 documentation.
5
6 ## Quick Start
7
8 1. Download a [binary installer][installer] for your platform.
9 2. Read the [tutorial].
10 3. Enjoy!
11
12 > ***Note:*** Windows users can read the detailed
13 > [getting started][wiki-start] notes on the wiki.
14
15 [installer]: http://www.rust-lang.org/install.html
16 [tutorial]: http://doc.rust-lang.org/tutorial.html
17 [wiki-start]: https://github.com/rust-lang/rust/wiki/Note-getting-started-developing-Rust
18 [win-wiki]: https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows
19
20 ## Building from Source
21
22 1. Make sure you have installed the dependencies:
23     * `g++` 4.7 or `clang++` 3.x
24     * `python` 2.6 or later (but not 3.x)
25     * `perl` 5.0 or later
26     * GNU `make` 3.81 or later
27     * `curl`
28     * `git`
29 2. Download and build Rust:
30
31     You can either download a [tarball] or build directly from the [repo].
32
33     To build from the [tarball] do:
34
35         $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz
36         $ tar -xzf rust-nightly.tar.gz
37         $ cd rust-nightly
38
39     Or to build from the [repo] do:
40
41         $ git clone https://github.com/rust-lang/rust.git
42         $ cd rust
43
44     Now that you have Rust's source code, you can configure and build it:
45
46         $ ./configure
47         $ make && make install
48
49     > ***Note:*** You may need to use `sudo make install` if you do not normally have
50     > permission to modify the destination directory. The install locations can
51     > be adjusted by passing a `--prefix` argument to `configure`. Various other
52     > options are also supported, pass `--help` for more information on them.
53
54     When complete, `make install` will place several programs into
55     `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
56     API-documentation tool.
57     system.
58 3. Read the [tutorial].
59 4. Enjoy!
60
61 ### Building on Windows
62
63 To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/msys2/):
64
65 1. Grab the latest MSYS2 installer and go through the installer.
66 2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
67    tools we need.
68
69         $ pacman -S mingw-w64-i686-toolchain
70         $ pacman -S base-devel
71
72 3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`).
73 4. From there just navigate to where you have Rust's source code, configure and build it:
74
75         $ ./configure --build=i686-pc-mingw32
76         $ make && make install
77
78 [repo]: https://github.com/rust-lang/rust
79 [tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
80 [tutorial]: http://doc.rust-lang.org/tutorial.html
81
82 ## Notes
83
84 Since the Rust compiler is written in Rust, it must be built by a
85 precompiled "snapshot" version of itself (made in an earlier state of
86 development). As such, source builds require a connection to the Internet, to
87 fetch snapshots, and an OS that can execute the available snapshot binaries.
88
89 Snapshot binaries are currently built and tested on several platforms:
90
91 * Windows (7, 8, Server 2008 R2), x86 only
92 * Linux (2.6.18 or later, various distributions), x86 and x86-64
93 * OSX 10.7 (Lion) or greater, x86 and x86-64
94
95 You may find that other platforms work, but these are our officially
96 supported build environments that are most likely to work.
97
98 Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits
99 swap, it will take a very long time to build.
100
101 There is a lot more documentation in the [wiki].
102
103 [wiki]: https://github.com/rust-lang/rust/wiki
104
105 ## License
106
107 Rust is primarily distributed under the terms of both the MIT license
108 and the Apache License (Version 2.0), with portions covered by various
109 BSD-like licenses.
110
111 See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.