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:
```
```bash
# From /path/to/serenity
./Meta/serenity.sh run 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
directory to always build LibWeb and Ladybird for Lagom when rebuilding SerenityOS using the
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
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
```

View file

@ -109,6 +109,15 @@ CMAKE_ARGS+=( "-DSERENITY_TOOLCHAIN=$TOOLCHAIN_TYPE" )
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() {
git rev-parse --show-toplevel
}
@ -129,7 +138,7 @@ is_valid_target() {
if [ "$TARGET" = "lagom" ]; then
CMAKE_ARGS+=("-DBUILD_LAGOM=ON")
if [ "${CMD_ARGS[0]}" = "ladybird" ]; then
CMAKE_ARGS+=("-DENABLE_LAGOM_LADYBIRD=ON")
CMAKE_ARGS+=("-DENABLE_LAGOM_LADYBIRD=ON" "-DENABLE_QT=${LADYBIRD_ENABLE_QT}")
fi
return 0
fi
@ -270,11 +279,11 @@ build_target() {
if [ "$TARGET" = "lagom" ]; then
# Ensure that all lagom binaries get built, in case user first
# 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
EXTRA_CMAKE_ARGS="-DENABLE_LAGOM_LADYBIRD=ON"
EXTRA_CMAKE_ARGS=("-DENABLE_LAGOM_LADYBIRD=ON" "-DENABLE_QT=${LADYBIRD_ENABLE_QT}")
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
# 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
case "$CMD" in
build)
build_target "$@"
build_target "${CMD_ARGS[@]}"
;;
install)
build_target
@ -480,7 +489,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
gdb)
if [ "$TARGET" = "lagom" ]; then
[ $# -ge 1 ] || usage
build_target "$@"
build_target "${CMD_ARGS[@]}"
run_gdb "${CMD_ARGS[@]}"
else
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
;;
rebuild)
build_target "$@"
build_target "${CMD_ARGS[@]}"
;;
recreate)
;;
@ -540,7 +549,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
fi
;;
*)
build_target "$CMD" "$@"
build_target "$CMD" "${CMD_ARGS[@]}"
;;
esac
elif [ "$CMD" = "delete" ]; then