diff options
| author | Michael Klishin <michael@novemberain.com> | 2015-10-23 22:17:35 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@novemberain.com> | 2015-10-23 22:17:35 +0300 |
| commit | 644b9b26232d04f8ee3d2091a14a08cca59692a8 (patch) | |
| tree | bfc8e731a93633639118ed12ef410086b9b75bde /scripts/rabbitmq-env | |
| parent | b7092c79837da3d89a6a11044fdb31c402590e7a (diff) | |
| parent | 6b93fa3a65d74c72d2b9d6de1dada0515e19e28f (diff) | |
| download | rabbitmq-server-git-644b9b26232d04f8ee3d2091a14a08cca59692a8.tar.gz | |
Merge pull request #385 from rabbitmq/erlang.mk
Switch to Erlang.mk
Diffstat (limited to 'scripts/rabbitmq-env')
| -rw-r--r--[-rwxr-xr-x] | scripts/rabbitmq-env | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env index 3eef90e141..cc05015cef 100755..100644 --- a/scripts/rabbitmq-env +++ b/scripts/rabbitmq-env @@ -235,6 +235,62 @@ rmq_check_if_shared_with_mnesia \ ##--- End of overridden <var_name> variables +## Development-specific environment. +if [ "${RABBITMQ_DEV_ENV}" ]; then + if [ "$(basename "$0")" = 'rabbitmq-plugins' ]; then + # We need to query the running node for the plugins directory + # and the "enabled plugins" file. + eval $( (${RABBITMQ_SCRIPTS_DIR}/rabbitmqctl eval \ + '{ok, P} = application:get_env(rabbit, plugins_dir), + {ok, E} = application:get_env(rabbit, enabled_plugins_file), + io:format( + "plugins_dir=\"~s\"~n" + "enabled_plugins_file=\"~s\"~n", [P, E]).' \ + 2>/dev/null | head -n 2) || :) + if [ "${plugins_dir}" ]; then + RABBITMQ_PLUGINS_DIR="${plugins_dir}" + fi + if [ "${enabled_plugins_file}" ]; then + RABBITMQ_ENABLED_PLUGINS_FILE="${enabled_plugins_file}" + fi + fi + + if [ -d "${RABBITMQ_PLUGINS_DIR}" ]; then + # RabbitMQ was started with "make run-broker" from its own + # source tree. Take rabbit_common from the plugins directory. + ERL_LIBS="${RABBITMQ_PLUGINS_DIR}:${ERL_LIBS}" + else + # RabbitMQ runs from a testsuite or a plugin. The .ez files are + # not available under RabbitMQ source tree. We need to look at + # $DEPS_DIR and default locations. + + if [ "${DEPS_DIR}" -a -d "${DEPS_DIR}/rabbit_common/ebin" ]; then + # $DEPS_DIR is set, and it contains rabbitmq-common, use + # this. + DEPS_DIR_norm="${DEPS_DIR}" + elif [ -f "${RABBITMQ_SCRIPTS_DIR}/../../../erlang.mk" -a \ + -d "${RABBITMQ_SCRIPTS_DIR}/../../rabbit_common/ebin" ]; then + # Look at default locations: "deps" subdirectory inside a + # plugin or the Umbrella. + DEPS_DIR_norm="${RABBITMQ_SCRIPTS_DIR}/../.." + fi + DEPS_DIR_norm=$(rmq_realpath "${DEPS_DIR_norm}") + + ERL_LIBS="${DEPS_DIR_norm}:${ERL_LIBS}" + fi +else + if [ -d "${RABBITMQ_PLUGINS_DIR}" ]; then + # RabbitMQ was started from its install directory. Take + # rabbit_common from the plugins directory. + ERL_LIBS="${RABBITMQ_PLUGINS_DIR}:${ERL_LIBS}" + fi +fi + +ERL_LIBS=${ERL_LIBS%:} +if [ "$ERL_LIBS" ]; then + export ERL_LIBS +fi + RABBITMQ_ENV_LOADED=1 # Since we source this elsewhere, don't accidentally stop execution |
