From 29ddeeb67bad4758400a98a32e58eecc445ef4f0 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 21 Feb 2023 13:11:31 +0700 Subject: [PATCH] chore(core): remove cl from path before build, build static lib --- core/build.sh | 1 + core/commands.inc.sh | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/core/build.sh b/core/build.sh index 35baff488b..c06388b5f8 100755 --- a/core/build.sh +++ b/core/build.sh @@ -17,6 +17,7 @@ cd "$THIS_SCRIPT_PATH" ################################ Main script ################################ get_builder_OS +cleanup_visual_studio_path MESON_LOW_VERSION=false diff --git a/core/commands.inc.sh b/core/commands.inc.sh index f09d899c6c..3714667146 100644 --- a/core/commands.inc.sh +++ b/core/commands.inc.sh @@ -28,7 +28,9 @@ do_configure() { # do_configure_wasm locate_emscripten build_meson_cross_file_for_wasm - STANDARD_MESON_ARGS="$MESON_OPTION_keyman_core_tests --cross-file wasm.defs.build --cross-file wasm.build --default-library static" + STANDARD_MESON_ARGS="$STANDARD_MESON_ARGS --cross-file wasm.defs.build --cross-file wasm.build --default-library static" + elif [[ $target =~ ^(x86|x64)$ ]]; then + STANDARD_MESON_ARGS="$STANDARD_MESON_ARGS --default-library both" fi pushd "$THIS_SCRIPT_PATH" > /dev/null @@ -135,3 +137,25 @@ build_meson_cross_file_for_wasm() { fi sed -e "s/\$EMSCRIPTEN_BASE/$R/g" wasm.build.$os_id.in > wasm.build } + +# +# Remove Visual Studio from the path so that meson goes looking for it rather than +# assuming that it's all available. If we don't do this, we get an error with link.exe: +# +# meson.build:8:0: ERROR: Found GNU link.exe instead of MSVC link.exe in C:\Program Files\Git\usr\bin\link.EXE. +# This link.exe is not a linker. +# You may need to reorder entries to your %PATH% variable to resolve this. +# + +cleanup_visual_studio_path() { + local _split_path _new_path="" + IFS=':' read -ra _split_path <<<"$PATH" + for p in "${_split_path[@]}"; do + if ! [[ $p =~ Visual\ Studio ]]; then + _new_path="$_new_path:$p" + fi + done + echo + PATH="${_new_path:1}" + unset VSINSTALLDIR +}