From 382ecf9d5c96e131dc931daf89064aeea5158bba Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 24 May 2023 21:23:04 +0200 Subject: [PATCH] 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 ';' --- build | 12 +++++++++++- dev | 13 ++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/build b/build index 4dd3071a1..7fd171402 100755 --- a/build +++ b/build @@ -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" diff --git a/dev b/dev index 01bee1269..5087cc30f 100755 --- a/dev +++ b/dev @@ -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" }