🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #5

installation problems

#5
From: h.b.furuseth
Date: Tue, 27 Oct 1992 23:44
195 lines
8171 bytes
In article <9210161335.AAdurin12404@durin.uio.no>, I wrote:

> * Please do not make INSTALL targets write to the source directory.
> ...

This was meant for bug-gnu-utils - I added bug-gcc just because it
concerned gcc too.  So of course it appeared in bug-gcc and not
bug-gnu-utils:-)  Anyway, here are details for gcc-2.2.2.

target install-common-headers writes ./byteorder.h
install-float-h-cross	writes ./float.h
			(it also has an unmatched "done" statement)
install-limits-h	writes ./tmp-limits.h
(install		writes ./install -- because install.sh exists)

Fixes in 1st patch below.  Copies byteorder during 'make all', writes
the .h files in /tmp, adds .PHONY: install.  Also, because
install-fixincludes may write to . (ie after make clean), I split out
a 'run-fixincludes' target which does not copy the gcc header files.

The patch on next page is to give somewhat better control over where
things are installed.  New Makefile variables: local_include_dir and
progsuffix.  Don't know how it should be done for crosscompiler things.


Hallvard

Move writes during install to 'make all' phase or to /tmp

--- Makefile.in.orig	Sat Oct 24 17:06:57 1992
+++ Makefile.in	Tue Oct 27 11:37:00 1992
@@ -146,2 +146,4 @@
 
+tmpdir = /tmp
+
 # Additional system libraries to link with.
@@ -427,3 +429,3 @@
 # whether making a cross compiler or not.
-native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
+native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) byteorder
 
@@ -859,2 +861,10 @@
 	-rm alloca.s
+
+byteorder:
+# Copy byteorder.h into the object file directory 
+# so that fixinc.svr4 can get at it if necessary.
+# If the dirs are the same, this won't do anything.
+# Delete file first in case it is read-only
+	-[ "x$(srcdir)" = x. ] || rm -f byteorder.h
+	-cp $(srcdir)/byteorder.h . > /dev/null 2>&1
 
@@ -1225,3 +1235,3 @@
 # Delete other temporary files.
-	-rm -f tmp-float.h tmp-gcc.xtar.Z tmp-limits.h gccnew
+	-rm -f tmp-float.h tmp-gcc.xtar.Z $(tmpdir)/gcc-limits.h gccnew
 	-rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
@@ -1344,7 +1354,8 @@
 install-float-h-cross:
-	if [ -f enquire ] ; then true; else false; done
-	-./enquire -f > float.h
+	[ -f enquire ]
+	-./enquire -f > $(tmpdir)/gcc-float.h
 	-rm -f $(libsubdir)/include/float.h
-	$(INSTALL_DATA) float.h $(libsubdir)/include/float.h
+	$(INSTALL_DATA) $(tmpdir)/gcc-float.h $(libsubdir)/include/float.h
 	chmod a-x $(libsubdir)/include/float.h
+	rm $(tmpdir)/gcc-float.h
 
@@ -1455,11 +1466,11 @@
 install-limits-h: limits.h limitx.h install-dir
-	-rm -f $(libsubdir)/include/limits.h tmp-limits.h
+	-rm -f $(libsubdir)/include/limits.h $(tmpdir)/gcc-limits.h
 	if [ -f /usr/include/limits.h ] ; then \
-	  cat $(srcdir)/limitx.h $(srcdir)/limits.h > tmp-limits.h; \
+	  cat $(srcdir)/limitx.h $(srcdir)/limits.h > $(tmpdir)/gcc-limits.h; \
 	else \
-	  cat $(srcdir)/limits.h > tmp-limits.h; \
+	  cat $(srcdir)/limits.h > $(tmpdir)/gcc-limits.h; \
 	fi
-	$(INSTALL_DATA) tmp-limits.h $(libsubdir)/include/limits.h
+	$(INSTALL_DATA) $(tmpdir)/gcc-limits.h $(libsubdir)/include/limits.h
 	chmod a-x $(libsubdir)/include/limits.h
-	rm tmp-limits.h
+	rm $(tmpdir)/gcc-limits.h
 
@@ -1486,8 +1497,2 @@
 	chmod a-x $(libsubdir)/include/stddef.h
-# Copy byteorder.h into the object file directory 
-# so that fixinc.svr4 can get at it if necessary.
-# If the dirs are the same, this won't do anything.
-# Delete file first in case it is read-only
-	-if [ "$(srcdir)" != "." ]; then rm -f byteorder.h; else true; fi
-	-cp $(srcdir)/byteorder.h . > /dev/null 2>&1
 
@@ -1503,4 +1508,7 @@
 
+# Install headers from $(srcdir), and run fixincludes.
+install-fixincludes: install-headers run-fixincludes;
+
 # Run fixincludes in the proper directory.
-install-fixincludes: install-headers
+run-fixincludes: force
 	rm -rf $(libsubdir)/tmp
@@ -1725,2 +1733,3 @@
 .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
+.PHONY: install all byteorder
 

Replace $(bindir)/foo with $(bindir)/foo$(progsuffix) and
$(prefix)/include with $(local_include_dir).

--- Makefile.in.orig	Tue Oct 27 11:37:00 1992
+++ Makefile.in	Tue Oct 27 22:15:44 1992
@@ -146,2 +146,9 @@
 
