* Android build * Fixes * More fixes - Still failing in the linking step * More work on getting linking working Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: use mozjs with ndk r25c. loads servo.org more android build fixes. * fix ./mach run for android and make it follow logs Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * add experimental logic for compositor pause/resume Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * pass DPI from android to simpleservo Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * ci: add android workflow Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * switch to ANDROID_SDK_ROOT and ANDROID_NDK_ROOT vars Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade gradle to 4.10.1 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade to gradle 5.1.1 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade to gradle 8 and agp 8 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * make compositing work again with external present Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: improve mach support for non-NixOS and CI Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fix sampler compilation bug introduced in #30490 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * ci: add android build to main workflow Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * gradle: set MinSdk = targetSdk = 30 NDK requires we compile against the minSdk API level which is 30 in our case. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * add instructions for android in README.md Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: move servosurface to servoview Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: uncomment the mediasession callbacks on MainActivity Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: fix crash on MainAtivity.onDestroy Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: drop VR, arm 5 and unused code This commit drops: * support for google, oculusvr * support for arm5 architecture and also removes * fakeld scripts * unused java code Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * cleanup shell.nix Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: add FIXMEs for gstreamer code Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: remove commented code and debug logs Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * cleanup ServoView.java Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * mach: comment call to download gstreamer deps for android Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * disable bluetooth for jniapi as blurdroid is broken Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fixup! README.md * fixup! remove change in Cargo.toml * fixup! move shell variables together * fixup! cleanup jniapi/Cargo.toml comments * delete commented gstreamer related android code Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * remove unused config variable in servbuild Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: more cleanup Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * force no_static_freetype only for android * use actions to manage sdk, ndk and java Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * rename embedder event names to be more clear. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * link to startup crash issue Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fix lint issues Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade env_logger to 0.10 with duplicate exception libservo and android_logger can use env_logger 0.10 but quickcheck is still stuck on 0.8 and has not seen any activity in the last 2 years. This commit adds a duplicate exception until the quickcheck dependency can be upgraded (or replaced) Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: fix comments Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * disable jemalloc on android Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fixup! replace linux with android in cfg --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com> |
||
---|---|---|
.cargo | ||
.github | ||
.vscode | ||
components | ||
docs | ||
etc | ||
ports | ||
python | ||
resources | ||
support | ||
tests | ||
third_party | ||
.clang-format | ||
.flake8 | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
Cargo.lock | ||
Cargo.toml | ||
CLOBBER | ||
CONTRIBUTING.md | ||
dependencyci.yml | ||
Info.plist | ||
LICENSE | ||
mach | ||
mach.bat | ||
PULL_REQUEST_TEMPLATE.md | ||
README.md | ||
rust-toolchain.toml | ||
rustfmt.toml | ||
servo-tidy.toml | ||
servobuild.example | ||
taplo.toml |
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
- Ensure that the version showed by
python --version
is >= 3.10: - Install Xcode
- Install Homebrew
- Run
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- 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 (version >= 3.10):
- Debian-like: Run
sudo apt install python3-pip python3-venv
- Fedora: Run
sudo dnf install python3 python3-pip python3-devel
- Arch: Run
sudo pacman -S --needed python python-pip
- Gentoo: Run
sudo emerge dev-python/pip
- Debian-like: Run
- Run
./mach bootstrap
Windows
- Download and run
rustup-init.exe
then follow the onscreen instructions. - Install chocolatey
- Install Python 3.11
- Run
mach bootstrap
- This will install CMake, Git, Ninja, 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.toml
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 you’re 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 doesn’t produce a binary you can run.
Building for Android target
Prerequisites:
Servo's build system assumes that both the Android SDK & NDK are
already installed and expects the paths to be specified via the
environment variables ANDROID_SDK_ROOT
and ANDROID_NDK_ROOT
.
Servo also expects the following components are installed via sdkmanager:
For building:
sdkmanager install platform-tools platforms;android-33
To run in emulator, also install the related components:
sdkmanager install emulator system-images;android-33;google_apis;x86
Build commands:
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
Install the APK to the device or emulator:
./mach install --release --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 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 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
orCtrl
+Q
exits Servo (Cmd
+Q
on Mac)
Runtime dependencies
Linux
GStreamer
>=1.16gst-plugins-bad
>=1.16libXcursor
libXrandr
libXi
libxkbcommon
vulkan-loader
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