install root patch

Archie Cobbs archie at whistle.com
Tue Jul 21 12:46:42 PDT 1998


Below is a patch that allows you to change kaffe's "make install" 
installation root directory.

This simply prefixes all install target directories with a variable
INSTROOT, which by default is the empty string. So you could, e.g.,
install into /tmp/usr/local while still "targeting" /usr/local.

Before you couldn't do this because the normal prefix (eg, /usr/local)
gets embedded in libkaffevm.so and other installed files.

This is useful if you're building kaffe on one machine, but targeting
for another machine.

A couple of notes:

 o Since configure is generated from configure.in, the patch to configure
   is not included below (you must regenerate configure using "autoconf";
   if anyone wants it, email me).

 o Ideally, configure would take a command line argument, something
   like --install-root=DIRECTORY. Since I couldn't figure out how to
   do this easily without modifying the autoconf m4 macros, instead
   INSTROOT is just read from the environment variable DESTDIR.

 o These patches are 100% backward compatible, ie., if DESTDIR is
   not set (or empty) then everything works as before.

Tim et.al.: would it be possible to add this to kaffe? However you
want INSTROOT set is fine with me... surely there's a better way
than reading from an environment variable (the Makefile.in
patches should be OK even if this decision is delayed).

Thanks,
-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

Index: configure.in
===================================================================
RCS file: /cvs/mod/net/kaffe/configure.in,v
retrieving revision 1.1.1.6.2.2
diff -c -u -r1.1.1.6.2.2 configure.in
--- configure.in	1998/07/20 23:50:09	1.1.1.6.2.2
+++ configure.in	1998/07/21 19:33:27
@@ -221,6 +221,12 @@
 fi
 
 dnl =========================================================================
+dnl Use DESTDIR environment variable to set the root of all installs
+dnl -------------------------------------------------------------------------
+
+INSTROOT="$DESTDIR"
+
+dnl =========================================================================
 
 dnl =========================================================================
 dnl Setup for generating a depend make target
@@ -281,6 +287,7 @@
 	KPREFIX=$program_prefix
 fi
 AC_SUBST(KPREFIX)
+AC_SUBST(INSTROOT)
 
 dnl =========================================================================
 
Index: include/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/include/Makefile.in,v
retrieving revision 1.1.1.3.2.2
diff -c -u -r1.1.1.3.2.2 Makefile.in
--- Makefile.in	1998/07/20 23:50:13	1.1.1.3.2.2
+++ Makefile.in	1998/07/21 19:33:28
@@ -9,6 +9,7 @@
 prefix=		@prefix@
 srcdir=		@srcdir@
 incdir=		@includedir@/kaffe
+INSTROOT=	@INSTROOT@
 INSTALL=	@INSTALL@
 INSTALL_DATA=	@INSTALL_DATA@
 MKDIR=		@MKDIR@
@@ -38,14 +39,14 @@
 		rm -f Makefile $(BUILT_INCLUDEFILES) .depend
 
 install:
-		test -d $(incdir) || $(MKDIR) $(incdir)
+		test -d $(INSTROOT)$(incdir) || $(MKDIR) $(INSTROOT)$(incdir)
 		for i in $(BUILT_INCLUDEFILES) ;\
 		do \
-			$(INSTALL_DATA) $$i $(incdir)/$$i ;\
+			$(INSTALL_DATA) $$i $(INSTROOT)$(incdir)/$$i ;\
 		done
 		for i in $(INCLUDEFILES) ;\
 		do \
-			$(INSTALL_DATA) $(srcdir)/$$i $(incdir)/$$i ;\
+			$(INSTALL_DATA) $(srcdir)/$$i $(INSTROOT)$(incdir)/$$i ;\
 		done
 
 depend:
Index: kaffe/kaffe/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/kaffe/kaffe/Makefile.in,v
retrieving revision 1.1.1.3.2.1
diff -c -u -r1.1.1.3.2.1 Makefile.in
--- Makefile.in	1998/07/16 19:42:13	1.1.1.3.2.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -12,6 +12,7 @@
 exec_prefix=	@exec_prefix@
 bindir=		@bindir@
 libdir=         @libdir@
