Skip to content

Commit

Permalink
cygwin support
Browse files Browse the repository at this point in the history
git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@1253 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Claes Wikstrom committed May 25, 2008
1 parent 6f82638 commit 4607990
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 42 deletions.
42 changes: 21 additions & 21 deletions scripts/Makefile
Expand Up @@ -6,11 +6,11 @@ all debug: ../bin/yaws yaws.conf
../bin/yaws: yaws.template
cat yaws.template | \
./Subst %yawsdir% `pwd`/.. | \
./Subst %vardir% $(VARDIR) | \
./Subst %run_erl% "$(ERLBINDIR)/run_erl" | \
./Subst %to_erl% "$(ERLBINDIR)/to_erl" | \
./Subst %erl% "$(ERL)" | \
./Subst %werl% "$(WERL)" > ../bin/yaws
./Subst %vardir% $(VARDIR) | \
./Subst %run_erl% "$(ERLBINDIR)/run_erl" | \
./Subst %to_erl% "$(ERLBINDIR)/to_erl" | \
./Subst %erl% $(ERL) | \
./Subst %werl% $(WERL) > ../bin/yaws
chmod +x ../bin/yaws


Expand All @@ -23,14 +23,14 @@ local_install: ../bin/yaws
fi; \
echo "--- Installing local config file at $${target} "; \
cat yaws.conf.template | \
./Subst %yawsdir% `pwd`/.. | \
./Subst %logdir% $$HOME/yaws_logs | \
./Subst %host% `hostname` | \
./Subst %port% 8000 | \
./Subst %vardir% $(VARDIR) | \
./Subst %docroot% `pwd`/../www | \
./Subst %certdir% `pwd`/../ssl | \
./Subst %sslport% 4443 > $${target}; \
./Subst %yawsdir% `pwd`/.. | \
./Subst %logdir% $$HOME/yaws_logs | \
./Subst %host% `hostname` | \
./Subst %port% 8000 | \
./Subst %vardir% $(VARDIR) | \
./Subst %docroot% `pwd`/../www | \
./Subst %certdir% `pwd`/../ssl | \
./Subst %sslport% 4443 > $${target}; \
$(INSTALL) -d $$HOME/bin; \
rm $$HOME/bin/yaws 2> /dev/null; \
cp -f ../bin/yaws $$HOME/bin/yaws; \
Expand All @@ -40,14 +40,14 @@ local_install: ../bin/yaws
yaws.conf:
@echo PREFIX is $(PREFIX)
cat yaws.conf.template | \
./Subst %yawsdir% $(PREFIX)/lib/yaws | \
./Subst %logdir% $(VARDIR)/log/yaws | \
./Subst %vardir% $(VARDIR) | \
./Subst %host% `hostname` | \
./Subst %port% 80 | \
./Subst %docroot% $(VARDIR)/yaws/www | \
./Subst %certdir% $(ETCDIR) | \
./Subst %sslport% 443 > yaws.conf
./Subst %yawsdir% $(PREFIX)/lib/yaws | \
./Subst %logdir% $(VARDIR)/log/yaws | \
./Subst %vardir% $(VARDIR) | \
./Subst %host% `hostname` | \
./Subst %port% 80 | \
./Subst %docroot% $(VARDIR)/yaws/www | \
./Subst %certdir% $(ETCDIR) | \
./Subst %sslport% 443 > yaws.conf

clean:
rm -f ../bin/yaws yaws.conf
Expand Down
7 changes: 6 additions & 1 deletion scripts/Subst
Expand Up @@ -2,7 +2,12 @@


p=$1
d=$2

if [ "$(uname -a | fgrep Cygwin)" != "" ]; then
d=`cygpath -m $2`
else
d=$2
fi

sed -e "s;$p;$d;g"

4 changes: 2 additions & 2 deletions scripts/yaws.template
Expand Up @@ -8,9 +8,9 @@ to_erl="%to_erl%"

