Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 90 lines (77 sloc) 2.527 kb
#!/bin/sh
YAWS_DIR=`pwd`
DEFAULT_YAWS_VSN=`sed -e 's/^.*=//' $YAWS_DIR/vsn.mk 2>/dev/null`
YAWS_VSN=${VSN-$DEFAULT_YAWS_VSN}
YAWS_VARDIR=${VARDIR-$YAWS_DIR/var}
YAWS_ETCDIR=${ETCDIR-$YAWS_DIR/etc}
ERL_BIN=`which erl`
ERL_BIN_DIR=${ERL_BIN%/erl}
YAWS_ERLBINDIR=${ERLBINDIR-$ERL_BIN_DIR}
ERL_BIN=$YAWS_ERLBINDIR/erl
WERL_BIN=$YAWS_ERLBINDIR/werl
# For rebar, support only local install for the yaws script.
YAWS_LOCALINSTALL=true
script=`basename $0`
# Use a function for error exit instead of set -e so we can conditionally
# remove files before exiting. If this were bash we could trap ERR but
# Bourne shell doesn't support that portably.
fail() {
[ -n "$@" ] && rm -f "$@"
exit 1
}
keep_or_replace() {
if [ -f "$1" ] && cmp -s "$1" "$2"; then
rm -f "$2"
return 0
else
mv "$2" "$1" || fail "$2"
return 1
fi
}
cd src || fail
if [ "$1" = clean ]; then
rm -f mime_types.erl charset.def yaws_configure.hrl yaws_generated.erl
exit 0
fi
CHARSET=${DEFAULT_CHARSET-""}
need_mime=yes
if [ -f mime_types.erl ]; then
need_mime=`find mime_type_c.erl -newer mime_types.erl -print`
fi
if [ -n "$need_mime" ]; then
echo ${CHARSET} > charset.def || fail
erlc -o ../ebin mime_type_c.erl || fail charset.def
erl -pa ../ebin -noshell -s mime_type_c compile || \
fail charset.def mime_types.erl
fi
if [ ! -f yaws_configure.hrl ]; then
echo '%% rebar sets HAVE_SENDFILE in erlc command line' > yaws_configure.hrl
[ $? -eq 0 ] || fail
fi
tmpgen=`mktemp /tmp/${script}.XXXXXX` || fail
YAWS_VSN=$YAWS_VSN VARDIR="$YAWS_VARDIR" ETCDIR="$YAWS_ETCDIR" \
../scripts/gen-yaws-generated $YAWS_LOCALINSTALL >$tmpgen || fail
keep_or_replace yaws_generated.erl $tmpgen
[ -d "$YAWS_VARDIR" ] || mkdir "$YAWS_VARDIR" || fail
[ -d "$YAWS_ETCDIR" ] || mkdir "$YAWS_ETCDIR" || fail
cd ../scripts
case $YAWS_LOCALINSTALL in
true)
tmpgen=`mktemp /tmp/${script}.XXXXXX` || fail
VARDIR="${YAWS_VARDIR}" ERLBINDIR="${YAWS_ERLBINDIR}" \
ERL="${ERL_BIN}" WERL="${WERL_BIN}" ./gen-yaws > $tmpgen || fail
keep_or_replace ../bin/yaws $tmpgen
if [ $? -eq 0 ]; then
VARDIR="${YAWS_VARDIR}" ./local-install false || fail
else
chmod +x ../bin/yaws || fail
VARDIR="${YAWS_VARDIR}" ./local-install true || fail
fi
;;
*)
echo "ERROR: Configurations other than 'localinstall' not yet \
supported with rebar"
exit 1
;;
esac
exit 0
Jump to Line
Something went wrong with that request. Please try again.