Subject: Re: circular dependency for gcc with USE_GCC[23]
To: Gavan Fantom <gavan@coolfactor.org>
From: Stoned Elipot <seb@starfleet.univ-paris7.fr>
List: tech-pkg
Date: 08/11/2003 14:02:50
On Fri, Aug 08, 2003 at 10:14:42PM +0100, Gavan Fantom wrote:
> Does this look like a reasonable way to solve the circular dependency
> problems with gcc?

AFAICT this is not specific to gcc packages. A lot if not all pkgs
are concerned about this on solaris.

> It appears to work, in that I can now build gcc, and that doing bmake
> clean-depends-list no longer forkbombs the machine. A similar solution
> should work for the tools.mk problems, too.

It does the job that's right. But I tested only the patch line 
regarding 'CLEAN_DEPENDS_LIST_SEEN=' in bsd.pkg.mk. There is no need for
the patch on gcc.buildlink2.mk or for this -unused?- _PKGSRC_DEPS.

Anyway I propose something else, which would reduce the clutter a bit in
bsd.pkg.mk: get ride of the target 'clean-depends-list' and just use
'show-all-depends-dirs-excl' instead. 

See the attached patch.

Comments? 
If not I'll commit this after a few more hours of test.

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1234
diff -u -r1.1234 bsd.pkg.mk
--- bsd.pkg.mk	2003/08/09 10:24:54	1.1234
+++ bsd.pkg.mk	2003/08/11 12:01:44
@@ -3381,53 +3381,11 @@
 clean-depends:
 .  if defined(BUILD_DEPENDS) || defined(DEPENDS)
 	${_PKG_SILENT}${_PKG_DEBUG}					\
-	for i in `${MAKE} ${MAKEFLAGS} CLEAN_DEPENDS_LIST_TOP=YES clean-depends-list | ${SED} -e 's;\.\./[^ ]*; ;g' | ${TR} -s "[:space:]" "\n" | ${SORT} -u` ;\
+	for i in `${MAKE} ${MAKEFLAGS} show-all-depends-dirs-excl` ;\
 	do 								\
 		cd ${.CURDIR}/../../$$i &&				\
 		${MAKE} ${MAKEFLAGS} CLEANDEPENDS=NO clean;		\
 	done
-.  endif
-.endif
-
-
-# The clean-depends-list target will produce a list of all
-# BUILD_DEPENDS and DEPENDS packages.
-# As each *DEPENDS package is visited, it is added to the
-# CLEAN_DEPENDS_LIST_SEEN variable.  Once a pkg is in the list
-# it will not be visited again.  This prevents traversing the same
-# part of the dependency tree multiple times.  Each depending package
-# ends up in the list twice.  Once as the relative path from the depending
-# package and once as the path from pkgsrc.  Eg, "../../foo/bar foo/bar"
-# The "../../foo/bar" version is later removed from the list in the
-# clean-depends target.  The remaining bit of redundancy is that some
-# packages list their depends as "../bar" instead of "../../foo/bar"
-# In this case its possible for a dependency to be visited twice.
-
-.PHONY: clean-depends-list
-.if !target(clean-depends-list)
-clean-depends-list:
-.  if defined(BUILD_DEPENDS) || defined(DEPENDS)
-	@for dir in `${ECHO} ${BUILD_DEPENDS:C/^[^:]*://:C/:.*//}	\
-			${DEPENDS:C/^[^:]*://:C/:.*//} |		\
-			${TR} '\040' '\012' `; do			\
-		case "$$CLEAN_DEPENDS_LIST_SEEN" in			\
-		*" "$$dir" "*)  ;; 					\
-		*) 							\
-			CLEAN_DEPENDS_LIST_SEEN=" $$dir `cd ${.CURDIR} ; cd $$dir && ${MAKE} ${MAKEFLAGS} CLEAN_DEPENDS_LIST_SEEN="$$CLEAN_DEPENDS_LIST_SEEN" CLEAN_DEPENDS_LIST_TOP=NO clean-depends-list`";\
-			;;						\
-		esac							\
-	done ;								\
-	if [ "${CLEAN_DEPENDS_LIST_TOP}" != "YES" ]; then		\
-		${ECHO} " ${PKGPATH} $$CLEAN_DEPENDS_LIST_SEEN";	\
-	else								\
-		${ECHO} " $$CLEAN_DEPENDS_LIST_SEEN";			\
-	fi
-.  else
-	@if [ "${CLEAN_DEPENDS_LIST_TOP}" != "YES" ]; then		\
-		${ECHO} " ${PKGPATH} $$CLEAN_DEPENDS_LIST_SEEN";	\
-	else								\
-		${ECHO} " $$CLEAN_DEPENDS_LIST_SEEN";			\
-	fi
 .  endif
 .endif