зеркало из https://github.com/mozilla/gecko-dev.git
56 строки
2.7 KiB
Plaintext
56 строки
2.7 KiB
Plaintext
Step 1: Install/switch to Rust Nightly
|
|
If you don't have it installed, you can install it from https://www.rust-lang.org/en-US/downloads.html
|
|
For Linux/Mac you can do this using rustup, see the curl command at the bottom of the page
|
|
For Windows you can use the MSVC ABI Nightly installer linked to from that download page
|
|
Note: do NOT install rust using ./mach bootstrap, as that will install the stable version and we need Nightly.
|
|
If you have already installed stable rust, make sure it is not in your $PATH
|
|
|
|
Step 2: Set up environment
|
|
Add the following two lines to your mozconfig:
|
|
ac_add_options --enable-rust
|
|
ac_add_options --enable-webrender
|
|
Ensure rustc and cargo are in your $PATH.
|
|
On Windows in the MozillaBuild shell you can run:
|
|
export PATH="$PATH:/c/Program Files/Rust nightly MSVC 1.14/bin"
|
|
to add them to your path assuming you used the default installation options when installing.
|
|
You can also add the export statement to your mozconfig
|
|
The first time you do a build with these changes, you should also run |mach clobber|
|
|
|
|
Step 3:
|
|
Build using |mach build|
|
|
|
|
|
|
When making changes:
|
|
- Make the changes you want.
|
|
- Run |mach build| or |mach build binaries| as desired.
|
|
|
|
|
|
For a debug webrender build:
|
|
Use a debug mozconfig (ac_add_options --enable-debug)
|
|
You can also use an opt build but make webrender less optimized by putting opt-level=0 in the [profile.release] section of your toolkit/library/rust/Cargo.toml file
|
|
See also https://groups.google.com/forum/#!topic/mozilla.dev.servo/MbeMcqqO1fs
|
|
|
|
|
|
What if you have to make changes to webrender itself?
|
|
|
|
1) Update your graphics branch checkout to the latest code on the
|
|
graphics branch
|
|
2) Check out and update the webrender repo to the version you want
|
|
3) Copy over the webrender and webrender_traits folders into gfx/.
|
|
4) If you need to modify webrender_bindings/Cargo.toml to include or remove
|
|
features, do so now.
|
|
4) Commit your changes to the graphics branch locally
|
|
5) Run |mach vendor rust| to update the rust dependencies in third_party/rust
|
|
6) Commit the vendored changes locally
|
|
7) Build and test. You may need to make changes in bindings.rs or on
|
|
the C++ side depending on what changed in webrender. This can
|
|
potentially be quite tricky if you don't fully understand the API
|
|
changes on the webrender side. In this step, try to not use your new
|
|
features yet, just get the build working with the minimal changes.
|
|
8) Commit the changes locally from step 7, and push everything to the
|
|
graphics branch.
|
|
9) Now you have an update webrender with the new features you wanted,
|
|
so you can write gecko code against them.
|
|
|
|
Yes, this is somewhat painful. It used to be worse. :)
|