English's Github Trend's slide
Trending Slides
Japanese Github Trend's slide
Trending Slides
@servo
Servo is a prototype web browser engine written in the Rust language. It is currently developed on 64-bit macOS, 64-bit Linux, 64-bit Windows, and Android.
Servo welcomes contribution from everyone. See
CONTRIBUTING.md
andHACKING_QUICKSTART.md
for help getting started.Visit the Servo Project page for news and guides.
Setting up your environment
readme
Rustup.rs
Building servo requires rustup, version 1.8.0 or more recent. If you have an older version, run
rustup self update
.To install on Windows, download and run
rustup-init.exe
then follow the onscreen instructions.To install on other systems, run:
This will also download the current stable version of Rust, which Servo won’t use. To skip that step, run instead:
See also Other installation methods
Other dependencies
Please select your operating system:
macOS
Debian-based distros
Fedora
Arch Linux
openSUSE
Gentoo Linux
Microsoft Windows
Android
macOS
Xcode version 10.2 or above is recommended.
On macOS(Intel based or ARM based) (Homebrew)
On Debian-based distros
If
./mach bootstrap
doesn’t work, file a bug, and, run the commands below:Additionally, you’ll need a local copy of GStreamer with a version later than 16.2. You can place it in
support/linux/gstreamer/gst
, or run./mach bootstrap-gstreamer
to set it up. On Ubuntu 20.04LTS, you can use the system GStreamer if you install the necessary packages:If you are using Ubuntu 16.04 or Linux Mint 18, run
export HARFBUZZ_SYS_NO_PKG_CONFIG=1
before building to avoid an error with harfbuzz.If you get an undefined symbol error on
gst_player_get_config
try removinggir1.2-gst-plugins-bad-1.0
and all old versions of clang, see #22016.On Fedora
If
python3 ./mach bootstrap
doesn’t work, file a bug, and, run the commands below:On CentOS
If
./mach bootstrap
doesn’t work, file a bug, and, run the commands below:Build inside
llvm-toolset
anddevtoolset
:with the following environmental variables set:
On openSUSE
On Arch Linux
On Gentoo Linux
With the following environment variable set:
On NixOS Linux
You will need to run this in every shell before running mach.
On Windows (MSVC)
Install Python 3.9 for Windows (https://www.python.org/downloads/release/python-392/). The Windows x86-64 MSI installer is fine. This is required in order to build the JavaScript engine, SpiderMonkey.
You will also need to set the
PYTHON3
environment variable, e.g., to 'C:\Python39\python.exe' by doing:The
/m
will set it system-wide for all future command windows.Install virtualenv.
In a normal Windows Shell (cmd), do:
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.
Install the most recent GStreamer MSVC packages. You need to download the two
.msi
files for your platform from the GStreamer website and install them. The currently recommended version is 1.16.0. i.e.:gstreamer-1.0-msvc-x86_64-1.16.0.msi
gstreamer-1.0-devel-msvc-x86_64-1.16.0.msi
Note that the MinGW binaries will not work, so make sure that you install the MSVC ones.
Note that you should ensure that all components are installed from gstreamer, as we require many of the optional libraries that are not installed by default.
Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).
Install Visual Studio Build Tools 2019 (https://visualstudio.microsoft.com/de/downloads/#build-tools-for-visual-studio-2019). It is easiest to install via Chocolatey with:
If you really need to use the Visual Studio Installer (UI), choose "Desktop development with C++" and add the optional "MSVC", "C++-ATL" and "C++-MFC" (latest).
The Visual Studio 2019 Build Tools MUST be installed to the default location or mach.bat will not find them.
[Optional] Install LLVM for faster link times
You may experience much faster builds on Windows by following these steps. (Related Rust issue: https://raw.githubusercontent.com/rust-lang/rust/issues/37543)
Download the latest version of LLVM (https://releases.llvm.org/).
Run the installer and choose to add LLVM to the system PATH.
Add the following to your Cargo config (Found at
%USERPROFILE%\.cargo\config
). You may need to change the triple to match your environment.Troubleshooting a Windows environment
Cross-compilation for Android
Run
./mach bootstrap-android --build
to get Android-specific tools. See wiki for details.Cloning the Repo
Your CARGO_HOME needs to point to (or be in) the same drive as your Servo repository (See #28530).
Building
Servo is built with Cargo, the Rust package manager. We also use Mozilla’s Mach tools to orchestrate the build and other tasks. You can call Mach like this:
On Unix systems:
On Windows Commandline:
The examples below will use Unix, but the same applies to Windows.
The Rust compiler
Servo’s build system uses rustup.rs to automatically download a Rust compiler. This is a specific version of Rust Nightly determined by the
rust-toolchain
file.Normal build
To build Servo in development mode. This is useful for development, but the resulting binary is very slow:
Release build
For benchmarking, performance testing, or real-world use. Add the
--release
flag to create an optimized build:mach build ` will build both `servo
andlibsimpleservo
. To make compilation a bit faster, it’s possible to only compile the servo binary:./mach build --dev -p servo
.Checking for build errors, without building
If you’re making changes to one crate that cause build errors in another crate, consider this instead of a full build:
It will run
cargo check
, which runs the analysis phase of the compiler (and so shows build errors if any) but skips the code generation phase. This can be a lot faster than a full build, though of course it doesn’t produce a binary you can run.Building for Android target
For ARM (
armv7-linux-androideabi
, most phones):For x86 (typically for the emulator):
Running
Run Servo with the command:
Commandline Arguments
-p INTERVAL
turns on the profiler and dumps info to the console everyINTERVAL
seconds-s SIZE
sets the tile size for painting; defaults to 512-z
disables all graphical output; useful for running JS / layout tests-Z help
displays useful output to debug servoKeyboard Shortcuts
Ctrl
+L
opens URL prompt (Cmd
+L
on Mac)Ctrl
+R
reloads current page (Cmd
+R
on Mac)Ctrl
+-
zooms out (Cmd
+-
on Mac)Ctrl
+=
zooms in (Cmd
+=
on Mac)Alt
+left arrow
goes backwards in the history (Cmd
+left arrow
on Mac)Alt
+right arrow
goes forwards in the history (Cmd
+right arrow
on Mac)Esc
orCtrl
+Q
exits Servo (Cmd
+Q
on Mac)Runtime dependencies
Linux
GStreamer
>=1.16gst-plugins-bad
>=1.16Developing
There are lots of mach commands you can use. You can list them with
./mach --help
.The generated documentation can be found on https://doc.servo.org/servo/index.html