mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-19 14:17:40 +00:00
maint(common): consolidate standard.meson.build configuration
Use a shared function standard_meson_build to prep the resources/meson.build folder for consistency. A future cleanup would be to use meson-utils.inc.sh for all meson build scripts.
This commit is contained in:
parent
926be6e946
commit
9d2db4faf3
7 changed files with 56 additions and 41 deletions
|
|
@ -115,14 +115,10 @@ builder_describe_outputs \
|
|||
build:arch /core/build/arch/$BUILDER_CONFIGURATION/src/libkeymancore.a \
|
||||
build:wasm /core/build/wasm/$BUILDER_CONFIGURATION/src/libkeymancore.a
|
||||
|
||||
# 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
|
||||
if builder_has_action configure; then
|
||||
mkdir -p "$THIS_SCRIPT_PATH/resources"
|
||||
cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build"
|
||||
# Write our tagged version environment variable into a file so meson can read it
|
||||
echo "$VERSION_WITH_TAG" > "$THIS_SCRIPT_PATH/resources/VERSION_WITH_TAG.md"
|
||||
# Import our standard compiler defines
|
||||
source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
||||
standard_meson_build
|
||||
fi
|
||||
|
||||
# Iterate through all possible targets; note that targets that cannot be built
|
||||
|
|
|
|||
|
|
@ -92,14 +92,10 @@ fi
|
|||
do_action clean
|
||||
|
||||
# Note, we have a 'global' configure and also a per-arch configure
|
||||
if builder_start_action configure; then
|
||||
# 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"
|
||||
# Write our tagged version environment variable into a file so meson can read it
|
||||
echo "$VERSION_WITH_TAG" > "$THIS_SCRIPT_PATH/resources/VERSION_WITH_TAG.md"
|
||||
if builder_has_action configure; then
|
||||
# Import our standard compiler defines
|
||||
source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
||||
standard_meson_build
|
||||
|
||||
# We have to checkout the keyboards repo in a 'configure' action because
|
||||
# otherwise meson will not get the right list of keyboard source files,
|
||||
|
|
@ -107,8 +103,6 @@ if builder_start_action configure; then
|
|||
if should_do_full_test; then
|
||||
checkout_keyboards
|
||||
fi
|
||||
|
||||
builder_finish_action success configure
|
||||
fi
|
||||
|
||||
do_action configure
|
||||
|
|
|
|||
|
|
@ -45,13 +45,10 @@ else
|
|||
MESON_COVERAGE=
|
||||
fi
|
||||
|
||||
# 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. ${THIS_SCRIPT_PATH}/meson.build
|
||||
# then includes `resources` as a subdir.
|
||||
if builder_has_action configure; then
|
||||
mkdir -p "${THIS_SCRIPT_PATH}/resources"
|
||||
cp "${KEYMAN_ROOT}/resources/build/meson/standard.meson.build" "${THIS_SCRIPT_PATH}/resources/meson.build"
|
||||
# Import our standard compiler defines
|
||||
source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
||||
standard_meson_build
|
||||
fi
|
||||
|
||||
configure_action() {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ builder_describe \
|
|||
|
||||
builder_parse "$@"
|
||||
|
||||
# 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. ${THIS_SCRIPT_PATH}/meson.build
|
||||
# then includes `resources` as a subdir.
|
||||
if builder_has_action configure; then
|
||||
cp "${KEYMAN_ROOT}/resources/build/meson/standard.meson.build" "${THIS_SCRIPT_PATH}/resources/meson.build"
|
||||
# Import our standard compiler defines
|
||||
source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
||||
standard_meson_build
|
||||
|
||||
# TODO: it would be cleaner to split this from the standard.meson.build file/folder
|
||||
cat "${THIS_SCRIPT_PATH}/resources/meson.build.in" >> "${THIS_SCRIPT_PATH}/resources/meson.build"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# This script contains common meson functions
|
||||
|
||||
source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# clean
|
||||
|
|
@ -17,11 +18,8 @@ do_meson_clean() {
|
|||
# ----------------------------------------------------------------------------
|
||||
|
||||
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"
|
||||
# Import our standard compiler defines
|
||||
standard_meson_build
|
||||
|
||||
pushd "$THIS_SCRIPT_PATH" > /dev/null
|
||||
# Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,10 @@
|
|||
# and is copied into each project's <project>/resources/meson.build in the
|
||||
# configure step, so that it can be referenced by meson directly.
|
||||
#
|
||||
# Standard code block for copying this file into a meson project:
|
||||
# Use standard_meson_build.inc.sh to make the file copy
|
||||
#
|
||||
# # 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"
|
||||
# # Write our tagged version environment variable into a file so meson can read it
|
||||
# echo "$VERSION_WITH_TAG" > "$THIS_SCRIPT_PATH/resources/VERSION_WITH_TAG.md"
|
||||
|
||||
|
||||
#
|
||||
# Where possible, we want to use these flags everywhere
|
||||
#
|
||||
|
|
|
|||
35
resources/build/meson/standard_meson_build.inc.sh
Normal file
35
resources/build/meson/standard_meson_build.inc.sh
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
#
|
||||
# Created by mcdurdin on 2025-04-30
|
||||
#
|
||||
# This import script helps us setup a consistent meson environment across all
|
||||
# our build scripts. It will generate two files in the calling scripts
|
||||
# resources/ folder (which should be git-ignored):
|
||||
#
|
||||
# * resources/meson.build - a copy of standard.meson.build from this folder
|
||||
# * resources/VERSION_WITH_TAG.md - the value of the env var $VERSION_WITH_TAG
|
||||
#
|
||||
# We do this because meson doesn't allow us to:
|
||||
#
|
||||
# * reference a file outside the project root, or
|
||||
# * read environment variables
|
||||
#
|
||||
# Sample of normal usage:
|
||||
#
|
||||
# if builder_has_action configure; then
|
||||
# # Import our standard compiler defines
|
||||
# source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
||||
# standard_meson_build
|
||||
# fi
|
||||
#
|
||||
# ${THIS_SCRIPT_PATH}/meson.build then includes `resources` as a subdir:
|
||||
#
|
||||
# subdir('resources')
|
||||
#
|
||||
|
||||
standard_meson_build() {
|
||||
mkdir -p "$THIS_SCRIPT_PATH/resources"
|
||||
cp "$KEYMAN_ROOT/resources/build/meson/standard.meson.build" "$THIS_SCRIPT_PATH/resources/meson.build"
|
||||
echo "$VERSION_WITH_TAG" > "$THIS_SCRIPT_PATH/resources/VERSION_WITH_TAG.md"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue