The Servo Browser Engine
Find a file
Martin Robinson 1eb3e85d69
Collect android build setup into two methods
This is small refactor which tries to isolate all of the Android setup
into a couple methods, so that it is easier to reason about in the
scripts. This doesn't change any behavior but does fix a few small
linting errors in the existing code.

Note: The Android build is currently broken and this change doesn't fix
it. It shouldn't break it any more though.
2023-07-05 07:47:00 +02:00
.cargo Support building UWP with native UWP rustc target. 2019-10-12 10:19:26 -04:00
.github Auto merge of #29963 - mrobinson:run-unit-tests-when-using-try-platform, r=atbrakhi 2023-07-04 13:51:28 +02:00
.vscode Update suggested Rust vscode extension. 2022-08-03 20:08:24 +08:00
components Split layout_in_flow_non_replaced_block_level 2023-07-03 16:11:44 +02:00
docs Move logers into seperate logger files 2023-05-02 17:02:02 +02:00
etc Update scripts to reflect new WPT directory name 2023-06-26 10:48:02 +02:00
ports Auto merge of #29956 - mrobinson:update-mozangle, r=jdm 2023-07-02 02:23:26 +02:00
python Collect android build setup into two methods 2023-07-05 07:47:00 +02:00
resources It was removed from the spec and it's disabled everywhere. 2023-06-30 16:28:21 +02:00
support Windows bootstrap support 2023-07-03 21:40:24 +02:00
tests Update web-platform-tests to revision b'f513c41310ebb13de9a0c5ea5e1c22544e0b5000' 2023-07-02 01:24:53 +00:00
third_party Create a top-level "third_party" directory 2023-06-30 09:51:31 +02:00
.clang-format Run test-tidy on Windows 2019-11-21 09:56:39 +01:00
.flake8 Standalone Flake8 config 2023-06-23 16:24:35 +02:00
.gitattributes Explicitly declare image files to be binaries in .gitattributes, so as to avoid crlf-munging 2019-07-05 09:00:56 -05:00
.gitignore Remove more Taskcluster and Treeherder integration 2023-04-10 23:04:17 +02:00
.hgignore Add .hgignore file 2017-02-03 18:42:52 -08:00
.mailmap Update Tetsuharu OHZEKI's entry in mailmap 2019-11-15 00:46:45 +09:00
Cargo.lock Update mozangle 2023-07-01 18:41:54 +02:00
Cargo.toml Update mozangle 2023-07-01 18:41:54 +02:00
CLOBBER Add clobber mechanism 2017-05-08 16:19:56 +02:00
CONTRIBUTING.md Update link to CoC 2023-05-19 19:09:45 +02:00
dependencyci.yml Don't report smallbitvec as an error. 2017-10-16 11:38:34 -04:00
Info.plist remove bhtml 2018-02-11 08:02:39 +01:00
LICENSE Update MPL license to https (part 1) 2018-11-19 14:46:43 +01:00
mach mach: cleanup after dropping Python 2 support 2021-07-19 14:24:29 +02:00
mach.bat Make mach.bat request Python 3 2021-05-22 18:27:10 +09:00
PULL_REQUEST_TEMPLATE.md Minor pull request template cleanup 2018-12-08 13:11:37 -08:00
README.md Windows bootstrap support 2023-07-03 21:40:24 +02:00
rust-toolchain Upgrade the Rust toolchain to 'nightly-2023-02-01' 2023-02-01 19:38:06 +05:30
rustfmt.toml Reorder imports 2018-11-06 22:35:07 +01:00
servo-tidy.toml Create a top-level "third_party" directory 2023-06-30 09:51:31 +02:00
servobuild.example Use layout 2020 by default 2023-06-08 23:13:53 +05:30
Xargo.toml Upgrade to rustc 1.44.0-nightly (42abbd887 2020-04-07) 2020-04-09 21:33:44 +02:00

The Servo Parallel Browser Engine Project

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 and HACKING_QUICKSTART.md for help getting started.

Visit the Servo Project page for news and guides.

Build Setup

If these instructions fail or you would like to install dependencies manually, try the manual build setup.

macOS

  • Install Xcode
  • Install Homebrew
  • Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Run pip install virtualenv
  • Run ./mach bootstrap
    Note: This will install the recommended version of GStreamer globally on your system.

Linux

  • Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Install Python and virtualenv
    • Debian-like: Run sudo apt install python3-virtualenv python3-pip
    • Fedora: Run sudo dnf install python3 python3-virtualenv python3-pip python3-devel
    • Arch: Run sudo pacman -S --needed python python-virtualenv python-pip
    • Gentoo: Run sudo emerge dev-python/virtualenv dev-python/pip
  • Run ./mach bootstrap

Windows

  • Download and run rustup-init.exe then follow the onscreen instructions.
  • Install chocolatey
  • Run mach bootstrap
  • This will install CMake, Git, Ninja, NuGet, Python and the Visual Studio 2019 Build Tools via choco in an Administrator console. It can take quite a while.
  • If you already have Visual Studio 2019 installed, this may not install all necessary components. Please follow the Visual Studio 2019 installation instructions in the manual setup.
  • Run refreshenv

See also Windows Troubleshooting Tips.

Cloning the Repo

Your CARGO_HOME needs to point to (or be in) the same drive as your Servo repository (See #28530).

git clone https://github.com/servo/servo
cd servo

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:

./mach [command] [arguments]

On Windows Commandline:

mach.bat [command] [arguments]

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:

./mach build --dev
./mach run tests/html/about-mozilla.html

Release build

For benchmarking, performance testing, or real-world use. Add the --release flag to create an optimized build:

./mach build --release
./mach run --release tests/html/about-mozilla.html

Checking for build errors, without building

If youre making changes to one crate that cause build errors in another crate, consider this instead of a full build:

./mach check

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 doesnt produce a binary you can run.

Building for Android target

For ARM (armv7-linux-androideabi, most phones):

./mach build --release --android
./mach package --release --android

For x86 (typically for the emulator):

./mach build --release --target i686-linux-android
./mach package --release --target i686-linux-android

Running

Run Servo with the command:

./servo [url] [arguments] # if you run with nightly build
./mach run [url] [arguments] # if you run with mach

# For example
./mach run https://www.google.com

Commandline Arguments

  • -p INTERVAL turns on the profiler and dumps info to the console every INTERVAL 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 servo

Keyboard 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 or Ctrl+Q exits Servo (Cmd+Q on Mac)

Runtime dependencies

Linux

  • GStreamer >=1.16
  • gst-plugins-bad >=1.16

Developing

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