ladybird/Ladybird
2022-12-25 07:58:58 -07:00
..
android Ladybird/Meta: Add Android build 2022-12-25 07:58:58 -07:00
cmake Ladybird/CMake: Install resources and Lagom libraries alongside ladybird 2022-12-25 07:58:58 -07:00
.gitignore Ladybird/Meta: Add Android build 2022-12-25 07:58:58 -07:00
AndroidPlatform.cpp Ladybird/Meta: Add Android build 2022-12-25 07:58:58 -07:00
BrowserWindow.cpp Ladybird/BrowserWindow: Give color scheme action group a detailed name 2022-12-25 07:58:58 -07:00
BrowserWindow.h Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
CMakeLists.txt Ladybird: Add a very simple DOM inspector 2022-12-25 07:58:58 -07:00
ConsoleClient.cpp Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
ConsoleClient.h Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
ConsoleGlobalObject.cpp Ladybird: Remove redundant use of impl() 2022-12-25 07:58:58 -07:00
ConsoleGlobalObject.h Ladybird: Fix build after LibWeb+LibJS GC changes 2022-12-25 07:58:58 -07:00
CookieJar.cpp Ladybird: Update for removal of StringView(char const*) 2022-12-25 07:58:58 -07:00
CookieJar.h Ladybird: Implement basic cookie support 2022-12-25 07:58:58 -07:00
EventLoopPluginQt.cpp Ladybird: Use only the Qt event loop to speed everything up :^) 2022-12-25 07:58:58 -07:00
EventLoopPluginQt.h Ladybird: Use only the Qt event loop to speed everything up :^) 2022-12-25 07:58:58 -07:00
FontPluginQt.cpp Ladybird/FontPluginQt: Initialize the default fixed-width font 2022-12-25 07:58:58 -07:00
FontPluginQt.h Ladybird/FontPluginQt: Implement default font virtuals 2022-12-25 07:58:58 -07:00
History.cpp Ladybird: Expanded toolbar with browser history and home button 2022-12-25 07:58:58 -07:00
History.h Ladybird: Expanded toolbar with browser history and home button 2022-12-25 07:58:58 -07:00
ImageCodecPluginLadybird.cpp Ladybird: Implement the Web::Platform::ImageCodecPlugin interface 2022-12-25 07:58:58 -07:00
ImageCodecPluginLadybird.h Ladybird: Implement the Web::Platform::ImageCodecPlugin interface 2022-12-25 07:58:58 -07:00
Info.plist Ladybird/Meta: Use reverse domain name notation in property list files 2022-12-25 07:58:58 -07:00
LICENSE.md Ladybird: Add a separate license file 2022-12-25 07:58:58 -07:00
main.cpp Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
ModelTranslator.cpp Ladybird: Add a very simple DOM inspector 2022-12-25 07:58:58 -07:00
ModelTranslator.h Ladybird: Add a ModelTranslator to translate a GUI::Model to a Qt model 2022-12-25 07:58:58 -07:00
PageClientLadybird.cpp Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
PageClientLadybird.h Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
README.md Ladybird: Add macOS build instructions 2022-12-25 07:58:58 -07:00
RequestManagerQt.cpp Ladybird: Enable HTTP pipelining 2022-12-25 07:58:58 -07:00
RequestManagerQt.h Ladybird: Use QtNetwork for HTTP and HTTPS requests 2022-12-25 07:58:58 -07:00
Settings.cpp Ladybird: Add Settings class 2022-12-25 07:58:58 -07:00
Settings.h Ladybird: Add Settings class 2022-12-25 07:58:58 -07:00
SettingsDialog.cpp Ladybird: Allow for setting the hompage through SettingsDialog 2022-12-25 07:58:58 -07:00
SettingsDialog.h Ladybird: Allow for setting the hompage through SettingsDialog 2022-12-25 07:58:58 -07:00
SimpleWebView.cpp Ladybird: Add a very simple DOM inspector 2022-12-25 07:58:58 -07:00
SimpleWebView.h Ladybird: Add a very simple DOM inspector 2022-12-25 07:58:58 -07:00
Tab.cpp Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
Tab.h Ladybird: Rename WebView to SimpleWebView 2022-12-25 07:58:58 -07:00
TimerQt.cpp Ladybird: Use only the Qt event loop to speed everything up :^) 2022-12-25 07:58:58 -07:00
TimerQt.h Ladybird: Use only the Qt event loop to speed everything up :^) 2022-12-25 07:58:58 -07:00
Utilities.cpp Ladybird/WebView: Move our PageClient to its own file 2022-12-25 07:58:58 -07:00
Utilities.h Ladybird/WebView: Move our PageClient to its own file 2022-12-25 07:58:58 -07:00
WebSocketClientManagerLadybird.cpp Ladybird/WebView: Move WebSocket stuff to its own files 2022-12-25 07:58:58 -07:00
WebSocketClientManagerLadybird.h Ladybird/WebView: Move WebSocket stuff to its own files 2022-12-25 07:58:58 -07:00
WebSocketLadybird.cpp Ladybird/WebView: Move WebSocket stuff to its own files 2022-12-25 07:58:58 -07:00
WebSocketLadybird.h Ladybird/WebView: Move WebSocket stuff to its own files 2022-12-25 07:58:58 -07:00

