diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 61 |
1 files changed, 61 insertions, 0 deletions
@@ -21,6 +21,8 @@ basename=`basename $0` PACKAGE_AUTHOR_NAME="The Apache Software Foundation" +REBAR3_BRANCH="master" + # TEST=0 WITH_PROPER="true" WITH_FAUXTON=1 @@ -31,6 +33,7 @@ SKIP_DEPS=0 COUCHDB_USER="$(whoami 2>/dev/null || echo couchdb)" SM_VSN=${SM_VSN:-"1.8.5"} ARCH="$(uname -m)" +ERLANG_VER="$(erl -eval 'io:put_chars(erlang:system_info(otp_release)), halt().' -noshell)" . ${rootdir}/version.mk COUCHDB_VERSION=${vsn_major}.${vsn_minor}.${vsn_patch} @@ -54,6 +57,8 @@ Options: --skip-deps do not update erlang dependencies --rebar=PATH use rebar by specified path (version >=2.6.0 && <3.0 required) --generate-tls-dev-cert generate a cert for TLS distribution (To enable TLS, change the vm.args file.) + --rebar3=PATH use rebar3 by specified path + --erlfmt=PATH use erlfmt by specified path EOF } @@ -137,6 +142,28 @@ parse_opts() { fi ;; + --rebar3) + if [ -x "$2" ]; then + eval REBAR3=$2 + shift 2 + continue + else + printf 'ERROR: "--rebar3" requires valid path to executable.\n' >&2 + exit 1 + fi + ;; + + --erlfmt) + if [ -x "$2" ]; then + eval ERLFMT=$2 + shift 2 + continue + else + printf 'ERROR: "--erlfmt" requires valid path to executable.\n' >&2 + exit 1 + fi + ;; + --user|-u) if [ -n "$2" ]; then eval COUCHDB_USER=$2 @@ -275,12 +302,46 @@ install_local_rebar() { fi } +install_local_rebar3() { + if [ ! -x "${rootdir}/bin/rebar3" ]; then + if [ ! -d "${rootdir}/src/rebar3" ]; then + git clone --depth 1 --branch ${REBAR3_BRANCH} https://github.com/erlang/rebar3.git ${rootdir}/src/rebar3 + fi + cd src/rebar3 + ./bootstrap + mv ${rootdir}/src/rebar3/rebar3 ${rootdir}/bin/rebar3 + cd ../.. + fi +} + +install_local_erlfmt() { + if [ ! -x "${rootdir}/bin/erlfmt" ]; then + if [ ! -d "${rootdir}/src/erlfmt" ]; then + git clone --depth 1 https://github.com/WhatsApp/erlfmt.git ${rootdir}/src/erlfmt + fi + cd "${rootdir}"/src/erlfmt + ${REBAR3} as release escriptize + mv ${rootdir}/src/erlfmt/_build/release/bin/erlfmt ${rootdir}/bin/erlfmt + ${REBAR3} clean + cd ../.. + fi +} if [ -z "${REBAR}" ]; then install_local_rebar REBAR=${rootdir}/bin/rebar fi +if [ -z "${REBAR3}" ] && [ "${ERLANG_VER}" != "20" ]; then + install_local_rebar3 + REBAR3=${rootdir}/bin/rebar3 +fi + +if [ -z "${ERLFMT}" ] && [ "${ERLANG_VER}" != "20" ]; then + install_local_erlfmt + ERLFMT=${rootdir}/bin/erlfmt +fi + # only update dependencies, when we are not in a release tarball if [ -d .git -a $SKIP_DEPS -ne 1 ]; then echo "==> updating dependencies" |