Subject: Re: lang/gcc on Solaris8/zoularis
To: Matthias Scheler <tron@zhadum.de>
From: Stoned Elipot <Stoned.Elipot@script.jussieu.fr>
List: tech-pkg
Date: 09/07/2001 15:50:28
On Fri, 7 Sep 2001 07:21:28 +0000 (UTC)  Matthias Scheler wrote:
> In article <200109061317.f86DHwA08161@bandsept.script.jussieu.fr>,
> 	Stoned Elipot <Stoned.Elipot@script.jussieu.fr> writes:
> > Is current lang/gcc pkg supposed to compile on Solaris8/Zoularis-20010704 ?
> 
> It worked a few month ago but it was broken the last time I tried it. I
> have no idea yet how it got broken. If anybody has patches to make it
> work again please send PR them.

ok I think I have the explanation for this and a fix but as I'm not a gcc
expert before submitting a PR I would like to have your opinion...

A couple of weeks ago ZOULARISBASE was modified to be LOCALBASE on fresh
system - aka without existing pkgs installed. so now in $LOCALBASE/include
we have the installed/fixed include of zoularis.
GCC's ccp gets compiled with a LOCAL_INCLUDE_DIR in its search path list,
of course in pkgsrc land this is $LOCALBASE/include. Now whatever
gets compiled with pkg's gcc (and that's also libgcc with xgcc during gcc
build) have this directory "at hands". Unfortunately llibgcc.a build fails
againt the zoularis installed/fixed include installed there and hiding the
system ones. 

I get around this by removing '-DLOCAL_INCLUDE_DIR=\"$(includedir)\"'
from the compilation command of cppinit.o in gcc-2.95.2/gcc/Makefile.in.
I made this removal conditionnal to the pkg being built on SunOS or not.

But I'm not really sure if it would be the way to go.
GCC's cpp's LOCAL_INCLUDE_DIR is only intended to help gcc's user
with locally installed include files so I guess it's not big harm to
remove it from the include search list ?

The patch is short so I guess I can include it here...

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc/Makefile,v
retrieving revision 1.27
diff -u -r1.27 Makefile
--- Makefile	2001/06/11 17:21:56	1.27
+++ Makefile	2001/09/07 13:47:59
@@ -62,8 +62,20 @@
 	${MKDIR} ${WRKSRC}
 	${CP} ${FILESDIR}/netbsd*.ml ${WRKSRC}/../${DISTNAME}/libstdc++/config
 
+.if (${OPSYS} != SunOS)
 post-patch:
 	${ECHO} "bogus" >${WRKSRC}/../${DISTNAME}/gcc/cstamp-h.in
+	${SED} -e 's|^@LOCAL_INCLUDE_DIR@|      -DLOCAL_INCLUDE_DIR=\\"$$(includedir)\\"        \\|'                                            \
+		< ${WRKSRC}/../${DISTNAME}/gcc/Makefile.in      \
+		> ${WRKSRC}/../${DISTNAME}/gcc/Makefile.in.temp
+.else
+post-patch:
+	${ECHO} "bogus" >${WRKSRC}/../${DISTNAME}/gcc/cstamp-h.in
+	${SED} -e '/^@LOCAL_INCLUDE_DIR@/d'                     \
+		< ${WRKSRC}/../${DISTNAME}/gcc/Makefile.in      \
+		> ${WRKSRC}/../${DISTNAME}/gcc/Makefile.in.temp
+	${MV} ${WRKSRC}/../${DISTNAME}/gcc/Makefile.in.temp ${WRKSRC}/../${DISTNAME}/gcc/Makefile.in
+.endif
 
 .if (${OPSYS} != SunOS)
 post-build:

And here is a new pkg patch-file:
--- ../gcc-2.95.2/gcc/Makefile.in.orig	Fri Aug 13 09:46:55 1999
+++ ../gcc-2.95.2/gcc/Makefile.in
@@ -1971,7 +1971,7 @@
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
+@LOCAL_INCLUDE_DIR@
 	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
 	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
 	  -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`