|
105.
|
|
|
This example follows the `Machine-readable debian/copyright <DEP5_>`_ format. You are encouraged to use this format as well.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:174
|
|
106.
|
|
|
The rules file
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:179
|
|
107.
|
|
|
The last file we need to look at is ``rules``. This does all the work for creating our package. It is a Makefile with targets to compile and install the application, then create the ``.deb`` file from the installed files. It also has a target to clean up all the build files so you end up with just a source package again.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:181
|
|
108.
|
|
|
Here is a simplified version of the rules file created by ``dh_make`` (which can be found in the ``dh-make`` package):
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:189
|
|
109.
|
|
|
Let us go through this file in some detail. What this does is pass every build target that ``debian/rules`` is called with as an argument to ``/usr/bin/dh``, which itself will call all the necessary ``dh_*`` commands.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:203
|
|
110.
|
|
|
``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". In order to see what commands are run in each target, run::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:207
|
|
111.
|
|
|
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.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:216
|
|
112.
|
|
|
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.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:221
|
|
113.
|
|
|
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.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:226
|
|
114.
|
|
|
If ``debian/rules`` contains a target with a name like ``override_dh_command``, then when it gets to that command in the sequence, ``dh`` will run that target from the rules file, rather than running the actual command. The override target can then run the command with additional options, or run entirely different commands instead. (Note that to use this feature, you should Build-Depend on debhelper 7.0.50 or above.)
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../ubuntu-packaging-guide/debian-dir-overview.rst:231
|