Package: debhelper
Version: 8.9.7
Severity: normal

dh's improved support for running build-arch/build-indep is good from a
least surprise POV, but it's not clear writing such targets is necessarily
the best way to handle a arch/indep source build. The problem lies not
with build, but with install.

%:
        dh $@

build-indep:
        make -C doc

install-arch:
        dh $@
        dh_auto_install

install-indep:
        dh $@
        make -C doc install DESTDIR=$(CURDIR)/debian/install

override_dh_auto_install:

The above is broken, because it does the actual installation
only after dh has run dh_install*, dh_fixperms, etc.

But, dh has to come first in the install-* targets, in order for the
build targets to be run first. Otherwise, the install-* targets would
need to explicitly depend on them.

%:
        dh $@

build-indep:
        make -C doc

install-arch: build-arch
        dh_auto_install
        dh $@

install-indep: build-indep
        make -C doc install DESTDIR=$(CURDIR)/debian/install
        dh $@

override_dh_auto_install:

Well, that works, but it's back to explicit targets. The need to
override dh_auto_install into a no-op, so that "make install"
isn't run in install-indep, and then explicitly run it in install-arch,
is also ugly and not an obvious solution.

So split install-arch/indep targets seems to only bring complexity.
An alternate way is to keep the explicit build target(s), and make
the override check what's being installed:

%:
        dh $@

build-indep:
        make -C doc

override_dh_auto_install:
ifneq (,$(shell dh_listpackages -a 2>/dev/null))
        dh_auto_install
endif
ifneq (,$(shell dh_listpackages -i 2>/dev/null))
        make -C doc install DESTDIR=$(CURDIR)/debian/install
endif

I've considered before adding a dh_do command, which allows some
simplification:

override_dh_auto_install:
        dh_do -a -- dh_auto_install
        dh_do -i -- make -C doc install DESTDIR=$(CURDIR)/debian/install

Or, override targets could get -arch and -indep variants:

override_dh_auto_install-indep:
        make -C doc install DESTDIR=$(CURDIR)/debian/install

This seems better than dh_do, since the -arch case can be left implicit
when it just needs to run dh_auto_install.

They could be used for building too, instead of specifying
the traditional build-arch/indep targets. 

%:
        dh $@

override_dh_auto_configure-indep:
        # nothing to do

override_dh_auto_build-indep:
        make -C doc

override_dh_auto_test-indep:
        # nothing to do

override_dh_auto_install-indep:
        make -C doc install DESTDIR=$(CURDIR)/debian/install/

override_dh_fixperms-arch:
        dh_fixperms
        chmod +s usr/sbin/food

While this is a more consistent style, that nicely continues through to
other arch/indep tweaks like fixperms, the need to no-op configure and
test suggests a build-indep target might be better, even if
install-indep/arch arn't.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to