+local_include_dir = $(prefix)/include
+
+# Suffix to all files installed in $(bindir).  Note that if you use
+# collect2, it may need a program named "gcc" in $(bindir) anyway, or
+# a symlink $(libsubdir)/gcc -> $(bindir)/gcc$(progsuffix).
+progsuffix =
+
 tmpdir = /tmp
@@ -1113,3 +1120,3 @@
 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
-	  -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
+	  -DLOCAL_INCLUDE_DIR=\"$(local_include_dir)\" \
 	  -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
@@ -1135,3 +1142,3 @@
           -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
-	  -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
+	  -DLOCAL_INCLUDE_DIR=\"$(local_include_dir)\" \
 	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
@@ -1143,3 +1150,3 @@
           -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
-	  -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
+	  -DLOCAL_INCLUDE_DIR=\"$(local_include_dir)\" \
 	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
@@ -1392,2 +1399,4 @@
 	done
+	-[ x"$(USE_COLLECT2)" != xld ] || [ x"$(progsuffix)" = x ] || \
+	   $(SYMLINK) $(bindir)/gcc$(progsuffix) $(libsubdir)/gcc
 	-rm -f $(libsubdir)/specs
@@ -1397,3 +1406,3 @@
 	-if [ -f gcc-cross ] ; then \
-	  $(INSTALL_PROGRAM) gcc-cross $(bindir)/gcc-$(target); \
+	  $(INSTALL_PROGRAM) gcc-cross $(bindir)/gcc$(progsuffix)-$(target); \
 	  if [ -d $(tooldir)/bin/. ] ; then \
@@ -1403,13 +1412,15 @@
 	else \
-	  rm -f $(bindir)/gcc; \
-	  $(INSTALL_PROGRAM) gcc $(bindir)/gcc; \
-	  rm -f $(bindir)/gcc-$(target)-1; \
-	  ln $(bindir)/gcc $(bindir)/gcc-$(target)-1; \
-	  mv $(bindir)/gcc-$(target)-1 $(bindir)/gcc-$(target); \
+	  rm -f $(bindir)/gcc$(progsuffix); \
+	  $(INSTALL_PROGRAM) gcc $(bindir)/gcc$(progsuffix); \
+	  rm -f $(bindir)/gcc$(progsuffix)-$(target)-1; \
+	  ln $(bindir)/gcc$(progsuffix) $(bindir)/gcc$(progsuffix)-$(target)-1; \
+	  mv $(bindir)/gcc$(progsuffix)-$(target)-1 $(bindir)/gcc$(progsuffix)-$(target); \
 	fi
-	-rm -f $(bindir)/c++
-	$(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++
-	-rm -f $(bindir)/g++
-	$(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++
-	-rm -f $(libsubdir)/cpp
+	sed -e 's%[ /]gcc%&$(progsuffix)%' < $(srcdir)/c++ > $(tmpdir)/gcc-c++
+	chmod a+x $(tmpdir)/gcc-c++
+	-rm -f $(bindir)/c++$(progsuffix)
+	$(INSTALL_PROGRAM) $(tmpdir)/gcc-c++ $(bindir)/c++$(progsuffix)
+	-rm -f $(bindir)/g++$(progsuffix)
+	$(INSTALL_PROGRAM) $(tmpdir)/gcc-c++ $(bindir)/g++$(progsuffix)
+	-rm -f $(libsubdir)/cpp $(tmpdir)/gcc-c++
 	$(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
@@ -1418,6 +1429,6 @@
 install-proto: proto install-dir
-	-rm -f $(bindir)/protoize
-	$(INSTALL_PROGRAM) protoize $(bindir)/protoize
-	-rm -f $(bindir)/unprotoize
-	$(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize
+	-rm -f $(bindir)/protoize$(progsuffix)
+	$(INSTALL_PROGRAM) protoize $(bindir)/protoize$(progsuffix)
+	-rm -f $(bindir)/unprotoize$(progsuffix)
+	$(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize$(progsuffix)
 	-rm -f $(libsubdir)/SYSCALLS.c.X
@@ -1546,5 +1557,5 @@
 	-rm -rf $(libsubdir)
-	-rm -rf $(bindir)/gcc
-	-rm -rf $(bindir)/protoize
-	-rm -rf $(bindir)/unprotoize
+	-rm -rf $(bindir)/gcc$(progsuffix)
+	-rm -rf $(bindir)/protoize$(progsuffix)
+	-rm -rf $(bindir)/unprotoize$(progsuffix)
 	-rm -rf $(mandir)/gcc$(manext)
Technical Details
Message-ID: <9210272144.AAgandalf29853@gandalf.uio.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!usit.uio.NO!h.b.furuseth
References: <9210161335.AAdurin12404@durin.uio.no>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!usit.uio.NO!h.b.furuseth
From: h.b.furuseth@usit.uio.NO
Newsgroups: gnu.gcc.bug
Subject: installation problems
Message-ID: <9210272144.AAgandalf29853@gandalf.uio.no>
Date: 27 Oct 92 23:44:28 GMT
Article-I.D.: gandalf.9210272144.AAgandalf29853
References: <9210161335.AAdurin12404@durin.uio.no>
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 195
Approved: bug-gcc@prep.ai.mit.edu