[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

REORDER_DEPENDENCIES framework



This is a cleaner way to solve the infamous automake rebuilds everything
in the wrong order problem.

Specifically, instead of specifying an *order* for touching files, it
actually specifies *dependencies*, so this makes a database you can add to,
and possibly split when we find projects that disagree (which will happen
any time now, knowing how well the gnu auto-bullshit works).

Comments on the syntax welcome.

Tests wanted. I have tried it on a few samples, but this hasn't gone
through a full ports build yet.

Two patches, one for the ports, one for the docs.

Index: bsd.port.mk
===================================================================
RCS file: /spare/mirrors/openbsd/cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.616
diff -u -p -u -r1.616 bsd.port.mk
--- bsd.port.mk	1 Jun 2004 21:06:29 -0000	1.616
+++ bsd.port.mk	4 Jun 2004 09:45:32 -0000
@@ -1105,6 +1105,7 @@ _LIB_DEP2= ${LIB_DEPENDS}
 
 README_NAME?=	${TEMPLATES}/README.port
 
+POST_PATCH_REORDER_DEPENDENCIES?=
 ###
 ### end of variable setup. Only targets now
 ###
@@ -1638,6 +1639,22 @@ ${_PATCH_COOKIE}: ${_EXTRACT_COOKIE}
 	@${MOD${_m:U}_post-patch}
 .  endif
 .endfor
+.if !empty(POST_PATCH_REORDER_DEPENDENCIES)
+	sed -e '/^#/d' ${POST_PATCH_REORDER_DEPENDENCIES} | \
+	  tsort -r|while read f; do \
+	    cd ${WRKSRC}; \
+		case $$f in \
+		/*) \
+			find . -name $${f#/} -print| while read i; \
+				do echo "Touching $$i"; touch $$i; done \
+			;; \
+		*) \
+			if test -e $$f ; then \
+				echo "Touching $$f"; touch $$f; \
+			fi \
+			;; \
+		esac; done
+.endif
 .if ${PATCH_CHECK_ONLY:L} != "yes"
 	@${_MAKE_COOKIE} $@
 .endif
Index: gnu.port.mk
===================================================================
RCS file: /spare/mirrors/openbsd/cvs/ports/infrastructure/mk/gnu.port.mk,v
retrieving revision 1.18
diff -u -p -u -r1.18 gnu.port.mk
--- gnu.port.mk	5 May 2004 11:17:22 -0000	1.18
+++ gnu.port.mk	4 Jun 2004 09:42:48 -0000
@@ -59,11 +59,6 @@ CONFIGURE_ARGS+=	--sysconfdir='${SYSCONF
 
 REGRESS_TARGET?=	check
 
-# Files to touch in order...
-MODGNU_AUTOCONF_FILES?= /Makefile.am configure.files configure.in configure.ac \
-	acinclude.m4 aclocal.m4 acconfig.h stamp-h.in \
-	config.h.in /Makefile.in configure
-
 # internal stuff to run on each directory.
 MODGNU_post-patch= for d in ${AUTOCONF_DIR}; do cd $$d; ${_MODGNU_loop} done;
 _MODGNU_loop=
@@ -82,18 +77,7 @@ _MODGNU_loop+= echo "Running autoheader-
 _MODGNU_loop+= ${_SYSTRACE_CMD} ${SETENV} ${AUTOCONF_ENV} ${AUTOHEADER};
 .    endif
 .    if !${CONFIGURE_STYLE:L:Mautomake}
-_MODGNU_loop+= for f in ${MODGNU_AUTOCONF_FILES}; do \
-		case $$f in \
-		/*) \
-			find . -name $${f\#/} -print| while read i; \
-				do echo "Touching $$i"; touch $$i; done \
-			;; \
-		*) \
-			if test -e $$f ; then \
-				echo "Touching $$f"; touch $$f; \
-			fi \
-			;; \
-		esac; done; 
+POST_PATCH_REORDER_DEPENDENCIES+=${PORTSDIR}/infrastructure/mk/automake.dep
 .    endif
 .  endif
 .  endif
Index: automake.dep
===================================================================
RCS file: automake.dep
diff -N automake.dep
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ automake.dep	11 May 2004 09:06:17 -0000
@@ -0,0 +1,31 @@
+# $OpenBSD$
+configure configure.ac
+configure configure.in
+/Makefile.in /Makefile.am
+/Makefile.in configure.in
+/Makefile.in configure.ac
+/Makefile.in aclocal.m4
+aclocal.m4 configure.in
+aclocal.m4 configure.ac
+aclocal.m4 acinclude.m4
+config.h.in configure.in
+config.h.in configure.ac
+config.h.in aclocal.m4
+configure configure.in
+configure configure.ac
+configure aclocal.m4
+stamp-h.in configure.in
+stamp-h.in configure.ac
+stamp-h.in aclocal.m4
+stamp-h.in acconfig.h
+# kde files
+acinclude.m4 admin/cvs.sh
+configure.in admin/cvs.sh
+/Makefile.am admin/cvs.sh
+subdirs admin/cvs.sh
+/Makefile.am subdirs
+configure.files subdirs
+configure.in configure.files
+acinclude.m4 admin/libtool.m4.in
+acinclude.m4 admin/acinclude.m4.in
+acinclude.m4 libltdl/ltdl.m4





Second patch follows:

Index: bsd.port.mk.5
===================================================================
RCS file: /spare/mirrors/openbsd/cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.135
diff -u -p -u -r1.135 bsd.port.mk.5
--- bsd.port.mk.5	16 May 2004 23:14:55 -0000	1.135
+++ bsd.port.mk.5	4 Jun 2004 09:55:59 -0000
@@ -360,6 +360,11 @@ exists, the files described under
 .Ev PATCH_LIST
 will be applied under
 .Ev WRKDIST .
+See also
+.Ev REORDER_DEPENDENCIES
+for possible
+.Ar post-patch
+clean-up.
 .It Ar readmes
 Create an html description of packages, including comments, description,
 and dependencies.
@@ -1340,6 +1345,22 @@ which default to
 and
 .Sq check
 respectively.
+.It Ev REORDER_DEPENDENCIES
+Points to a list of files that specify inter-dependencies for
+.Xr make 1 .
+If defined, each line of the file is either a comment (starting with #)
+or a pair of two files: most_recent older.
+At the end of
+.Ar post-patch ,
+.Xr touch 1
+will be used to ensure those files are put in the proper order.
+The files are assumed to be under
+.Pa ${WRKSRC} .
+The notation /file can be used to ask for a recursive search, e.g.,
+to make sure that all Makefile.in  are up-to-date.
+See
+.Pa ${PORTSDIR}/infrastructure/mk/automake.dep
+for an example.
 .It Ev RUN_DEPENDS
 Specification of ports this port needs installed to be functional.
 Same format as BUILD_DEPENDS.