mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Meta: Make LADYBIRD_SOURCE_DIR consistent between WPT.sh and ladybird.sh
ladybird.sh allows the source directory to be overriden to point to another source directory. I am not sure if anyone is actually using this behaviour in practise, but let's make the behaviour at least common between the two scripts with a helper function.
This commit is contained in:
parent
cc1f0c3af2
commit
16f68ab1bd
Notes:
github-actions[bot]
2024-10-09 10:32:57 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/16f68ab1bdc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1687 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 17 additions and 12 deletions
|
@ -4,13 +4,14 @@ set -e
|
|||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
LADYBIRD_SOURCE_DIR="$(realpath "${DIR}"/..)"
|
||||
WPT_SOURCE_DIR=${WPT_SOURCE_DIR:-"${LADYBIRD_SOURCE_DIR}/Tests/LibWeb/WPT/wpt"}
|
||||
WPT_REPOSITORY_URL=${WPT_REPOSITORY_URL:-"https://github.com/web-platform-tests/wpt.git"}
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "${DIR}/shell_include.sh"
|
||||
|
||||
ensure_ladybird_source_dir
|
||||
|
||||
WPT_SOURCE_DIR=${WPT_SOURCE_DIR:-"${LADYBIRD_SOURCE_DIR}/Tests/LibWeb/WPT/wpt"}
|
||||
WPT_REPOSITORY_URL=${WPT_REPOSITORY_URL:-"https://github.com/web-platform-tests/wpt.git"}
|
||||
|
||||
default_binary_path() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "${LADYBIRD_SOURCE_DIR}/Build/ladybird/bin/Ladybird.app/Contents/MacOS/"
|
||||
|
|
|
@ -83,10 +83,6 @@ EOF
|
|||
|
||||
fi
|
||||
|
||||
get_top_dir() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
create_build_dir() {
|
||||
check_program_version_at_least CMake cmake 3.25 || exit 1
|
||||
cmake --preset "$BUILD_PRESET" "${CMAKE_ARGS[@]}" -S "$LADYBIRD_SOURCE_DIR" -B "$BUILD_DIR"
|
||||
|
@ -97,10 +93,7 @@ cmd_with_target() {
|
|||
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=${CC}")
|
||||
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=${CXX}")
|
||||
|
||||
if [ ! -d "$LADYBIRD_SOURCE_DIR" ]; then
|
||||
LADYBIRD_SOURCE_DIR="$(get_top_dir)"
|
||||
export LADYBIRD_SOURCE_DIR
|
||||
fi
|
||||
ensure_ladybird_source_dir
|
||||
|
||||
# Note: Keep in sync with buildDir defaults in CMakePresets.json
|
||||
case "${BUILD_PRESET}" in
|
||||
|
|
|
@ -49,3 +49,14 @@ get_number_of_processing_units() {
|
|||
|
||||
($number_of_processing_units)
|
||||
}
|
||||
|
||||
get_top_dir() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
ensure_ladybird_source_dir() {
|
||||
if [ -z "$LADYBIRD_SOURCE_DIR" ] || [ ! -d "$LADYBIRD_SOURCE_DIR" ]; then
|
||||
LADYBIRD_SOURCE_DIR="$(get_top_dir)"
|
||||
export LADYBIRD_SOURCE_DIR
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue