NAME

dh - debhelper command sequencer

SYNOPSIS

dh sequence [--until cmd] [--before cmd] [--after cmd] [--remaining] [--with addon] [debhelper options]

DESCRIPTION

dh runs a sequence of debhelper commands. The supported sequences correspond to the targets of a debian/rules file: "build", "clean", "install", "binary-arch", "binary-indep", and "binary".

Commands in the binary-indep sequence are passed the "-i" option to ensure they only work on binary independent packages, and commands in the binary-arch sequences are passed the "-a" option to ensure they only work on architecture dependent packages.

Each debhelper command will record when it's successfully run in debian/package.debhelper.log. (Which dh_clean deletes.) So dh can tell which commands have already been run, for which packages, and skip running those commands again.

Each time dh is run, it examines the log, and finds the last logged command that is in the specified sequence. It then continues with the next command in the sequence. The --until, --before, --after, and --remaining options can override this behavior.

OPTIONS

--until cmd
Run commands in the sequence until and including cmd, then stop.
--before cmd
Run commands in the sequence before cmd, then stop.
--after cmd
Run commands in the sequence that come after cmd.
--remaining
Run all commands in the sequence that have yet to be run.
--with addon
Add the debhelper commands specified by the given addon to appropriate places in the sequence of commands that is run. This option can be repeated more than once, and is used when there is a third-party package that provides debhelper commands. See "SEQUENCE ADDONS" below for documentation about what such packages should do to be supported by --with.

All other options passed to dh are passed on to each command it runs. This can be used to set an option like "-v" or "-X" or "-N", as well as for more specialised options.

COMMAND SPECIFICATION

cmd can be a full name of a debhelper command, or a substring. It'll first search for a command in the sequence exactly matching the name, to avoid any ambiguity. If there are multiple substring matches, the last one in the sequence will be used.

SEQUENCE ADDONS

When --with addon is used, dh loads the perl module Debian::Debhelper::Sequence::addon. Two functions are provided to let the module add its commands to sequences:

Debian::Debhelper::Dh_Lib::insert_before(existing_command, new_command)
Insert new_command in sequences before existing_command.
Debian::Debhelper::Dh_Lib::insert_after(existing_command, new_command)
Insert new_command in sequences after existing_command.
Debian::Debhelper::Dh_Lib::remove_command(existing_command)
Remove existing_command from the list of commands to run.

EXAMPLES

To see what commands are included in a sequence, without actually doing anything:

	dh binary-arch --no-act

This is a very simple rules file, for packages where the default sequences of commands work with no additional options.

	#!/usr/bin/make -f
	%:
		dh $@

This is a simple rules file that is a good starting place for customisation. (It's also available in /usr/share/doc/debhelper/examples/rules.simple

	#!/usr/bin/make -f

	build: build-stamp
		dh build
		touch build-stamp

	clean:
		dh clean

	install: build install-stamp
	install-stamp:
		dh install
		touch install-stamp

	binary-arch: install
		dh binary-arch

	binary-indep: install
		dh binary-indep

	binary: binary-arch binary-indep

Often you'll want to pass an option to ./configure. This uses dh to run all commands before dh_auto_configure(1), then runs that command by hand, and then finished up by running the rest of the sequence. You could also run ./configure by hand, instead of bothering with using dh_auto_configure. And if necessary, you can add commands to run automake, etc here too.

	build: build-stamp
	build-stamp:
		dh build --before configure
		dh_auto_configure -- --kitchen-sink=yes
		dh build --after configure
		touch build-stamp

Here's how to skip two automated in a row (configure and build), and instead run the commands by hand.

	build: build-stamp
	build-stamp:
		dh build --before configure
		./mondoconfig
		make universe-explode-in-delight
		dh build --after build
		touch build-stamp

Another common case is wanting to run some code manually after a particular debhelper command is run.

	install: build install-stamp
	install-stamp:
		dh install --until dh_fixperms
		# dh_fixperms has run, now override it for one program
		chmod 4755 debian/foo/usr/bin/foo
		# and continue
		dh install --after dh_fixperms
		touch install-stamp

It's also fine to run debhelper commands early. Just make sure that at least dh_prep is run from the sequence first, and be sure to use the --remaining option to ensure that commands that normally come before those in the sequence are still run.

	install: build install-stamp
	install-stamp:
		dh install --until dh_prep
		dh_installdocs README TODO
		dh_installchangelogs Changes
		dh install --remaining
		touch install-stamp

        binary-arch: install
                dh_strip -X foo
                dh binary-arch --remaining

SEE ALSO

debhelper(7)

This program is a part of debhelper.

AUTHOR

Joey Hess <joeyh@debian.org>