1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:47:35 +00:00

Meta: Add and document convenient method to build non-Qt Ladybird chrome

This lets us switch between the AppKit and Qt chromes more easily.
This commit is contained in:
Timothy Flynn 2023-08-25 07:05:57 -04:00 committed by Tim Flynn
parent b7f9634f6c
commit 5d7e73adfe
2 changed files with 34 additions and 10 deletions

View file

@ -65,12 +65,27 @@ MinGW/MSYS2 are not supported, but may work with sufficient elbow grease. Native
The simplest way to build and run ladybird is via the serenity.sh script: The simplest way to build and run ladybird is via the serenity.sh script:
``` ```bash
# From /path/to/serenity # From /path/to/serenity
./Meta/serenity.sh run lagom ladybird ./Meta/serenity.sh run lagom ladybird
./Meta/serenity.sh gdb lagom ladybird ./Meta/serenity.sh gdb lagom ladybird
``` ```
By default, the above commands will build Ladybird using Qt for the browser chrome. We also support
the following platform-specific browser chromes:
* [AppKit](https://developer.apple.com/documentation/appkit?language=objc) - The native chrome on macOS.
To build Ladybird using one of these chromes on the appropriate platform, use the following serenity.sh
commands:
```bash
# From /path/to/serenity
./Meta/serenity.sh run lagom ladybird-appkit # Use the AppKit chrome on macOS.
```
### Disabling Ladybird
Note that running ladybird from the script will change the CMake cache in your Build/lagom build Note that running ladybird from the script will change the CMake cache in your Build/lagom build
directory to always build LibWeb and Ladybird for Lagom when rebuilding SerenityOS using the directory to always build LibWeb and Ladybird for Lagom when rebuilding SerenityOS using the
serenity.sh script to run a qemu instance. serenity.sh script to run a qemu instance.
@ -78,7 +93,7 @@ serenity.sh script to run a qemu instance.
To restore the previous behavior that only builds code generators and tools from Lagom when To restore the previous behavior that only builds code generators and tools from Lagom when
rebuilding serenity, you must modify the CMake cache back to the default. rebuilding serenity, you must modify the CMake cache back to the default.
``` ```bash
cmake -S Meta/Lagom -B Build/lagom -DENABLE_LAGOM_LADYBIRD=OFF -DENABLE_LAGOM_LIBWEB=OFF -DBUILD_LAGOM=OFF cmake -S Meta/Lagom -B Build/lagom -DENABLE_LAGOM_LADYBIRD=OFF -DENABLE_LAGOM_LIBWEB=OFF -DBUILD_LAGOM=OFF
``` ```

View file

@ -109,6 +109,15 @@ CMAKE_ARGS+=( "-DSERENITY_TOOLCHAIN=$TOOLCHAIN_TYPE" )
CMD_ARGS=( "$@" ) CMD_ARGS=( "$@" )
LADYBIRD_ENABLE_QT=1
if [ "$TARGET" = "lagom" ]; then
if [ "${CMD_ARGS[0]}" = "ladybird-appkit" ]; then
CMD_ARGS[0]="ladybird"
LADYBIRD_ENABLE_QT=0
fi
fi
get_top_dir() { get_top_dir() {
git rev-parse --show-toplevel git rev-parse --show-toplevel
} }
@ -129,7 +138,7 @@ is_valid_target() {
if [ "$TARGET" = "lagom" ]; then if [ "$TARGET" = "lagom" ]; then
CMAKE_ARGS+=("-DBUILD_LAGOM=ON") CMAKE_ARGS+=("-DBUILD_LAGOM=ON")
if [ "${CMD_ARGS[0]}" = "ladybird" ]; then if [ "${CMD_ARGS[0]}" = "ladybird" ]; then
CMAKE_ARGS+=("-DENABLE_LAGOM_LADYBIRD=ON") CMAKE_ARGS+=("-DENABLE_LAGOM_LADYBIRD=ON" "-DENABLE_QT=${LADYBIRD_ENABLE_QT}")
fi fi
return 0 return 0
fi fi
@ -270,11 +279,11 @@ build_target() {
if [ "$TARGET" = "lagom" ]; then if [ "$TARGET" = "lagom" ]; then
# Ensure that all lagom binaries get built, in case user first # Ensure that all lagom binaries get built, in case user first
# invoked superbuild for serenity target that doesn't set -DBUILD_LAGOM=ON # invoked superbuild for serenity target that doesn't set -DBUILD_LAGOM=ON
local EXTRA_CMAKE_ARGS="" local EXTRA_CMAKE_ARGS=()
if [ "${CMD_ARGS[0]}" = "ladybird" ]; then if [ "${CMD_ARGS[0]}" = "ladybird" ]; then
EXTRA_CMAKE_ARGS="-DENABLE_LAGOM_LADYBIRD=ON" EXTRA_CMAKE_ARGS=("-DENABLE_LAGOM_LADYBIRD=ON" "-DENABLE_QT=${LADYBIRD_ENABLE_QT}")
fi fi
cmake -S "$SERENITY_SOURCE_DIR/Meta/Lagom" -B "$BUILD_DIR" -DBUILD_LAGOM=ON ${EXTRA_CMAKE_ARGS} cmake -S "$SERENITY_SOURCE_DIR/Meta/Lagom" -B "$BUILD_DIR" -DBUILD_LAGOM=ON "${EXTRA_CMAKE_ARGS[@]}"
fi fi
# Get either the environment MAKEJOBS or all processors via CMake # Get either the environment MAKEJOBS or all processors via CMake
@ -441,7 +450,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
ensure_target ensure_target
case "$CMD" in case "$CMD" in
build) build)
build_target "$@" build_target "${CMD_ARGS[@]}"
;; ;;
install) install)
build_target build_target
@ -480,7 +489,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
gdb) gdb)
if [ "$TARGET" = "lagom" ]; then if [ "$TARGET" = "lagom" ]; then
[ $# -ge 1 ] || usage [ $# -ge 1 ] || usage
build_target "$@" build_target "${CMD_ARGS[@]}"
run_gdb "${CMD_ARGS[@]}" run_gdb "${CMD_ARGS[@]}"
else else
command -v tmux >/dev/null 2>&1 || die "Please install tmux!" command -v tmux >/dev/null 2>&1 || die "Please install tmux!"
@ -505,7 +514,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
fi fi
;; ;;
rebuild) rebuild)
build_target "$@" build_target "${CMD_ARGS[@]}"
;; ;;
recreate) recreate)
;; ;;
@ -540,7 +549,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
fi fi
;; ;;
*) *)
build_target "$CMD" "$@" build_target "$CMD" "${CMD_ARGS[@]}"
;; ;;
esac esac
elif [ "$CMD" = "delete" ]; then elif [ "$CMD" = "delete" ]; then