case `uname` in
CYGWIN*)
yawsdir=`cygpath --windows $yawsdir`
yawsdir=`cygpath -m $yawsdir`
werl="%werl%"
delim=\\;;
delim=/;;
*)
delim=/
esac
Expand Down
22 changes: 10 additions & 12 deletions src/Makefile
Expand Up @@ -57,22 +57,20 @@ $(EBIN_FILES) : ../include/yaws.hrl ../include/yaws_api.hrl

yaws_generated.erl: yaws_generated.template ../vsn.mk
. ../vsn.mk; \
sed -e "s/%VSN%/${YAWS_VSN}/" -e \
"s;%VARDIR%;${VARDIR};g" -e \
"s;%localinstall%;true;g" -e \
"s;%ETCDIR%;${ETCDIR};g" \
< yaws_generated.template > yaws_generated.erl

cat yaws_generated.template | \
../scripts/Subst %VSN% ${YAWS_VSN} | \
../scripts/Subst %VARDIR% ${VARDIR} | \
../scripts/Subst %localinstall% true | \
../scripts/Subst %ETCDIR% ${ETCDIR} > yaws_generated.erl

## need to differentiate between local install and not
regen:
. ../vsn.mk; \
sed -e "s/%VSN%/${YAWS_VSN}/" -e \
"s;%VARDIR%;${VARDIR};g" -e \
"s;%localinstall%;false;g" -e \
"s;%ETCDIR%;${ETCDIR};g" \
< yaws_generated.template > yaws_generated.erl

cat yaws_generated.template | \
../scripts/Subst %VSN% ${YAWS_VSN} | \
../scripts/Subst %VARDIR% ${VARDIR} | \
../scripts/Subst %localinstall% false | \
../scripts/Subst %ETCDIR% ${ETCDIR} > yaws_generated.erl

charset.def:
if [ ! -z "$(DEFAULT_CHARSET)" ]; then \
Expand Down
13 changes: 7 additions & 6 deletions src/yaws_config.erl
Expand Up @@ -379,10 +379,10 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
Err
end;
{error, Error} ->
{error, ?F("Direcory ~s is not readable: ~s", [Name, Error])}
{error, ?F("Directory ~s is not readable: ~s", [Name, Error])}
end;
false ->
{error, ?F("Expect directory at line ~w", [Lno])}
{error, ?F("Expect directory at line ~w (subconfdir: ~s)", [Lno, Dir])}
end;

["trace", '=', Bstr] when GC#gconf.trace == false ->
Expand Down Expand Up @@ -412,7 +412,7 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
fload(FD, globals, GC#gconf{logdir = Dir},
C, Cs, Lno+1, Next);
false ->
{error, ?F("Expect directory at line ~w", [Lno])}
{error, ?F("Expect directory at line ~w (logdir ~s)", [Lno, Dir])}
end;

["ebin_dir", '=', Ebindir] ->
Expand All @@ -423,7 +423,7 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
[Dir|GC#gconf.ebin_dir]},
C, Cs, Lno+1, Next);
false ->
{error, ?F("Expect directory at line ~w", [Lno])}
{error, ?F("Expect directory at line ~w (ebin_dir: ~s)", [Lno, Dir])}
end;

["runmod", '=', Mod0] ->
Expand Down Expand Up @@ -476,7 +476,7 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
[Dir|GC#gconf.include_dir]},
C, Cs, Lno+1, Next);
false ->
{error, ?F("Expect directory at line ~w", [Lno])}
{error, ?F("Expect directory at line ~w (include_dir: ~s)", [Lno, Dir])}
end;

["mnesia_dir", '=', Mnesiadir] ->
Expand Down Expand Up @@ -728,7 +728,8 @@ fload(FD, server, GC, C, Cs, Lno, Chars) ->
xtra_docroots = tl(RootDirs)},
fload(FD, server, GC, C2, Cs, Lno+1, Next);
_ ->
{error, ?F("Expect directory at line ~w", [Lno])}
{error, ?F("Expect directory at line ~w (docroot: ~s)",
[Lno, hd(RootDirs)])}
end;

["partial_post_size",'=',Size] ->
Expand Down

0 comments on commit 4607990

Please sign in to comment.