Find a file
Yehuda Katz 2af55011b5 Merge pull request #23 from alexcrichton/crate-types
Invoke rustc only once for multiple crate types
2014-06-19 19:49:56 -07:00
.vagrant/machines/default/virtualbox WIP 2014-04-11 17:39:18 -07:00
DESIGN WIP 2014-04-11 17:39:18 -07:00
libs Add --verbose cause chain support 2014-06-19 14:15:17 -07:00
src Invoke rustc only once for multiple crate types 2014-06-19 19:44:45 -07:00
tests Invoke rustc only once for multiple crate types 2014-06-19 19:44:45 -07:00
.gitignore Clean up cargo-compile 2014-05-07 15:49:01 -07:00
.gitmodules Up to date with master 2014-04-01 22:31:11 -07:00
.travis.check.style.sh Update to rust style guidelines 2014-06-19 17:02:21 -07:00
.travis.install.deps.sh Get travis working on OSX 2014-06-19 15:49:40 -07:00
.travis.yml Update to rust style guidelines 2014-06-19 17:02:21 -07:00
.vimrc Add vimrc settings 2014-04-29 11:43:18 -07:00
Makefile Add a .travis.yml 2014-06-19 11:52:51 -07:00
MANIFEST.md Add support for detailed manifest dependencies 2014-06-09 17:51:53 -07:00
README.md Fix a typo in the README 2014-06-13 22:14:55 -07:00
Vagrantfile WIP 2014-04-11 17:39:18 -07:00

Compiling cargo

You'll want to clone cargo using --recursive on git, to clone in it's submodule dependencies.

$ git clone --recursive https://github.com/carlhuda/cargo

or

$ git submodule init
$ git submodule update

Then it's as simple as make and you're ready to go.

Porcelain

cargo-compile

$ cargo compile

This command assumes the following directory structure:

|Cargo.toml
|~src
| | {main,lib}.rs
|~target
| |~x86_64-apple-darwin
| | |~lib
| | | |~[symlinked dependencies]
| | | | [build artifacts]
| |~...

When running cargo compile, Cargo runs the following steps:

  • cargo verify --manifest=[location of Cargo.toml]
  • ... TODO: dependency resolution and downloading ...
  • cargo prepare
  • cargo rustc --out-dir=[from Cargo.toml]/[platform] -L [from Cargo.toml]/[platform]/lib ...

Plumbing

cargo-verify

$ cargo verify --manifest=MANIFEST

Verifies that the manifest is in the location specified, in a valid format, and contains all of the required sections.

Success

{ "success": true }

Errors

{
  "invalid": < "not-found" | "invalid-format" >,
  "missing-field": [ required-field... ],
  "missing-source": bool,
  "unwritable-target": bool
}

cargo-rustc

$ cargo rustc --out-dir=LOCATION -L LIBDIR -- ...ARGS

cargo-prepare

Prepare the directories (including symlinking dependency libraries) to be ready for the flags Cargo plans to pass into rustc.

NOTES and OPEN QUESTIONS

  • We need to support per-platform calls to make (et al) to build native (mostly C) code. Should this be part of prepare or a different step between prepare and cargo-rustc.