[Build-common-hackers] Bug#202385: Configuration variable to load modules instead of using include
Chris Halls
Chris Halls <halls@debian.org>, 202385@bugs.debian.org
Sat, 19 Jul 2003 17:38:00 +0200
Package: cdbs
Version: 0.4.4
Severity: wishlist
First of all, cdbs is really cool, thanks for making it :)
I have a suggestion for the way classes/modules are included. Instead
of including the modules for every file, define a variable similar to
DEB_BUILD_OPTIONS that contains the list of modules to load, and then
use a single include line:
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
becomes for example:
CDBS_MODULES=debhelper,autotools,simple-patchsys
include /usr/share/cdbs/1/rules/buildcore.mk
And in buildcore, or even another file if you prefer, you create stanzas
such as:
ifneq (,$(findstring debhelper,$(CDBS_MODULES)))
include $(_cdbs_rules_path)/debhelper.mk
endif
ifneq (,$(findstring autotools,$(CDBS_MODULES)))
include $(_cdbs_class_path)/autotools.mk
endif
ifneq (,$(findstring debhelper,$(CDBS_MODULES)))
include $(_cdbs_rules_path)/simple-patchsys.mk
endif
This should make it easier to write rules files (if cdbs didn't make it
easy enough already :), and I think will prevent some potential
problems:
* Because you get to decide in which order the files are included, you
prevent users from forgetting to do this:
Incidentally, you should usually include debhelper.mk first, before
other rules. This will turn on optional Debhelper-using parts of
other rules, if any, which is usually what you want. (README.gz)
So future changes of such requirements can be implemented more
transparently to the users, because the complete list of modules is
available from the start.
* The version-specific subdirectory is only declared once in the user
rules file, so you can't get inconsistencies like this:
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/2/class/autotools.mk
Chris