From 8fa72080d1d63b398ca18311239086032d10be35 Mon Sep 17 00:00:00 2001 From: Sabine Date: Wed, 2 Oct 2024 17:54:45 +0200 Subject: [PATCH 1/4] chore (common): move do_clean, do_configure, do_build and do_test to meson-utils.inc.sh --- mac/mcompile/build.sh | 32 +------------------ resources/build/meson-utils.inc.sh | 51 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 31 deletions(-) create mode 100644 resources/build/meson-utils.inc.sh diff --git a/mac/mcompile/build.sh b/mac/mcompile/build.sh index b04c20e04a..2f16314463 100755 --- a/mac/mcompile/build.sh +++ b/mac/mcompile/build.sh @@ -4,6 +4,7 @@ # adjust relative paths as necessary THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" . "${THIS_SCRIPT%/*}/../../resources/build/builder.inc.sh" +. "${THIS_SCRIPT%/*}/../../resources/build/meson-utils.inc.sh" ## END STANDARD BUILD SCRIPT INCLUDE ################################ Main script ################################ @@ -24,37 +25,6 @@ builder_describe_outputs \ TARGET_PATH="$THIS_SCRIPT_PATH/build" -do_clean() { - rm -rf "$THIS_SCRIPT_PATH/resources" - rm -rf "$TARGET_PATH" -} - -do_configure() { - # Import our standard compiler defines; this is copied from - # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't - # allow us to reference a file outside its root - mkdir -p "$THIS_SCRIPT_PATH/resources" - cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build" - - pushd "$THIS_SCRIPT_PATH" > /dev/null - # Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR} - meson setup build --buildtype $BUILDER_CONFIGURATION "${builder_extra_params[@]}" - popd > /dev/null - -} - -do_build() { - pushd "$TARGET_PATH" > /dev/null - ninja - popd > /dev/null -} - -do_test() { - pushd "$TARGET_PATH" > /dev/null - meson test "${builder_extra_params[@]}" - popd > /dev/null -} - builder_run_action clean do_clean builder_run_action configure do_configure builder_run_action build do_build diff --git a/resources/build/meson-utils.inc.sh b/resources/build/meson-utils.inc.sh new file mode 100644 index 0000000000..e3e5e8d994 --- /dev/null +++ b/resources/build/meson-utils.inc.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# This script contains common meson functions + + +# ---------------------------------------------------------------------------- +# clean +# ---------------------------------------------------------------------------- + +do_clean() { + rm -rf "$THIS_SCRIPT_PATH/resources" + rm -rf "$TARGET_PATH" +} + +# ---------------------------------------------------------------------------- +# configure +# ---------------------------------------------------------------------------- + +do_configure() { + # Import our standard compiler defines; this is copied from + # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't + # allow us to reference a file outside its root + mkdir -p "$THIS_SCRIPT_PATH/resources" + cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build" + + pushd "$THIS_SCRIPT_PATH" > /dev/null + # Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR} + meson setup build --buildtype $BUILDER_CONFIGURATION "${builder_extra_params[@]}" + popd > /dev/null + +} + +# ---------------------------------------------------------------------------- +# build +# ---------------------------------------------------------------------------- + +do_build() { + pushd "$TARGET_PATH" > /dev/null + ninja + popd > /dev/null +} + +# ---------------------------------------------------------------------------- +# test +# ---------------------------------------------------------------------------- + +do_test() { + pushd "$TARGET_PATH" > /dev/null + meson test "${builder_extra_params[@]}" + popd > /dev/null +} \ No newline at end of file From afc82297eab9d26307875da9a525fe14834245ab Mon Sep 17 00:00:00 2001 From: Sabine Date: Wed, 2 Oct 2024 17:54:45 +0200 Subject: [PATCH 2/4] chore (common): on mcompile-linux->move do_clean, do_configure, do_build and do_test to meson-utils.inc.sh --- linux/mcompile/keymap/build.sh | 32 +------------------ mac/mcompile/build.sh | 32 +------------------ resources/build/meson-utils.inc.sh | 51 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 62 deletions(-) create mode 100644 resources/build/meson-utils.inc.sh diff --git a/linux/mcompile/keymap/build.sh b/linux/mcompile/keymap/build.sh index 7c66e4b0b4..838ec86c38 100755 --- a/linux/mcompile/keymap/build.sh +++ b/linux/mcompile/keymap/build.sh @@ -4,6 +4,7 @@ # adjust relative paths as necessary THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" . "${THIS_SCRIPT%/*}/../../../resources/build/builder.inc.sh" +. "${THIS_SCRIPT%/*}/../../../resources/build/meson-utils.inc.sh" ## END STANDARD BUILD SCRIPT INCLUDE #. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" @@ -26,37 +27,6 @@ builder_describe_outputs \ TARGET_PATH="$THIS_SCRIPT_PATH/build" -do_clean() { - rm -rf "$THIS_SCRIPT_PATH/resources" - rm -rf "$TARGET_PATH" -} - -do_configure() { - # Import our standard compiler defines; this is copied from - # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't - # allow us to reference a file outside its root - mkdir -p "$THIS_SCRIPT_PATH/resources" - cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build" - - pushd "$THIS_SCRIPT_PATH" > /dev/null - # Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR} - meson setup build --buildtype $BUILDER_CONFIGURATION "${builder_extra_params[@]}" - popd > /dev/null - -} - -do_build() { - pushd "$TARGET_PATH" > /dev/null - ninja - popd > /dev/null -} - -do_test() { - pushd "$TARGET_PATH" > /dev/null - meson test "${builder_extra_params[@]}" - popd > /dev/null -} - builder_run_action clean do_clean builder_run_action configure do_configure builder_run_action build do_build diff --git a/mac/mcompile/build.sh b/mac/mcompile/build.sh index b04c20e04a..2f16314463 100755 --- a/mac/mcompile/build.sh +++ b/mac/mcompile/build.sh @@ -4,6 +4,7 @@ # adjust relative paths as necessary THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" . "${THIS_SCRIPT%/*}/../../resources/build/builder.inc.sh" +. "${THIS_SCRIPT%/*}/../../resources/build/meson-utils.inc.sh" ## END STANDARD BUILD SCRIPT INCLUDE ################################ Main script ################################ @@ -24,37 +25,6 @@ builder_describe_outputs \ TARGET_PATH="$THIS_SCRIPT_PATH/build" -do_clean() { - rm -rf "$THIS_SCRIPT_PATH/resources" - rm -rf "$TARGET_PATH" -} - -do_configure() { - # Import our standard compiler defines; this is copied from - # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't - # allow us to reference a file outside its root - mkdir -p "$THIS_SCRIPT_PATH/resources" - cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build" - - pushd "$THIS_SCRIPT_PATH" > /dev/null - # Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR} - meson setup build --buildtype $BUILDER_CONFIGURATION "${builder_extra_params[@]}" - popd > /dev/null - -} - -do_build() { - pushd "$TARGET_PATH" > /dev/null - ninja - popd > /dev/null -} - -do_test() { - pushd "$TARGET_PATH" > /dev/null - meson test "${builder_extra_params[@]}" - popd > /dev/null -} - builder_run_action clean do_clean builder_run_action configure do_configure builder_run_action build do_build diff --git a/resources/build/meson-utils.inc.sh b/resources/build/meson-utils.inc.sh new file mode 100644 index 0000000000..e3e5e8d994 --- /dev/null +++ b/resources/build/meson-utils.inc.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# This script contains common meson functions + + +# ---------------------------------------------------------------------------- +# clean +# ---------------------------------------------------------------------------- + +do_clean() { + rm -rf "$THIS_SCRIPT_PATH/resources" + rm -rf "$TARGET_PATH" +} + +# ---------------------------------------------------------------------------- +# configure +# ---------------------------------------------------------------------------- + +do_configure() { + # Import our standard compiler defines; this is copied from + # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't + # allow us to reference a file outside its root + mkdir -p "$THIS_SCRIPT_PATH/resources" + cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build" + + pushd "$THIS_SCRIPT_PATH" > /dev/null + # Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR} + meson setup build --buildtype $BUILDER_CONFIGURATION "${builder_extra_params[@]}" + popd > /dev/null + +} + +# ---------------------------------------------------------------------------- +# build +# ---------------------------------------------------------------------------- + +do_build() { + pushd "$TARGET_PATH" > /dev/null + ninja + popd > /dev/null +} + +# ---------------------------------------------------------------------------- +# test +# ---------------------------------------------------------------------------- + +do_test() { + pushd "$TARGET_PATH" > /dev/null + meson test "${builder_extra_params[@]}" + popd > /dev/null +} \ No newline at end of file From 33dcf94c0989838c7c7abb322b379692976974ba Mon Sep 17 00:00:00 2001 From: Sabine Date: Thu, 10 Oct 2024 11:13:59 +0200 Subject: [PATCH 3/4] chore (common): rename do_clean, do_configure, do_build, do_test to do_meson_... --- linux/mcompile/keymap/build.sh | 8 ++++---- mac/mcompile/build.sh | 8 ++++---- resources/build/meson-utils.inc.sh | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/linux/mcompile/keymap/build.sh b/linux/mcompile/keymap/build.sh index 838ec86c38..d7c6aac34f 100755 --- a/linux/mcompile/keymap/build.sh +++ b/linux/mcompile/keymap/build.sh @@ -27,7 +27,7 @@ builder_describe_outputs \ TARGET_PATH="$THIS_SCRIPT_PATH/build" -builder_run_action clean do_clean -builder_run_action configure do_configure -builder_run_action build do_build -builder_run_action test do_test +builder_run_action clean do_meson_clean +builder_run_action configure do_meson_configure +builder_run_action build do_meson_build +builder_run_action test do_meson_test diff --git a/mac/mcompile/build.sh b/mac/mcompile/build.sh index 2f16314463..c689cd7a39 100755 --- a/mac/mcompile/build.sh +++ b/mac/mcompile/build.sh @@ -25,7 +25,7 @@ builder_describe_outputs \ TARGET_PATH="$THIS_SCRIPT_PATH/build" -builder_run_action clean do_clean -builder_run_action configure do_configure -builder_run_action build do_build -builder_run_action test do_test \ No newline at end of file +builder_run_action clean do_meson_clean +builder_run_action configure do_meson_configure +builder_run_action build do_meson_build +builder_run_action test do_meson_test diff --git a/resources/build/meson-utils.inc.sh b/resources/build/meson-utils.inc.sh index e3e5e8d994..24375a840a 100644 --- a/resources/build/meson-utils.inc.sh +++ b/resources/build/meson-utils.inc.sh @@ -7,7 +7,7 @@ # clean # ---------------------------------------------------------------------------- -do_clean() { +do_meson_clean() { rm -rf "$THIS_SCRIPT_PATH/resources" rm -rf "$TARGET_PATH" } @@ -16,7 +16,7 @@ do_clean() { # configure # ---------------------------------------------------------------------------- -do_configure() { +do_meson_configure() { # Import our standard compiler defines; this is copied from # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't # allow us to reference a file outside its root @@ -34,7 +34,7 @@ do_configure() { # build # ---------------------------------------------------------------------------- -do_build() { +do_meson_build() { pushd "$TARGET_PATH" > /dev/null ninja popd > /dev/null @@ -44,7 +44,7 @@ do_build() { # test # ---------------------------------------------------------------------------- -do_test() { +do_meson_test() { pushd "$TARGET_PATH" > /dev/null meson test "${builder_extra_params[@]}" popd > /dev/null From 62380afb38527b5cb23288fdf0e5a068f053f3dc Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Fri, 11 Oct 2024 04:54:48 +0200 Subject: [PATCH 4/4] Update VERSION.md