Ladybird Web Browser

The Ladybird Web Browser is a browser using the SerenityOS LibWeb engine with a Qt GUI.

Build Prerequisites

Qt6 development packages and a c++20-enabled compiler are required. On Debian/Ubuntu required packages include, but are not limited to:

sudo apt install build-essential cmake libgl1-mesa-dev ninja-build qt6-base-dev qt6-tools-dev-tools

On Arch Linux/Manjaro:

sudo pacman -S --needed base-devel cmake libgl ninja qt6-base qt6-tools qt6-wayland

On Fedora or derivates:

sudo dnf install cmake libglvnd-devel ninja-build qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland-devel

On macOS:

xcode-select --install
brew install qt ninja

For the c++ compiler, gcc-11 or clang-13 are required at a minimum for c++20 support.

For Ubuntu 20.04 and above, ensure that the Qt6 Wayland packages are available:

sudo apt install qt6-wayland

Build steps

Basic workflow, using serenity source dir cloned from github:

cmake -GNinja -B Build
cmake --build Build
ninja -C Build run

Advanced workflow, using pre-existing serenity checkout.

If you previously didn't set SERENITY_SOURCE_DIR, probably want to blast the Build directory before doing this:

cmake -GNinja -B Build -DSERENITY_SOURCE_DIR=/path/to/serenity
ninja -C Build run

To automatically run in gdb:

ninja -C Build debug

To run without ninja rule:

# or your existing serenity checkout /path/to/serenity
export SERENITY_SOURCE_DIR=${PWD}/Build/serenity
./Build/ladybird # or, in macOS: open ./Build/ladybird.app

Experimental Android Build Steps

Prepping Qt Creator

In order to build an Android APK, the following additional dependencies are required/recommended:

  • Qt Creator 6.4.0 (dev branch)
  • Android Studio 2021.2 (dev branch)

Note that Qt Creator 6.3.x LTS does NOT have the required fix to QTBUG-104580 as of 2022-07-16 in order to use NDK 24.

The build configuration was tested with the following packages from the Android SDK:

  • Android Platform and Build Tools version 33
  • Android System Images for API 33 aka "system-images;android-33;google-apis;x86_64"
  • Android NDK 24.0.8215888 for the llvm-14 based toolchain

In order to build ladybird for cross compilation, a separate serenity checkout is recommended.

e.g.

cd ~/Repos
git clone https://github.com/SerenityOS/serenity

First create a LagomTools build:

cmake -GNinja -S /path/to/serenity -B BuildTools -Dpackage=LagomTools -DCMAKE_INSTALL_PREFIX=tool-install
ninja -C BuildTools install

Next, create a build configuration in Qt Creator that uses an Android Qt 6.4.0 Debug x86_64 Kit by following the instructions here.

Ensure that you get Android API 30 or higher, and Android NDK 24 or higher. In the initial standup, an API 33 SDK for Android 13 was used.

Setup Android device settings in Qt Creator following this link. Note that Qt Creator might not like the Android NDK version 24 we downloaded earlier, as it's "too new" and "not supported". No worries, we can force it to like our version by editing the sdk_defintions.json file as described under Viewing Android Tool Chain Settings.

The relevant snippets of that JSON file are reproduced below. Just have to make sure it's happy with "platforms;android-33" and the exact installed NDK version.

        "sdk_essential_packages": {
            "default": ["platform-tools", "platforms;android-33", "cmdline-tools;latest"],
            "linux": [],
            "mac": [],
            "windows": ["extras;google;usb_driver"]
        }
    },
    "specific_qt_versions": [
        {
            "versions": ["default"],
            "sdk_essential_packages": ["build-tools;33.0.0", "ndk;24.0.8215888"],
            "ndk_path": "ndk/24.0.8215888"
        },

Building Ladybird for Android

Next, we can select the Android Qt 6.4.0 Debug x86_64 Kit under the Projects tab of the Qt Creator, and watch CMake have a bad time because we need to edit the configuration.

In the Initial Configuration Tab of the CMake configuration for the Kit, edit the following initial values:

  • ANDROID_NATIVE_API_LEVEL: 23 --> 30
  • LagomTools_DIR: New Directory setting, set to /path/to/ladybird/tool-install/share/Lagom for the LagomTools build we created earlier
  • SERENITY_SOURCE_DIR: New path setting, set to your local serenity checkout

Make sure to click the Reconfigure With Initial Parameters button, and triple check you've been editing the Initial Configuration tab and not the Current Configuration one.

Build the project, and cross your fingers that it all works :)

Running the Android APK

In order to run the ladybird application, first make sure that the Debug settings in the bottom left of the Qt Creator window are trying to debug ladybird, and not another Lagom target, like LibArchive.

Create an Android device to test using the Tools->Options->Devices->Devices add button. This will only work for an Android device if the "system-images;android-33;google-apis;x86_64" or similar package is installed with the Android SDK sdkmanager tool.

Open up Android Studio, and in the Device Manager edit the created AVD to update its Internal Storage under Advanced Settings. Make sure it's at least 1 GiB. The default of 800 MiB is generally too small to install ladybird.

Hit the Debug or Run green arrows and hope for the best!

With luck the application should start up, install the required resources into the internal storage from the APK, and open up the default webpage. Clicking the home button to load serenityos.org should work.