From ad8183beb4ce22e09bede15be05b39d9b1587e4b Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 26 Jan 2023 06:51:48 -0500 Subject: [PATCH] Meta: Support running ladybird with arguments from serenity.sh You may now, for example, run: ./Meta/serenity.sh run lagom ladybird https://serenityos.org --- Ladybird/CMakeLists.txt | 3 ++- Meta/serenity.sh | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Ladybird/CMakeLists.txt b/Ladybird/CMakeLists.txt index 275aa369ae6..43daac54f11 100644 --- a/Ladybird/CMakeLists.txt +++ b/Ladybird/CMakeLists.txt @@ -116,8 +116,9 @@ if (ANDROID) endif() add_custom_target(run${LADYBIRD_CUSTOM_TARGET_SUFFIX} - COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SERENITY_SOURCE_DIR}" "$" + COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SERENITY_SOURCE_DIR}" "$" $ENV{LAGOM_ARGS} USES_TERMINAL + VERBATIM ) add_custom_target(debug${LADYBIRD_CUSTOM_TARGET_SUFFIX} diff --git a/Meta/serenity.sh b/Meta/serenity.sh index 31986f1e58b..eb985da2b64 100755 --- a/Meta/serenity.sh +++ b/Meta/serenity.sh @@ -402,6 +402,7 @@ run_gdb() { } build_and_run_lagom_target() { + local run_target="${1}" local lagom_target="${CMD_ARGS[0]}" local lagom_args @@ -415,7 +416,7 @@ build_and_run_lagom_target() { # Then existing list separators must be replaced with a semicolon for CMake. lagom_args=$(IFS=';' ; echo -e "${cmd_args[*]}") - LAGOM_TARGET="${lagom_target}" LAGOM_ARGS="${lagom_args[*]}" build_target "run-lagom-target" + LAGOM_TARGET="${lagom_target}" LAGOM_ARGS="${lagom_args[*]}" build_target "${run_target}" } if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kaddr2line|addr2line|setup-and-run)$ ]]; then @@ -447,10 +448,9 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad run) if [ "$TARGET" = "lagom" ]; then if [ "${CMD_ARGS[0]}" = "ladybird" ]; then - build_target "${CMD_ARGS[0]}" - ninja -C "$BUILD_DIR" run-ladybird + build_and_run_lagom_target "run-ladybird" else - build_and_run_lagom_target + build_and_run_lagom_target "run-lagom-target" fi else build_target