Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > 0b91cf6ce22e2364f6c1be47ebb667b0 > files > 3

yaws-1.89-3.fc13.src.rpm

From f98e56057baf629cf82658f854b5e103f53c0278 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com>
Date: Mon, 13 Sep 2010 16:42:17 +0200
Subject: [PATCH] Install into FHS-compliant hierarchy

basically move /var/yaws into /var/lib/yaws and ensure logs stay in
/var/log. Also, use /usr/lib64 on 64-bit.
---
 Makefile         |    8 ++++----
 c_src/Makefile   |   10 +++++-----
 include.mk.in    |    3 ++-
 scripts/Install  |   11 ++++++-----
 scripts/Makefile |    8 ++++----
 src/Makefile     |   16 ++++++++--------
 6 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index ef0ae16..4a1a026 100644
--- a/Makefile
+++ b/Makefile
@@ -19,13 +19,13 @@ install:	all
 	for d in $(SUBDIRS) ; do \
 	    if [ -f $$d/Makefile ]; then ( cd $$d && $(MAKE) $@ ) || exit 1 ; fi ; \
 	done
-	$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/pkgconfig
-	$(INSTALL) -m 644 $(PKGCONFIG_FILES) $(DESTDIR)$(PREFIX)/lib/pkgconfig
+	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/pkgconfig
+	$(INSTALL) -m 644 $(PKGCONFIG_FILES) $(DESTDIR)$(LIBDIR)/pkgconfig
 	@echo "-------------------------------"
 	@echo
 	@echo "** etc files went into        ${ETCDIR}"	
 	@echo "** executables went into      ${prefix}/bin"		
-	@echo "** library files went into    ${prefix}/lib/yaws"
+	@echo "** library files went into    ${LIBDIR}/yaws"
 	@echo "** var files went into        ${VARDIR}"
 	@echo "** default docroot went into  ${VARDIR}/yaws/www"
 	@echo
@@ -76,7 +76,7 @@ foo:
 	@echo
 	@echo "** etc files will go into     ${ETCDIR}"	
 	@echo "** executables will go into   ${prefix}/bin"		
-	@echo "** library file will go into  ${prefix}/lib/yaws"
+	@echo "** library file will go into  ${LIBDIR}/yaws"
 	@echo "** var files will go into     ${VARDIR}"
 	@echo
 	@echo "--------------------------------"
diff --git a/c_src/Makefile b/c_src/Makefile
index d7907ab..6707fa5 100644
--- a/c_src/Makefile
+++ b/c_src/Makefile
@@ -34,12 +34,12 @@ clean:
 	-rm -f $(PRIV_FILES) setuid_drv.$(OBJ) epam.$(OBJ) yaws_sendfile_drv.$(OBJ) hashtable.$(OBJ)
 
 install:	$(PRIV_FILES)
-	$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/priv/lib
-	$(INSTALL) $(PRIV_FILES) $(DESTDIR)$(PREFIX)/lib/yaws/priv/lib
+	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/yaws/priv/lib
+	$(INSTALL) $(PRIV_FILES) $(DESTDIR)$(LIBDIR)/yaws/priv/lib
 ifndef WIN32
-	if [ `id -u` = "0" -a -d $(DESTDIR)$(PREFIX)/lib/yaws/priv/epam ]; then \
-		chown root $(DESTDIR)$(PREFIX)/lib/yaws/priv/epam; \
-		chmod a+s $(DESTDIR)$(PREFIX)/lib/yaws/priv/epam; \
+	if [ `id -u` = "0" -a -d $(DESTDIR)$(LIBDIR)/yaws/priv/epam ]; then \
+		chown root $(DESTDIR)$(LIBDIR)/yaws/priv/epam; \
+		chmod a+s $(DESTDIR)$(LIBDIR)/yaws/priv/epam; \
 	fi
 endif
 
diff --git a/include.mk.in b/include.mk.in
index 1fd1ffa..b735d3d 100644
--- a/include.mk.in
+++ b/include.mk.in
@@ -2,9 +2,10 @@
 
 
 PREFIX             = @prefix@
+LIBDIR             = @libdir@
 prefix             = ${PREFIX}
 ETCDIR             = @sysconfdir@