+INSTROOT=	@INSTROOT@
 INSTALL=	@INSTALL@
 INSTALL_PROGRAM=@INSTALL_PROGRAM@
 MKDIR=		@MKDIR@
@@ -45,8 +46,8 @@
 		rm -f .depend
 
 install:
-		test -d $(bindir) || $(MKDIR) $(bindir)
-		$(INSTALL_PROGRAM) Kaffe$(EXEEXT) $(bindir)/Kaffe$(EXEEXT)
+		test -d $(INSTROOT)$(bindir) || $(MKDIR) $(INSTROOT)$(bindir)
+		$(INSTALL_PROGRAM) Kaffe$(EXEEXT) $(INSTROOT)$(bindir)/Kaffe$(EXEEXT)
 
 .SUFFIXES:	.d
 
Index: kaffe/kaffeh/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/kaffe/kaffeh/Makefile.in,v
retrieving revision 1.1.1.2
diff -c -u -r1.1.1.2 Makefile.in
--- Makefile.in	1998/07/10 23:00:22	1.1.1.2
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 bindir=		@bindir@
+INSTROOT=	@INSTROOT@
 INSTALL=	@INSTALL@
 INSTALL_PROGRAM=@INSTALL_PROGRAM@
 MKDIR=		@MKDIR@
@@ -84,8 +85,8 @@
 		rm -f Makefile
 
 install:
-		test -d $(bindir) || $(MKDIR) $(bindir)
-		$(INSTALL_PROGRAM) $(KPREFIX)kaffeh$(EXEEXT) $(bindir)/$(KPREFIX)kaffeh$(EXEEXT)
+		test -d $(INSTROOT)$(bindir) || $(MKDIR) $(INSTROOT)$(bindir)
+		$(INSTALL_PROGRAM) $(KPREFIX)kaffeh$(EXEEXT) $(INSTROOT)$(bindir)/$(KPREFIX)kaffeh$(EXEEXT)
 
 @INC_DEPEND@
 
Index: kaffe/kaffevm/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/kaffe/kaffevm/Makefile.in,v
retrieving revision 1.1.1.2.4.1
diff -c -u -r1.1.1.2.4.1 Makefile.in
--- Makefile.in	1998/07/16 19:42:13	1.1.1.2.4.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 libdir=		@libdir@
+INSTROOT=	@INSTROOT@
 INSTALL=	@INSTALL@
 INSTALL_DATA=	@INSTALL_DATA@
 MKDIR=		@MKDIR@
@@ -106,10 +107,10 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(libdir) || $(MKDIR) $(libdir)
-		$(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
-		rm -f $(libdir)/$(LLIB)
-		$(LN) $(LIB) $(libdir)/$(LLIB)
+		test -d $(INSTROOT)$(libdir) || $(MKDIR) $(INSTROOT)$(libdir)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(libdir)/$(LIB)
+		rm -f $(INSTROOT)$(libdir)/$(LLIB)
+		$(LN) $(LIB) $(INSTROOT)$(libdir)/$(LLIB)
 
 depend:         $(DEPENDS)
 		rm -f .depend
Index: kaffe/man/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/kaffe/man/Makefile.in,v
retrieving revision 1.1.1.2
diff -c -u -r1.1.1.2 Makefile.in
--- Makefile.in	1998/07/10 23:00:55	1.1.1.2
+++ Makefile.in	1998/07/21 19:33:28
@@ -9,6 +9,7 @@
 prefix=		@prefix@
 srcdir=		@srcdir@
 mandir=		@mandir@
+INSTROOT=	@INSTROOT@
 INSTALL=	@INSTALL@
 INSTALL_DATA=	${INSTALL} -m 644
 MKDIR=		@MKDIR@
@@ -21,9 +22,9 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(mandir) || $(MKDIR) $(mandir)
-		test -d $(mandir)/man1 || $(MKDIR) $(mandir)/man1
-		$(INSTALL_DATA) $(srcdir)/kaffe.1 $(mandir)/man1/kaffe.1
+		test -d $(INSTROOT)$(mandir) || $(MKDIR) $(INSTROOT)$(mandir)
+		test -d $(INSTROOT)$(mandir)/man1 || $(MKDIR) $(INSTROOT)$(mandir)/man1
+		$(INSTALL_DATA) $(srcdir)/kaffe.1 $(INSTROOT)$(mandir)/man1/kaffe.1
 
 depend:
 
Index: kaffe/scripts/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/kaffe/scripts/Makefile.in,v
retrieving revision 1.1.1.3.2.1
diff -c -u -r1.1.1.3.2.1 Makefile.in
--- Makefile.in	1998/07/16 19:42:13	1.1.1.3.2.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -10,6 +10,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 bindir=		@bindir@
+INSTROOT=	@INSTROOT@
 INSTALL=	@INSTALL@
 INSTALL_SCRIPT=	@INSTALL_SCRIPT@
 MKDIR=		@MKDIR@
@@ -38,28 +39,28 @@
 install:	install-pizza install-sun install-jars @suncompatible@
 
 install-sun:
-		test -d $(bindir) || $(MKDIR) $(bindir)
+		test -d $(INSTROOT)$(bindir) || $(MKDIR) $(INSTROOT)$(bindir)
 		for i in $(SCRIPTFILES_SUN) ;\
 		do \
-			$(INSTALL_SCRIPT) $(srcdir)/$(SCREXT)/$$i $(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
+			$(INSTALL_SCRIPT) $(srcdir)/$(SCREXT)/$$i $(INSTROOT)$(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
 		done
 
 install-pizza:
 		for i in $(SCRIPTFILES_PIZZA) ;\
 		do \
-			$(INSTALL_SCRIPT) $(srcdir)/$(SCREXT)/$$i $(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
+			$(INSTALL_SCRIPT) $(srcdir)/$(SCREXT)/$$i $(INSTROOT)$(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
 		done
 
 install-compat:
 		for i in $(SCRIPTFILES_COMPAT) ;\
 		do \
-			$(INSTALL_SCRIPT) $(srcdir)/compat/$$i $(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
+			$(INSTALL_SCRIPT) $(srcdir)/compat/$$i $(INSTROOT)$(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
 		done
 
 install-jars:
 		for i in $(PSCRIPTFILES) ;\
 		do \
-			$(INSTALL_SCRIPT) $$i $(bindir)/$(KPREFIX)$$i ;\
+			$(INSTALL_SCRIPT) $$i $(INSTROOT)$(bindir)/$(KPREFIX)$$i ;\
 		done
 
 depend:
Index: libraries/clib/awt/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/clib/awt/Makefile.in,v
retrieving revision 1.1.1.1.2.2
diff -c -u -r1.1.1.1.2.2 Makefile.in
--- Makefile.in	1998/07/16 19:42:13	1.1.1.1.2.2
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 nativedir=	@libdir@
+INSTROOT=	@INSTROOT@
 CC=		@CC@
 LD=		@LD@
 AR=		@AR@
@@ -85,10 +86,10 @@
 		rmdir X
 
 install:
-		test -d $(nativedir) || $(MKDIR) $(nativedir)
-		rm -f $(nativedir)/$(LIB) $(nativedir)/$(LIBV)
-		$(INSTALL_DATA) $(LIB) $(nativedir)/$(LIBV)
-		$(LN) $(LIBV) $(nativedir)/$(LIB)
+		test -d $(INSTROOT)$(nativedir) || $(MKDIR) $(INSTROOT)$(nativedir)
+		rm -f $(INSTROOT)$(nativedir)/$(LIB) $(INSTROOT)$(nativedir)/$(LIBV)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(nativedir)/$(LIBV)
+		$(LN) $(LIBV) $(INSTROOT)$(nativedir)/$(LIB)
 
 depend:         .dir-stamp external_wrappers.h $(DEPENDS)
 		rm -f .depend
Index: libraries/clib/management/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/clib/management/Makefile.in,v
retrieving revision 1.1.1.1.2.2
diff -c -u -r1.1.1.1.2.2 Makefile.in
--- Makefile.in	1998/07/16 19:42:14	1.1.1.1.2.2
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 nativedir=	@libdir@
+INSTROOT=	@INSTROOT@
 CC=		@CC@
 LD=		@LD@
 AR=		@AR@
@@ -72,10 +73,10 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(nativedir) || $(MKDIR) $(nativedir)
-		rm -f $(nativedir)/$(LIB) $(nativedir)/$(LIBV)
-		$(INSTALL_DATA) $(LIB) $(nativedir)/$(LIBV)
-		$(LN) $(LIBV) $(nativedir)/$(LIB)
+		test -d $(INSTROOT)$(nativedir) || $(MKDIR) $(INSTROOT)$(nativedir)
+		rm -f $(INSTROOT)$(nativedir)/$(LIB) $(INSTROOT)$(nativedir)/$(LIBV)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(nativedir)/$(LIBV)
+		$(LN) $(LIBV) $(INSTROOT)$(nativedir)/$(LIB)
 
 depend:         $(DEPENDS) external_wrappers.h
 		rm -f .depend
Index: libraries/clib/math/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/clib/math/Makefile.in,v
retrieving revision 1.1.1.1.4.1
diff -c -u -r1.1.1.1.4.1 Makefile.in
--- Makefile.in	1998/07/16 19:42:14	1.1.1.1.4.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 libdir=		@libdir@
+INSTROOT=	@INSTROOT@
 CC=		@CC@
 LD=		@LD@
 AR=		@AR@
@@ -75,10 +76,10 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(libdir) || $(MKDIR) $(libdir)
-		$(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
-		rm -f $(libdir)/$(LLIB)
-		$(LN) $(LIB) $(libdir)/$(LLIB)
+		test -d $(INSTROOT)$(libdir) || $(MKDIR) $(INSTROOT)$(libdir)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(libdir)/$(LIB)
+		rm -f $(INSTROOT)$(libdir)/$(LLIB)
+		$(LN) $(LIB) $(INSTROOT)$(libdir)/$(LLIB)
 
 depend:         $(DEPENDS)
 		rm -f .depend
Index: libraries/clib/native/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/clib/native/Makefile.in,v
retrieving revision 1.1.1.2.2.1
diff -c -u -r1.1.1.2.2.1 Makefile.in
--- Makefile.in	1998/07/16 19:42:15	1.1.1.2.2.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 libdir=		@libdir@
+INSTROOT=	@INSTROOT@
 CC=		@CC@
 LD=		@LD@
 AR=		@AR@
@@ -117,10 +118,10 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(libdir) || $(MKDIR) $(libdir)
-		$(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
-		rm -f $(libdir)/$(LLIB)
-		$(LN) $(LIB) $(libdir)/$(LLIB)
+		test -d $(INSTROOT)$(libdir) || $(MKDIR) $(INSTROOT)$(libdir)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(libdir)/$(LIB)
+		rm -f $(INSTROOT)$(libdir)/$(LLIB)
+		$(LN) $(LIB) $(INSTROOT)$(libdir)/$(LLIB)
 
 depend:		$(DEPENDS)
 		rm -f .depend
Index: libraries/clib/net/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/clib/net/Makefile.in,v
retrieving revision 1.1.1.1
diff -c -u -r1.1.1.1 Makefile.in
--- Makefile.in	1998/07/10 23:01:01	1.1.1.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 libdir=		@libdir@
+INSTROOT=	@INSTROOT@
 CC=		@CC@
 LD=		@LD@
 AR=		@AR@
@@ -78,10 +79,10 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(libdir) || $(MKDIR) $(libdir)
-		$(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
-		rm -f $(libdir)/$(LLIB)
-		$(LN) $(LIB) $(libdir)/$(LLIB)
+		test -d $(INSTROOT)$(libdir) || $(MKDIR) $(INSTROOT)$(libdir)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(libdir)/$(LIB)
+		rm -f $(INSTROOT)$(libdir)/$(LLIB)
+		$(LN) $(LIB) $(INSTROOT)$(libdir)/$(LLIB)
 
 depend:         $(DEPENDS)
 		rm -f .depend
Index: libraries/clib/zip/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/clib/zip/Makefile.in,v
retrieving revision 1.1.1.1.4.1
diff -c -u -r1.1.1.1.4.1 Makefile.in
--- Makefile.in	1998/07/16 19:42:15	1.1.1.1.4.1
+++ Makefile.in	1998/07/21 19:33:28
@@ -11,6 +11,7 @@
 prefix=		@prefix@
 exec_prefix=	@exec_prefix@
 libdir=		@libdir@
+INSTROOT=	@INSTROOT@
 CC=		@CC@
 LD=		@LD@
 AR=		@AR@
@@ -78,10 +79,10 @@
 		rm -f Makefile .depend
 
 install:
-		test -d $(libdir) || $(MKDIR) $(libdir)
-		$(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
-		rm -f $(libdir)/$(LLIB)
-		$(LN) $(LIB) $(libdir)/$(LLIB)
+		test -d $(INSTROOT)$(libdir) || $(MKDIR) $(INSTROOT)$(libdir)
+		$(INSTALL_DATA) $(LIB) $(INSTROOT)$(libdir)/$(LIB)
+		rm -f $(INSTROOT)$(libdir)/$(LLIB)
+		$(LN) $(LIB) $(INSTROOT)$(libdir)/$(LLIB)
 
 depend:         $(DEPENDS)
 		rm -f .depend
Index: libraries/javalib/Makefile.in
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/javalib/Makefile.in,v
retrieving revision 1.1.1.2.2.2
diff -c -u -r1.1.1.2.2.2 Makefile.in
--- Makefile.in	1998/07/16 19:42:15	1.1.1.2.2.2
+++ Makefile.in	1998/07/21 19:33:28
@@ -13,6 +13,7 @@
 srcdir=         @srcdir@
 prefix=		@prefix@
 classdir=	@datadir@/kaffe
+INSTROOT=	@INSTROOT@
 
 INSTALL=        @INSTALL@
 INSTALL_DATA=	@INSTALL_DATA@
@@ -30,10 +31,10 @@
 all:
 
 install:
-		test -d $(classdir) || $(MKDIR) $(classdir)
+		test -d $(INSTROOT)$(classdir) || $(MKDIR) $(INSTROOT)$(classdir)
 		for i in $(JARS) ;\
 		do \
-			if test -f $(srcdir)/$$i ; then $(INSTALL_DATA) $(srcdir)/$$i $(classdir)/$$i ; fi ;\
+			if test -f $(srcdir)/$$i ; then $(INSTALL_DATA) $(srcdir)/$$i $(INSTROOT)$(classdir)/$$i ; fi ;\
 		done
 
 clean:
@@ -55,8 +56,8 @@
 		(cd $(LIBDIR) && $(ZIP) -r ../$(CLASSFILE) java kaffe)
 
 install-classes:
-		test -d $(classdir) || $(MKDIR) $(classdir)
-		$(INSTALL_DATA) $(CLASSFILE) $(classdir)/$(CLASSFILE)
+		test -d $(INSTROOT)$(classdir) || $(MKDIR) $(INSTROOT)$(classdir)
+		$(INSTALL_DATA) $(CLASSFILE) $(INSTROOT)$(classdir)/$(CLASSFILE)
 
 # not yet implemented, but must stay to not break make depend
 depend:


More information about the kaffe mailing list