Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Sep 1995 03:28:38 -0700
From:      asami@cs.berkeley.edu (Satoshi Asami)
To:        ports@freebsd.org
Subject:   dependency cleanup
Message-ID:  <199509141028.DAA26868@silvia.HIP.Berkeley.EDU>

next in thread | raw e-mail | index | archive | help
Here's the long-awaited bsd.port.mk update to handle dependencies in a
cleaner fashion.  In essense:

EXEC_DEPENDS is broken up into FETCH_DEPENDS, BUILD_DEPENDS and
RUN_DEPENDS.  They are called from within the "fetch", "extract" and
"install" targets, respectively.  (I know "install" isn't really
"running"...but if we don't call it there, the user will be greeted
with "wish: command not found" ;)

Only RUN_DEPENDS is put in the package via @pkgdep.

This change means we won't have emacs depending on gmake or "make
fetch" compiling and installing tcl/tk anymore.

If someone has a better idea on how I can clean up the definitions of
{fetch,build,run}-depends, I'm all ears.  Right now there are three
targets that are identical except for the target names and the
*_DEPENDS line, but since the latter is in the @for loop in a
subshell, I can't make it share the rest of the lines.

If nobody objects, I will put this in -current in a few days.  PLEASE
try it on your system!  Of course you'll need to change EXEC_DEPENDS
to something else...right now it will be copied to BUILD_DEPENDS and
RUN_DEPENDS as a "compatibility" measure.  USE_GMAKE is handled
correctly.

Satoshi
=======
--- bsd.port.mk.current	Thu Sep 14 02:48:01 1995
+++ bsd.port.mk	Thu Sep 14 03:12:55 1995
@@ -100,10 +100,23 @@
 #				  during a build.  User can then decide to skip this port by
 #				  setting ${BATCH}, or compiling only the interactive ports
 #				  by setting ${INTERACTIVE}.
-# EXEC_DEPENDS	- A list of "prog:dir" pairs of other ports this
-#				  package depends on.  "prog" is the name of an
-#				  executable.  make will search your $PATH for it and go
-#				  into "dir" to do a "make all install" if it's not found.
+# FETCH_DEPENDS - A list of "prog:dir" pairs of other ports this
+#				  package depends in the "fetch" stage.  "prog" is the
+#				  name of an executable.  make will search your $PATH
+#				  for it and go into "dir" to do a "make all install"
+#				  if it's not found.
+# BUILD_DEPENDS - A list of "prog:dir" pairs of other ports this
+#				  package depends to build (somewhere between the
+#				  "extract" to "build" stage).  "prog" is the name
+#				  of an executable.  make will search your $PATH for
+#				  it and go into "dir" to do a "make all install" if
+#				  it's not found.
+# RUN_DEPENDS	- A list of "prog:dir" pairs of other ports this package
+#				  depends to run.  "prog" is the name of an
+#				  executable.  make will search your $PATH for it and
+#				  go into "dir" to do a "make all install" if it's not
+#				  found.  This will be build during the "install" stage
+#				  and its name will be put into the package as well.
 # LIB_DEPENDS	- A list of "lib:dir" pairs of other ports this package
 #				  depends on.  "lib" is the name of a shared library.
 #				  make will use "ldconfig -r" to search for the
@@ -201,8 +214,13 @@
 .else
 PREFIX?=		/usr/local
 .endif
+# The following 4 lines should go away as soon as the ports are all updated
+.if defined(EXEC_DEPENDS)
+BUILD_DEPENDS+=	${EXEC_DEPENDS}
+RUN_DEPENDS+=	${EXEC_DEPENDS}
+.endif
 .if defined(USE_GMAKE)
-EXEC_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
+BUILD_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
 .endif
 
 .if exists(${PORTSDIR}/../Makefile.inc)
@@ -660,6 +678,15 @@
 ################################################################
 
 _PORT_USE: .USE
+.if make(real-fetch)
+	@${MAKE} ${.MAKEFLAGS} fetch-depends
+.endif
+.if make(real-extract)
+	@${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
+.endif
+.if make(real-install)
+	@${MAKE} ${.MAKEFLAGS} run-depends
+.endif
 .if make(real-install)
 .if !defined(NO_MTREE)
 	@if [ `id -u` = 0 ]; then \
@@ -706,7 +733,7 @@
 ################################################################
 
 .if !target(fetch)
-fetch: depends
+fetch:
 	@${MAKE} ${.MAKEFLAGS} real-fetch
 .endif
 
@@ -907,7 +934,7 @@
 
 .if !target(package-depends)
 package-depends:
-	@for i in ${EXEC_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
+	@for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
 		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
 		(cd $$dir ; ${MAKE} package-name package-depends); \
 	done
@@ -935,19 +962,81 @@
 ################################################################
 
 .if !target(depends)
-depends: exec_depends lib_depends misc_depends
+depends: fetch-depends build-depends run-depends lib-depends misc-depends
 
-exec_depends:
-.if defined(EXEC_DEPENDS)
+fetch-depends:
+.if defined(FETCH_DEPENDS)
+.if defined(NO_DEPENDS)
+# Just print out messages
+	@for i in ${FETCH_DEPENDS}; do \
+		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
+		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
+		${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
+	done
+.else
+	@for i in ${FETCH_DEPENDS}; do \
+		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
+		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
+		if which -s "$$prog"; then \
+			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
+		else \
+			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
+			${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
+			if [ ! -d "$$dir" ]; then \
+				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
+			else \
+				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
+				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
+			fi; \
+		fi; \
+	done
+.endif
+.else
+	@${DO_NADA}
+.endif
+
+build-depends:
+.if defined(BUILD_DEPENDS)
+.if defined(NO_DEPENDS)
+# Just print out messages
+	@for i in ${BUILD_DEPENDS}; do \
+		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
+		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
+		${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
+	done
+.else
+	@for i in ${BUILD_DEPENDS}; do \
+		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
+		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
+		if which -s "$$prog"; then \
+			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
+		else \
+			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
+			${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
+			if [ ! -d "$$dir" ]; then \
+				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
+			else \
+				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
+				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
+			fi; \
+		fi; \
+	done
+.endif
+.else
+	@${DO_NADA}
+.endif
+
+run-depends:
+.if defined(RUN_DEPENDS)
 .if defined(NO_DEPENDS)
 # Just print out messages
-	@for i in ${EXEC_DEPENDS}; do \
+	@for i in ${RUN_DEPENDS}; do \
 		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
 		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
 		${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
 	done
 .else
-	@for i in ${EXEC_DEPENDS}; do \
+	@for i in ${RUN_DEPENDS}; do \
 		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
 		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
 		if which -s "$$prog"; then \
@@ -968,7 +1057,7 @@
 	@${DO_NADA}
 .endif
 
-lib_depends:
+lib-depends:
 .if defined(LIB_DEPENDS)
 .if defined(NO_DEPENDS)
 # Just print out messages
@@ -999,7 +1088,7 @@
 	@${DO_NADA}
 .endif
 
-misc_depends:
+misc-depends:
 .if defined(DEPENDS)
 	@${ECHO_MSG} "===>  ${PKGNAME} depends on:  ${DEPENDS}"
 .if !defined(NO_DEPENDS)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509141028.DAA26868>