Erlang Mailing Lists

Author Message

<  Yaws mailing list  ~  cygwin make && make install patch

billrobertson42
Posted: Wed May 14, 2008 4:18 am Reply with quote
User Joined: 07 Jan 2008 Posts: 13
Hi,

I see that in include.mk, DESTDIR is assigned to / if there is no
value. This creates problems in cygwin when running a make install.
I also see that DESTDIR is somehow related to packages, but I don't
understand how that is supposed to work.

Anyway, with DESTDIR = / it creates this problem for cygwin.

e.g. in c_src/Makefile
$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/priv/lib
expands to
: usr/bin/install -c -d //cygdrive/c/erl/lib/yaws/priv/lib

and cygwin apparently does not like the // at the front (or anywhere
else?). In the above case, you could set DESTDIR to an empty string,
and cygwin would probably be happy, but that will not work in other
spots in the makefiles.

e.g. in applications/yapp/Makefile:
$(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/$(APPNAME)/ebin

Here, if DESTDIR is empty, the string will still expand to
//cygdrive/c/lib because of the / between DESTDIR and PREFIX. You
can't specify a relative directory with configure --prefix as a
cheap way of getting around this. I tried.

Also, this is not cygwin specific, there are also several spots in the
makefile that leave prefix out completely. Maybe these work for a
non-rooted prefix in some other way?

bash-3.2$ find . -name Makefile | xargs grep DESTDIR | grep -v PREFIX | grep -v VARDIR | grep -v ETCDIR
./applications/mail/src/Makefile: install -d $(DESTDIR)/etc/mail
./applications/mail/src/Makefile: @if [ -f $(DESTDIR)/etc/mail/yaws-webmail.conf ]; \
./applications/mail/src/Makefile: then echo "$(DESTDIR)/etc/mail/yaws-webmail.conf already exists"; \
./applications/mail/src/Makefile: cp yaws-webmail.conf $(DESTDIR)/etc/mail/yaws-webmail.conf; fi

I think this will require some changes to make it work in cygwin
correctly. What is the "right" thing to do here? It seems to me that
if you get rid of intervening slashes between $(DESTDIR) and $(PREFIX),
and then remove the if statement in include.mk (well, whatever that is
generated from) then you would get (what I think to be) the intended
results. AFAIK, prefix will always begin with a slash, and this will
allow a non-empty or an empty DESTDIR to expand to an equivalent
value. This change is also reflected in scripts/Install.

In addition, I enquoted the erlc command (and others) in include.mk.in
since erlang installs by default in the "Program Files" on windows (not
my my system though!)

The following patch allows make install to complete w/o error on (my) cygwin+windows box. I
have not really had time to verify that it produces a fully functional
yaws install or tried it on another system, but I thought I would post it though if
anybody wants to take a look. It is based off of the 1.76
tarball.

Thanks
Bill Robertson
---------------
diff -r 0ce346d3ebde applications/mail/src/Makefile
--- a/applications/mail/src/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/applications/mail/src/Makefile Wed May 14 00:08:24 2008 -0400
@@ -32,11 +32,11 @@
install: all
install -d $(MAILINSTALLDIR)
install -d $(EBININSTALLDIR)
- install -d $(DESTDIR)/etc/mail
- @if [ -f $(DESTDIR)/etc/mail/yaws-webmail.conf ]; \
- then echo "$(DESTDIR)/etc/mail/yaws-webmail.conf already exists"; \
+ install -d $(DESTDIR)$(PREFIX)/etc/mail
+ @if [ -f $(DESTDIR)$(PREFIX)/etc/mail/yaws-webmail.conf ]; \
+ then echo "$(DESTDIR)$(PREFIX)/etc/mail/yaws-webmail.conf already exists"; \
else \
- cp yaws-webmail.conf $(DESTDIR)/etc/mail/yaws-webmail.conf; fi
+ cp yaws-webmail.conf $(DESTDIR)$(PREFIX)/etc/mail/yaws-webmail.conf; fi
(cd ../ebin; find . -name '*' -print | xargs tar cf - ) | (cd $(EBININSTALLDIR); tar xf - )
(cd ../mail; find . -name '*' -print | xargs tar cf - ) | (cd $(MAILINSTALLDIR); tar xf - )

diff -r 0ce346d3ebde applications/yapp/Makefile
--- a/applications/yapp/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/applications/yapp/Makefile Wed May 14 00:08:24 2008 -0400
@@ -24,8 +24,8 @@
rm -rf doc/*.html doc/edoc-info doc/stylesheet.css

install: all docs
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/$(APPNAME)/ebin
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/$(APPNAME)/priv/docroot
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/$(APPNAME)/doc
- (tar cf - ebin priv doc) | (cd $(DESTDIR)/$(PREFIX)/lib/yapp; tar xf - )
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/$(APPNAME)/ebin
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/$(APPNAME)/priv/docroot
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/$(APPNAME)/doc
+ (tar cf - ebin priv doc) | (cd $(DESTDIR)$(PREFIX)/lib/yapp; tar xf - )

diff -r 0ce346d3ebde doc/Makefile
--- a/doc/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/doc/Makefile Wed May 14 00:08:24 2008 -0400
@@ -29,6 +29,6 @@
rm -f *.ps *.dvi *.log *.aux *.pdf *.toc *.beam 2> /dev/null || true

install:
- -install -d $(DESTDIR)/$(PREFIX)/share/doc/yaws-$(YAWS_VSN)
- -cp yaws.pdf $(DESTDIR)/$(PREFIX)/share/doc/yaws-$(YAWS_VSN)
+ -install -d $(DESTDIR)$(PREFIX)/share/doc/yaws-$(YAWS_VSN)
+ -cp yaws.pdf $(DESTDIR)$(PREFIX)/share/doc/yaws-$(YAWS_VSN)

diff -r 0ce346d3ebde include.mk.in
--- a/include.mk.in Tue May 13 22:50:18 2008 -0400
+++ b/include.mk.in Wed May 14 00:08:24 2008 -0400
@@ -6,15 +6,9 @@
ETCDIR = @sysconfdir@
VARDIR = @localstatedir@

-ifeq ($(DESTDIR),)
- DESTDIR=/
-endif
-
-## DESTDIR is handled separately in the individual Makefiles
-
-ERL=@ERL@
-WERL=@WERL@
-ERLC=@ERLC@
+ERL="@ERL@"
+WERL="@WERL@"
+ERLC="@ERLC@"
EMULATOR=beam
DEFAULT_CHARSET=@DEFAULT_CHARSET@
EPAM = @EPAM@
diff -r 0ce346d3ebde man/Makefile
--- a/man/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/man/Makefile Wed May 14 00:08:24 2008 -0400
@@ -2,10 +2,10 @@
include ../include.mk

install:
- install -d $(DESTDIR)/$(PREFIX)/share/man/man1
- install -d $(DESTDIR)/$(PREFIX)/share/man/man5
- cp yaws.1 $(DESTDIR)/$(PREFIX)/share/man/man1
- cp yaws.conf.5 $(DESTDIR)/$(PREFIX)/share/man/man5
- cp yaws_api.5 $(DESTDIR)/$(PREFIX)/share/man/man5
+ install -d $(DESTDIR)$(PREFIX)/share/man/man1
+ install -d $(DESTDIR)$(PREFIX)/share/man/man5
+ cp yaws.1 $(DESTDIR)$(PREFIX)/share/man/man1
+ cp yaws.conf.5 $(DESTDIR)$(PREFIX)/share/man/man5
+ cp yaws_api.5 $(DESTDIR)$(PREFIX)/share/man/man5

all debug clean:
diff -r 0ce346d3ebde scripts/Install
--- a/scripts/Install Tue May 13 22:50:18 2008 -0400
+++ b/scripts/Install Wed May 14 00:08:24 2008 -0400
@@ -3,12 +3,12 @@
#set -x

prefix=$1
-destdir=$2
-erl=$3
-werl=$4
-etcdir=$5
-vardir=$6
-bindir=$7
+erl=$2
+werl=$3
+etcdir=$4
+vardir=$5
+bindir=$6
+destdir=$7

#bindir=`dirname $erl` ; bindir=`dirname $bindir`/lib/erlang/bin

@@ -18,8 +18,8 @@
e=${etcdir}
v=${vardir}

-install -d ${destdir}/${prefix}/bin
-install -d ${destdir}/${prefix}/etc
+install -d ${destdir}${prefix}/bin
+install -d ${destdir}${prefix}/etc

cat yaws.template | \
./Subst %yawsdir% ${prefix}/lib/yaws | \
@@ -27,44 +27,44 @@
./Subst %erl% "${erl}" | \
./Subst %run_erl% "${bindir}/run_erl" | \
./Subst %to_erl% "${bindir}/to_erl" | \
- ./Subst %werl% "${werl}" > ${destdir}/${prefix}/bin/yaws
+ ./Subst %werl% "${werl}" > ${destdir}${prefix}/bin/yaws

-chmod +x ${destdir}/${prefix}/bin/yaws
+chmod +x ${destdir}${prefix}/bin/yaws

-install -d ${destdir}/${prefix}/lib/yaws/examples/ebin
-install -d ${destdir}/${prefix}/lib/yaws/examples/include
+install -d ${destdir}${prefix}/lib/yaws/examples/ebin
+install -d ${destdir}${prefix}/lib/yaws/examples/include

## seems gentoo don't like to be installed in /usr/local/etc
## since /sbin/runscript still reads /etc/conf.d
if [ -f /etc/gentoo-release ]; then
- install -d ${destdir}/${etcdir}/init.d/
- install -d ${destdir}/${etcdir}/conf.d/
- install -d ${destdir}/${vardir}/run/yaws
- chmod a+rwx ${destdir}/${vardir}/run/yaws
+ install -d ${destdir}${etcdir}/init.d/
+ install -d ${destdir}${etcdir}/conf.d/
+ install -d ${destdir}${vardir}/run/yaws
+ chmod a+rwx ${destdir}${vardir}/run/yaws
sed -e "s;%prefix%;$p;g" \
- -e "s;%etcdir%;$e;g" gentoo/init.d.yaws > ${destdir}/${etcdir}/init.d/yaws
- chmod +x ${destdir}/${etcdir}/init.d/yaws
+ -e "s;%etcdir%;$e;g" gentoo/init.d.yaws > ${destdir}${etcdir}/init.d/yaws
+ chmod +x ${destdir}${etcdir}/init.d/yaws
elif [ -f /etc/redhat-release ]; then
- install -d ${destdir}/${etcdir}/init.d
+ install -d ${destdir}${etcdir}/init.d
sed -e "s;%prefix%;$p;g" \
- -e "s;%etcdir%;$e;g" redhat/yaws.init.d > ${destdir}/${etcdir}/init.d/yaws
- chmod +x ${destdir}/${etcdir}/init.d/yaws
- install -d ${destdir}/${vardir}/run/yaws
- chmod a+rwx ${destdir}/${vardir}/run/yaws
+ -e "s;%etcdir%;$e;g" redhat/yaws.init.d > ${destdir}${etcdir}/init.d/yaws
+ chmod +x ${destdir}${etcdir}/init.d/yaws
+ install -d ${destdir}${vardir}/run/yaws
+ chmod a+rwx ${destdir}${vardir}/run/yaws
elif [ -f /etc/suseservers ]; then
- install -d ${destdir}/${etcdir}/init.d
+ install -d ${destdir}${etcdir}/init.d
sed -e "s;%prefix%;$p;g" \
- -e "s;%etcdir%;$e;g" suse/yaws.init.d/ > ${destdir}/${etcdir}/init.d/yaws
- chmod +x ${destdir}/${etcdir}/init.d/yaws
- install -d ${destdir}/${vardir}/run/yaws
- chmod a+rwx ${destdir}/${vardir}/run/yaws
+ -e "s;%etcdir%;$e;g" suse/yaws.init.d/ > ${destdir}${etcdir}/init.d/yaws
+ chmod +x ${destdir}${etcdir}/init.d/yaws
+ install -d ${destdir}${vardir}/run/yaws
+ chmod a+rwx ${destdir}${vardir}/run/yaws
elif [ -f /etc/debian_version ]; then
- install -d ${destdir}/${etcdir}/init.d
+ install -d ${destdir}${etcdir}/init.d
sed -e "s;%prefix%;$p;g" \
- -e "s;%etcdir%;$e;g" debian/yaws.init.d > ${destdir}/${etcdir}/init.d/yaws
- chmod +x ${destdir}/${etcdir}/init.d/yaws
- install -d ${destdir}/${vardir}/run/yaws
- chmod a+rwx ${destdir}/${vardir}/run/yaws
+ -e "s;%etcdir%;$e;g" debian/yaws.init.d > ${destdir}${etcdir}/init.d/yaws
+ chmod +x ${destdir}${etcdir}/init.d/yaws
+ install -d ${destdir}${vardir}/run/yaws
+ chmod a+rwx ${destdir}${vardir}/run/yaws

elif [ "`uname -s`" = "Darwin" -a `id -u` = 0 ]; then
startupdir="/Library/StartupItems/Yaws"
@@ -80,11 +80,11 @@
# MacOS is particular about the ownership of startup items.
chown -R root:wheel ${startupdir}
elif [ "`uname -s`" = "FreeBSD" ]; then
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" freebsd/yaws.sh > ${destdir}/${etcdir}/rc.d/yaws.sh
+ sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" freebsd/yaws.sh > ${destdir}${etcdir}/rc.d/yaws.sh
elif [ "`uname -s`" = "NetBSD" ]; then
sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" netbsd/yaws.sh > /etc/rc.d/yaws
else
- install -d ${destdir}/${etcdir}
+ install -d ${destdir}${etcdir}
echo "Don't know how to make /etc/init scrips for this system"
echo "possibly add ${prefix}/bin/yaws --daemon --heart to your /etc/rc.local manually"
fi
diff -r 0ce346d3ebde scripts/Makefile
--- a/scripts/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/scripts/Makefile Wed May 14 00:08:24 2008 -0400
@@ -56,15 +56,15 @@

.install:
-rm -rf /tmp/yaws 2> /dev/null
- sh ./Install $(PREFIX) $(DESTDIR) "$(ERL)" \
- "$(WERL)" $(ETCDIR)/ $(VARDIR)/ $(ERLBINDIR)/
- @cp ../ssl/yaws-cert.pem $(DESTDIR)/$(ETCDIR)
- @cp ../ssl/yaws-key.pem $(DESTDIR)/$(ETCDIR)
- @if [ -f $(DESTDIR)/$(ETCDIR)/yaws.conf ]; \
+ sh ./Install $(PREFIX) $(ERL) \
+ $(WERL) $(ETCDIR)/ $(VARDIR)/ $(ERLBINDIR)/ $(DESTDIR)
+ @cp ../ssl/yaws-cert.pem $(DESTDIR)$(ETCDIR)
+ @cp ../ssl/yaws-key.pem $(DESTDIR)$(ETCDIR)
+ @if [ -f $(DESTDIR)$(ETCDIR)/yaws.conf ]; \
then echo "Keeping old config file "; \
- cp yaws.conf $(DESTDIR)/$(ETCDIR)/yaws.conf.template; \
+ cp yaws.conf $(DESTDIR)$(ETCDIR)/yaws.conf.template; \
else \
- echo "Installing $(DESTDIR)/$(ETCDIR)/yaws.conf"; \
- mkdir -p $(DESTDIR)/$(ETCDIR); \
- cp yaws.conf $(DESTDIR)/$(ETCDIR)/yaws.conf; \
+ echo "Installing $(DESTDIR)$(ETCDIR)/yaws.conf"; \
+ mkdir -p $(DESTDIR)$(ETCDIR); \
+ cp yaws.conf $(DESTDIR)$(ETCDIR)/yaws.conf; \
fi
diff -r 0ce346d3ebde src/Makefile
--- a/src/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/src/Makefile Wed May 14 00:08:24 2008 -0400
@@ -89,20 +89,20 @@
rm -f $(EBIN_FILES) yaws_generated.erl charset.def mime_types.erl

install: regen all docsinstall
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/yaws/examples/ebin
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/yaws/examples/include
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/yaws/ebin
- $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/yaws/priv
- $(INSTALL) -d $(DESTDIR)/$(VARDIR)/log/yaws
- $(INSTALL) -d $(DESTDIR)/$(VARDIR)/yaws/ebin
- (cd ..; tar cf - ebin ) | (cd $(DESTDIR)/$(PREFIX)/lib/yaws; tar xf - )
- (cd ..; tar cf - include ) | (cd $(DESTDIR)/$(PREFIX)/lib/yaws; tar xf - )
- (cd ..; tar cf - priv/*.xsd ) | (cd $(DESTDIR)/$(PREFIX)/lib/yaws; tar xf - )
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/examples/ebin
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/examples/include
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/ebin
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/priv
+ $(INSTALL) -d $(DESTDIR)$(VARDIR)/log/yaws
+ $(INSTALL) -d $(DESTDIR)$(VARDIR)/yaws/ebin
+ (cd ..; tar cf - ebin ) | (cd $(DESTDIR)$(PREFIX)/lib/yaws; tar xf - )
+ (cd ..; tar cf - include ) | (cd $(DESTDIR)$(PREFIX)/lib/yaws; tar xf - )
+ (cd ..; tar cf - priv/*.xsd ) | (cd $(DESTDIR)$(PREFIX)/lib/yaws; tar xf - )
$(RM) yaws_generated.erl ../ebin/yaws_generated.beam 2>/dev/null || true

docsinstall:
- $(INSTALL) -d $(DESTDIR)/$(VARDIR)/yaws/www
- (cd ..; tar cf - www ) | (cd $(DESTDIR)/$(VARDIR)/yaws; tar xf - )
+ $(INSTALL) -d $(DESTDIR)$(VARDIR)/yaws/www
+ (cd ..; tar cf - www ) | (cd $(DESTDIR)$(VARDIR)/yaws; tar xf - )

tags:
erl -noshell -pa ../ebin -s yaws_debug mktags
diff -r 0ce346d3ebde www/code/Makefile
--- a/www/code/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/www/code/Makefile Wed May 14 00:08:24 2008 -0400
@@ -5,7 +5,7 @@
debug:

install: all
- cp myappmod.beam $(DESTDIR)/$(VARDIR)/yaws/ebin
+ cp myappmod.beam $(DESTDIR)$(VARDIR)/yaws/ebin

clean:
$(RM) myappmod.beam
diff -r 0ce346d3ebde www/shopingcart/Makefile
--- a/www/shopingcart/Makefile Tue May 13 22:50:18 2008 -0400
+++ b/www/shopingcart/Makefile Wed May 14 00:08:24 2008 -0400
@@ -5,7 +5,7 @@
debug:

install: all
- cp shopcart.beam $(DESTDIR)/$(VARDIR)/yaws/ebin
+ cp shopcart.beam $(DESTDIR)$(VARDIR)/yaws/ebin

clean:
$(RM) shopcart.beam




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
View user's profile Send private message
Guest
Posted: Wed May 14, 2008 8:40 am Reply with quote
Guest
Bill Robertson wrote:
> Hi,
>

Excellent - at last someone who cares for win32 build. However, I cannot apply
the patch. Could you repost the patch using diff -Naur <olddir> <newdir>

Now I get a series of
1 out of 1 hunk FAILED -- saving rejects to file applications/mail/src/Makefile.rej
......

/klacke


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
billrobertson42
Posted: Thu May 15, 2008 2:56 am Reply with quote
User Joined: 07 Jan 2008 Posts: 13
Hi,

I think people do care about windows config. I a blog entry about how
to work around a couple of problems. I originally was just going to
post a request. Then I started digging in, and I was going to post the
research. Then I realized how easy it appeared to be. Next thing I
know I had a patch. Once I know that i have things working, I can submit a windows readme if you wish to include that in the distribution.

Anyway. Here is a new patch made that way.

bash-3.2$ diff -Naur yaws-1.76.old/ yaws-1.76.new/ > cygwin_destdir2.patch

I saw no fundamental difference between the two patch files though. So maybe yahoo mail somehow damaged the patch in the mail? To avoid more hassle, I posted the patch here for you to download. http://www.tekbot.com/cygwin_destdir2.patch If for some reason that does not work, here is a tarfile. http://www.tekbot.com/yaws-1.76.new.tar.bz2 (I will take this down in a few days)

I did not find time this evening to look at the install, but if you're interested, please check out the patch. I will let you know in a day or two what the findings are. Sorry for the delay.

Thanks for your hard work.
-Bill Robertson




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
View user's profile Send private message
Guest
Posted: Thu May 15, 2008 10:38 am Reply with quote
Guest
Bill Robertson wrote:

Once I know that i have things working, I can submit a windows readme if you wish to include that in the distribution.

Absolutely,

>
> Anyway. Here is a new patch made that way.
>

And it applies fine, unix install still works as expected.
thanks.

/klacke


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum