servo - サーボは、Rust言語で書かれたプロトタイプのWebブラウザエンジンです。現在、64ビットmacOS、64ビットLinux、64ビットWindows、およびAndroidで開発されています。

(The Servo Browser Engine)

Created at: 2012-02-09 03:07:25
Language: NULL
License: MPL-2.0

サーボ並列ブラウザエンジンプロジェクト

サーボは、Rust言語で書かれたプロトタイプのWebブラウザエンジンです。現在開発中 64 ビット版の macOS、64 ビット版の Linux、64 ビット版の Windows、および Android。

サーボは皆様からの貢献を歓迎します。開始方法については、CONTRIBUTING.md および HACKING_QUICKSTART.md を参照してください。

訪問 サーボプロジェクト ニュースとガイドのページ。

環境のセットアップ

Rustup.rs

サーボの構築には、バージョン1.8.0以降の錆びが必要です。 古いバージョンを使用している場合は、を実行します。

rustup self update

Windowsにインストールするには、rustup-initをダウンロードして実行し.exe画面の指示に従います。

他のシステムにインストールするには、次のコマンドを実行します。

curl https://sh.rustup.rs -sSf | sh

これにより、サーボが使用しない現在の安定バージョンのRustもダウンロードされます。 その手順をスキップするには、代わりに次のコマンドを実行します。

curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none

関連項目 その他のインストール方法

その他の依存関係

お使いのオペレーティングシステムを選択してください:

マック

Xcode バージョン 10.2 以降を推奨します。

macOS上(インテルベースまたはARMベース)(自作)

注: これらの手順は、プロジェクトをローカルに複製した後に実行します。

cd servo 
brew bundle install --file=etc/taskcluster/macos/Brewfile
brew bundle install --file=etc/taskcluster/macos/Brewfile-build
pip install virtualenv

Debianベースのディストリビューション

sudo apt install python3-virtualenv python3-pip
./mach bootstrap

が機能しない場合は、バグを報告し、以下のコマンドを実行します。

./mach bootstrap

sudo apt install git curl autoconf libx11-dev libfreetype6-dev libgl1-mesa-dri \
    libglib2.0-dev xorg-dev gperf g++ build-essential cmake libssl-dev \
    liblzma-dev libxmu6 libxmu-dev \
    libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
    libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libharfbuzz-dev ccache \
    clang libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
    libgstreamer-plugins-bad1.0-dev autoconf2.13 llvm-dev

さらに、16.2 より後のバージョンの GStreamer のローカル コピーが必要です。に配置するか、実行してセットアップできます。Ubuntu 20.04LTSでは、必要なパッケージをインストールすると、システムGStreamerを使用できます。

support/linux/gstreamer/gst
./mach bootstrap-gstreamer

sudo apt install gstreamer1.0-nice gstreamer1.0-plugins-bad

Ubuntu 16.04またはLinux Mint 18を使用している場合は、harfbuzzのエラーを回避するために、ビルドする前に実行してください。

export HARFBUZZ_SYS_NO_PKG_CONFIG=1

すべての古いバージョンのclangを削除しようとすると、未定義のシンボルエラーが発生した場合は、#22016を参照してください。

gst_player_get_config
gir1.2-gst-plugins-bad-1.0

フェドーラについて

sudo dnf install python3 python3-virtualenv python3-pip python3-devel
python3 ./mach bootstrap

が機能しない場合は、バグを報告し、以下のコマンドを実行します。

python3 ./mach bootstrap

sudo dnf install curl libtool gcc-c++ libXi-devel libunwind-devel \
    freetype-devel mesa-libGL-devel mesa-libEGL-devel glib2-devel libX11-devel \
    libXrandr-devel gperf fontconfig-devel cabextract ttmkfdir  expat-devel \
    rpm-build openssl-devel cmake libX11-devel libXcursor-devel \
    libXmu-devel dbus-devel ncurses-devel harfbuzz-devel \
    ccache clang clang-libs python3-devel gstreamer1-devel \
    gstreamer1-plugins-base-devel gstreamer1-plugins-bad-free-devel autoconf213 \
    libjpeg-turbo-devel zlib libjpeg

CentOS の場合

sudo yum install python-virtualenv python-pip
./mach bootstrap

が機能しない場合は、バグを報告し、以下のコマンドを実行します。

./mach bootstrap

sudo yum install curl libtool gcc-c++ libXi-devel freetype-devel \
    mesa-libGL-devel mesa-libEGL-devel glib2-devel libX11-devel libXrandr-devel \
    gperf fontconfig-devel cabextract ttmkfdir python expat-devel rpm-build \
    openssl-devel cmake3 libXcursor-devel libXmu-devel \
    dbus-devel ncurses-devel python34 harfbuzz-devel \
    ccache clang clang-libs llvm-toolset-7

内部に構築し、:

llvm-toolset
devtoolset

scl enable devtoolset-7 llvm-toolset-7 bash

次の環境変数を設定します。

export CMAKE=cmake3
export LIBCLANG_PATH=/opt/rh/llvm-toolset-7/root/usr/lib64

openSUSE で

sudo zypper install libX11-devel libexpat-devel Mesa-libEGL-devel Mesa-libGL-devel cabextract cmake \
    dbus-1-devel fontconfig-devel freetype-devel gcc-c++ git glib2-devel gperf \
    harfbuzz-devel libXcursor-devel libXi-devel libXmu-devel libXrandr-devel libopenssl-devel \
    python3-pip python3-virtualenv rpm-build ccache llvm-clang libclang autoconf213 gstreamer-devel \
    gstreamer-plugins-base-devel gstreamer-plugins-bad-devel

Arch Linux 上

sudo pacman -S --needed base-devel git python python-virtualenv python-pip mesa cmake libxmu \
    pkg-config ttf-fira-sans harfbuzz ccache llvm clang autoconf2.13 gstreamer gstreamer-vaapi \
    gst-plugins-base gst-plugins-good gst-plugins-bad

Gentoo Linux 上

sudo emerge net-misc/curl \
    media-libs/freetype media-libs/mesa dev-util/gperf \
    dev-python/virtualenv dev-python/pip dev-libs/openssl \
    media-libs/harfbuzz dev-util/ccache sys-libs/libunwind \
    x11-libs/libXmu x11-base/xorg-server sys-devel/clang \
    media-libs/gstreamer media-libs/gst-plugins-bad media-libs/gst-plugins-base

次の環境変数を設定します。

export LIBCLANG_PATH=$(llvm-config --prefix)/lib64

NixOS Linux の場合

nix-shell etc/shell.nix

machを実行する前に、すべてのシェルでこれを実行する必要があります。

