OK, after Wichert's comments, here is a new version of the proposed amendment to policy. Note that there is no mention of "debian/rules -q <target>" giving exit status of 2 if the target does not exist; this should really be handled as part of the question of whether debian/rules are makefiles is mandatory or not.
Also, while this does not *require* or *need* any changes to dpkg-buildpackage (and I was wrong to intially suggest it does), it would certainly be enhanced by such changes. The autobuilders, which call dpkg-buildpackage -B, would no longer need to install both the Build-Depends and Build-Depends-Indep if the package provides both build-arch and build-indep targets and dpkg-buildpackage is enhanced with the necessary simple change. That was the original intention of the Build-Depends/Build-Depends-Indep split; unfortunately this implementation aspect was overlooked. Please see the inital proposal for more details. [I changed the inconsistent use of <prgn> and <tt> in the process as well. So there are a few more lines of changes than actually relevant to this proposal. Sorry.] So this is now looking to be reseconded. --- policy.sgml.orig Thu Mar 29 11:09:27 2001 +++ policy.sgml Thu Mar 29 11:23:08 2001 @@ -1761,10 +1761,11 @@ <p> The targets which must be present are: <taglist> - <tag><tt>build</tt></tag> + <tag><tt>build</tt>, <tt>build-arch</tt> (optional), + <tt>build-indep</tt> (optional)</tag> <item> <p> - This should perform all non-interactive + The <tt>build</tt> target should perform all non-interactive configuration and compilation of the package. If a package has an interactive pre-build configuration routine, the Debianised source package should be @@ -1772,39 +1773,70 @@ built without rerunning the configuration. </p> + + <p> + A package may also provide both of the targets + <tt>build-arch</tt> and <tt>build-indep</tt>. The + <tt>build-arch</tt> target, if provided, should + perform all non-interactive configuration and + compilation required for producing all + architecture-dependant binary packages (those packages + for which the body of the <tt>Architecture</tt> field + in <tt>debian/control</tt> is not <tt>all</tt>). + Similarly, the <tt>build-indep</tt> target, if + provided, should perform all non-interactive + configuration and compilation required for producing + all architecture-independent binary packages (those + packages for which the body of the + <tt>Architecture</tt> field in <tt>debian/control</tt> + is <tt>all</tt>). The <tt>build</tt> target should + depend on those of the targets <tt>build-arch</tt> and + <tt>build-indep</tt> that are provided in the rules + file. + </p> + <p> + If one or both of the targets <tt>build-arch</tt> and + <tt>build-indep</tt> are not provided, then invoking + <tt>debian/rules</tt> with one of the not-provided + targets as arguments should produce a exit status code + of 2. Usually this is provided automatically by make + if the target is missing. + </p> + + <p> For some packages, notably ones where the same source tree is compiled in different ways to produce - two binary packages, the <prgn>build</prgn> target + two binary packages, the <tt>build</tt> target does not make much sense. For these packages it is good enough to provide two (or more) targets (<tt>build-a</tt> and <tt>build-b</tt> or whatever) for each of the ways of building the package, and a - <prgn>build</prgn> target that does nothing. The - <prgn>binary</prgn> target will have to build the + <tt>build</tt> target that does nothing. The + <tt>binary</tt> target will have to build the package in each of the possible ways and make the binary package out of each. </p> <p> - The <prgn>build</prgn> target must not do anything - that might require root privilege. + The targets <tt>build</tt>, <tt>build-arch</tt> + and <tt>build-indep</tt> target must not do + anything that might require root privilege. </p> <p> - The <prgn>build</prgn> target may need to run - <prgn>clean</prgn> first - see below. + The <tt>build</tt> target may need to run + <tt>clean</tt> first - see below. </p> <p> - When a package has a configuration routine that - takes a long time, or when the makefiles are poorly - designed, or when <prgn>build</prgn> needs to run - <prgn>clean</prgn> first, it is a good idea to - <tt>touch build</tt> when the build process is - complete. This will ensure that if <tt>debian/rules - build</tt> is run again it will not rebuild the - whole program. + When a package has a configuration routine that takes + a long time, or when the makefiles are poorly + designed, or when <tt>build</tt> needs to run + <tt>clean</tt> first, it is a good idea to <tt>touch + build</tt> when the build process is complete. This + will ensure that if <tt>debian/rules build</tt> is run + again it will not rebuild the whole program. </p> </item> @@ -1813,36 +1845,36 @@ </tag> <item> <p> - The <prgn>binary</prgn> target must be all that is + The <tt>binary</tt> target must be all that is necessary for the user to build the binary package. All these targets are required to be non-interactive. It is split into two parts: - <prgn>binary-arch</prgn> builds the packages' output + <tt>binary-arch</tt> builds the packages' output files which are specific to a particular - architecture, and <prgn>binary-indep</prgn> builds + architecture, and <tt>binary-indep</tt> builds those which are not. </p> <p> - <prgn>binary</prgn> may be (and commonly is) a target - with no commands which simply depends on - <prgn>binary-arch</prgn> and - <prgn>binary-indep</prgn>. + <tt>binary</tt> may be (and commonly is) a target with + no commands which simply depends on + <tt>binary-arch</tt> and <tt>binary-indep</tt>. </p> <p> - Both <prgn>binary-*</prgn> targets should depend on - the <prgn>build</prgn> target, above, so that the - package is built if it has not been already. It - should then create the relevant binary package(s), - using <prgn>dpkg-gencontrol</prgn> to make their - control files and <prgn>dpkg-deb</prgn> to build - them and place them in the parent of the top level - directory. + Both <tt>binary-*</tt> targets should depend on the + <tt>build</tt> target, or on the appropriate + <tt>build-arch</tt> or <tt>build-indep</tt> target, if + provided, so that the package is built if it has not + been already. It should then create the relevant + binary package(s), using <tt>dpkg-gencontrol</tt> to + make their control files and <tt>dpkg-deb</tt> to + build them and place them in the parent of the top + level directory. </p> <p> - If one of the <prgn>binary-*</prgn> targets has + If one of the <tt>binary-*</tt> targets has nothing to do (this will be always be the case if the source generates only a single binary package, whether architecture-dependent or not) it @@ -1851,7 +1883,7 @@ </p> <p> - The <prgn>binary</prgn> targets must be invoked as + The <tt>binary</tt> targets must be invoked as root. </p> </item> @@ -1861,29 +1893,29 @@ <p> This must undo any effects that the - <prgn>build</prgn> and <prgn>binary</prgn> targets + <tt>build</tt> and <tt>binary</tt> targets may have had, except that it should leave alone any output files created in the parent directory by a - run of <prgn>binary</prgn>. This target must be + run of <tt>binary</tt>. This target must be non-interactive. </p> <p> - If a <prgn>build</prgn> file is touched at the end - of the <prgn>build</prgn> target, as suggested + If a <tt>build</tt> file is touched at the end + of the <tt>build</tt> target, as suggested above, it should be removed as the first thing that - <prgn>clean</prgn> does, so that running - <prgn>build</prgn> again after an interrupted - <prgn>clean</prgn> doesn't think that everything is + <tt>clean</tt> does, so that running + <tt>build</tt> again after an interrupted + <tt>clean</tt> doesn't think that everything is already done. </p> <p> - The <prgn>clean</prgn> target may need to be - invoked as root if <prgn>binary</prgn> has been - invoked since the last <prgn>clean</prgn>, or if - <prgn>build</prgn> has been invoked as root (since - <prgn>build</prgn> may create directories, for + The <tt>clean</tt> target may need to be + invoked as root if <tt>binary</tt> has been + invoked since the last <tt>clean</tt>, or if + <tt>build</tt> has been invoked as root (since + <tt>build</tt> may create directories, for example). </p> </item> @@ -1914,8 +1946,8 @@ </taglist> <p> - The <prgn>build</prgn>, <prgn>binary</prgn> and - <prgn>clean</prgn> targets must be invoked with a current + The <tt>build</tt>, <tt>binary</tt> and + <tt>clean</tt> targets must be invoked with a current directory of the package's top-level directory. </p> @@ -3332,8 +3364,9 @@ <p> The <tt>Build-Depends</tt> and <tt>Build-Conflicts</tt> fields apply to the targets - <tt>build</tt>, <tt>binary</tt>, <tt>binary-arch</tt> - and <tt>binary-indep</tt>. + <tt>build</tt>, <tt>build-arch</tt>, + <tt>build-indep</tt>, <tt>binary</tt>, + <tt>binary-arch</tt> and <tt>binary-indep</tt>. </p> </item> <tag><tt>Build-Depends-Indep</tt>, <tt>Build-Conflicts-Indep</tt></tag> @@ -3341,7 +3374,8 @@ <p> The <tt>Build-Depends-Indep</tt> and <tt>Build-Conflicts-Indep</tt> fields apply to the - targets <tt>binary</tt> and <tt>binary-indep</tt>. + targets <tt>build</tt>, <tt>build-indep</tt>, + <tt>binary</tt> and <tt>binary-indep</tt>. </p> </item> </taglist> Julian -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Julian Gilbey, Dept of Maths, Queen Mary, Univ. of London Debian GNU/Linux Developer, see http://people.debian.org/~jdg Donate free food to the world's hungry: see http://www.thehungersite.com/