-VARDIR             = @localstatedir@
+VARDIR             = @localstatedir@/lib
 
 DVILATEX = @DVILATEX@
 PDFLATEX = @PDFLATEX@
diff --git a/scripts/Install b/scripts/Install
index 9662fcd..d66cd1b 100644
--- a/scripts/Install
+++ b/scripts/Install
@@ -8,7 +8,8 @@ werl=$3
 etcdir=$4
 vardir=$5
 bindir=$6
-destdir=$7
+libdir=$7
+destdir=$8
 
 #bindir=`dirname $erl` ; bindir=`dirname $bindir`/lib/erlang/bin
 
@@ -20,10 +21,10 @@ v=${vardir}
 
 install -d ${destdir}${prefix}/bin
 install -d ${destdir}${prefix}/etc
-install -d ${destdir}${vardir}/log/yaws
+install -d ${destdir}/var/log/yaws
 
 cat yaws.template | \
-    ./Subst %yawsdir% ${prefix}/lib/yaws | \
+    ./Subst %yawsdir% ${libdir}/yaws | \
     ./Subst %vardir% ${vardir} | \
     ./Subst %erl% "${erl}" | \
     ./Subst %run_erl% "${bindir}/run_erl" | \
@@ -32,8 +33,8 @@ cat yaws.template | \
 
 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}${libdir}/yaws/examples/ebin
+install -d ${destdir}${libdir}/yaws/examples/include
 
 ## seems gentoo don't like to be installed in /usr/local/etc
 ## since /sbin/runscript still reads /etc/conf.d
diff --git a/scripts/Makefile b/scripts/Makefile
index 8c67ff0..9d9a33f 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -38,10 +38,10 @@ local_install:	../bin/yaws
 
 
 yaws.conf:
-	@echo PREFIX is $(PREFIX)
+	@echo LIBDIR is $(LIBDIR)
 	cat yaws.conf.template | \
-		./Subst %yawsdir% "$(PREFIX)/lib/yaws"  | \
-		./Subst %logdir% "$(PREFIX)/var/log/yaws"  | \
+		./Subst %yawsdir% "$(LIBDIR)/yaws"  | \
+		./Subst %logdir% "/var/log/yaws"  | \
 		./Subst %vardir% "$(VARDIR)"  | \
 		./Subst %host% `hostname`  | \
 		./Subst %port% 80  | \
@@ -57,7 +57,7 @@ install:	.install
 .install:
 	-rm -rf /tmp/yaws 2> /dev/null
 	sh  ./Install $(PREFIX) $(ERL) \
-		$(WERL) $(ETCDIR)/ $(VARDIR)/ $(ERLBINDIR)/ $(DESTDIR)
+		$(WERL) $(ETCDIR)/ $(VARDIR)/ $(ERLBINDIR)/ $(LIBDIR)/ $(DESTDIR)
 	@if [ -f $(DESTDIR)$(ETCDIR)/yaws/yaws.conf ]; \
 		then echo "Keeping old config file "; \
 		cp yaws.conf $(DESTDIR)$(ETCDIR)/yaws/yaws.conf.template; \
diff --git a/src/Makefile b/src/Makefile
index f208602..bd06406 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -114,15 +114,15 @@ clean:
 	rm -f $(EBIN_FILES) yaws_generated.erl charset.def mime_types.erl yaws_configure.hrl ../ebin/*.beam
 
 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)$(LIBDIR)/yaws/examples/ebin
+	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/yaws/examples/include
+	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/yaws/ebin
+	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/yaws/priv
+	$(INSTALL) -d $(DESTDIR)$/var/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 - )
+	(cd ..; tar cf - ebin ) | (cd $(DESTDIR)$(LIBDIR)/yaws; tar xf - )
+	(cd ..; tar cf - include ) | (cd $(DESTDIR)$(LIBDIR)/yaws; tar xf - )
+	(cd ..; tar cf - priv/*.xsd ) | (cd $(DESTDIR)$(LIBDIR)/yaws; tar xf - )
 	$(RM) yaws_generated.erl ../ebin/yaws_generated.beam 2>/dev/null || true
 
 docsinstall:
-- 
1.7.2.1