[Build-common-hackers] Bug#206941: cdbs: do we have to run configure twice?
Julian Gilbey
Julian Gilbey <jdg@polya.uklinux.net>, 206941@bugs.debian.org
Thu, 11 Dec 2003 16:25:45 +0000
I thought I'd figured out how this bug really came to be, but now I'm
not sure. Here's my thinking....
As far as I can determine, the makefiles which attempt to set
DEB_BUILDDIR are: kde.mk, buildvars.mk and tarball.mk:
buildvars.mk: sets DEB_SRCDIR ?= .
and DEB_BUILDDIR ?= $(strip $(DEB_SRCDIR))
tarball.mk: sets DEB_SRCDIR = ..... and DEB_BUILDDIR ?= $(DEB_SRCDIR)
(incidentally, tarball.mk includes buildcore.mk which
includes buildvars.mk, so has already set DEB_BUILDDIR
before it resets DEB_SRCDIR; thus this is probably
unintended)
kde.mk: sets DEB_BUILDDIR = obj-$(DEB_BUILD_GNU_TYPE)
The value of this variable is significant in autotools.mk, gnome.mk,
perlmodule.mk, ant-vars.mk and buildcore.mk.
autotools.mk: uses DEB_BUILDDIR (as an immediate variable) for
locating the config.status file
gnome.mk: cd's into DEB_BUILDDIR (as a deferred variable), so no
problem here
perlmodule.mk: tests DEB_BUILDDIR = DEB_SRCDIR (as immediate
variables)
ant-vars.mk: cd's into DEB_BUILDDIR (as a deferred variable), so no
problem here
buildcore.mk: only uses DEB_BUILDDIR in rules as a deferred variable
Note also that kde.mk and gnome.mk both begin by including autotools.mk.
So problems would seem to arise when any of the following are true:
- DEB_BUILDDIR is set in debian/rules with a value including
$(DEB_SRCDIR), and
+ tarball.mk is used *after* autotools.mk or perlmodule.mk
- kde.mk is used (it resets DEB_BUILDDIR, but only *after*
autotools.mk has been included)
(Oh, so are kde.mk and tarball.mk compatible? Maybe not.... There
should be a check for this.)
Thus the "correct" fix would appear to be:
(1) In tarball.mk, run tests like the following early on:
ifdef _cdbs_class_gnome
$(error tarball.mk must be included *before* gnome.mk in debian/rules)
endif
ifdef _cdbs_class_kde
$(error tarball.mk must be included *before* kde.mk in debian/rules)
endif
ifdef _cdbs_class_autotools
$(error tarball.mk must be included *before* autotools.mk in debian/rules)
endif
ifdef _cdbs_class_perlmodule
$(error perlmodule.mk must be included *before* autotools.mk in debian/rules)
endif
(2) In kde.mk, apply the following (untested) patch:
--- kde.mk.orig 2003-12-11 16:21:21.000000000 +0000
+++ kde.mk 2003-12-11 16:24:00.000000000 +0000
@@ -27,6 +27,10 @@
ifndef _cdbs_class_kde
_cdbs_class_kde := 1
+include $(_cdbs_class_path)/buildcore.mk$(_cdbs_makefile_suffix)
+
+DEB_BUILDDIR = obj-$(DEB_BUILD_GNU_TYPE)
+
include $(_cdbs_class_path)/autotools.mk$(_cdbs_makefile_suffix)
export kde_cgidir = /usr/lib/cgi-bin
@@ -44,7 +48,6 @@
cdbs_configure_flags += --with-qt-dir=/usr/share/qt3 --disable-rpath --with-xinerama $(cdbs_kde_enable_final) $(cdbs_kde_enable_debug)
DEB_AC_AUX_DIR = $(DEB_SRCDIR)/admin
-DEB_BUILDDIR = obj-$(DEB_BUILD_GNU_TYPE)
DEB_CONFIGURE_INCLUDEDIR = "\$${prefix}/include/kde"
DEB_COMPRESS_EXCLUDE := .dcl .docbook -license
Julian
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey, website: http://www.polya.uklinux.net/
Debian GNU/Linux Developer, see: http://people.debian.org/~jdg/
Visit http://www.thehungersite.com/ to help feed the hungry