Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(common): consolidate common meson patterns and use 'c++17' in standard.meson.build 🐘 #12496

Merged
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.126
18.0.126
40 changes: 5 additions & 35 deletions linux/mcompile/keymap/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -26,38 +27,7 @@ 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
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
40 changes: 5 additions & 35 deletions mac/mcompile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ################################
Expand All @@ -24,38 +25,7 @@ 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
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
51 changes: 51 additions & 0 deletions resources/build/meson-utils.inc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

# This script contains common meson functions


# ----------------------------------------------------------------------------
# clean
# ----------------------------------------------------------------------------

do_meson_clean() {
rm -rf "$THIS_SCRIPT_PATH/resources"
rm -rf "$TARGET_PATH"
}

# ----------------------------------------------------------------------------
# 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
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_meson_build() {
pushd "$TARGET_PATH" > /dev/null
ninja
popd > /dev/null
}

# ----------------------------------------------------------------------------
# test
# ----------------------------------------------------------------------------

do_meson_test() {
pushd "$TARGET_PATH" > /dev/null
meson test "${builder_extra_params[@]}"
popd > /dev/null
}
Loading