build: adapt ERL_LIBS dir separator for windows

Using ':' in ERL_LIBS environment variable e.g. ERL_LIBS='dir1:dir2'
does not work in windows, it has to be ';'
This commit is contained in:
Zaiming (Stone) Shi 2023-05-24 21:23:04 +02:00
parent dee21d2ccf
commit 382ecf9d5c
2 changed files with 23 additions and 2 deletions

12
build
View File

@ -94,9 +94,19 @@ log() {
prepare_erl_libs() {
local libs_dir="$1"
local erl_libs="${ERL_LIBS:-}"
local sep
if [ "${SYSTEM}" = 'windows' ]; then
sep=';'
else
sep=':'
fi
for app in "${libs_dir}"/*; do
if [ -d "${app}/ebin" ]; then
erl_libs="${erl_libs}:${app}"
if [ -n "$erl_libs" ]; then
erl_libs="${erl_libs}${sep}${app}"
else
erl_libs="${app}"
fi
fi
done
export ERL_LIBS="$erl_libs"

13
dev
View File

@ -58,6 +58,7 @@ fi
export HOCON_ENV_OVERRIDE_PREFIX='EMQX_'
export EMQX_LOG__FILE__DEFAULT__ENABLE='false'
export EMQX_LOG__CONSOLE__ENABLE='true'
SYSTEM="$(./scripts/get-distro.sh)"
EMQX_NODE_NAME="${EMQX_NODE_NAME:-emqx@127.0.0.1}"
PROFILE="${PROFILE:-emqx}"
FORCE_COMPILE=0
@ -158,13 +159,23 @@ prepare_erl_libs() {
local profile="$1"
local libs_dir="_build/${profile}/lib"
local erl_libs="${ERL_LIBS:-}"
local sep
if [ "${SYSTEM}" = 'windows' ]; then
sep=';'
else
sep=':'
fi
if [ $FORCE_COMPILE -eq 1 ] || [ ! -d "$libs_dir" ]; then
make "compile-${PROFILE}"
else
echo "Running from code in $libs_dir"
fi
for app in "${libs_dir}"/*; do
erl_libs="${erl_libs}:${app}"
if [ -n "$erl_libs" ]; then
erl_libs="${erl_libs}${sep}${app}"
else
erl_libs="${app}"
fi
done
export ERL_LIBS="$erl_libs"
}