-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add a Cargo-based build system to replace the Makefiles #27003
Changes from all commits
e645ed5
37755fe
6af9387
969c974
4f96077
6042556
92fae85
c0fe709
769b18c
85c3ade
f47c848
cdcc1ac
bc8d465
c7bbd39
49a0466
a7e0eb8
6cab349
70858dc
2a795be
4b59341
ff8b83f
90f55a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,3 +93,7 @@ tmp.*.rs | |
version.md | ||
version.ml | ||
version.texi | ||
*.racertmp | ||
Cargo.lock | ||
target | ||
!/src/librustc_back/target | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,59 @@ Read ["Installing Rust"] from [The Book]. | |
|
||
## Building from Source | ||
|
||
Starting from `e645ed59` the Rust Build System is being converted to use | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before we get experience with using Cargo I don't think we want to mention it so prominently in the README. I suspect there will be a long tail of many minor bugs to fix, and we can always add this info later on down the road. |
||
Cargo. The new build system is supposed to replace the old Makefile-based | ||
build system once it is mature enough. It is encouraged to use the new build | ||
system whenever possible as the Makefile-based system is marked for deletion | ||
in the future. | ||
|
||
To build the compiler, | ||
|
||
1. Make sure you have installed the dependencies: | ||
|
||
* `g++` 4.7 or `clang++` 3.x | ||
* `python` 2.7 or later (but not 3.x) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3.x is released so long ago, that it doesn’t make sense to support 2.x only. That’s something that can be fixed later, of course. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The LLVM build system requires Python2, so you need python2 to compile LLVM. The python scripts in the Rust source repo are compatible with both versions. |
||
* `git` | ||
|
||
On a Unix-based system (Linux/Mac) you also need: | ||
|
||
* GNU `make` 3.81 or later | ||
|
||
2. Download the latest nightly build of Rust, and install it. | ||
|
||
On Unix-based systems, you can use the `multirust` tool to do this. | ||
|
||
3. Clone the [source] with `git`: | ||
|
||
```sh | ||
$ git clone https://github.com/rust-lang/rust.git | ||
$ cd rust | ||
``` | ||
|
||
[source]: https://github.com/rust-lang/rust | ||
|
||
4. Update the git submodules within the source repository: | ||
|
||
```sh | ||
$ git submodule init | ||
$ git submodule update | ||
``` | ||
|
||
5. On a Unix-based system, run | ||
|
||
```sh | ||
$ ./build.sh | ||
``` | ||
|
||
On Windows, open a (normal) command line window and run | ||
|
||
``` | ||
python src\etc\build_rust.py | ||
``` | ||
|
||
|
||
## Building from Source with the Makefile-based Build System | ||
|
||
1. Make sure you have installed the dependencies: | ||
|
||
* `g++` 4.7 or `clang++` 3.x | ||
|
@@ -55,7 +108,7 @@ Read ["Installing Rust"] from [The Book]. | |
|
||
[Cargo]: https://github.com/rust-lang/cargo | ||
|
||
### Building on Windows | ||
### Building on Windows with the Makefile-based Build System | ||
|
||
[MSYS2](http://msys2.github.io/) can be used to easily build Rust on Windows: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
python src/etc/build_rust.py $@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will positively not work on any systems where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the only python2 feature that was used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’d just call python2 here, honestly, unless you’re absolutely sure it will work on both python3 and python2. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep the experience consistent across platforms I'd be fine just removing this small shell script (or moving a python script to the top of the project) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "build_helper" | ||
version = "0.1.0" | ||
authors = ["Chang Liu <cliu712@aucklanduni.ac.nz>"] | ||
|
||
[lib] | ||
name = "build_helper" | ||
path = "lib.rs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be refactored to just: