Chromium
Chromium は Google の Chrome Web ブラウザのオープンソース版です。最小限のユーザーインターフェースと、強力な Web 開発ツールと、組み込みのタスクマネージャを特徴としています。Chromium プロジェクトは新しい Web 標準を実装する最前線です。
Chromium はオープンソースなので、プロプライエタリな Google Chrome ブラウザにデフォルトで含まれるいくつかの機能は、法律上の理由で含めることができません。例えば自動アップデートです。差分の完全な一覧は chromium リポジトリで確認できます。
インストール
USE フラグ
USE flags for www-client/chromium Open-source version of Google Chrome web browser
X
|
Add support for X11 |
component-build
|
Split build into more shared libraries to speed up linking. Mostly intended for debugging and development, NOT RECOMMENDED for general use. |
cups
|
Add support for CUPS (Common Unix Printing System) |
custom-cflags
|
Build with user-specified CFLAGS (unsupported) |
debug
|
Enable DCHECK feature with severity configurable at runtime. Mostly intended for debugging and development, NOT RECOMMENDED for general use. |
gtk4
|
Build with GTK4 headers. |
hangouts
|
Enable support for Google Hangouts features such as screen sharing |
headless
|
Build Ozone only with headless backend, NOT RECOMMENDED for general use. |
kerberos
|
Add kerberos support |
libcxx
|
Use bundled libc++ instead of libstdc++ for building. |
lto
|
Build with Link Time Optimizations (via clang's ThinLTO) |
official
|
Enable Official build instead of Developer build. |
pax-kernel
|
Allow building on a PaX-enabled kernel |
pgo
|
Build with Profile Guided Optimizations (2-stage compilation) |
pic
|
Disable optimized assembly code that is not PIC friendly |
proprietary-codecs
|
Enable codecs for patent-encumbered audio and video formats. |
pulseaudio
|
Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire) |
qt5
|
Add support for the Qt 5 application and UI framework |
qt6
|
Add support for the Qt 6 application and UI framework |
screencast
|
Enable support for remote desktop and screen cast using PipeWire |
selinux
|
!!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur |
suid
|
Build the SUID sandbox, which is only needed on CONFIG_USER_NS=n kernels |
system-av1
|
Use system media-libs/libaom and media-libs/dav1d instead of the bundled libraries. |
system-ffmpeg
|
Use system media-video/ffmpeg instead of the bundled version. |
system-harfbuzz
|
Use system media-libs/harfbuzz instead of the bundled library. |
system-icu
|
Use system dev-libs/icu instead of the bundled one |
system-png
|
Use system media-libs/libpng instead of the bundled library |
system-zstd
|
Use system app-arch/zstd instead of the bundled one. |
vaapi
|
Enable Video Acceleration API for hardware decoding |
wayland
|
Enable dev-libs/wayland backend |
widevine
|
Unsupported closed-source DRM capability (required by Netflix VOD) |
icu
Chromium が emerge されるのを妨げる dev-libs/libxml2 との emerge スロット衝突を回避するには、/etc/portage/make.conf で
icu
USE フラグを設定する必要があります。icu
が新たに設定された場合、Chromium を emerge する前に以下を実行してシステムを更新してください:root #
emerge --ask --update --deep --newuse @world
L10N
Chromium では L10N USE_EXPAND 変数を通して多くの言語を利用することができます。多すぎて wiki ではすべてを表示できません。すべての地域化言語を一覧表示するには、次を実行してください:
user $
equery u www-client/chromium | grep -i l10n
地域化に関するさらなる情報については、地域化の記事を読んでください。
Emerge
Chromium のコンパイルには、かなりの実時間と CPU 時間とシステムメモリを占有することに注意してください。make の各スレッドに対して 2Gb の RAM が割り当てられるようにしてください (MAKEOPTS を適切に設定することによって。こちらの投稿も参考にしてください)。システムに負荷がかかっている状態で Chromium をビルドするのは、おそらく止めておいたほうがよいでしょう。
USE フラグを望み通り設定したら、次のコマンドで Chromium を emerge してください:
root #
emerge --ask www-client/chromium
設定
Clang
Clang で Chromium をビルドするには、まず Clang environments を読んでください。
Chromium に固有な事項として、次の env 設定が必要です:
/etc/portage/env/clang-chromium
# 任意で,以下を EXTRA_GN に追加してください:
# - thin_lto_enable_optimizations=true
# - use_thin_lto=true
# - is_cfi=true
EXTRA_GN="use_lld=true is_clang=true clang_use_chrome_plugins=false"
#
# GCC11を用いる場合に必要です
CHROMIUM_FORCE_LIBCXX=yes
それからこれらを有効にしてください (他の記事に記載されている基本的な Clang の設定に、必要な設定を今定義したことに気をつけてください):
/etc/portage/package.env
# compiler-clang: 基本的なClang環境でビルド(Clangの記事を見てください)
# clang-chromium: Chromium用の調整を加えてビルド
www-client/chromium compiler-clang clang-chromium
HiDPI
Chromium の映像出力は通常、デスクトップ環境の DPI スケーリングとは独立しています。--force-device-scale-factor
コマンドラインオプションを使用することで、スケールされたモードで起動するように指示することができます。このオプションには整数または小数の値を渡すことができます。標準のスケーリングは 1.0 で開始します。例えば、Chromium の UI を 1.5 倍の大きさにするには:
user $
chromium --force-device-scale-factor=1.5
コマンドラインスイッチの一覧はここで見ることができます。
ネイティブ Wayland サポート
バージョン 87 以降、次のオプションを渡すことで Chromium のネイティブ Wayland サポートを有効化することができます:
user $
chromium --enable-features=UseOzonePlatform --ozone-platform=wayland
Chromium を常に Wayland バックエンドを使用して起動するように設定するには、ユーザの Chromium 構成ファイルに以下の行を追加してください:
~/.config/chromium-flags.conf
--enable-features=UseOzonePlatform
--ozone-platform=wayland
ページのためのダークテーマ (prefers-color-scheme) を有効化する
2022 年 5 月時点で、GTK 上の Chromium はバグのために、ユーザがダークページを表示したいことを認識しません。しかしこの好みは手動で設定することができます:
/etc/chromium/default
CHROMIUM_FLAGS="--force-dark-mode
--enable-features=WebUIDarkMode"
1 番目は通常のページのためのもので、2 番目は内部用 chrome:// ページのためのものです。
タブホバーカードを無効化する
バージョン 91.0.4472.77 以降、Chrome フラグ内でタブホバーカードを無効化することができなくなりました。Google はこの機能を復活させることを優先しないようです。無効化するために、Portage に以下のパッチを追加することができます:
/etc/portage/patches/www-client/chromium/hover-card.patch
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 2c94eb0..1f7bde0 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -2149,6 +2149,7 @@ void TabStrip::OnMouseEventInTab(views::View* source,
}
void TabStrip::UpdateHoverCard(Tab* tab, HoverCardUpdateType update_type) {
+ return;
// Some operations (including e.g. starting a drag) can cause the tab focus
// to change at the same time as the tabstrip is starting to animate; the
// hover card should not be visible at this time.
Added setting for Tab Hover Cards もご覧ください。
ポリシー
It is possible to set specific policies for chromium. This can be useful especially if the browser should be accessible by users, but the content should be restricted to trusted sites. It can also be configured to restrict the access to specified URIs, like the file://
protocol, to prevent users from surfing the file system.
Chromium looks in /etc/chromium/policies for existing policies. There are two types of policies which can be defined:
- managed
- recommended
Generally managed policies are maintained by an administrator and recommended policies are recommended for users but not required.
For further information about the two policy types the documentation should be referred on the Google Chrome support page.
The following example assumes managed policies. However, the procedure for recommended policies is very similar and can be found in the Chromium documentation.
Creating of managed policies
To set custom managed policies, a JSON file must be created in /etc/chromium/policies/managed/<filename>.json
It is important to ensure, that the
<filename>.json
is not writable by non-admin users, to prevent overwriting of the policies by users, which would defeat the purpose of policies! The chown and chmod commands can be used to change ownership and rights if for any reason the file should be writable by non-admin users.The structure of the JSON file is the same for all chromium based browsers (Chrome, Chromium, Brave etc). An example JSON file could look like this:
{
"IncognitoModeAvailability": 1,
"URLBlocklist": [
"https://facebook.com",
"file://*",
"javascript://*",
"ftp://*",
"mailto:*"
],
"DefaultGeolocationSetting": 2,
"DefaultNotificationsSetting": 2,
}
This prevents the user from surfing on the file system using the file protocol, incognito mode, blocks the listed URIs and URLs, and the location and notifications. More settings, can be found in the policy list: https://www.chromium.org/administrators/policy-list-3/. If configured for other users as a service, it is recommended to block all sites at first and then define the allowed sites, to avoid abuse of the service. Please note that this only blocks the user from visiting specified locations. It does not disable the protocols on the system, so other applications must be configured separately.
If the policy was configured properly can be proofed on the special page: chrome://policy
.
For a better structure, it is also possible to spread the policies over multiple JSON files. In this case it is indispensable to ensure that the same policy occurs only once per all files! If a policy is defined multiple times across the JSON files than the state of the policy will be undefined and it would be unclear which rule would be used!
Meaningful filenames and a simple grep across the files in case of doubt can help to prevent such misconfigurations.
使い方
Chrome URL
Firefox と同じように、Chromium は追加の構成設定、トラブルシューティング、タスク管理、等々のために使用できる、内部 Chrome URL(特別ページ)を多数持っています。特別ページの完全な一覧は chrome://about/
に移動することでアクセスできます。
特によく使用される特別ページには次のようなものがあります:
chrome://components/
- 有効化されたコンポーネントを表示し、それぞれの更新を確認するためのボタンを提供します。Chrome を使用している場合、このインターフェースを介して手動で PPAPI Adobe flash モジュールを更新する必要がある場合があります。chrome://chrome/
- バージョン情報を含む About ページを表示します。chrome://extensions/
- 拡張機能を管理するページです。chrome://flags/
- 実験的機能を有効化・無効化します。chrome://flash/
- Adobe Flash Player に関する特別な情報を表示します(Chromium からアクセス可能な場合)。chrome://gpu/
- グラフィックスアクセラレーションの使用に関する情報を表示します。chrome://history/
- Web の履歴を表示します。サンドイッチメニューから、あるいは Ctrl+h を押すことでもアクセスできます。chrome://memory-redirect/
- ブラウザのメモリ使用量とタブ毎の使用量を計測します。chrome://net-internals/
- ネットワーク接続に関する多くの情報です。chrome://plugins/
- プラグインの一覧を表示します。このインターフェースからプラグインを有効化・無効化できます。(Chrome バージョン 57 で旧式化されました[1]。)chrome://version/
-chrome
ページよりも詳細なバージョン情報を表示します。
トラブルシューティング
スクリーンキャストのサポート
スクリーンキャストはデフォルトでは実行時のレベルで無効化されています。Chromium 内で chrome://flags/#enable-webrtc-pipewire-capturer
に移動して有効化するか、/etc/chromium/default ファイル内の CHROMIUM_FLAGS 変数の値として --enable-features=WebRTCPipeWireCapturer
を追加してください。
タブがクラッシュする
時として Chromium のタブがクラッシュすることがあります。クラッシュの原因はいくつか考えられますが、よくある原因の一つはメモリの空き容量が少ない状態でシステムが動作していることです。Gentoo では特に、システムが Chromium を実行している状態で www-client/chromium のパッケージ更新をコンパイルしている場合に起こり得ます。
システムのメモリ空き容量を確認するには、free コマンドを使用できます:
user $
free -h
total used free shared buff/cache available Mem: 15G 11G 735M 789M 3.4G 3.1G
解決策は、大きなパッケージのコンパイルが完了するまでメモリを空けておくことです。リソースモニタを開き、メモリを大量に使用しているアプリケーションを終了させてください。