Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 77 lines (65 sloc) 2.155 kB
#!/bin/sh
YAWS_DIR=`pwd`
DEFAULT_YAWS_VSN=`sed -ne '1,/^YAWS_VSN=/s/^YAWS_VSN=//p' $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
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 yaws_configure.hrl yaws_generated.erl
exit 0
fi
if [ ! -f yaws_configure.hrl ]; then
echo '%% rebar sets HAVE_YAWS_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 true >$tmpgen || fail
keep_or_replace yaws_generated.erl $tmpgen
[ -d "$YAWS_VARDIR" ] || mkdir "$YAWS_VARDIR" || fail
[ -d "$YAWS_ETCDIR" ] || mkdir "$YAWS_ETCDIR" || fail
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
erlc -o ../ebin yaws_generated.erl || fail
erlc -o ../ebin mime_type_c.erl || fail
erl -pa ../ebin -noshell -s mime_type_c generate || fail mime_types.erl
fi
cd ../scripts
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 "${YAWS_DIR}" || fail
else
chmod +x ../bin/yaws || fail
VARDIR="${YAWS_VARDIR}" ./local-install true "${YAWS_DIR}" || fail
fi
exit 0
Jump to Line
Something went wrong with that request. Please try again.