ウィンドウズ (MSVC) の場合

  1. Python 3.9 for Windows (https://www.python.org/downloads/release/python-392/) をインストールします。Windows x86-64 MSIインストーラは問題ありません。これは、JavaScript エンジンである SpiderMonkey を構築するために必要です。

また、次のようにして、環境変数を 'C:\Python39\python.exe' に設定する必要があります。

PYTHON3

setx PYTHON3 "C:\Python39\python.exe" /m

は、将来のすべてのコマンドウィンドウに対してシステム全体を設定します。

/m

  1. virtualenvをインストールします。

通常の Windows シェル (cmd) では、次のようにします。

pip install virtualenv

これが機能しない場合は、(Pythonインストーラーによって)変更されたPATH設定を有効にするために再起動する必要があります。

  1. 最新の GStreamer MSVC パッケージをインストールします。お使いのプラットフォーム用の 1 つのファイルを GStreamer Web サイトからダウンロードしてインストールする必要があります。現在推奨されているバージョンは 16.0.<> です。すなわち:
    .msi

MinGWバイナリは機能しないため、必ずMSVCバイナリをインストールしてください。

デフォルトではインストールされないオプションライブラリの多くが必要なため、すべてのコンポーネントがgstreamerからインストールされていることを確認する必要があることに注意してください。

  1. Git for Windows (https://git-scm.com/download/win) をインストールします。パスにgit.exeを追加することを許可してください(デフォルト インストーラーの設定は問題ありません)。

  2. Visual Studio ビルド ツール 2019 (https://visualstudio.microsoft.com/de/downloads/#build-tools-for-visual-studio-2019) をインストールします。Chocolatey経由でインストールするのが最も簡単です。

choco install -y visualstudio2019buildtools --package-parameters="--add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.Component.MSBuild --add Microsoft.VisualStudio.Component.CoreBuildTools --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.TextTemplating --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.VisualStudio.Workload.VCTools"

Visual Studio インストーラー (UI) を本当に使用する必要がある場合は、[C++ によるデスクトップ開発] を選択し、オプションの "MSVC"、"C++-ATL"、および "C++-MFC" (最新) を追加します。

Visual Studio 2019ビルドツールは、デフォルトの場所にインストールする必要があり.batまたはマッハはそれらを見つけることができません。

[オプション]LLVMをインストールしてリンク時間を短縮する

次の手順に従って、Windowsでのビルドが大幅に高速化される場合があります。(関連する錆の問題:https://github.com/rust-lang/rust/issues/37543)

  1. LLVM (https://releases.llvm.org/) の最新バージョンをダウンロードします。
  2. インストーラを実行し、LLVM をシステム PATH に追加することを選択します。
  3. カーゴ設定に以下を追加します(にあります)。環境に合わせてトリプルを変更する必要がある場合があります。
    %USERPROFILE%\.cargo\config
[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"
ウィンドウズ環境のトラブルシューティング

デフォルトで設定されているプロンプトに問題がある場合:

x64 type
mach.bat

  1. Windowsメニューなど、タイプを手動で選択して起動する必要がある場合があります。
    x86_x64 Cross Tools Command Prompt for VS 2019
  2. cd to/the/path/servo
  3. python mach build -d

エラーが発生した場合:

Cannot run mach in a path on a case-sensitive file system on Windows

  1. 管理者としてコマンド プロンプトまたは PowerShell を開きます。
  2. サーボパスの大文字と小文字を区別することを無効にします。
    fsutil.exe file SetCaseSensitiveInfo X:\path\to\servo disable

エラーが発生した場合は.dll 環境変数は、 などを含む適切なディレクトリに格納されます。

DLL file 
 not found!
WindowsSdkDir
Windows Kit
Redist\ucrt\DLLs\x64\api-ms-win-crt-runtime-l1-1-0.dll
C:\Program Files (x86)\Windows Kits\10

エラーが発生した場合LIBCLANG_PATHは、32ビットのターゲットではなく64ビットのデフォルトターゲットをインストールした可能性があります。 で構成を検索し、 でデフォルトを設定できます。

thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the 
 environment variable to a path where one of these files can be found (invalid: ... invalid DLL (64-bit))])"'
rustup
rustup show
rustup set default-host x86_64-pc-windows-msvc

アンドロイドのためのクロスコンパイル

実行して、Android 固有のツールを入手します。詳細については、ウィキを参照してください。

./mach bootstrap-android --build

リポジトリの複製

CARGO_HOMEは、Servoリポジトリと同じドライブを指している(または入っている)必要があります(#28530を参照)。

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

建物

サーボは、RustパッケージマネージャーであるCargoで構築されています。 また、Mozilla の Mach ツールを使用して、ビルドやその他のタスクをオーケストレーションしています。 マッハは次のように呼び出すことができます。

Unix システムの場合:

./mach [command] [arguments]

Windows コマンドラインの場合:

mach.bat [command] [arguments]

以下の例ではUnixを使用しますが、同じことがWindowsにも当てはまります。

Rust コンパイラ

Servoのビルドシステムは、rustup.rs を使用してRustコンパイラを自動的にダウンロードします。 これは、rust-toolchainファイルによって決定されるRust Nightlyの特定のバージョンです。

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 flag to create an optimized build:

--release

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

Note: will build both and . To make compilation a bit faster, it's possible to only compile the servo binary: .

mach build 
servo
libsimpleservo
./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:

./mach check

It will run , 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.

cargo check

Building for Android target

For ARM (, most phones):

armv7-linux-androideabi

./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
    プロファイラーをオンにし、数秒ごとに情報をコンソールにダンプします
    INTERVAL
  • -s SIZE
    ペイントのタイルサイズを設定します。デフォルトは 512 です。
  • -z
    すべてのグラフィック出力を無効にします。JS /レイアウトテストの実行に便利
  • -Z help
    サーボのデバッグに役立つ出力を表示します

キーボードショートカット

  • Ctrl
    +
    L
    URLプロンプトを開きます(Macでは+)
    Cmd
    L
  • Ctrl
    +
    R
    現在のページをリロードします(Macでは+)
    Cmd
    R
  • Ctrl
    +
    -
    ズームアウトします(+Macの場合)
    Cmd
    -
  • Ctrl
    +
    =
    ズームイン(Macでは+)
    Cmd
    =
  • Alt
    +
    left arrow
    履歴をさかのぼります(+Macの場合)
    Cmd
    left arrow
  • Alt
    +
    right arrow
    履歴を前進させます(+Macの場合)
    Cmd
    right arrow
  • Esc
    または+サーボを終了します(Macの場合は+)
    Ctrl
    Q
    Cmd
    Q

ランタイムの依存関係

リナックス

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

現像

使用できるマッハコマンドはたくさんあります。あなたはそれらをでリストすることができます。

./mach --help

生成されたドキュメントは、https://doc.servo.org/servo/index.html にあります。