[Build-common-hackers] Bug#206941: autotools.mk and running configure twice

Nathaniel W. Turner "Nathaniel W. Turner" <nate@houseofnate.net>, 206941@bugs.debian.org
Mon, 8 Dec 2003 22:49:42 -0500


--Boundary-00=_WZU1/GP9d/Resl2
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

tags 206941 +patch
thanks

Well, perhaps my problem has a different cause than that of the submitter of 
bug 206941, but my problem is the same; configure runs twice: once before 
building (good), and then again before installing (bad).

For background, my debian/rules directly includes the following 3 cdbs files:
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/class/kde.mk

After some study, I tried using a stamp file in autotools.mk (see the attached 
patch).  This solved the problem for me.

I still don't quite understand why using configure.status as a stamp file 
didn't work though.  It seems like make was remaking that file even though it 
already existed.  (I put an "ls -l $(DEB_BUILDDIR)/config.status" as the 
first command in the target of the same name, and the file was already there 
every time).  However, $(DEB_BUILDDIR)/config.status was not in any .PHONY 
list.  Strange.  At any rate, the patch here fixes the problem for me.

Cheers,
nate

-- 
Nathaniel W. Turner
http://www.houseofnate.net/
Tel: +1 508 579 1948 (mobile)

--Boundary-00=_WZU1/GP9d/Resl2
Content-Type: text/x-diff;
  charset="us-ascii";
  name="cdbs-configure-stamp.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="cdbs-configure-stamp.diff"

diff -u3 -r /usr/share/cdbs/1.orig/class/autotools.mk /usr/share/cdbs/1/class/autotools.mk
--- /usr/share/cdbs/1.orig/class/autotools.mk	2003-10-15 23:24:55.000000000 -0400
+++ /usr/share/cdbs/1/class/autotools.mk	2003-12-08 22:03:07.000000000 -0500
@@ -34,13 +34,15 @@
 DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) make -C $(DEB_BUILDDIR)
 
 common-configure-arch common-configure-indep:: common-configure-impl
-common-configure-impl:: $(DEB_BUILDDIR)/config.status
-$(DEB_BUILDDIR)/config.status:
+common-configure-impl:: debian/stamp-autotools-configured
+debian/stamp-autotools-configured:
 	chmod a+x $(DEB_CONFIGURE_SCRIPT)
 	$(DEB_CONFIGURE_INVOKE) $(cdbs_configure_flags) $(DEB_CONFIGURE_EXTRA_FLAGS) $(DEB_CONFIGURE_USER_FLAGS)
+	touch debian/stamp-autotools-configured
 
 clean::
 	if test -f $(DEB_BUILDDIR)/config.status && grep -i -q 'Generated.*by configure.' $(DEB_BUILDDIR)/config.status; then rm -f $(DEB_BUILDDIR)/config.status; fi
 	if test -f $(DEB_BUILDDIR)/config.cache && grep -i -q 'shell.*script.*caches.*results.*configure' $(DEB_BUILDDIR)/config.cache; then rm -f $(DEB_BUILDDIR)/config.cache; fi
+	rm -f debian/stamp-autotools-configured
 
 endif

--Boundary-00=_WZU1/GP9d/Resl2--