mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
chore(core): use builder_ for build.sh
Refactoring of build.sh to use the builder_ functions. The script should now be a lot cleaner. Usage is available with `core/build.sh --help` Targets are :x86, :x64, :wasm, :arch (linux/mac). Supports additional requirements of Linux build (--target-path, --configure). By default will attempt to build all available targets. Actions are: clean, configure, build, test, install, uninstall. The install and uninstall actions only work for linux and mac targets at present.
This commit is contained in:
parent
31a34f73d7
commit
91d375ac81
8 changed files with 281 additions and 336 deletions
|
|
@ -15,14 +15,13 @@ goto help
|
|||
rem ----------------------------------
|
||||
|
||||
:help
|
||||
echo Usage: %0 x86^|x64^|all debug^|release [build] [tests]
|
||||
echo Usage: %0 x86^|x64^|all debug^|release [configure] [build] [test]
|
||||
echo or
|
||||
echo Usage: %0 x86^|x64^|all -c
|
||||
echo Usage: %0 x86^|x64 -c
|
||||
echo -c will leave your environment configured for Visual Studio for selected platform.
|
||||
echo -c can be used only with x86 and x64 options
|
||||
echo.
|
||||
echo Otherwise, %0 is intended to be used by build.sh, not directly.
|
||||
echo At least one of 'build' or 'tests' is required.
|
||||
echo At least one of 'configure', 'build', or 'test' is required.
|
||||
goto :eof
|
||||
|
||||
rem ----------------------------------
|
||||
|
|
@ -72,27 +71,27 @@ set BUILDTYPE=%2
|
|||
|
||||
set STATIC_LIBRARY=--default-library both
|
||||
|
||||
if "%3" == "build" (
|
||||
echo === Calling meson build for Windows !ARCH! !BUILDTYPE! ===
|
||||
if "%3" == "configure" (
|
||||
echo === Configuring Keyman Core for Windows !ARCH! !BUILDTYPE! ===
|
||||
if exist build\!ARCH!\!BUILDTYPE! rd /s/q build\!ARCH!\!BUILDTYPE!
|
||||
meson build\!ARCH!\!BUILDTYPE! !STATIC_LIBRARY! --buildtype !BUILDTYPE! --werror || exit !errorlevel!
|
||||
|
||||
echo === Building Keyman Core for Windows !ARCH! !BUILDTYPE! ===
|
||||
cd build\!ARCH!\!BUILDTYPE! || exit !errorlevel!
|
||||
|
||||
ninja || exit !errorlevel!
|
||||
cd ..\..\..
|
||||
|
||||
meson setup build\!ARCH!\!BUILDTYPE! !STATIC_LIBRARY! --buildtype !BUILDTYPE! --werror || exit !errorlevel!
|
||||
shift
|
||||
)
|
||||
|
||||
if "%3" == "tests" (
|
||||
cd build\!ARCH!/!BUILDTYPE! || exit !errorlevel!
|
||||
|
||||
echo === Running tests for Windows !ARCH! !BUILDTYPE! ===
|
||||
meson test --print-errorlogs || exit !errorlevel!
|
||||
|
||||
if "%3" == "build" (
|
||||
echo === Building Keyman Core for Windows !ARCH! !BUILDTYPE! ===
|
||||
cd build\!ARCH!\!BUILDTYPE! || exit !errorlevel!
|
||||
ninja || exit !errorlevel!
|
||||
cd ..\..\..
|
||||
shift
|
||||
)
|
||||
|
||||
if "%3" == "test" (
|
||||
echo === Testing Keyman Core for Windows !ARCH! !BUILDTYPE! ===
|
||||
cd build\!ARCH!/!BUILDTYPE! || exit !errorlevel!
|
||||
meson test --print-errorlogs || exit !errorlevel!
|
||||
cd ..\..\..
|
||||
shift
|
||||
)
|
||||
|
||||
goto :eof
|
||||
|
|
|
|||
372
core/build.sh
372
core/build.sh
|
|
@ -10,312 +10,80 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA
|
|||
## END STANDARD BUILD SCRIPT INCLUDE
|
||||
|
||||
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
||||
. "$THIS_SCRIPT_PATH/commands.inc.sh"
|
||||
|
||||
display_usage() {
|
||||
echo "usage: build.sh [build options] [targets] [-- options to pass to c++ configure]"
|
||||
echo
|
||||
echo "Build options:"
|
||||
echo " --debug, -d Debug build"
|
||||
echo " --target, -t Target path (linux,macos only, default build/)"
|
||||
echo " --platform, -p Platform to build (wasm or native, default native)"
|
||||
echo
|
||||
echo "Targets (all except install if not specified):"
|
||||
echo " clean Clean target path"
|
||||
echo " configure Configure libraries (linux,macos only)"
|
||||
echo " build Build all libraries"
|
||||
echo " build-cpp Build c++ libraries"
|
||||
echo " tests Run all tests"
|
||||
echo " tests-cpp Run c++ tests"
|
||||
echo " install Install all libraries"
|
||||
echo " install-cpp Install c++ libraries"
|
||||
echo " uninstall Uninstall all libraries"
|
||||
echo " uninstall-cpp Uninstall c++ libraries"
|
||||
echo
|
||||
echo "C++ libraries will be in: TARGETPATH/<arch>/<buildtype>/src"
|
||||
echo "WASM libraries will be in: TARGETPATH/wasm/<buildtype>/src"
|
||||
echo "On Windows, <arch> will be 'x86' or 'x64'; elsewhere it is 'arch'"
|
||||
exit 0
|
||||
}
|
||||
################################ Main script ################################
|
||||
|
||||
get_builder_OS
|
||||
|
||||
MESON_TARGET=release
|
||||
HAS_TARGET=false
|
||||
CLEAN=false
|
||||
CONFIGURE=false
|
||||
BUILD_CPP=false
|
||||
TESTS_CPP=false
|
||||
INSTALL_CPP=false
|
||||
UNINSTALL_CPP=false
|
||||
QUIET=false
|
||||
TARGET_PATH="$THIS_SCRIPT_PATH/build"
|
||||
ADDITIONAL_ARGS=
|
||||
PLATFORM=native
|
||||
#
|
||||
# Restrict available targets to those that can be built on the current system
|
||||
#
|
||||
|
||||
# Parse args
|
||||
shopt -s nocasematch
|
||||
archtargets=(":wasm WASM build")
|
||||
|
||||
while [[ $# -gt 0 ]] ; do
|
||||
key="$1"
|
||||
case $key in
|
||||
--debug|-d)
|
||||
MESON_TARGET=debug
|
||||
;;
|
||||
--help|-\?)
|
||||
display_usage
|
||||
;;
|
||||
--target|-t)
|
||||
TARGET_PATH=$(readlink -f "$2")
|
||||
shift
|
||||
;;
|
||||
--platform|-p)
|
||||
PLATFORM="$2"
|
||||
shift
|
||||
;;
|
||||
configure)
|
||||
HAS_TARGET=true
|
||||
CONFIGURE=true
|
||||
;;
|
||||
clean)
|
||||
HAS_TARGET=true
|
||||
CLEAN=true
|
||||
;;
|
||||
build)
|
||||
HAS_TARGET=true
|
||||
BUILD_CPP=true
|
||||
;;
|
||||
*-rust)
|
||||
echo "$key: Rust was removed in <https://github.com/keymanapp/keyman/issues/6290>"
|
||||
;;
|
||||
build-cpp)
|
||||
HAS_TARGET=true
|
||||
BUILD_CPP=true
|
||||
;;
|
||||
tests)
|
||||
HAS_TARGET=true
|
||||
TESTS_CPP=true
|
||||
;;
|
||||
tests-cpp)
|
||||
HAS_TARGET=true
|
||||
TESTS_CPP=true
|
||||
;;
|
||||
install)
|
||||
HAS_TARGET=true
|
||||
INSTALL_CPP=true
|
||||
;;
|
||||
install-cpp)
|
||||
HAS_TARGET=true
|
||||
INSTALL_CPP=true
|
||||
;;
|
||||
uninstall)
|
||||
HAS_TARGET=true
|
||||
# ninja records the files it installs, so unless we install first we don't know
|
||||
# what to uninstall. Installing will overwrite the existing files, if we then
|
||||
# then uninstall the files get removed - unless previously we had additional files.
|
||||
INSTALL_CPP=true
|
||||
UNINSTALL_CPP=true
|
||||
;;
|
||||
uninstall-cpp)
|
||||
HAS_TARGET=true
|
||||
INSTALL_CPP=true
|
||||
UNINSTALL_CPP=true
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
ADDITIONAL_ARGS=$@
|
||||
break
|
||||
;;
|
||||
*)
|
||||
fail "Invalid parameters. Use --help for help"
|
||||
esac
|
||||
shift
|
||||
case $os_id in
|
||||
win)
|
||||
archtargets+=(
|
||||
":x86 32-bit Windows (x86) build"
|
||||
":x64 64-bit Windows (x64) build"
|
||||
)
|
||||
;;
|
||||
mac|linux)
|
||||
archtargets+=(
|
||||
":arch Linux or mac build -- current architecture"
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
# TODO: consider using "linux" and "mac" instead of "arch"?
|
||||
# ":linux Build for current Linux architecture"
|
||||
# ":mac Build for current macOS architecture"
|
||||
|
||||
builder_describe \
|
||||
"Build Keyman Core
|
||||
|
||||
Libraries will be built in 'build/<target>/<configuration>/src'.
|
||||
* <configuration>: 'debug' or 'release' (see --debug flag)
|
||||
" \
|
||||
"clean" \
|
||||
"configure" \
|
||||
"build" \
|
||||
"test" \
|
||||
"install Install libraries to current system" \
|
||||
"uninstall Uninstall libraries from current system" \
|
||||
"${archtargets[@]}" \
|
||||
"--debug,d Configuration is 'debug', not 'release'" \
|
||||
"--target-path=opt_target_path Override for build/ target path" \
|
||||
"--configure=opt_configure Options to pass to C++ configure" \
|
||||
"--test=opt_tests,-t Test[s] to run (space separated)"
|
||||
builder_parse "$@"
|
||||
|
||||
if builder_has_option debug; then
|
||||
CONFIGURATION=debug
|
||||
else
|
||||
CONFIGURATION=release
|
||||
fi
|
||||
|
||||
# Target path is used by Linux build, e.g. --target-path keyboardprocessor
|
||||
if builder_has_option target-path; then
|
||||
TARGET_PATH=$opt_target_path
|
||||
else
|
||||
TARGET_PATH=build
|
||||
fi
|
||||
|
||||
# Iterate through all possible targets; note that targets that cannot be built
|
||||
# on the current platform have already been excluded through the archtargets
|
||||
# settings above
|
||||
targets=(wasm x86 x64 arch)
|
||||
|
||||
for target in "${targets[@]}"; do
|
||||
MESON_PATH="$TARGET_PATH/$target/$CONFIGURATION"
|
||||
|
||||
do_clean $target
|
||||
do_configure $target
|
||||
do_build $target
|
||||
do_test $target
|
||||
do_install $target
|
||||
do_uninstall $target
|
||||
done
|
||||
|
||||
if ! $HAS_TARGET; then
|
||||
if [ ! -f "$TARGET_PATH" ]; then
|
||||
CONFIGURE=true
|
||||
fi
|
||||
BUILD_CPP=true
|
||||
TESTS_CPP=true
|
||||
fi
|
||||
|
||||
if [[ $PLATFORM == wasm ]]; then
|
||||
MESON_PATH="$TARGET_PATH/wasm/$MESON_TARGET"
|
||||
else
|
||||
MESON_PATH="$TARGET_PATH/arch/$MESON_TARGET"
|
||||
fi
|
||||
|
||||
displayInfo "" \
|
||||
"VERSION: $VERSION" \
|
||||
"TIER: $TIER" \
|
||||
"PLATFORM: $PLATFORM" \
|
||||
"CONFIGURE: $CONFIGURE" \
|
||||
"CLEAN: $CLEAN" \
|
||||
"BUILD_CPP: $BUILD_CPP" \
|
||||
"TESTS_CPP: $TESTS_CPP" \
|
||||
"INSTALL_CPP: $INSTALL_CPP" \
|
||||
"UNINSTALL_CPP: $UNINSTALL_CPP" \
|
||||
"MESON_TARGET: $MESON_TARGET" \
|
||||
"TARGET_PATH: $TARGET_PATH" \
|
||||
""
|
||||
|
||||
clean() {
|
||||
rm -rf "$TARGET_PATH/"
|
||||
}
|
||||
|
||||
path_remove() {
|
||||
# Delete path by parts so we can never accidentally remove sub paths
|
||||
PATH=${PATH//":$1:"/":"} # delete any instances in the middle
|
||||
PATH=${PATH/#"$1:"/} # delete any instance at the beginning
|
||||
PATH=${PATH/%":$1"/} # delete any instance in the at the end
|
||||
}
|
||||
|
||||
build_windows() {
|
||||
# Build targets for Windows
|
||||
|
||||
# Build the meson targets, both x86 and x64 also
|
||||
# We need to use a batch file here so we can get
|
||||
# the Visual Studio build environment with vcvarsall.bat
|
||||
# TODO: if PATH is the only variable required, let's try and
|
||||
# eliminate this difference in the build process
|
||||
|
||||
if $BUILD_CPP; then
|
||||
if $TESTS_CPP; then
|
||||
echo_heading "======= Building and Testing C++ library for Windows (x86, x64) ======="
|
||||
cmd //C build.bat all $MESON_TARGET build tests
|
||||
else
|
||||
echo_heading "======= Building C++ library for Windows (x86, x64) ======="
|
||||
cmd //C build.bat all $MESON_TARGET build
|
||||
fi
|
||||
elif $TESTS_CPP; then
|
||||
echo_heading "======= Testing C++ library for Windows (x86, x64) ======="
|
||||
cmd //C build.bat all $MESON_TARGET tests
|
||||
fi
|
||||
}
|
||||
|
||||
build_standard() {
|
||||
local BUILD_PLATFORM="$1"
|
||||
local ARCH="$2"
|
||||
local RUSTARCH=${3:-}
|
||||
# RUSTARCH is not currently used.
|
||||
if [ $# -gt 3 ]; then
|
||||
shift 3
|
||||
local STANDARD_MESON_ARGS="$*"
|
||||
else
|
||||
local STANDARD_MESON_ARGS=
|
||||
fi
|
||||
|
||||
# Build meson targets
|
||||
if $CONFIGURE; then
|
||||
echo_heading "======= Configuring C++ library for $BUILD_PLATFORM ======="
|
||||
pushd "$THIS_SCRIPT_PATH" > /dev/null
|
||||
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET $STANDARD_MESON_ARGS $ADDITIONAL_ARGS
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
if $BUILD_CPP; then
|
||||
echo_heading "======= Building C++ library for $BUILD_PLATFORM ======="
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
ninja
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
if $TESTS_CPP; then
|
||||
echo_heading "======= Testing C++ library for $BUILD_PLATFORM ======="
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
meson test --print-errorlogs
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
if $INSTALL_CPP; then
|
||||
echo_heading "======= Installing C++ libraries for $BUILD_PLATFORM ======="
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
ninja install
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
if $UNINSTALL_CPP; then
|
||||
echo_heading "======= Uninstalling C++ libraries for $BUILD_PLATFORM ======="
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
ninja uninstall
|
||||
popd > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# We don't want to rely on emcc being on the path, because Emscripten puts far
|
||||
# too many things onto the path (in particular for us, node).
|
||||
#
|
||||
# The following comment suggests that we don't need emcc on the path.
|
||||
# https://github.com/emscripten-core/emscripten/issues/4848#issuecomment-1097357775
|
||||
#
|
||||
# So we try and locate emcc in common locations ourselves. The search pattern
|
||||
# is:
|
||||
#
|
||||
# 1. Look for $EMSCRIPTEN_BASE (our primary emscripten variable), which should
|
||||
# point to the folder that emcc is located in
|
||||
# 2. Look for $EMCC which should point to the emcc executable
|
||||
# 3. Look for emcc on the path
|
||||
#
|
||||
locate_emscripten() {
|
||||
if [[ -z ${EMSCRIPTEN_BASE+x} ]]; then
|
||||
if [[ -z ${EMCC+x} ]]; then
|
||||
local EMCC=`which emcc`
|
||||
[[ -z $EMCC ]] && fail "locate_emscripten: Could not locate emscripten (emcc) on the path or with \$EMCC or \$EMSCRIPTEN_BASE"
|
||||
fi
|
||||
[[ -x $EMCC ]] || fail "locate_emscripten: Variable EMCC ($EMCC) does not point to a valid executable emcc"
|
||||
EMSCRIPTEN_BASE="$(dirname "$EMCC")"
|
||||
fi
|
||||
|
||||
[[ -x ${EMSCRIPTEN_BASE}/emcc ]] || fail "locate_emscripten: Variable EMSCRIPTEN_BASE ($EMSCRIPTEN_BASE) does not point to emcc's folder"
|
||||
}
|
||||
|
||||
build_meson_cross_file_for_wasm() {
|
||||
if [ $os_id == win ]; then
|
||||
local R=$(cygpath -w $(echo $EMSCRIPTEN_BASE) | sed 's_\\_\\\\_g')
|
||||
else
|
||||
local R=$(echo $EMSCRIPTEN_BASE | sed 's_/_\\/_g')
|
||||
fi
|
||||
sed -e "s/\$EMSCRIPTEN_BASE/$R/g" wasm.build.$os_id.in > wasm.build
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
if $CLEAN; then
|
||||
clean
|
||||
fi
|
||||
|
||||
# check dependency for ldml - kmldmlc
|
||||
# TODO: in the future this should be part of the meson build, but
|
||||
# it's too complicated at present due to old meson versions in
|
||||
# debian packaging environments
|
||||
if $CONFIGURE; then
|
||||
if type node >/dev/null 2>&1; then
|
||||
echo "Note: Found node, checking and building kmldmlc dependency if needed"
|
||||
if [[ ! -f "$KEYMAN_ROOT/developer/src/kmldmlc/build/kmldmlc.js" ]]; then
|
||||
"$KEYMAN_ROOT/common/web/keyman-version/build.sh" configure build
|
||||
"$KEYMAN_ROOT/developer/src/kmldmlc/build.sh" build
|
||||
"$KEYMAN_ROOT/common/tools/hextobin/build.sh" build
|
||||
fi
|
||||
else
|
||||
echo "Note: could not find node, skipping kmldmlc dependency build, ldml tests will not be run"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $PLATFORM == native ]]; then
|
||||
case $os_id in
|
||||
"linux")
|
||||
build_standard $os_id arch
|
||||
;;
|
||||
"mac")
|
||||
build_standard $os_id arch
|
||||
;;
|
||||
"win")
|
||||
build_windows
|
||||
;;
|
||||
esac
|
||||
else
|
||||
locate_emscripten
|
||||
build_meson_cross_file_for_wasm
|
||||
build_standard wasm wasm wasm32-unknown-unknown --cross-file wasm.defs.build --cross-file wasm.build --default-library static
|
||||
fi
|
||||
|
|
|
|||
182
core/commands.inc.sh
Normal file
182
core/commands.inc.sh
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# clean
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
do_clean() {
|
||||
# clean: note build/<arch> will be left, but build/<arch>/<CONFIGURATION> should be gone
|
||||
local target=$1
|
||||
|
||||
if builder_has_action clean:$target; then
|
||||
rm -rf "$MESON_PATH"
|
||||
builder_report success clean:$target
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# configure
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
do_configure() {
|
||||
if ! builder_has_action configure:$1; then return; fi
|
||||
|
||||
local target=$1
|
||||
|
||||
local STANDARD_MESON_ARGS=
|
||||
|
||||
# Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR}
|
||||
local ADDITIONAL_ARGS=${opt_configure-}
|
||||
|
||||
echo_heading "======= Configuring $target ======="
|
||||
|
||||
do_configure_dependencies
|
||||
|
||||
if [[ $target == wasm ]]; then
|
||||
# do_configure_wasm
|
||||
locate_emscripten
|
||||
build_meson_cross_file_for_wasm
|
||||
STANDARD_MESON_ARGS="--cross-file wasm.defs.build --cross-file wasm.build --default-library static"
|
||||
fi
|
||||
|
||||
if [[ $target =~ ^(x86|x64)$ ]]; then
|
||||
cmd //C build.bat $target $CONFIGURATION configure
|
||||
else
|
||||
pushd "$THIS_SCRIPT_PATH" > /dev/null
|
||||
meson setup "$MESON_PATH" --werror --buildtype $CONFIGURATION $STANDARD_MESON_ARGS $ADDITIONAL_ARGS
|
||||
popd > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
has_configured_dependencies=false
|
||||
|
||||
do_configure_dependencies() {
|
||||
if $has_configured_dependencies; then
|
||||
return
|
||||
fi
|
||||
has_configured_dependencies=true
|
||||
|
||||
# check dependency for ldml - kmldmlc
|
||||
# TODO: in the future this should be part of the meson build, but
|
||||
# it's too complicated at present due to old meson versions in
|
||||
# debian packaging environments
|
||||
if type node >/dev/null 2>&1; then
|
||||
echo "Note: Found node, checking and building kmldmlc dependency if needed"
|
||||
if [[ ! -f "$KEYMAN_ROOT/developer/src/kmldmlc/build/kmldmlc.js" ]]; then
|
||||
"$KEYMAN_ROOT/common/web/keyman-version/build.sh" configure build
|
||||
"$KEYMAN_ROOT/developer/src/kmldmlc/build.sh" build
|
||||
"$KEYMAN_ROOT/common/tools/hextobin/build.sh" build
|
||||
fi
|
||||
else
|
||||
echo "Note: could not find node, skipping kmldmlc dependency build, ldml tests will not be run"
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# build
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
do_build() {
|
||||
if ! builder_has_action build:$1; then return; fi
|
||||
local target=$1
|
||||
|
||||
echo_heading "======= Building $target ======="
|
||||
|
||||
if [[ $target =~ ^(x86|x64)$ ]]; then
|
||||
# Build the meson targets, both x86 and x64 also
|
||||
# We need to use a batch file here so we can get
|
||||
# the Visual Studio build environment with vcvarsall.bat
|
||||
# TODO: if PATH is the only variable required, let's try and
|
||||
# eliminate this difference in the build process
|
||||
cmd //C build.bat $target $CONFIGURATION build
|
||||
else
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
ninja
|
||||
popd > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# test
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
do_test() {
|
||||
if ! builder_has_action test:$1; then return; fi
|
||||
|
||||
local target=$1
|
||||
echo_heading "======= Testing $target ======="
|
||||
|
||||
if [[ $target =~ ^(x86|x64)$ ]]; then
|
||||
cmd //C build.bat $target $CONFIGURATION test
|
||||
else
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
meson test --print-errorlogs
|
||||
popd > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# install and uninstall
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
do_install() {
|
||||
do_command install $1
|
||||
}
|
||||
|
||||
do_uninstall() {
|
||||
do_command uninstall $1
|
||||
}
|
||||
|
||||
do_command() {
|
||||
if ! builder_has_action $1:$2; then return; fi
|
||||
|
||||
local command=$1
|
||||
local target=$2
|
||||
|
||||
echo_heading "======= Installing $target ======="
|
||||
|
||||
pushd "$MESON_PATH" > /dev/null
|
||||
ninja $2
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# utility functions
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# We don't want to rely on emcc being on the path, because Emscripten puts far
|
||||
# too many things onto the path (in particular for us, node).
|
||||
#
|
||||
# The following comment suggests that we don't need emcc on the path.
|
||||
# https://github.com/emscripten-core/emscripten/issues/4848#issuecomment-1097357775
|
||||
#
|
||||
# So we try and locate emcc in common locations ourselves. The search pattern
|
||||
# is:
|
||||
#
|
||||
# 1. Look for $EMSCRIPTEN_BASE (our primary emscripten variable), which should
|
||||
# point to the folder that emcc is located in
|
||||
# 2. Look for $EMCC which should point to the emcc executable
|
||||
# 3. Look for emcc on the path
|
||||
#
|
||||
locate_emscripten() {
|
||||
if [[ -z ${EMSCRIPTEN_BASE+x} ]]; then
|
||||
if [[ -z ${EMCC+x} ]]; then
|
||||
local EMCC=`which emcc`
|
||||
[[ -z $EMCC ]] && fail "locate_emscripten: Could not locate emscripten (emcc) on the path or with \$EMCC or \$EMSCRIPTEN_BASE"
|
||||
fi
|
||||
[[ -x $EMCC ]] || fail "locate_emscripten: Variable EMCC ($EMCC) does not point to a valid executable emcc"
|
||||
EMSCRIPTEN_BASE="$(dirname "$EMCC")"
|
||||
fi
|
||||
|
||||
[[ -x ${EMSCRIPTEN_BASE}/emcc ]] || fail "locate_emscripten: Variable EMSCRIPTEN_BASE ($EMSCRIPTEN_BASE) does not point to emcc's folder"
|
||||
}
|
||||
|
||||
build_meson_cross_file_for_wasm() {
|
||||
if [ $os_id == win ]; then
|
||||
local R=$(cygpath -w $(echo $EMSCRIPTEN_BASE) | sed 's_\\_\\\\_g')
|
||||
else
|
||||
local R=$(echo $EMSCRIPTEN_BASE | sed 's_/_\\/_g')
|
||||
fi
|
||||
sed -e "s/\$EMSCRIPTEN_BASE/$R/g" wasm.build.$os_id.in > wasm.build
|
||||
}
|
||||
|
|
@ -31,15 +31,15 @@ pull-core:
|
|||
cd $(KEYMAN_ROOT)\core
|
||||
!ifdef GIT_BASH_FOR_KEYMAN
|
||||
!ifdef DEBUG
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh --debug
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh clean:x86 configure:x86 build:x86 --debug
|
||||
!else
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh clean:x86 configure:x86 build:x86
|
||||
!endif
|
||||
!else
|
||||
!ifdef DEBUG
|
||||
start /wait ./build.sh --debug
|
||||
start /wait ./build.sh clean:x86 configure:x86 build:x86 --debug
|
||||
!else
|
||||
start /wait ./build.sh
|
||||
start /wait ./build.sh clean:x86 configure:x86 build:x86
|
||||
!endif
|
||||
!endif
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
"command": "${workspaceFolder}/core/build.sh",
|
||||
"args": [
|
||||
"--debug",
|
||||
"tests"
|
||||
"test"
|
||||
],
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
|
|
|
|||
|
|
@ -27,12 +27,7 @@ if [[ "${CONFIGUREONLY}" != "no" && "${BUILDONLY}" != "no" ]]; then
|
|||
fi
|
||||
|
||||
if [[ "${BUILDONLY}" == "no" ]]; then
|
||||
../core/build.sh -t keyboardprocessor configure
|
||||
|
||||
cd keyboardprocessor/arch/release
|
||||
echo "reconfiguring keyboardprocessor meson with prefix ${INSTALLDIR}"
|
||||
meson configure -Dprefix=${INSTALLDIR} && ninja reconfigure
|
||||
cd $BASEDIR
|
||||
../core/build.sh --target-path keyboardprocessor --configure="-Dprefix=${INSTALLDIR}" configure
|
||||
fi
|
||||
|
||||
if [[ "${CONFIGUREONLY}" == "no" ]]; then
|
||||
|
|
@ -40,7 +35,7 @@ if [[ "${CONFIGUREONLY}" == "no" ]]; then
|
|||
# May 2021: For now, running tests here as well. We could move this elsewhere
|
||||
# in the future if we want to split out the tests, but they run in a couple of seconds
|
||||
# at present.
|
||||
../core/build.sh -t keyboardprocessor build tests
|
||||
../core/build.sh --target-path keyboardprocessor build test
|
||||
fi
|
||||
|
||||
function buildproject() {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ for proj in ${extra_projects}; do
|
|||
if [ "${proj}" == "keyboardprocessor" -o "${proj}" == "keyman" ]; then
|
||||
rm -rf keyboardprocessor
|
||||
cp ../VERSION.md ../core/
|
||||
../core/build.sh -t keyboardprocessor configure
|
||||
../core/build.sh --target-path keyboardprocessor configure
|
||||
#TODO: is --configure="-Dprefix=${INSTALLDIR}" needed also?
|
||||
fi
|
||||
if [ "${proj}" == "keyman-config" -o "${proj}" == "keyman" ]; then
|
||||
cd keyman-config
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ BUILD_DEBUG=
|
|||
|
||||
pull-core:
|
||||
cd $(ROOT)\..\core
|
||||
$(CALLER) ./build.sh -p native $(BUILD_DEBUG)
|
||||
$(CALLER) ./build.sh clean:x86 configure:x86 build:x86 clean:x64 configure:x64 build:x64 $(BUILD_DEBUG)
|
||||
cd $(ROOT)\src\engine\keyman32
|
||||
|
||||
!include ..\..\Target.mak
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue