Rust cross-compile support
Starting with Firefox 53 currently in beta, Mozilla enables rust code by default. It can be disabled, for the moment, but they should be adding more rust code in the future. For us to be able to keep building fennec, rust support is needed.
For this, the host needs:
- cargo: The rust build-system. Cargo version doesnt need to be the same of rustc, so it should be easy to intall (backport) from debian.
- rustc: The rust compiler. Actually is packaged in Debian Stretch, but this cant be used for firefox becouse of number 3
- rust-std: There should be installed the libs for every target (in the case of firefox: x86_64-unknown-linux-gnu (assuming 64-bit build server), i686-linux-android, armv7-linux-androideabi) and needs to be built from the same commit as rustc. Debian only has packaged the std for x86_64.
They have a tool for installing/downloading rustc and managing targets, but most importantly, they have an index for downloading cargo, rustc, and the libs.
They come with a install script, but i just tried extracting them to a custom location.
For building Fennec 53 i used the following (for tarballs, i list the directories that i extracted):
- cargo from the repos
- rust-1.16.0-x86_64-unknown-linux-gnu.tar.gz (also works rustc 1.16.0 x86_64 + rust-std 1.16.0 x86_64)
- /rust-1.16.0-x86_64-unknown-linux-gnu/rustc/{bin, lib}
- /rust-1.16.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/
- rust-std-1.16.0-i686-linux-android.tar.gz
- /rust-std-1.16.0-i686-linux-android/rust-std-i686-linux-android/lib/rustlib/i686-linux-android/
- rust-std-1.16.0-armv7-linux-androideabi.tar.gz
- /rust-std-1.16.0-armv7-linux-androideabi/rust-std-armv7-linux-androideabi/lib/rustlib/armv7-linux-androideabi/
So my directories looks like
- /rustc
- /bin
- rusc + some binaries
- /lib
- rustc libs
- /rustlib
- /etc
- more rustc libs (debugger)
- /armv7-linux-androideabi
- armv7 std-libs
- /i686-linux-android
- i686 std-libs
- /x86_64-unknown-linux-gnu
- x86_64 std-libs
- /etc
- /bin
I have also installed the rustc packaged from the system (for personal projects), and this didnt conflict with it, as i didn need to add rustc/bin to PATH, just added the RUSTC=/rustc/bin/rustc variable to the firefox build config