/[ddp]/manuals/trunk/maint-guide/maint-guide.en.dbk
ViewVC logotype

Diff of /manuals/trunk/maint-guide/maint-guide.en.dbk

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8709 by osamu, Fri Apr 22 14:43:26 2011 UTC revision 9043 by osamu, Sat Jan 14 15:28:46 2012 UTC
# Line 105  takes many hours.  Make no mistake, for Line 105  takes many hours.  Make no mistake, for
105  need to be both technically competent and diligent.  need to be both technically competent and diligent.
106  </para>  </para>
107  <para>  <para>
 This document will explain every little (at first maybe irrelevant) step, and  
 help you create that first package, and to gain some experience in building  
 the next releases of that and maybe other packages later on.  
 </para>  
 <para>  
108  If you need some help on packaging, please read <xref linkend="helpme"/>.  If you need some help on packaging, please read <xref linkend="helpme"/>.
109  </para>  </para>
110  <para>  <para>
# Line 120  The translations may be available in pac Line 115  The translations may be available in pac
115  <systemitem role="package">maint-guide-es</systemitem>.  <systemitem role="package">maint-guide-es</systemitem>.
116  Please note that this documentation may be slightly outdated.  Please note that this documentation may be slightly outdated.
117  </para>  </para>
118  <section id="socialdynamism"><title>Social dynamics of Debian</title>  <para>
119    Since this is a tutorial, I choose to explain each detailed step for some
120    important topics.  Some of them may look irrelevant to you.  Please be patient.
121    I have also intentionally skipped some corner cases and provided only pointers
122    to keep this document simple.
123    </para>
124    <section id="socialdynamics"><title>Social dynamics of Debian</title>
125  <para>  <para>
126  Here are some observations of Debian's social dynamics, presented in the hope  Here are some observations of Debian's social dynamics, presented in the hope
127  that it will prepare you for interactions with Debian.  that it will prepare you for interactions with Debian.
# Line 219  please refer to the following to learn h Line 220  please refer to the following to learn h
220  <itemizedlist>  <itemizedlist>
221  <listitem><para><ulink url="&logiciellibre;">Debian: 17 years of Free Software, "do-ocracy", and democracy</ulink> (Introductory slides) </para> </listitem>  <listitem><para><ulink url="&logiciellibre;">Debian: 17 years of Free Software, "do-ocracy", and democracy</ulink> (Introductory slides) </para> </listitem>
222  <listitem><para><ulink url="&debianorghelp;">How can you help Debian?</ulink> (official) </para> </listitem>  <listitem><para><ulink url="&debianorghelp;">How can you help Debian?</ulink> (official) </para> </listitem>
223  <listitem><para><ulink url="&debianfaqhelp;">The Debian GNU/Linux FAQ, Chapter 13 - 'Contributing to the Debian Project'</ulink> (semi-official) </para> </listitem>  <listitem><para><ulink url="&debianfaqhelp;">The Debian GNU/Linux FAQ, Chapter 13 - "Contributing to the Debian Project"</ulink> (semi-official) </para> </listitem>
224  <listitem><para><ulink url="&debianwikihelp;">Debian Wiki, HelpDebian</ulink> (supplemental) </para> </listitem>  <listitem><para><ulink url="&debianwikihelp;">Debian Wiki, HelpDebian</ulink> (supplemental) </para> </listitem>
225  <listitem><para><ulink url="&nm-do;">Debian New Maintainer site</ulink> (official) </para> </listitem>  <listitem><para><ulink url="&nm-do;">Debian New Maintainer site</ulink> (official) </para> </listitem>
226  <listitem><para><ulink url="&debianmentorfaq;">Debian Mentors FAQ</ulink> (supplemental) </para> </listitem>  <listitem><para><ulink url="&debianmentorfaq;">Debian Mentors FAQ</ulink> (supplemental) </para> </listitem>
227  </itemizedlist>  </itemizedlist>
228  </section>  </section>
229  <section id="needprogs"><title>Programs you need for development</title>  <section id="needprogs"><title>Programs needed for development</title>
230  <para>  <para>
231  Before you start anything, you should make sure that you have properly  Before you start anything, you should make sure that you have properly
232  installed some additional packages needed for development.  Note that the list  installed some additional packages needed for development.  Note that the list
# Line 420  those made for X11, also use these progr Line 421  those made for X11, also use these progr
421  </itemizedlist>  </itemizedlist>
422  <para>  <para>
423  The short descriptions that are given above only serve to introduce you to what  The short descriptions that are given above only serve to introduce you to what
424  each package does.  Before continuing please thoroughly read the documentation  each package does.  Before continuing please read the documentation
425  of each program, at least, for the standard usage.  It may seem like heavy  of each relevant program including ones installed through the package dependency such as
426    <command>make</command>, at least, for the standard usage.  It may seem like heavy
427  going now, but later on you'll be <emphasis>very</emphasis> glad you read it.  going now, but later on you'll be <emphasis>very</emphasis> glad you read it.
 </para>  
 <para>  
428  If you have specific questions later, I would suggest re-reading the documents  If you have specific questions later, I would suggest re-reading the documents
429  mentioned above.  Since this is a tutorial, I have intentionally skipped  mentioned above.
 details and provided only pointers to keep it simple.  
430  </para>  </para>
431  </section>  </section>
432  <section id="needdocs"><title>Documentation needed for development</title>  <section id="needdocs"><title>Documentation needed for development</title>
# Line 438  you should read along with this document Line 437  you should read along with this document
437  <itemizedlist>  <itemizedlist>
438  <listitem>  <listitem>
439  <para>  <para>
 <ulink url="&autotools-tutorial;">Autotools  
 Tutorial</ulink> provides a very good tutorial for <ulink url="&gnu-build-system;">the GNU Build System known  
 as the GNU Autotools</ulink> whose most important components are Autoconf,  
 Automake, Libtool, and gettext.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
440  <systemitem role="package">debian-policy</systemitem> - the <ulink url="&debian-policy;">Debian Policy  <systemitem role="package">debian-policy</systemitem> - the <ulink url="&debian-policy;">Debian Policy
441  Manual</ulink> includes explanations of the structure and contents of the  Manual</ulink> includes explanations of the structure and contents of the
442  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>
443  (FHS, which says where each file and directory should be), etc.  For you, the most  (FHS, which says where each file and directory should be), etc.  For you, the most
444  important thing is that it describes requirements that each package must  important thing is that it describes requirements that each package must
445  satisfy to be included in the distribution (see the local copies of  satisfy to be included in the distribution. (See the local copies of
446  <ulink url="&policy-pdf;">policy.pdf</ulink> and <ulink url="&fhs-pdf;">fhs-2.3.pdf</ulink>).  <ulink url="&policy-pdf;">policy.pdf</ulink> and <ulink url="&fhs-pdf;">fhs-2.3.pdf</ulink>.)
447  </para>  </para>
448  </listitem>  </listitem>
449  <listitem>  <listitem>
# Line 466  when and where to upload etc.  (See the Line 457  when and where to upload etc.  (See the
457  <ulink url="&developers-refpdf;">developers-reference.pdf</ulink>.)  <ulink url="&developers-refpdf;">developers-reference.pdf</ulink>.)
458  </para>  </para>
459  </listitem>  </listitem>
460    </itemizedlist>
461    <para>
462    The following is the <emphasis>important</emphasis> documentation which
463    you should read along with this document:
464    </para>
465    <itemizedlist>
466    <listitem>
467    <para>
468    <ulink url="&autotools-tutorial;">Autotools
469    Tutorial</ulink> provides a very good tutorial for <ulink url="&gnu-build-system;">the GNU Build System known
470    as the GNU Autotools</ulink> whose most important components are Autoconf,
471    Automake, Libtool, and gettext.
472    </para>
473    </listitem>
474  <listitem>  <listitem>
475  <para>  <para>
476  <systemitem role="package">gnu-standards</systemitem> - this package contains  <systemitem role="package">gnu-standards</systemitem> - this package contains
# Line 486  are correct.  Please file a bug report o Line 491  are correct.  Please file a bug report o
491  <systemitem role="package">maint-guide</systemitem> package using  <systemitem role="package">maint-guide</systemitem> package using
492  <command>reportbug</command>.  <command>reportbug</command>.
493  </para>  </para>
494    <para>
495    The following is an alternative tutorial documentation which you may
496    read along with this document:
497    </para>
498    <itemizedlist>
499    <listitem><para><ulink url="&debpkg-tutorial0;">Debian Packaging Tutorial</ulink></para></listitem>
500    <listitem><para><ulink url="&debpkg-tutorial1;">Practical session 1: Modifying the grep package</ulink></para></listitem>
501    <listitem><para><ulink url="&debpkg-tutorial2;">Practical session 2: Packaging GNUjump</ulink></para></listitem>
502    <listitem><para><ulink url="&debpkg-tutorial3;">Practical session 3: Packaging a Java library</ulink></para></listitem>
503    </itemizedlist>
504  </section>  </section>
505  <section id="helpme"><title>Where to ask for help</title>  <section id="helpme"><title>Where to ask for help</title>
506  <para>  <para>
# Line 558  is time for you to dig into the Line 573  is time for you to dig into the
573  <ulink url="&bts;">Debian Bug Tracking System</ulink>  <ulink url="&bts;">Debian Bug Tracking System</ulink>
574  and read the documentation there, to be able to  and read the documentation there, to be able to
575  deal with the reports efficiently.  I highly recommend reading the  deal with the reports efficiently.  I highly recommend reading the
576  <ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8:  <ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8.
577  "Handling bugs"</ulink>.  "Handling bugs"</ulink>.
578  </para>  </para>
579  <para>  <para>
# Line 580  documentation</emphasis> for details). Line 595  documentation</emphasis> for details).
595  Let's start by creating a package of your own (or, even better,  Let's start by creating a package of your own (or, even better,
596  adopting an existing one).  adopting an existing one).
597  </para>  </para>
598  <section id="workflow"><title>Work flow of the Debian package building</title>  <section id="workflow"><title>Debian package building workflow</title>
599  <para>  <para>
600  If you are making a Debian package with an upstream program,  If you are making a Debian package with an upstream program, the
601  typical work flow of the Debian package building involves generating several  typical workflow of Debian package building involves generating several
602  specifically named files for each step as the following.  specifically named files for each step as follows.
603  </para>  </para>
604  <itemizedlist>  <itemizedlist>
605  <listitem>  <listitem>
606  <para>We obtain an upstream program file usually in a compressed tar format.</para>  <para>Get a copy of the upstream software, usually in a compressed tar format.</para>
607    <itemizedlist>    <itemizedlist>
608    <listitem><literal><replaceable>programname</replaceable>-<replaceable>version</replaceable>.tar.gz</literal></listitem>    <listitem><literal><replaceable>package</replaceable>-<replaceable>version</replaceable>.tar.gz</literal></listitem>
609    </itemizedlist>    </itemizedlist>
610  </listitem>  </listitem>
611  <listitem>  <listitem>
612  <para>  <para>
613  We create a non-native Debian source package in the "3.0 (quilt)" format, which refers to the set of input files for  Add Debian-specific packaging modifications to the upstream program under the
614  the Debian package building, by adding Debian package modifications to the upstream program under the <filename>debian</filename> directory.  <filename>debian</filename> directory, and create a non-native source package
615    (that is, the set of input files used for Debian package building) in
616    <literal>3.0 (quilt)</literal> format.
617  </para>  </para>
618    <itemizedlist>    <itemizedlist>
619    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>.orig.tar.gz</literal></listitem>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.orig.tar.gz</literal></listitem>
620    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.debian.tar.gz</literal>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.debian.tar.gz</literal>
621      <footnote><para>For the older non-native Debian source package in the "1.0" format,      <footnote><para>For the older style of non-native Debian source packages in <literal>1.0</literal> format,
622      <literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.diff.gz</literal>      <literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.diff.gz</literal>
623      is used instead. </para></footnote></listitem>      is used instead. </para></footnote></listitem>
624    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.dsc</literal></listitem>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.dsc</literal></listitem>
625    </itemizedlist>    </itemizedlist>
626  </listitem>  </listitem>
627  <listitem>  <listitem>
628  <para>  <para>
629  We build Debian binary packages, which are ordinary installable package files in <literal>.deb</literal> format (or <literal>.udeb</literal> format, used by the Debian Installer), from the Debian source package.  Build Debian binary packages, which are ordinary installable package files in <literal>.deb</literal> format (or <literal>.udeb</literal> format, used by the Debian Installer) from the Debian source package.
630  </para>  </para>
631    <itemizedlist>    <itemizedlist>
632    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
633    </itemizedlist>    </itemizedlist>
634  </listitem>  </listitem>
635  </itemizedlist>  </itemizedlist>
636  <para>  <para>
637  If you are making a Debian specific package without an upstream program instead,  Please note that the character separating
638  typical work flow of the Debian package building is simpler.  <literal><replaceable>package</replaceable></literal> and
639    <literal><replaceable>version</replaceable></literal> was changed from
640    <literal>-</literal> (hyphen) in the tarball name to
641    <literal>_</literal> (underscore) in the Debian package filenames.
642    </para>
643    <para>
644    In the file names above, replace
645    the <literal><replaceable>package</replaceable></literal> part with the <emphasis role="strong">package name</emphasis>,
646    the <literal><replaceable>version</replaceable></literal> part with the <emphasis role="strong">upstream version</emphasis>,
647    the <literal><replaceable>revision</replaceable></literal> part with the <emphasis role="strong">Debian revision</emphasis>,
648    and the <literal><replaceable>arch</replaceable></literal> part with the <emphasis role="strong">package architecture</emphasis>,
649    as defined in the Debian Policy Manual.
650    <footnote> <para> See
651    <ulink url="&policy-source;">5.6.1 Source</ulink>,
652    <ulink url="&policy-package;">5.6.7 Package</ulink>, and
653    <ulink url="&policy-version;">5.6.12 Version</ulink>.
654    The <emphasis role="strong">package architecture</emphasis> follows the
655    Debian Policy Manual: <ulink url="&policy-architecture;">5.6.8 Architecture</ulink>
656    and is automatically assigned by the package build process.</para></footnote>
657    </para>
658    <para>
659    If instead you are making a Debian-specific package with no upstream, the
660    typical workflow of Debian package building is simpler.
661  </para>  </para>
662  <itemizedlist>  <itemizedlist>
663  <listitem>  <listitem>
664  <para>  <para>
665  We create a native Debian source package in the "3.0 (native)" format using a compressed tar format in which required files under the <filename>debian</filename> directory are also included.  Create a native Debian source package in the <literal>3.0 (native)</literal>
666    format using a single compressed tar file in which all files are included.
667  </para>  </para>
668    <itemizedlist>    <itemizedlist>
669    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>.tar.gz</literal></listitem>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.tar.gz</literal></listitem>
670    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>.dsc</literal></listitem>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.dsc</literal></listitem>
671    </itemizedlist>    </itemizedlist>
672  </listitem>  </listitem>
673  <listitem>  <listitem>
674  <para>  <para>
675  We build Debian binary packages from the native Debian source package.  Build Debian binary packages from the native Debian source package.
676  </para>  </para>
677    <itemizedlist>    <itemizedlist>
678    <listitem><literal><replaceable>programname</replaceable>_<replaceable>version</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>    <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
679    </itemizedlist>    </itemizedlist>
680  </listitem>  </listitem>
681  </itemizedlist>  </itemizedlist>
682  <para>  <para>
683  Here,  Each step of this outline is explained with detailed examples in later sections.
 <literal><replaceable>programname</replaceable></literal> part of the file name is substituted by the  
 <emphasis role="strong">package name</emphasis>,  
 <literal><replaceable>version</replaceable></literal> part of it is substituted by the  
 <emphasis role="strong">upstream version</emphasis>,  
 <literal><replaceable>revision</replaceable></literal> part of it is substituted by the  
 <emphasis role="strong">Debian revision</emphasis>,  
 <literal><replaceable>arch</replaceable></literal> part of it is substituted by the  
 <emphasis role="strong">package architecture</emphasis>.  
 <footnote><para>  
 The <emphasis role="strong">package name</emphasis>, <emphasis  
 role="strong">upstream version</emphasis>, and <emphasis role="strong">Debian  
 revision</emphasis> must be adjusted to comply with the Debian Policy Manual:  
 <ulink url="&policy-source;">5.6.1 Source</ulink>,  
 <ulink url="&policy-package;">5.6.7 Package</ulink>, and  
 <ulink url="&policy-version;">5.6.12 Version</ulink>.  
 The <emphasis role="strong">package architecture</emphasis> follows the  
 Debian Policy Manual: <ulink url="&policy-architecture;">5.6.8 Architecture</ulink>  
 and is automatically assigned by the package build process.</para></footnote>  
 </para>  
 <para>  
 You should chose the <emphasis role="strong">package name</emphasis>  
 which consists only of lower case letters (<literal>a-z</literal>), digits  
 (<literal>0-9</literal>), plus (<literal>+</literal>) and minus  
 (<literal>-</literal>) signs, and periods (<literal>.</literal>). They must be  
 at least two characters long and must start with an alphanumeric character.  
 </para>  
 <para>  
 You should use the <emphasis role="strong">upstream version</emphasis> and the  
 <emphasis role="strong">Debian revision</emphasis> which consists only of  
 alphanumerics (<literal>a-zA-Z0-9</literal>), plus (<literal>+</literal>),  
 tilde (<literal>~</literal>), and periods (<literal>.</literal>). They must  
 start with a digit (<literal>0-9</literal>).  <footnote><para>This stricter  
 rule should help you avoid confusing file names.</para></footnote>  
 </para>  
 <para>  
 In the following, each step of this is explained with detailed examples.  
684  </para>  </para>
685  </section>  </section>
686  <section id="choose"><title>Choose your program</title>  <section id="choose"><title>Choose your program</title>
# Line 813  For the <literal>non-free</literal> sect Line 817  For the <literal>non-free</literal> sect
817  with the DFSG but it <emphasis role="strong">must be distributable</emphasis>.  with the DFSG but it <emphasis role="strong">must be distributable</emphasis>.
818  </para>  </para>
819  </listitem>  </listitem>
820  </itemizedlist>  <listitem>
821  <para>  <para>
822  If you are unsure about where it should go, post the license text on <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>  If you are unsure about where it should go, post the license text on
823    <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>
824  and ask for advice.  and ask for advice.
825  </para>  </para>
826  </listitem>  </listitem>
827    </itemizedlist>
828    </listitem>
829  <listitem>  <listitem>
830  <para>  <para>
831  The program certainly should <emphasis role="strong">not</emphasis> run setuid  The program should <emphasis role="strong">not</emphasis> introduce security
832  root, or even better, it shouldn't need to be setuid or setgid to anything.  and maintenance concerns to the Debian system.
833  </para>  </para>
834  </listitem>  <itemizedlist>
835  <listitem>  <listitem>
836  <para>  <para>
837  The program should not be a daemon, or go in an  The program should be well documented and its code needs to be understandable
838  <filename>*/sbin</filename> directory, or open a port as root.  (i.e.  not obfuscated).
839  </para>  </para>
840  </listitem>  </listitem>
841  <listitem>  <listitem>
842  <para>  <para>
843  The program should be in binary executable form; libraries are harder to handle.  You should contact the program's author(s) to check if they agree with packaging it
844    and are amicable to Debian.  It is important to be able to consult with the author(s)
845    in case of any problems with the program, so don't try to package
846    unmaintained software.
847  </para>  </para>
848  </listitem>  </listitem>
849  <listitem>  <listitem>
850  <para>  <para>
851  The program should be well documented and its code needs to be understandable  The program certainly should <emphasis role="strong">not</emphasis> run setuid
852  (i.e.  not obfuscated).  root, or even better, it shouldn't need to be setuid or setgid to anything.
853  </para>  </para>
854  </listitem>  </listitem>
855  <listitem>  <listitem>
856  <para>  <para>
857  You should contact the program's author(s) to check if they agree with packaging it  The program should not be a daemon, or go in an
858  and are amicable to Debian.  It is important to be able to consult with the author(s)  <filename>*/sbin</filename> directory, or open a port as root.
 in case of any problems with the program, so don't try to package  
 unmaintained software.  
859  </para>  </para>
860  </listitem>  </listitem>
861  </itemizedlist>  </itemizedlist>
862    </listitem>
863    </itemizedlist>
864  <para>  <para>
865  Of course, these are just safety measures, and intended to save you from  Of course, the last one is just a safety measures, and intended to save you from
866  enraging users if you do something wrong in some setuid daemon...  When you gain  enraging users if you do something wrong in some setuid daemon...  When you gain
867  more experience in packaging, you'll be able to package such software.  more experience in packaging, you'll be able to package such software.
868  </para>  </para>
869    <para>
870    As a new maintainer, you are encouraged to get some experience in packaging
871    with easier packages and discouraged from creating complicated packages.
872    </para>
873    <itemizedlist>
874    <listitem><para>Simple packages</para>
875    <itemizedlist>
876      <listitem><para>single binary package, arch = all (collection of data such as wallpaper graphics)</para></listitem>
877      <listitem><para>single binary package, arch = all (executables written in an interpreted language such as POSIX shell)</para></listitem>
878    </itemizedlist>
879    </listitem>
880    <listitem><para>Intermediate complexity packages</para>
881    <itemizedlist>
882      <listitem><para>single binary package, arch = any (ELF binary executables compiled from languages such as C and C++)</para></listitem>
883      <listitem><para>multiple binary packages, arch = any + all (packages for ELF binary executables + documentation)</para></listitem>
884      <listitem><para>upstream source in a format other than <filename>tar.gz</filename> or <filename>tar.bz2</filename></para></listitem>
885      <listitem><para>upstream source containing undistributable contents</para></listitem>
886    </itemizedlist>
887    </listitem>
888    <listitem><para>High complexity packages</para>
889    <itemizedlist>
890      <listitem><para>interpreter module package used by other packages</para></listitem>
891      <listitem><para>generic ELF library package used by other packages</para></listitem>
892      <listitem><para>multiple binary packages including an ELF library package</para></listitem>
893      <listitem><para>source package with multiple upstream sources</para></listitem>
894      <listitem><para>kernel module packages</para></listitem>
895      <listitem><para>kernel patch packages</para></listitem>
896      <listitem><para>any package with non-trivial maintainer scripts</para></listitem>
897    </itemizedlist>
898    </listitem>
899    </itemizedlist>
900    <para>
901    Packaging high complexity packages is not too hard, but it requires a bit more
902    knowledge. You should seek specific guidance for every complex feature. For
903    example, some languages have their own sub-policy documents:
904    </para>
905    <itemizedlist>
906    <listitem><para><ulink url="&policy-perl;">Perl policy</ulink></para></listitem>
907    <listitem><para><ulink url="&policy-python;">Python policy</ulink></para></listitem>
908    <listitem><para><ulink url="&policy-java;">Java policy</ulink></para></listitem>
909    </itemizedlist>
910    <para>
911    There is another old Latin saying: <emphasis>fabricando fit faber</emphasis>
912    (practice makes perfect).  It is <emphasis>highly</emphasis> recommended to
913    practice and experiment with all the steps of Debian packaging with simple packages
914    while reading this tutorial.  A trivial upstream tarball
915    <filename>hello-sh-1.0.tar.gz</filename> created as followings may offer
916    a good starting point.<footnote><para>Do not worry about the missing
917    <filename>Makefile</filename>.  You can install the <command>hello</command>
918    command by simply using <command>debhelper</command> as in
919    <xref linkend="install"/>, or by modifying the upstream source to add a new
920    <filename>Makefile</filename> with the <literal>install</literal> target as in
921    <xref linkend="modify"/>.</para></footnote>
922    </para>
923    <screen>
924    $ mkdir -p hello-sh/hello-sh-1.0; cd hello-sh/hello-sh-1.0
925    $ cat &gt; hello &lt;&lt;EOF
926    #!/bin/sh
927    # (C) 2011 Foo Bar, GPL2+
928    echo "Hello!"
929    EOF
930    $ chmod 755 hello
931    $ cd ..
932    $ tar -cvzf hello-sh-1.0.tar.gz hello-sh-1.0
933    </screen>
934  </section>  </section>
935  <section id="getit"><title>Get the program, and try it out</title>  <section id="getit"><title>Get the program, and try it out</title>
936  <para>  <para>
# Line 867  author's homepage.  Sources for free Uni Line 942  author's homepage.  Sources for free Uni
942  <command>tar</command>+<command>bzip2</command> format with the extension  <command>tar</command>+<command>bzip2</command> format with the extension
943  <filename>.tar.bz2</filename>, or  <filename>.tar.bz2</filename>, or
944  <command>tar</command>+<command>xz</command> format with the extension  <command>tar</command>+<command>xz</command> format with the extension
945  <filename>.tar.zx</filename>.  These usually contain a directory called  <filename>.tar.xz</filename>.  These usually contain a directory called
946  <filename><replaceable>programname</replaceable>-<replaceable>version</replaceable></filename>  <filename><replaceable>package</replaceable>-<replaceable>version</replaceable></filename>
947  with all the sources inside.  with all the sources inside.
948  </para>  </para>
949  <para>  <para>
# Line 887  enough.  </para> </footnote>), you shoul Line 962  enough.  </para> </footnote>), you shoul
962  appropriate tools and repack it.  appropriate tools and repack it.
963  </para>  </para>
964  <para>  <para>
965    If your program's source comes with some contents which do not comply with
966    DFSG, you should also unpack it to remove such contents and repack it with a
967    modified upstream version containing <literal>dfsg</literal>.
968    </para>
969    <para>
970  As an example, I'll use a program called <command>gentoo</command>, a GTK+  As an example, I'll use a program called <command>gentoo</command>, a GTK+
971  file manager.  file manager.
972  <footnote><para> This program is already packaged. The  <footnote><para> This program is already packaged. The
# Line 903  case).  Place the downloaded archive in Line 983  case).  Place the downloaded archive in
983  xzf gentoo-0.9.12.tar.gz</literal>).  Make sure there are no warning  xzf gentoo-0.9.12.tar.gz</literal>).  Make sure there are no warning
984  messages, even <emphasis>irrelevant</emphasis> ones, because other  messages, even <emphasis>irrelevant</emphasis> ones, because other
985  people's unpacking tools may or may not ignore these anomalies, so they  people's unpacking tools may or may not ignore these anomalies, so they
986  may have problems unpacking them.  Your shell commandline may look  may have problems unpacking them.  Your shell command line may look
987  something like this:  something like this:
988  </para>  </para>
989  <screen>  <screen>
# Line 925  install to the <filename>/usr/local/bin< Line 1005  install to the <filename>/usr/local/bin<
1005  that, but more on that later in <xref linkend="destdir"/>).  that, but more on that later in <xref linkend="destdir"/>).
1006  </para>  </para>
1007  <para>  <para>
1008  Simple programs come with a <filename>Makefile</filename> and can  You should start packaging with a completely clean (pristine) source directory,
1009    or simply with freshly unpacked sources.
1010    </para>
1011    </section>
1012    <section id="simplemake"><title>Simple build systems</title>
1013    <para>
1014    Simple programs usually come with a <filename>Makefile</filename> and can
1015  be compiled just by invoking <literal>make</literal>.<footnote><para>  be compiled just by invoking <literal>make</literal>.<footnote><para>
1016  Many modern programs come with a script <filename>configure</filename> which  Many modern programs come with a script <filename>configure</filename> which
1017  when executed creates a <filename>Makefile</filename> customized for  when executed creates a <filename>Makefile</filename> customized for
# Line 947  all the installed files. Line 1033  all the installed files.
1033  </section>  </section>
1034  <section id="portable"><title>Popular portable build systems</title>  <section id="portable"><title>Popular portable build systems</title>
1035  <para>  <para>
1036  A lot of free software is written in the <ulink url="&c-program;">C</ulink> and  A lot of free software programs are written in the <ulink url="&c-program;">C</ulink> and
1037  <ulink url="&cxx;">C++</ulink> languages.  Many of  <ulink url="&cxx;">C++</ulink> languages.  Many of these use Autotools or
1038  these use Autotools or CMake to make them portable across different platforms.  CMake to make them portable across different platforms.  These build tools need
1039  These tools are used to generate the <filename>Makefile</filename> and other  to be used to generate the <filename>Makefile</filename> and other
1040  required source files.  Then, such programs are built using the usual  required source files first.  Then, such programs are built using the usual
1041  <literal>make; make install</literal>.  <literal>make; make install</literal>.
1042  </para>  </para>
1043  <para>  <para>
# Line 962  system comprising <ulink url="&autoconf; Line 1048  system comprising <ulink url="&autoconf;
1048  <ulink url="&gettext;">gettext</ulink>.  You can recognize  <ulink url="&gettext;">gettext</ulink>.  You can recognize
1049  such sources by the <filename>configure.ac</filename>,  such sources by the <filename>configure.ac</filename>,
1050  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.
1051  <footnote><para> See the <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink>  <footnote><para>Autotools is too big to deal in this small tutorial. This
1052  and <ulink url="&autotools-readme;"/>.  </para> </footnote>  section is meant to provide keywords and references only.  Please make sure to read the
1053    <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink> and
1054    <ulink url="&autotools-readme;"/>, if you need to use it.</para></footnote>
1055  </para>  </para>
1056  <para>  <para>
1057  The first step of the Autotools workflow is usually that upstream runs  The first step of the Autotools workflow is usually that upstream runs
# Line 989  files requires some knowledge of <comman Line 1077  files requires some knowledge of <comman
1077  <para>  <para>
1078  The second step of the Autotools workflow is usually that the user obtains this  The second step of the Autotools workflow is usually that the user obtains this
1079  distributed source and runs <literal>./configure &amp;&amp; make</literal> in  distributed source and runs <literal>./configure &amp;&amp; make</literal> in
1080  the source directory to compile the program into a  the source directory to compile the program into an executable command
1081  <command><replaceable>binary</replaceable></command>.  <command><replaceable>binary</replaceable></command>.
1082  </para>  </para>
1083  <screen>  <screen>
# Line 1003  config.h.in -----+                +-&gt; Line 1091  config.h.in -----+                +-&gt;
1091  <para>  <para>
1092  You can change many things in the <filename>Makefile</filename>; for  You can change many things in the <filename>Makefile</filename>; for
1093  instance you can change the default location for file installation  instance you can change the default location for file installation
1094  using the option <command>./configure --prefix=/usr</command>.  using the option <literal>./configure --prefix=/usr</literal>.
1095  </para>  </para>
1096  <para>  <para>
1097  Although it is not required, updating the <filename>configure</filename> and  Although it is not required, updating the <filename>configure</filename> and
# Line 1021  build system.  You can recognize such so Line 1109  build system.  You can recognize such so
1109  </section>  </section>
1110  <section id="namever"><title>Package name and version</title>  <section id="namever"><title>Package name and version</title>
1111  <para>  <para>
1112  You should start packaging with a completely clean (pristine) source directory,  If the upstream source comes as <filename>gentoo-0.9.12.tar.gz</filename>, you can
1113  or simply with freshly unpacked sources.  take <literal>gentoo</literal> as the (source) <emphasis role="strong">package name</emphasis>
1114    and <literal>0.9.12</literal> as the <emphasis role="strong">upstream version</emphasis>.
1115    These are used in the <filename>debian/changelog</filename> file described later in
1116    <xref linkend="changelog"/>, too.
1117    </para>
1118    <para>
1119    Although this simple approach works most of the times, you may need to adjust
1120    <emphasis role="strong">package name</emphasis> and
1121    <emphasis role="strong">upstream version</emphasis> by renaming the upstream
1122    source to follow Debian Policy and existing convention.
1123    </para>
1124    <para>
1125    You must choose the <emphasis role="strong">package name</emphasis>
1126    to consist only of lower case letters (<literal>a-z</literal>), digits
1127    (<literal>0-9</literal>), plus (<literal>+</literal>) and minus
1128    (<literal>-</literal>) signs, and periods (<literal>.</literal>). It must be
1129    at least two characters long, must start with an alphanumeric character, and
1130    must not be the same as existing ones.
1131    It is a good idea to keep its length within 30 characters.
1132    <footnote><para>The default package name field length of <command>aptitude</command> is 30.  For more than 90% of packages, the package name is less than 24 characters.</para></footnote>
1133    </para>
1134    <!--
1135    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1136    === stat for package name string length ===
1137    11 1947 36.9%   mode
1138    14 1717 54.7%  50% median
1139    23 611 91.0%   90%
1140    32 89 99.0%    99%
1141    41 12 99.9%    99.9%
1142    52 1 100.0%
1143    Previous 20 chars is becoming too short for 17% of packages
1144    Default aptitude setting display up to 30 chars (98.3%).
1145    -->
1146    <para>
1147    If upstream uses some generic term such as <literal>test-suite</literal> for
1148    its name, it is a good idea to rename it to identify its contents explicitly and avoid namespace pollution.
1149    <footnote><para>If you follow the
1150    <ulink url="&devref-newpackage;">Debian Developer's Reference 5.1. "New packages"</ulink>,
1151    the ITP process will usually catch this kind of issues.</para></footnote>
1152    </para>
1153    <para>
1154    You should choose the <emphasis role="strong">upstream version</emphasis>
1155    to consist only of
1156    alphanumerics (<literal>0-9A-Za-z</literal>), plus (<literal>+</literal>),
1157    tildes (<literal>~</literal>), and periods (<literal>.</literal>). It must
1158    start with a digit (<literal>0-9</literal>).  <footnote><para>This stricter
1159    rule should help you avoid confusing file names.</para></footnote>
1160    It is good idea to keep its length within 8 characters if possible.
1161    <footnote><para>The default version field length of <command>aptitude</command> is 10.  The Debian revision with preceding hyphen usually consumes 2.  For more than 80% of packages, the upstream version is less than 8 characters and the Debian revision is less than 2 characters.  For more than 90% of packages, the upstream version is less than 10 characters and the Debian revision is less than 3 characters.</para></footnote>
1162  </para>  </para>
1163    <!--
1164    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1165    === stat for upstream version string length ===
1166    5 9765 60.2%  50% median and mode
1167    6 3765 73.3%
1168    7 2789 82.9%
1169    8 1158 86.9%
1170    9 501 88.6%
1171    10 773 91.3%  90%
1172    18 55 99.1%   99%
1173    27 11 99.9%    99.9
1174    35 6 100.0%
1175    === stat for debian revision string length ===
1176    1 22556 83.3%  50% median and mode
1177    2 1106 87.2%
1178    3 1312 91.7%   90%
1179    4 2127 99.1%   99%
1180    7 14 99.9%     99.9%
1181    
1182    aptitude display 10 = 8char for up + 1char (for -) + 1char for deb
1183    90chars as max for file name of binary debs (package+up+deb+arch+.deb)
1184    -->
1185  <para>  <para>
1186  For the package to be built correctly, you must make the program's original  If upstream does not use a normal versioning scheme such as
1187  name lowercase (if it isn't already), and you should move the source directory  <literal>2.30.32</literal> but uses some kind of date such as
1188  to  <literal>11Apr29</literal>, a random codename string, or a VCS hash value as part
1189  <filename><replaceable>packagename</replaceable>-<replaceable>version</replaceable></filename>.  of the version, make sure to remove them from the
1190  </para>  <emphasis role="strong">upstream version</emphasis>.  Such information can be
1191  <para>  recorded in the <filename>debian/changelog</filename> file.  If you need to
1192  If the program name consists of more than one word, contract them to one word,  invent a version string, use the <literal>YYYYMMDD</literal> format such as
1193  or make an abbreviation.  For example, a package of the program "John's little  <literal>20110429</literal> as upstream version.  This ensures that
1194  editor for X" might be named <systemitem role="package">johnledx</systemitem>, or  <command>dpkg</command> interprets later versions correctly as upgrades.
1195  <systemitem role="package">jle4x</systemitem>, or whatever you decide, as long  If you need to ensure smooth transition to the normal version scheme such as
1196  as it's under some reasonable length limit, e.g. 20 characters.  <literal>0.1</literal> in future, use the <literal>0~YYMMDD</literal> format
1197  </para>  such as <literal>0~110429</literal> as upstream version, instead.
1198  <para>  </para>
1199  Also check for the exact version of the program (to be included in the package  <para>
1200  version).  If this piece of software is not numbered with versions like  Version strings <footnote><para>Version strings may be
1201  <literal>X.Y.Z</literal>, but with some kind of date, feel free to use that  <emphasis role="strong">upstream version</emphasis>
1202  date as the version number, as long as newer version numbers will look larger.  (<literal><replaceable>version</replaceable></literal>),
1203  While it is best to use the same version numbering as upstream, if it is  <emphasis role="strong">Debian revision</emphasis>
1204  in the format of <literal>09Oct23</literal> you may need to convert it to  (<literal><replaceable>revision</replaceable></literal>), or
1205  <literal>YYYYMMDD</literal> format, which would be <literal>20091023</literal>,  <emphasis role="strong">version</emphasis>
1206  to ensure that <command>dpkg</command> sees later versions as  (<literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>).
1207  upgrades.<footnote><para> Version strings can be compared with <literal>dpkg  See <xref linkend="newrevision"/> for how the
1208  --compare-versions <replaceable>ver1</replaceable>  <emphasis role="strong">Debian revision</emphasis> is incremented.
1209  <replaceable>op</replaceable> <replaceable>ver2</replaceable></literal>.  See  </para></footnote>
1210  <citerefentry> <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum>  can be compared using <citerefentry>
1211  </citerefentry>.  </para> </footnote>  <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> as follows.
1212  </para>  </para>
1213    <screen>
1214     $ dpkg --compare-versions <replaceable>ver1</replaceable> <replaceable>op</replaceable> <replaceable>ver2</replaceable>
1215    </screen>
1216  <para>  <para>
1217  Some programs won't be numbered at all, in which case you should contact the  The version comparison rule can be summarized as:
1218  upstream maintainer to see if they've got some other revision-tracking method.  </para>
1219    <itemizedlist>
1220    <listitem><para>Strings are compared from the head to the tail.</para></listitem>
1221    <listitem><para>Letters are larger than digits.</para></listitem>
1222    <listitem><para>Numbers are compared as integers.</para></listitem>
1223    <listitem><para>Letters are compared in ASCII code order.</para></listitem>
1224    <listitem><para>There are special rules for period
1225    (<literal>.</literal>), plus (<literal>+</literal>), and tilde
1226    (<literal>~</literal>) characters, as follows.</para>
1227      <para>
1228      <literal>0.0</literal> &lt;
1229      <literal>0.5</literal> &lt;
1230      <literal>0.10</literal> &lt;
1231      <literal>0.99</literal> &lt;
1232      <literal>1</literal> &lt;
1233      <literal>1.0~rc1</literal> &lt;
1234      <literal>1.0</literal> &lt;
1235      <literal>1.0+b1</literal> &lt;
1236      <literal>1.0+nmu1</literal> &lt;
1237      <literal>1.1</literal> &lt;
1238      <literal>2.0</literal>
1239      </para>
1240    </listitem>
1241    </itemizedlist>
1242    <para>
1243    One tricky case occurs when upstream releases
1244    <filename>gentoo-0.9.12-ReleaseCandidate-99.tar.gz</filename> as the
1245    pre-release of <filename>gentoo-0.9.12.tar.gz</filename>.  You need to make
1246    sure that the upgrade works properly by renaming the upstream source to
1247    <filename>gentoo-0.9.12~rc99.tar.gz</filename>.
1248  </para>  </para>
1249  </section>  </section>
1250  <section id="dh-make"><title>Initial Debian package</title>  <section id="dh-make"><title>Setting up <command>dh_make</command></title>
1251  <para>  <para>
1252  Set up the shell environment variables <literal>$DEBEMAIL</literal> and  Set up the shell environment variables <literal>$DEBEMAIL</literal> and
1253  <literal>$DEBFULLNAME</literal> so that various Debian maintenance  <literal>$DEBFULLNAME</literal> so that various Debian maintenance
1254  tools recognize your email address and name to use for packages.<footnote><para> The  tools recognize your email address and name to use for packages. <footnote><para> The
1255  following text assumes you are using Bash as your login shell.  If you use  following text assumes you are using Bash as your login shell.  If you use
1256  some other login shell such as Z shell, use their corresponding  some other login shell such as Z shell, use their corresponding
1257  configuration files instead of <filename>~/.bashrc</filename>. </para> </footnote>.  configuration files instead of <filename>~/.bashrc</filename>. </para> </footnote>
1258  </para>  </para>
1259  <screen>  <screen>
1260  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF
1261  DEBEMAIL=your.email.address@example.org  DEBEMAIL="your.email.address@example.org"
1262  DEBFULLNAME=Firstname Lastname  DEBFULLNAME="Firstname Lastname"
1263  export DEBEMAIL DEBFULLNAME  export DEBEMAIL DEBFULLNAME
1264  EOF  EOF
1265    $ . ~/.bashrc
1266  </screen>  </screen>
1267    </section>
1268    <section id="non-native-dh-make"><title>Initial non-native Debian package</title>
1269  <para>  <para>
1270  You can create an initial Debian package by issuing the  Normal Debian packages are non-native Debian packages made from upstream
1271  <command>dh_make</command> command as follows.  programs.  If you wish to create a non-native Debian package of an upstream
1272    source <filename>gentoo-0.9.12.tar.gz</filename>, you can create an initial
1273    non-native Debian package for it by issuing the <command>dh_make</command>
1274    command as follows.
1275  </para>  </para>
1276  <screen>  <screen>
1277  $ . ~/.bashrc  $ cd ~/gentoo
1278  $ cd ~/gentoo/gentoo-0.9.12  $ wget http://example.org/gentoo-0.9.12.tar.gz
1279    $ tar -xvzf gentoo-0.9.12.tar.gz
1280    $ cd gentoo-0.9.12
1281  $ dh_make -f ../gentoo-0.9.12.tar.gz  $ dh_make -f ../gentoo-0.9.12.tar.gz
1282  </screen>  </screen>
1283  <para>  <para>
# Line 1095  provided by the upstream for your Debian Line 1293  provided by the upstream for your Debian
1293  </para>  </para>
1294  <para>  <para>
1295  You should see some output asking you what sort of package you want  You should see some output asking you what sort of package you want
1296  to create.  Gentoo is a single binary package - it creates only one binary, and  to create.  Gentoo is a single binary package - it creates only one binary package, i.e,
1297  thus one <filename>.deb</filename> file - so we will select the first option  one <filename>.deb</filename> file - so we will select the first option
1298  (with the <literal>s</literal> key), check the information on the screen, and  (with the <literal>s</literal> key), check the information on the screen, and
1299  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.
1300  <footnote><para> There are several choices here: <literal>s</literal> for Single  <footnote><para> There are several choices here: <literal>s</literal> for
1301  binary, <literal>i</literal> for arch-Independent, <literal>m</literal> for  Single binary package, <literal>i</literal> for arch-Independent package, <literal>m</literal> for
1302  Multiple binary, <literal>l</literal> for Library, <literal>k</literal> for  Multiple binary packages, <literal>l</literal> for Library package, <literal>k</literal> for
1303  Kernel module, <literal>n</literal> for kernel patch, and <literal>b</literal>  Kernel module package, <literal>n</literal> for kernel patch package, and <literal>b</literal>
1304  for <systemitem role="package">cdbs</systemitem>.  This document focuses on the  for <systemitem role="package">cdbs</systemitem> package.  This document focuses on the
1305  use of the <command>dh</command> command (from the package  use of the <command>dh</command> command (from the package
1306  <systemitem role="package">debhelper</systemitem>) to create a single-binary package,  <systemitem role="package">debhelper</systemitem>) to create a single binary package,
1307  but also touches on how to use it for arch-independent or  but also touches on how to use it for arch-independent or
1308  multiple-binary packages.  The package  multiple binary packages.  The package
1309  <systemitem role="package">cdbs</systemitem> offers an alternative packaging script  <systemitem role="package">cdbs</systemitem> offers an alternative packaging script
1310  infrastructure to the <command>dh</command> command and is outside the scope of  infrastructure to the <command>dh</command> command and is outside the scope of
1311  this document.  </para> </footnote>  this document.  </para> </footnote>
# Line 1153  testing them (<xref linkend="checkit"/>) Line 1351  testing them (<xref linkend="checkit"/>)
1351  All the steps will be explained.  All the steps will be explained.
1352  </para>  </para>
1353  <para>  <para>
 Once again, as a new maintainer you are discouraged from creating complicated  
 packages, e.g.:  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 multiple binary packages;  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 library packages;  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel module packages;  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel patch packages;  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 packages with the source in a format other than <filename>tar.gz</filename> or  
 <filename>tar.bz2</filename>; or  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 packages where the source tarball contains undistributable contents.  
 </para>  
 </listitem>  
 </itemizedlist>  
 <para>  
 Doing so is not too hard, but it requires a bit more knowledge, so we won't  
 describe all of it here.  
 </para>  
 <para>  
1354  If you accidentally erased some template files while working on them, you can  If you accidentally erased some template files while working on them, you can
1355  recover them by running <command>dh_make</command> with the  recover them by running <command>dh_make</command> with the
1356  <literal>--addmissing</literal> option again in a Debian package source tree.  <literal>--addmissing</literal> option again in a Debian package source tree.
# Line 1203  Updating an existing package may get com Line 1360  Updating an existing package may get com
1360  techniques.  While learning the basics, please stick to creating a fresh  techniques.  While learning the basics, please stick to creating a fresh
1361  package; further explanations are given in <xref linkend="update"/>.  package; further explanations are given in <xref linkend="update"/>.
1362  </para>  </para>
1363    <para>
1364    Please note that the source file does not need to contain any build system
1365    discussed in <xref linkend="simplemake"/> and <xref linkend="portable"/>.  It
1366    could be just a collection of graphical data etc.  Installation of files may be
1367    carried out using only <systemitem role="package">debhelper</systemitem> configuration
1368    files such as <filename>debian/install</filename> (see
1369    <xref linkend="install"/>).
1370    </para>
1371    </section>
1372    <section id="native-dh-make"><title>Initial native Debian package</title>
1373    <para>
1374    If a package contains source files you are only maintaining for Debian,
1375    possibly only for local use, it may be simpler to create it as a Debian
1376    native package. If you have source
1377    files in <filename>~/mypackage-1.0</filename>, you can create an initial native
1378    Debian package for it by issuing the <command>dh_make</command> command as
1379    follows.
1380    </para>
1381    <screen>
1382    $ cd ~/mypackage-1.0
1383    $ dh_make --native
1384    </screen>
1385    <para>
1386    Then the <filename>debian</filename> directory and its contents are created
1387    just like <xref linkend="non-native-dh-make"/>.  This does not create a tarball
1388    since this is a native Debian package.  But that is the only difference.
1389    The rest of the packaging activities are practically the same.
1390    </para>
1391  </section>  </section>
1392  </chapter>  </chapter>
1393  <chapter id="modify"><title>Modifying the source</title>  <chapter id="modify"><title>Modifying the source</title>
# Line 1220  useful to have a slightly customized def Line 1405  useful to have a slightly customized def
1405  line to <filename>~/.bashrc</filename>.  line to <filename>~/.bashrc</filename>.
1406  </para>  </para>
1407  <screen>  <screen>
1408  alias dquilt="quilt --quiltrc=~/.quiltrc-dpkg"  alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"
1409  </screen>  </screen>
1410  <para>  <para>
1411  Then let's create <filename>~/.quiltrc-dpkg</filename> as follows.  Then let's create <filename>~/.quiltrc-dpkg</filename> as follows.
# Line 1346  installation.  The packaging script will Line 1531  installation.  The packaging script will
1531  <literal>$(DESTDIR)</literal> to the temporary directory.  <literal>$(DESTDIR)</literal> to the temporary directory.
1532  </para>  </para>
1533  <para>  <para>
1534  For packages of the single-binary type, the temporary directory used  For a source package generating a single binary package, the temporary directory used
1535  by the <command>dh_auto_install</command> command will be set to  by the <command>dh_auto_install</command> command will be set to
1536  <filename>debian/<replaceable>package</replaceable></filename>.  <filename>debian/<replaceable>package</replaceable></filename>.
1537  <footnote><para> For packages of the multiple-binary type, the  <footnote><para> For a source package generating multiple binary packages, the
1538  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>
1539  as the temporary directory while the <command>dh_install</command> command with  as the temporary directory while the <command>dh_install</command> command with
1540  the help of  the help of
# Line 1388  from the <command>dh_auto_configure</com Line 1573  from the <command>dh_auto_configure</com
1573  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:
1574  </para>  </para>
1575  <screen>  <screen>
1576  # Where to put binary on 'make install'?  # Where to put executable commands on 'make install'?
1577  BIN     = /usr/local/bin  BIN     = /usr/local/bin
1578  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1579  ICONS   = /usr/local/share/gentoo  ICONS   = /usr/local/share/gentoo
# Line 1399  As explained above, that directory hiera Line 1584  As explained above, that directory hiera
1584  Debian, so change those paths to:  Debian, so change those paths to:
1585  </para>  </para>
1586  <screen>  <screen>
1587  # Where to put binary on 'make install'?  # Where to put executable commands on 'make install'?
1588  BIN     = $(DESTDIR)/usr/bin  BIN     = $(DESTDIR)/usr/bin
1589  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1590  ICONS   = $(DESTDIR)/usr/share/gentoo  ICONS   = $(DESTDIR)/usr/share/gentoo
# Line 1411  documentation, etc. are specified in the Line 1596  documentation, etc. are specified in the
1596  your package.  your package.
1597  </para>  </para>
1598  <para>  <para>
1599  So, we should install the binary in <filename>/usr/bin</filename> instead of  So, we should install executable commands in <filename>/usr/bin</filename> instead of
1600  <filename>/usr/local/bin</filename>, the manual page in  <filename>/usr/local/bin</filename>, the manual page in
1601  <filename>/usr/share/man/man1</filename> instead of  <filename>/usr/share/man/man1</filename> instead of
1602  <filename>/usr/local/man/man1</filename>, and so on.  Notice how there's no manual  <filename>/usr/local/man/man1</filename>, and so on.  Notice how there's no manual
# Line 1438  Edit those files and in those lines repl Line 1623  Edit those files and in those lines repl
1623  with <literal>usr/lib</literal>.  This can be done automatically as follows:  with <literal>usr/lib</literal>.  This can be done automatically as follows:
1624  </para>  </para>
1625  <screen>  <screen>
1626  $ sed -i 's#usr/local/lib#usr/lib#g' \  $ sed -i -e 's#usr/local/lib#usr/lib#g' \
1627        $(find . -type f -name '*.[c|h]')        $(find . -type f -name '*.[c|h]')
1628  </screen>  </screen>
1629  <para>  <para>
1630  If you want to confirm each substituion instead, this can be done interactively as follows:  If you want to confirm each substitution instead, this can be done interactively as follows:
1631  </para>  </para>
1632  <screen>  <screen>
1633  $ vim '+argdo %s#usr/local/lib#usr/lib#gce|update' +q \  $ vim '+argdo %s#usr/local/lib#usr/lib#gce|update' +q \
# Line 1457  at the top of the <filename>Makefile</fi Line 1642  at the top of the <filename>Makefile</fi
1642  </para>  </para>
1643  <para>  <para>
1644  Originally, <systemitem role="package">gentoo</systemitem>'s  Originally, <systemitem role="package">gentoo</systemitem>'s
1645  install target said:  <literal>install</literal> target said:
1646  </para>  </para>
1647  <screen>  <screen>
1648  install: gentoo-target  install: gentoo-target
# Line 1527  Debian specific packaging modification: Line 1712  Debian specific packaging modification:
1712  </listitem>  </listitem>
1713  </orderedlist>  </orderedlist>
1714  <para>  <para>
1715  Whenever you make changes that are not specifically related to Debian package  Whenever you make changes that are not specific to the Debian package
1716  such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to  such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to
1717  send them to the upstream maintainer so they can be included in the next  send them to the upstream maintainer so they can be included in the next
1718  revision of the program and be useful to everyone else.  Also remember  version of the program and be useful to everyone else.  Also remember
1719  to avoid making your fixes specific to Debian or Linux - or even Unix!  to avoid making your fixes specific to Debian or Linux - or even Unix!
1720  Make them portable.  This will make your fixes much easier to apply.  Make them portable.  This will make your fixes much easier to apply.
1721  </para>  </para>
# Line 1543  upstream. Line 1728  upstream.
1728  <para>  <para>
1729  There is one other common problem: libraries are often different from platform  There is one other common problem: libraries are often different from platform
1730  to platform.  For example, a <filename>Makefile</filename> can contain a  to platform.  For example, a <filename>Makefile</filename> can contain a
1731  reference to a library which doesn't exist on Debian systems.  In that case, we  reference to a library which doesn't exist on the Debian system.  In that case, we
1732  need to change it to a library which does exist in Debian, and serves the same  need to change it to a library which does exist in Debian, and serves the same
1733  purpose.  purpose.
1734  </para>  </para>
1735  <para>  <para>
1736  So, if there is a line in your program's <filename>Makefile</filename> (or  Let's assume a line in your program's <filename>Makefile</filename> (or
1737  <filename>Makefile.in</filename>) that says something like this (and your  <filename>Makefile.in</filename>) as the following.
 program doesn't compile) <footnote><para> The author realizes that this is not  
 the best example considering our <systemitem role="package">libncurses</systemitem> package now ships with a  
 <filename>libcurses.so</filename> symlink, but he couldn't think of a better  
 one.  Suggestions very welcome&nbsp;:-) </para> </footnote>:  
1738  </para>  </para>
1739  <screen>  <screen>
1740  LIBS = -lcurses -lsomething -lsomethingelse  LIBS = -lfoo -lbar
1741  </screen>  </screen>
1742  <para>  <para>
1743  Let's fix this as <filename>debian/patches/ncurses.patch</filename> by changing  If your program doesn't compile since the <literal>foo</literal> library
1744  <literal>curses</literal> into <literal>ncurses</literal>.  doesn't exist and its equivalent is provided by the <literal>foo2</literal>
1745    library on the Debian system, you can fix this build problem as
1746    <filename>debian/patches/foo2.patch</filename> by changing
1747    <literal>foo</literal> into <literal>foo2</literal>.<footnote><para>If there
1748    are API changes from the <literal>foo</literal> library to the
1749    <literal>foo2</literal> library, required changes to the source code need to be
1750    made to match the new API.</para> </footnote>
1751  </para>  </para>
1752  <screen>  <screen>
1753  $ dquilt new ncurses.patch  $ dquilt new foo2.patch
1754  $ dquilt add Makefile  $ dquilt add Makefile
1755  $ sed -i s/-lcurses/-lncurses/g Makefile  $ sed -i -e 's/-lfoo/-lfoo2/g' Makefile
1756  $ dquilt refresh  $ dquilt refresh
1757  $ dquilt header -e  $ dquilt header -e
1758  ... describe patch  ... describe patch
# Line 1574  $ dquilt header -e Line 1761  $ dquilt header -e
1761  </chapter>  </chapter>
1762  <chapter id="dreq"><title>Required files under the <filename>debian</filename> directory</title>  <chapter id="dreq"><title>Required files under the <filename>debian</filename> directory</title>
1763  <para>  <para>
1764  There is a new subdirectory under the program's source directory, it's called  There is a new subdirectory under the program's source directory, called
1765  <filename>debian</filename>.  There are a number of files in this directory  <filename>debian</filename>.  There are a number of files in this directory
1766  that we should edit in order to customize the behavior of the package.  The  that we should edit in order to customize the behavior of the package.  The
1767  most important of them are <filename>control</filename>,  most important of them are <filename>control</filename>,
1768  <filename>changelog</filename>, <filename>copyright</filename> and  <filename>changelog</filename>, <filename>copyright</filename>, and
1769  <filename>rules</filename>, which are required for all packages.  <filename>rules</filename>, which are required for all packages.
1770  <footnote><para>  <footnote><para>
1771  In this chapter, files in the <filename>debian</filename> directory are  In this chapter, files in the <filename>debian</filename> directory are
1772  referred without preceding <filename>debian/</filename> for simplicity whenever  referred to without the leading <filename>debian/</filename> for simplicity whenever
1773  they are obvious.  the meaning is obvious.
1774  </para></footnote>  </para></footnote>
1775  </para>  </para>
1776  <section id="control"><title><filename>control</filename> file</title>  <section id="control"><title><filename>control</filename></title>
1777  <para>  <para>
1778  This file contains various values which <command>dpkg</command>,  This file contains various values which <command>dpkg</command>,
1779  <command>dselect</command>, <command>apt-get</command>,  <command>dselect</command>, <command>apt-get</command>,
1780  <command>apt-cache</command>, <command>aptitude</command>, and other package  <command>apt-cache</command>, <command>aptitude</command>, and other package
1781  management tools will use to manage the package.  It is defined by the <ulink url="&policy-control;">Debian  management tools will use to manage the package.  It is defined by the
1782  Policy Manual, 5 'Control files and their fields'</ulink>.  <ulink url="&policy-control;">Debian Policy Manual, 5 "Control files and their fields"</ulink>.
1783  </para>  </para>
1784  <para>  <para>
1785  Here is the <filename>control</filename> file <command>dh_make</command>  Here is the <filename>control</filename> file <command>dh_make</command>
# Line 1627  Line 1 is the name of the source package Line 1814  Line 1 is the name of the source package
1814  Line 2 is the section of the distribution the source package goes into.  Line 2 is the section of the distribution the source package goes into.
1815  </para>  </para>
1816  <para>  <para>
1817  As you may have noticed, Debian archive is divided in sections:  As you may have noticed, the Debian archive is divided into multiple areas:
1818  <literal>main</literal> (the free software), <literal>non-free</literal> (the  <literal>main</literal> (the free software), <literal>non-free</literal> (the
1819  not really free software) and <literal>contrib</literal> (free software that  not really free software) and <literal>contrib</literal> (free software that
1820  depends on non-free software).  Under those, there are logical subsections that  depends on non-free software).  Each of these is divided into sections that
1821  describe in short what packages are in.  So we have <literal>admin</literal>  classify packages into rough categories.  So we have <literal>admin</literal>
1822  for administrator-only programs, <literal>base</literal> for the basic tools,  for administrator-only programs,
1823  <literal>devel</literal> for programmer tools, <literal>doc</literal> for  <literal>devel</literal> for programmer tools, <literal>doc</literal> for
1824  documentation, <literal>libs</literal> for libraries, <literal>mail</literal>  documentation, <literal>libs</literal> for libraries, <literal>mail</literal>
1825  for e-mail readers and daemons, <literal>net</literal> for network apps and  for email readers and daemons, <literal>net</literal> for network apps and
1826  daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,  daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,
1827  and many more.  and many more.
1828  <footnote> <para>See  <footnote> <para>See
1829  <ulink url="&policy-subsections;">Debian Policy Manual, 2.4 'Sections'</ulink> and  <ulink url="&policy-subsections;">Debian Policy Manual, 2.4 "Sections"</ulink> and
1830  <ulink url="&sections-unstable;">List of sections in <literal>sid</literal></ulink>.</para>  <ulink url="&sections-unstable;">List of sections in <literal>sid</literal></ulink>.</para>
1831  </footnote>  </footnote>
1832  </para>  </para>
# Line 1650  we can omit it.) Line 1837  we can omit it.)
1837  <para>  <para>
1838  Line 3 describes how important it is that the user installs this package.  Line 3 describes how important it is that the user installs this package.
1839  <footnote> <para>See  <footnote> <para>See
1840  <ulink url="&policy-priorities;">Debian Policy Manual, 2.5 'Priorities'</ulink>.  <ulink url="&policy-priorities;">Debian Policy Manual, 2.5 "Priorities"</ulink>.
1841  </para>  </para>
1842  </footnote>  </footnote>
1843  </para>  </para>
# Line 1658  Line 3 describes how important it is tha Line 1845  Line 3 describes how important it is tha
1845  <listitem>  <listitem>
1846  <para>  <para>
1847  The <literal>optional</literal> priority will usually work for new packages  The <literal>optional</literal> priority will usually work for new packages
1848  that do not conflict with others with <literal>required</literal>,  that do not conflict with others claiming <literal>required</literal>,
1849  <literal>important</literal> or <literal>standard</literal> priorities.  <literal>important</literal>, or <literal>standard</literal> priority.
1850  </para>  </para>
1851  </listitem>  </listitem>
1852  <listitem>  <listitem>
# Line 1670  conflict with others with non-<literal>e Line 1857  conflict with others with non-<literal>e
1857  </listitem>  </listitem>
1858  </itemizedlist>  </itemizedlist>
1859  <para>  <para>
1860  Section and priority are used by the frontends like <command>aptitude</command>  Section and priority are used by front-ends like <command>aptitude</command>
1861  when they sort packages and select defaults.  Once you upload the package to  when they sort packages and select defaults.  Once you upload the package to
1862  Debian, the value of these two fields can be overridden by the archive  Debian, the value of these two fields can be overridden by the archive
1863  maintainers, in which case you will be notified by email.  maintainers, in which case you will be notified by email.
# Line 1681  we will change the priority to <literal> Line 1868  we will change the priority to <literal>
1868  </para>  </para>
1869  <para>  <para>
1870  Line 4 is the name and email address of the maintainer.  Make sure that this  Line 4 is the name and email address of the maintainer.  Make sure that this
1871  field includes a valid <literal>To</literal> header for an email, because after  field includes a valid <literal>To</literal> header for email, because after
1872  you upload it, the bug tracking system will use it to deliver bug emails to  you upload it, the bug tracking system will use it to deliver bug emails to
1873  you.  Avoid using commas, ampersands and parenthesis.  you.  Avoid using commas, ampersands, or parentheses.
1874  </para>  </para>
1875  <para>  <para>
1876  The 5th line includes the list of packages required to build your package as  Line 5 includes the list of packages required to build your package as
1877  the <literal>Build-Depends</literal> field.  You can also have the  the <literal>Build-Depends</literal> field.  You can also have the
1878  <literal>Build-Depends-Indep</literal> field as an additional line, here.  <literal>Build-Depends-Indep</literal> field as an additional line, here.
1879  <footnote><para>See <ulink url="&policy-relationships;#s-sourcebinarydeps">Debian  <footnote><para>See
1880  Policy Manual, 7.7 'Relationships between source and binary packages -  <ulink url="&policy-relationships;#s-sourcebinarydeps">Debian Policy Manual, 7.7 "Relationships between source and binary packages - Build-Depends, Build-Depends-Indep, Build-Conflicts, Build-Conflicts-Indep"</ulink>.</para></footnote>
1881  Build-Depends, Build-Depends-Indep, Build-Conflicts,  Some packages like
 Build-Conflicts-Indep'</ulink>.</para></footnote>  Some packages like  
1882  <systemitem role="package">gcc</systemitem> and  <systemitem role="package">gcc</systemitem> and
1883  <systemitem role="package">make</systemitem> which are required by the  <systemitem role="package">make</systemitem> which are required by the
1884  <systemitem role="package">build-essential</systemitem> package are implied.  If you need  <systemitem role="package">build-essential</systemitem> package are implied.  If you need
1885  to have other tools to build your package, you should add them to these fields.  to have other tools to build your package, you should add them to these fields.
1886  Multiple entries are separated with commas; read on for the explanation of  Multiple entries are separated with commas; read on for the explanation of
1887  binary dependencies to find out more about the syntax of these lines.  binary package dependencies to find out more about the syntax of these lines.
1888  </para>  </para>
1889  <itemizedlist>  <itemizedlist>
1890  <listitem>  <listitem>
# Line 1711  satisfy the Debian Policy requirement fo Line 1897  satisfy the Debian Policy requirement fo
1897  </listitem>  </listitem>
1898  <listitem>  <listitem>
1899  <para>  <para>
1900  For source packages which have some binary packages with <literal>Architecture:  Source packages which have binary packages with <literal>Architecture:
1901  any</literal>, they are rebuild by the autobuilder.  Since this autobuilder  any</literal> are rebuilt by the autobuilder.  Since this autobuilder
1902  procedure runs <literal>debian/rules build</literal> in it while installing  procedure installs only the packages listed in the
1903  only packages listed in the <literal>Build-Depends</literal> field (see <xref linkend="autobuilder"/>), the <literal>Build-Depends</literal> field needs to  <literal>Build-Depends</literal> field before running
1904  list practically all the required packages and the  <literal>debian/rules build</literal> (see <xref
1905  <literal>Build-Depends-indep</literal> is rarely used.  linkend="autobuilder"/>), the <literal>Build-Depends</literal> field
1906    needs to  list practically all the required packages and
1907    <literal>Build-Depends-Indep</literal> is rarely used.
1908  </para>  </para>
1909  </listitem>  </listitem>
1910  <listitem>  <listitem>
1911  <para>  <para>
1912  For source packages which have binary packages only with <literal>Architecture:  For source packages with binary packages all of which are <literal>Architecture:
1913  all</literal>, the <literal>Build-Depends-Indep</literal> field may list all  all</literal>, the <literal>Build-Depends-Indep</literal> field may list all
1914  the required packages unless they are already listed in the  the required packages unless they are already listed in the
1915  <literal>Build-Depends</literal> field to satisfy the Debian Policy requirement  <literal>Build-Depends</literal> field to satisfy the Debian Policy requirement
# Line 1734  If you are not sure which one should be Line 1922  If you are not sure which one should be
1922  <literal>Build-Depends</literal> field to be on the safe side.  <literal>Build-Depends</literal> field to be on the safe side.
1923  <footnote><para> This somewhat strange situation is a feature well documented  <footnote><para> This somewhat strange situation is a feature well documented
1924  in the <ulink url="&policy-build-depends-indep;">Debian Policy  in the <ulink url="&policy-build-depends-indep;">Debian Policy
1925  Manual, Footnotes 48</ulink>.  This is not due to the use of the  Manual, Footnotes 55</ulink>.  This is not due to the use of the
1926  <command>dh</command> command in the <filename>debian/rules</filename> file but  <command>dh</command> command in the <filename>debian/rules</filename> file but
1927  due to how the <command>dpkg-buildpackage</command> works.  The same situation  due to how the <command>dpkg-buildpackage</command> works.  The same situation
1928  applies to the <ulink url="https://bugs.launchpad.net/launchpad-buildd/+bug/238141">auto build system  applies to the <ulink url="https://bugs.launchpad.net/launchpad-buildd/+bug/238141">auto build system
# Line 1747  To find out what packages your package n Line 1935  To find out what packages your package n
1935  $ dpkg-depcheck -d ./configure  $ dpkg-depcheck -d ./configure
1936  </screen>  </screen>
1937  <para>  <para>
1938  To manually find exact build dependency for  To manually find exact build dependencies for
1939  <command><replaceable>/usr/bin/foo</replaceable></command>, you execute  <command><replaceable>/usr/bin/foo</replaceable></command>, execute
1940  </para>  </para>
1941  <screen>  <screen>
1942  $ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED  $ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED
# Line 1760  and for each library listed, e.g., <comm Line 1948  and for each library listed, e.g., <comm
1948  $ dpkg -S libfoo.so.6  $ dpkg -S libfoo.so.6
1949  </screen>  </screen>
1950  <para>  <para>
1951  Then you just take <literal>-dev</literal> version of every package as  Then just take the <literal>-dev</literal> version of every package as a
1952  <literal>Build-Depends</literal> entry.  If you use <command>ldd</command> for  <literal>Build-Depends</literal> entry.  If you use <command>ldd</command> for
1953  this purpose, it will report indirect lib dependencies as well, resulting in  this purpose, it will report indirect lib dependencies as well, resulting in
1954  the problem of excessive build dependencies.  the problem of excessive build dependencies.
# Line 1776  Manual</ulink> standards this package fo Line 1964  Manual</ulink> standards this package fo
1964  your package.  your package.
1965  </para>  </para>
1966  <para>  <para>
1967  On line 7 you can put the URL of the homepage for the upstream program.  On line 7 you can put the URL of the software's upstream homepage.
1968  </para>  </para>
1969  <para>  <para>
1970  Line 9 is the name of the binary package.  This is usually the same as the name  Line 9 is the name of the binary package.  This is usually the same as the name
1971  of the source package, but it doesn't necessarily have to be that way.  of the source package, but it doesn't necessarily have to be that way.
1972  </para>  </para>
1973  <para>  <para>
1974  Line 10 describes the CPU architecture the binary package can be compiled for.  Line 10 describes the architectures the binary package can be compiled for.
1975  We'll leave this as <literal>any</literal> because <citerefentry>  This value is usually one of the following depending
1976  <refentrytitle>dpkg-gencontrol</refentrytitle> <manvolnum>1</manvolnum>  on the type of the binary package.
1977  </citerefentry> will fill in the appropriate value for any machine this package  <footnote><para>See
1978  gets compiled on.  <ulink url="&policy-architecture;">Debian Policy Manual 5.6.8 "Architecture"</ulink>
1979    for exact details.
1980    </para></footnote>
1981    </para>
1982    <itemizedlist>
1983    <listitem><para><literal>Architecture: any</literal></para>
1984      <itemizedlist>
1985      <listitem><para>The generated binary package is an architecture dependent one
1986        usually in a compiled language.</para></listitem>
1987      </itemizedlist>
1988    </listitem>
1989    <listitem><para><literal>Architecture: all</literal></para>
1990      <itemizedlist>
1991      <listitem><para>The generated binary package is an architecture independent
1992        one usually consisting of text, images, or scripts in an interpreted
1993        language.</para></listitem>
1994      </itemizedlist>
1995    </listitem>
1996    </itemizedlist>
1997    <para>
1998    We leave line 10 as is since this is written in C.
1999    <citerefentry><refentrytitle>dpkg-gencontrol</refentrytitle><manvolnum>1</manvolnum></citerefentry>
2000    will fill in the appropriate architecture value for any machine this source
2001    package gets compiled on.
2002  </para>  </para>
2003  <para>  <para>
2004  If your package is architecture independent (for example, a shell or Perl  If your package is architecture independent (for example, a shell or Perl
# Line 1806  Packages can relate to each other in var Line 2017  Packages can relate to each other in var
2017  </para>  </para>
2018  <para>  <para>
2019  The package management tools usually behave the same way when dealing with  The package management tools usually behave the same way when dealing with
2020  these relations; if not, it will be explained.  (see <citerefentry>  these relations; if not, it will be explained.  (See <citerefentry>
2021  <refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,  <refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,
2022  <citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>  <citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>
2023  </citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>  </citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>
2024  <manvolnum>8</manvolnum> </citerefentry>, <citerefentry>  <manvolnum>8</manvolnum> </citerefentry>, <citerefentry>
2025  <refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>
2026  </citerefentry> etc.)  </citerefentry>, etc.)
2027  </para>  </para>
2028  <para>  <para>
2029  Here is a simplified description of package relationships.  Here is a simplified description of package relationships.
2030  <footnote><para>See  <footnote><para>See
2031  <ulink url="&policy-relationships;">Debian Policy Manual, 7 'Declaring relationships between packages'</ulink>.  <ulink url="&policy-relationships;">Debian Policy Manual, 7 "Declaring relationships between packages"</ulink>.
2032  </para></footnote>  </para></footnote>
2033  </para>  </para>
2034  <itemizedlist>  <itemizedlist>
# Line 1837  severe breakage) unless a particular pac Line 2048  severe breakage) unless a particular pac
2048  </para>  </para>
2049  <para>  <para>
2050  Use this for packages that are not strictly necessary but are typically used  Use this for packages that are not strictly necessary but are typically used
2051  with your program.  When a user installs your program, all frontends will  with your program.  When a user installs your program, all front-ends will
2052  likely prompt them to install the recommended packages.  probably prompt them to install the recommended packages.
2053  <command>aptitude</command> and <command>apt-get</command> install recommended  <command>aptitude</command> and <command>apt-get</command> install recommended
2054  packages along with your package (but the user can disable this default  packages along with your package by default (but the user can disable this
2055  behaviour).  <command>dpkg</command> will ignore this field.  behavior).  <command>dpkg</command> will ignore this field.
2056  </para>  </para>
2057  </listitem>  </listitem>
2058  <listitem>  <listitem>
# Line 1850  behaviour).  <command>dpkg</command> wil Line 2061  behaviour).  <command>dpkg</command> wil
2061  </para>  </para>
2062  <para>  <para>
2063  Use this for packages which will work nicely with your program but are not at  Use this for packages which will work nicely with your program but are not at
2064  all necessary.  When a user installs your program, all frontends will likely  all necessary.  When a user installs your program, they will probably not be
2065  prompt them to install the suggested packages.  <command>aptitude</command> can  prompted to install suggested packages.  <command>aptitude</command> can
2066  be configured to install suggested packages along with your package but this is  be configured to install suggested packages along with your package but this is
2067  not its default.  <command>dpkg</command> and <command>apt-get</command> will  not its default.  <command>dpkg</command> and <command>apt-get</command> will
2068  ignore this field.  ignore this field.
# Line 1884  severe problems if a particular package Line 2095  severe problems if a particular package
2095  <literal>Breaks</literal>  <literal>Breaks</literal>
2096  </para>  </para>
2097  <para>  <para>
2098  The package will be installed while all the listed packages will be broken.  When installed the package will break all the listed packages.
2099  Normally a <literal>Breaks</literal> entry has an earlier than version clause.  Normally a <literal>Breaks</literal> entry specifies that it applies to versions earlier than a certain value.
2100  The resolution is generally to upgrade the listed packages by the higher-level  The resolution is generally to use higher-level package management tools to upgrade the listed packages.
 package management tools.  
2101  </para>  </para>
2102  </listitem>  </listitem>
2103  <listitem>  <listitem>
# Line 1922  symbols). Line 2132  symbols).
2132  </para>  </para>
2133  <para>  <para>
2134  The fields may restrict their applicability to particular versions of each  The fields may restrict their applicability to particular versions of each
2135  named package.  These versions are listed in parentheses after each individual  named package.  The restriction of each individual package is listed in
2136  package name, and they should contain a relation from the list below followed  parentheses after its name, and should contain a relation from the list below
2137  by the version number.  The relations allowed are: <literal>&lt;&lt;</literal>,  followed by a version number value.
2138  <literal>&lt;=</literal>, <literal>=</literal>, <literal>&gt;=</literal> and  The relations allowed are: <literal>&lt;&lt;</literal>,
2139    <literal>&lt;=</literal>, <literal>=</literal>, <literal>&gt;=</literal>, and
2140  <literal>&gt;&gt;</literal> for strictly lower, lower or equal, exactly equal,  <literal>&gt;&gt;</literal> for strictly lower, lower or equal, exactly equal,
2141  greater or equal and strictly greater, respectively.  For example,  greater or equal, and strictly greater, respectively.  For example,
2142  </para>  </para>
2143  <screen>  <screen>
2144  Depends: foo (&gt;= 1.2), libbar1 (= 1.3.4)  Depends: foo (&gt;= 1.2), libbar1 (= 1.3.4)
# Line 1944  The last feature you need to know about Line 2155  The last feature you need to know about
2155  <para>  <para>
2156  <citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>  <citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>
2157  <manvolnum>1</manvolnum> </citerefentry> calculates shared library dependencies  <manvolnum>1</manvolnum> </citerefentry> calculates shared library dependencies
2158  for binary packages.  It generates a list of ELF executables and shared  for binary packages.  It generates a list of <ulink url="&elf;">ELF</ulink> executables and shared
2159  libraries it has found for each binary package.  Such list is used for  libraries it has found for each binary package.  This list is used for
2160  substituting <literal>${shlibs:Depends}</literal>.  substituting <literal>${shlibs:Depends}</literal>.
2161  </para>  </para>
2162  <para>  <para>
2163  <citerefentry> <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum>
2164  </citerefentry> calculates Perl dependencies.  It generates a list of a  </citerefentry> calculates Perl dependencies.  It generates a list of a
2165  dependency on <literal>perl</literal> or <literal>perlapi</literal> for each binary package.  Such list is used for  dependencies on <literal>perl</literal> or <literal>perlapi</literal> for each binary package.  This list is used for
2166  substituting <literal>${perl:Depends}</literal>.  substituting <literal>${perl:Depends}</literal>.
2167  </para>  </para>
2168  <para>  <para>
2169  Some <systemitem role="package">debhelper</systemitem> commands may make the  Some <systemitem role="package">debhelper</systemitem> commands may cause the
2170  generated package need to depend on some other packages.  All such commands  generated package to depend on some additional packages.  All such commands
2171  generate a list of required packages for each binary package.  generate a list of required packages for each binary package.
2172  Such list is used for substituting <literal>${misc:Depends}</literal>.  This list is used for substituting <literal>${misc:Depends}</literal>.
2173  </para>  </para>
2174  <para>  <para>
2175  <citerefentry> <refentrytitle>dh_gencontrol</refentrytitle>  <citerefentry> <refentrytitle>dh_gencontrol</refentrytitle>
# Line 1971  substituting <literal>${shlibs:Depends}< Line 2182  substituting <literal>${shlibs:Depends}<
2182  Having said all that, we can leave the <literal>Depends</literal> field exactly  Having said all that, we can leave the <literal>Depends</literal> field exactly
2183  as it is now, and insert another line after it saying <literal>Suggests:  as it is now, and insert another line after it saying <literal>Suggests:
2184  file</literal>, because <systemitem role="package">gentoo</systemitem> can use  file</literal>, because <systemitem role="package">gentoo</systemitem> can use
2185  some features provided by that <systemitem role="package">file</systemitem>  some features provided by the <systemitem role="package">file</systemitem>
2186  package.  package.
2187  </para>  </para>
2188  <para> Line 9 is the Homepage URL.  Let's assume this to be at  <para> Line 9 is the Homepage URL.  Let's assume this to be at
2189  <ulink url="&gentoo;"/>.  <ulink url="&gentoo;"/>.
2190  </para>  </para>
2191  <para>  <para>
2192  Line 12 is the short description.  Most people screens are 80 columns wide so  Line 12 is the short description.  Terminals are conventionally 80 columns wide so
2193  this shouldn't be longer than about 60 characters.  I'll change it to  this shouldn't be longer than about 60 characters.  I'll change it to
2194  <literal>fully GUI-configurable, two-pane X file manager</literal>.  <literal>fully GUI-configurable, two-pane X file manager</literal>.
2195  </para>  </para>
# Line 1992  English.  Translations of these descript Line 2203  English.  Translations of these descript
2203  <ulink url="&ddtp;">The Debian Description Translation Project - DDTP</ulink>.</para></footnote>  <ulink url="&ddtp;">The Debian Description Translation Project - DDTP</ulink>.</para></footnote>
2204  </para>  </para>
2205  <para>  <para>
2206  Let's insert <literal>Vcs-*</literal> fields to document the Version Control  We can insert <literal>Vcs-*</literal> fields to document the Version Control
2207  System (VCS) location between line 6 and 7.  System (VCS) location between lines 6 and 7.
2208  <footnote><para>See  <footnote><para>See
2209  <ulink url="&devref-bpp-vcs;">Developer's Reference, 6.2.5. 'Version Control System location'</ulink>.  <ulink url="&devref-bpp-vcs;">Debian Developer's Reference, 6.2.5. "Version Control System location"</ulink>.
2210  </para></footnote>  </para></footnote>
2211  Let's assume that the <systemitem role="package">gentoo</systemitem>  Let's assume that the <systemitem role="package">gentoo</systemitem>
2212  package has its VCS located in Debian Alioth Git Service at  package has its VCS located in the Debian Alioth Git Service at
2213  <literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.  <literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.
2214  </para>  </para>
2215  <para>  <para>
# Line 2026  Finally, here is the updated <filename>c Line 2237  Finally, here is the updated <filename>c
2237  19  they're fairly easy to work with since they are written in an XML format.  19  they're fairly easy to work with since they are written in an XML format.
2238  20  .  20  .
2239  21  gentoo features a fairly complex and powerful file identification system,  21  gentoo features a fairly complex and powerful file identification system,
2240  22  coupled to a object-oriented style system, which together give you a lot  22  coupled to an object-oriented style system, which together give you a lot
2241  23  of control over how files of different types are displayed and acted upon.  23  of control over how files of different types are displayed and acted upon.
2242  24  Additionally, over a hundred pixmap images are available for use in file  24  Additionally, over a hundred pixmap images are available for use in file
2243  25  type descriptions.  25  type descriptions.
2244  26  .  26  .
2245  29  gentoo was written from scratch in ANSI C, and it utilises the GTK+ toolkit  29  gentoo was written from scratch in ANSI C, and it utilizes the GTK+ toolkit
2246  30  for its interface.  30  for its interface.
2247  </screen>  </screen>
2248  <para>  <para>
2249  (I've added the line numbers.)  (I've added the line numbers.)
2250  </para>  </para>
2251  </section>  </section>
2252  <section id="copyright"><title><filename>copyright</filename> file</title>  <section id="copyright"><title><filename>copyright</filename></title>
2253  <para>  <para>
2254  This file contains the information about package upstream resources, copyright  This file contains information about the copyright and license of the upstream sources.
2255  and license information.  <ulink url="&policy-copyright;">Debian Policy Manual, 12.5 "Copyright information"</ulink>
2256  <ulink url="&policy-copyright;">Debian Policy Manual, 12.5 'Copyright information'</ulink>  dictates its content and
2257  dictates its content and  <ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>
 <ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>  
2258  provides guidelines for its format.  provides guidelines for its format.
2259  </para>  </para>
2260  <para>  <para>
# Line 2053  provides guidelines for its format. Line 2263  provides guidelines for its format.
2263  gpl2</literal> option here to get a template file for the <systemitem role="package">gentoo</systemitem> package released under GPL-2.  gpl2</literal> option here to get a template file for the <systemitem role="package">gentoo</systemitem> package released under GPL-2.
2264  </para>  </para>
2265  <para>  <para>
2266  You must fill in missing information such as the place you got the package  You must fill in missing information to complete this file, such as the place you got the package
2267  from, the actual copyright notice and their license to complete this file.  For  from, the actual copyright notice, and the license.  For certain
2268  the common free software licenses such as GNU GPL-1, GNU GPL-2, GNU GPL-3,  common free software licenses (GNU GPL-1, GNU GPL-2, GNU GPL-3,
2269  LGPL-2, LGPL-2.1, LGPL-3, GNU FDL-1.2, GNU FDL-1.3, Apache-2.0 or the Artistic  LGPL-2, LGPL-2.1, LGPL-3, GNU FDL-1.2, GNU FDL-1.3, Apache-2.0, or the Artistic
2270  license, you can just refer to the appropriate file in  license), you can just refer to the appropriate file in the
2271  <filename>/usr/share/common-licenses/</filename> directory that exists on every  <filename>/usr/share/common-licenses/</filename> directory that exists on every
2272  Debian system.  Otherwise, you must include the complete license.  Debian system.  Otherwise, you must include the complete license.
2273  </para>  </para>
2274  <para>  <para>
2275  In short, here's how <systemitem role="package">gentoo</systemitem>'s  In short, here's what <systemitem role="package">gentoo</systemitem>'s
2276  <filename>copyright</filename> file should look like:  <filename>copyright</filename> file should look like:
2277  </para>  </para>
2278  <screen>  <screen>
# Line 2092  In short, here's how <systemitem role="p Line 2302  In short, here's how <systemitem role="p
2302  24  but WITHOUT ANY WARRANTY; without even the implied warranty of  24  but WITHOUT ANY WARRANTY; without even the implied warranty of
2303  25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2304  26  GNU General Public License for more details.  26  GNU General Public License for more details.
2305  27 .  27  .
2306  28  You should have received a copy of the GNU General Public License along  28  You should have received a copy of the GNU General Public License along
2307  29  with this program; if not, write to the Free Software Foundation, Inc.,  29  with this program; if not, write to the Free Software Foundation, Inc.,
2308  30  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  30  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Line 2105  In short, here's how <systemitem role="p Line 2315  In short, here's how <systemitem role="p
2315  (I've added the line numbers.)  (I've added the line numbers.)
2316  </para>  </para>
2317  <para>  <para>
2318  Please follow the HOWTO provided by ftpmasters and sent to  Please follow the HOWTO provided by the ftpmasters and sent to
2319  debian-devel-announce: <ulink url="&howto-copyright;"/>.  debian-devel-announce: <ulink url="&howto-copyright;"/>.
2320  </para>  </para>
2321  </section>  </section>
2322  <section id="changelog"><title><filename>changelog</filename> file</title>  <section id="changelog"><title><filename>changelog</filename></title>
2323  <para>  <para>
2324  This is a required file, which has a special format described in the  This is a required file, which has a special format described in
2325  <ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 'debian/changelog'</ulink>.  <ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 "debian/changelog"</ulink>.
2326  This format is used by <command>dpkg</command> and other programs to obtain the  This format is used by <command>dpkg</command> and other programs to obtain the
2327  version number, revision, distribution and urgency of your package.  version number, revision, distribution, and urgency of your package.
2328  </para>  </para>
2329  <para>  <para>
2330  For you, it is also important, since it is good to have documented all changes  For you, it is also important, since it is good to have documented all changes
# Line 2124  saved as <filename>/usr/share/doc/gentoo Line 2334  saved as <filename>/usr/share/doc/gentoo
2334  binary package.  binary package.
2335  </para>  </para>
2336  <para>  <para>
2337  <command>dh_make</command> created a default one, and this is how it looks  <command>dh_make</command> created a default one, and this is what it looks
2338  like:  like:
2339  </para>  </para>
2340  <screen>  <screen>
# Line 2140  like: Line 2350  like:
2350  </para>  </para>
2351  <para>  <para>
2352  Line 1 is the package name, version, distribution, and urgency.  The name must  Line 1 is the package name, version, distribution, and urgency.  The name must
2353  match the source package name, distribution should be either  match the source package name; distribution should be
2354  <literal>unstable</literal> (or even <literal>experimental</literal>)  <literal>unstable</literal> (or even <literal>experimental</literal>)
2355  <footnote><para> Some people use invalid distribution values such as  <footnote><para> Some people use invalid distribution values such as
2356  <literal>UNRELEASED</literal> to prevent a package to be accidentally uploaded  <literal>UNRELEASED</literal> to prevent a package being accidentally uploaded
2357  when updating a package in a shared VCS.  </para> </footnote>, and urgency  when updating a package in a shared VCS.  </para> </footnote>, and urgency
2358  shouldn't be changed to anything higher than <literal>low</literal>.  :-)  shouldn't be changed to anything higher than <literal>low</literal>.  :-)
2359  </para>  </para>
2360  <para>  <para>
2361  Lines 3-5 are a log entry, where you document changes made in this package  Lines 3-5 are a log entry, where you document changes made in this package
2362  revision (not the upstream changes - there is special file for that purpose,  revision (not the upstream changes - there is a special file for that purpose,
2363  created by the upstream authors, which you will later install as  created by the upstream authors, which you will later install as
2364  <filename>/usr/share/doc/gentoo/changelog.gz</filename>).  Let's assume your  <filename>/usr/share/doc/gentoo/changelog.gz</filename>).  Let's assume your
2365  ITP (Intent To Package) bug report number was <literal>12345</literal>.  New  ITP (Intent To Package) bug report number was <literal>12345</literal>.  New
2366  lines must be inserted just before the uppermost line that begins with  lines must be inserted just below the uppermost line that begins with
2367  <literal>*</literal> (asterisk).  You can do it with <citerefentry>  <literal>*</literal> (asterisk).  You can do it with <citerefentry>
2368  <refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or  <refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or
2369  manually with a text editor.  manually with a text editor.
# Line 2179  You can read more about updating the <fi Line 2389  You can read more about updating the <fi
2389  in <xref linkend="update"/>.  in <xref linkend="update"/>.
2390  </para>  </para>
2391  </section>  </section>
2392  <section id="rules"><title><filename>rules</filename> file</title>  <section id="rules"><title><filename>rules</filename></title>
2393  <para>  <para>
2394  Now we need to take a look at the exact rules which <citerefentry>  Now we need to take a look at the exact rules which <citerefentry>
2395  <refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>
2396  </citerefentry> will use to actually create the package.  This file is actually  </citerefentry> will use to actually create the package.  This file is in fact
2397  another <filename>Makefile</filename>, but different from the one(s) in the  another <filename>Makefile</filename>, but different from the one(s) in the
2398  upstream source.  Unlike other files in <filename>debian</filename>, this one  upstream source.  Unlike other files in <filename>debian</filename>, this one
2399  is marked as executable.  is marked as executable.
2400  </para>  </para>
2401  <section id="targets"><title>Targets of <filename>rules</filename> file</title>  <section id="targets"><title>Targets of the <filename>rules</filename> file</title>
2402  <para>  <para>
2403  Every <filename>rules</filename> file, as any other  Every <filename>rules</filename> file, like any other
2404  <filename>Makefile</filename>, consists of several targets and their rules  <filename>Makefile</filename>, consists of several rules, each of
2405  specifying how to handle the source.  <ulink url="&policy-debianrules;">Debian  which defines a target and how it is carried out.
2406  Policy Manual, 4.9 'Main building script: debian/rules'</ulink> explains its  <footnote><para>You can start learning how to write <filename>Makefile</filename> from
2407  details.  <ulink url="&debref-make;">Debian Reference, 12.2. "Make"</ulink>.
2408    The full documentation is available as
2409    <ulink url="&gnu-make;"></ulink> or as the
2410    <systemitem role="package">make-doc</systemitem> package in the <literal>non-free</literal> archive area.
2411    </para></footnote>
2412    A new rule begins with its target declaration in the first column.  The
2413    following lines beginning with the TAB code (ASCII 9) specify the recipe for
2414    carrying out that target.
2415    Empty lines and lines beginning with <literal>#</literal> (hash) are treated as
2416    comments and ignored.
2417    <footnote><para><ulink url="&policy-debianrules;">Debian
2418    Policy Manual, 4.9 "Main building script: debian/rules"</ulink> explains the
2419    details.</para></footnote>
2420    </para>
2421    <para>
2422    A rule that you want to execute is invoked by its target name as a command line argument.  For
2423    example, <literal>debian/rules <replaceable>build</replaceable></literal> and
2424    <literal>fakeroot make -f debian/rules <replaceable>binary</replaceable></literal>
2425    execute rules for <literal><replaceable>build</replaceable></literal> and
2426    <literal><replaceable>binary</replaceable></literal> targets respectively.
2427  </para>  </para>
2428  <para>  <para>
2429  The simplified explanation of targets are the following.  Here is a simplified explanation of the targets:
2430  </para>  </para>
2431  <itemizedlist>  <itemizedlist>
2432  <listitem>  <listitem>
2433  <para>  <para>
2434  <literal>clean</literal> target: to clean all compiled, generated, and useless  <literal>clean</literal> target: to clean all compiled, generated, and useless
2435  files in the build-tree.  (required)  files in the build-tree.  (Required)
2436  </para>  </para>
2437  </listitem>  </listitem>
2438  <listitem>  <listitem>
2439  <para>  <para>
2440  <literal>build</literal> target: to build the source into compiled programs and  <literal>build</literal> target: to build the source into compiled programs and
2441  formatted documents in the build-tree.  (required)  formatted documents in the build-tree.  (Required)
2442  </para>  </para>
2443  </listitem>  </listitem>
2444  <listitem>  <listitem>
# Line 2217  formatted documents in the build-tree. Line 2446  formatted documents in the build-tree.
2446  <literal>install</literal> target: to install files into a file tree for each  <literal>install</literal> target: to install files into a file tree for each
2447  binary package under the <filename>debian</filename> directory.  If defined,  binary package under the <filename>debian</filename> directory.  If defined,
2448  <literal>binary*</literal> targets effectively depend on this target.  <literal>binary*</literal> targets effectively depend on this target.
2449  (optional)  (Optional)
2450  </para>  </para>
2451  </listitem>  </listitem>
2452  <listitem>  <listitem>
2453  <para>  <para>
2454  <literal>binary</literal> target: to create all binary packages (effectively  <literal>binary</literal> target: to create all binary packages (effectively
2455  combination of <literal>binary-arch</literal> and  a combination of <literal>binary-arch</literal> and
2456  <literal>binary-indep</literal> targets).  (required)<footnote><para> This  <literal>binary-indep</literal> targets).  (Required)<footnote><para> This
2457  target is used by <literal>dpkg-buildpackage</literal> as in <xref linkend="completebuild"/>.  </para> </footnote>  target is used by <literal>dpkg-buildpackage</literal> as in <xref linkend="completebuild"/>.  </para> </footnote>
2458  </para>  </para>
2459  </listitem>  </listitem>
# Line 2232  target is used by <literal>dpkg-buildpac Line 2461  target is used by <literal>dpkg-buildpac
2461  <para>  <para>
2462  <literal>binary-arch</literal> target: to create arch-dependent  <literal>binary-arch</literal> target: to create arch-dependent
2463  (<literal>Architecture: any</literal>) binary packages in the parent directory.  (<literal>Architecture: any</literal>) binary packages in the parent directory.
2464  (required)<footnote><para> This target is used by <literal>dpkg-buildpackage  (Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
2465  -B</literal> as in <xref linkend="autobuilder"/>.  </para> </footnote>  -B</literal> as in <xref linkend="autobuilder"/>.  </para> </footnote>
2466  </para>  </para>
2467  </listitem>  </listitem>
# Line 2240  target is used by <literal>dpkg-buildpac Line 2469  target is used by <literal>dpkg-buildpac
2469  <para>  <para>
2470  <literal>binary-indep</literal> target: to create arch-independent  <literal>binary-indep</literal> target: to create arch-independent
2471  (<literal>Architecture: all</literal>) binary packages in the parent directory.  (<literal>Architecture: all</literal>) binary packages in the parent directory.
2472  (required)<footnote><para> This target is used by <literal>dpkg-buildpackage  (Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
2473  -A</literal>.  </para> </footnote>  -A</literal>.  </para> </footnote>
2474  </para>  </para>
2475  </listitem>  </listitem>
2476  <listitem>  <listitem>
2477  <para>  <para>
2478  <literal>get-orig-source</literal> target: to obtain the most recent version of  <literal>get-orig-source</literal> target: to obtain the most recent version of
2479  the original source package from upstream archive site.  (optional)  the original source package from an upstream archive.  (Optional)
2480  </para>  </para>
2481  </listitem>  </listitem>
2482  </itemizedlist>  </itemizedlist>
2483  <para>  <para>
2484  Rules that you want to execute are invoked as command line arguments (for  You are probably overwhelmed by now, but things are much simpler upon examination of the
 example, <literal>./debian/rules build</literal> or <literal>fakeroot make -f  
 debian/rules binary</literal>).  After the target name, you can name the  
 dependency, program or file that the rule depends on.  After that, there can be  
 any number of commands, indented with  
 <literal><replaceable>TAB</replaceable></literal>.  A new rule begins with the  
 target declaration in the first column.  Empty lines and lines beginning with  
 <literal>#</literal> (hash) are treated as comments and ignored.  
 </para>  
 <para>  
 You are probably confused now, but it will all be clear upon examination of the  
2485  <filename>rules</filename> file that <command>dh_make</command> gives us as a  <filename>rules</filename> file that <command>dh_make</command> gives us as a
2486  default.  You should also read <literal>info make</literal> for more  default.
 information.  
2487  </para>  </para>
2488  </section>  </section>
2489  <section id="defaultrules"><title>Default <filename>rules</filename> file</title>  <section id="defaultrules"><title>Default <filename>rules</filename> file</title>
# Line 2290  Newer <command>dh_make</command> generat Line 2508  Newer <command>dh_make</command> generat
2508  </screen>  </screen>
2509  <para>  <para>
2510  (I've added the line numbers.  In the actual <filename>rules</filename> file,  (I've added the line numbers.  In the actual <filename>rules</filename> file,
2511  the leading white spaces are TAB codes.)  the leading spaces are a TAB code.)
2512  </para>  </para>
2513  <para>  <para>
2514  You are probably familiar with lines like line 1 from shell and Perl scripts.  You are probably familiar with lines like line 1 from shell and Perl scripts.
# Line 2298  It tells the operating system that this Line 2516  It tells the operating system that this
2516  <filename>/usr/bin/make</filename>.  <filename>/usr/bin/make</filename>.
2517  </para>  </para>
2518  <para>  <para>
2519  Line 11 can be uncommented to set <literal>DH_VERBOSE</literal> variable to 1.  Line 10 can be uncommented to set the <literal>DH_VERBOSE</literal> variable to 1,
2520  Then, the <command>dh</command> command will output which  so that the <command>dh</command> command outputs which
2521  <command>dh_*</command> commands are executed by the <command>dh</command>  <command>dh_*</command> commands it is executing.
2522  command.  You can also add <literal>export DH_OPTIONS=-v</literal> line here.  You can also add a line <literal>export DH_OPTIONS=-v</literal> here,
2523  Then each <command>dh_*</command> command will output which commands are  so that each <command>dh_*</command> command outputs which commands it
2524  executed by each <command>dh_*</command> command.  This helps you to understand  is executing.  This helps you to understand
2525  what exactly is going on behind this simple <filename>rules</filename> file and  exactly what is going on behind this simple <filename>rules</filename> file and
2526  to debug its problems.  This new <command>dh</command> is a core part of the  to debug its problems.  This new <command>dh</command> is designed to form a core part of the
2527  <systemitem role="package">debhelper</systemitem> tools and does not hide  <systemitem role="package">debhelper</systemitem> tools, and not to hide
2528  anything from you.  anything from you.
2529  </para>  </para>
2530  <para>  <para>
2531  Lines 12 and 13 are where all the work is done.  The percent sign means any  Lines 12 and 13 are where all the work is done with an implicit rule using the pattern rule.  The percent sign means "any
2532  targets which then call a single program, <command>dh</command> with the target  targets", which then call a single program, <command>dh</command>, with the target
2533  name.  <footnote><para> This uses the new <systemitem role="package">debhelper</systemitem> V7 features.  Its design concepts are  name.  <footnote><para> This uses the new <systemitem role="package">debhelper</systemitem> v7 features.  Its design concepts are
2534  explained in <ulink url="&debhelper-slides;">Not Your  explained in <ulink url="&debhelper-slides;">Not Your
2535  Grandpa's Debhelper</ulink> presented at Debconf9 by the <systemitem role="package">debhelper</systemitem> upstream.  Under  Grandpa's Debhelper</ulink> presented at DebConf9 by the <systemitem role="package">debhelper</systemitem> upstream.  Under
2536  <literal>lenny</literal>, <command>dh_make</command> created a much more  <literal>lenny</literal>, <command>dh_make</command> created a much more
2537  complicated <filename>rules</filename> file with many <command>dh_*</command>  complicated <filename>rules</filename> file with explicit rules
2538  scripts listed for each required explicit targets and frozen them to the state  and many <command>dh_*</command> scripts listed for each one, most of
2539  when it was initially packaged.  This new <command>dh</command> command is  which are now unnecessary (and show the package's age). The new <command>dh</command> command is
2540  simpler and frees us from this constrain.  You still have full power to  simpler and frees us from doing the routine work "manually". You still have full power to
2541  customize this with <literal>override_dh_*</literal> targets.  See <xref linkend="customrules"/>.  It is based only on the <systemitem role="package">debhelper</systemitem> package and does not obfuscate the  customize the process with <literal>override_dh_*</literal> targets. See <xref linkend="customrules"/>.  It is based only on the <systemitem role="package">debhelper</systemitem> package and does not obfuscate the
2542  package building process like the <systemitem role="package">cdbs</systemitem>  package building process as the <systemitem role="package">cdbs</systemitem>
2543  package.  </para> </footnote> The <command>dh</command> command is a wrapper  package tends to.  </para> </footnote> The <command>dh</command> command is a wrapper
2544  script which runs appropriate sequences of <command>dh_*</command> programs  script which runs appropriate sequences of <command>dh_*</command> programs
2545  depending on its argument.  <footnote><para> You can verify actual sequences of  depending on its argument.  <footnote><para> You can verify the actual sequences of
2546  <command>dh_*</command> programs invoked for a given  <command>dh_*</command> programs invoked for a given
2547  <literal><replaceable>target</replaceable></literal> as <literal>dh --no-act  <literal><replaceable>target</replaceable></literal> without really running them by invoking <literal>dh --no-act
2548  <replaceable>target</replaceable></literal> or <literal>debian/rules --  <replaceable>target</replaceable></literal> or <literal>debian/rules --
2549  '--no-act <replaceable>target</replaceable>'</literal> without really running  '--no-act <replaceable>target</replaceable>'</literal>.  </para> </footnote>
 them.  </para> </footnote>  
2550  </para>  </para>
2551  <itemizedlist>  <itemizedlist>
2552  <listitem>  <listitem>
2553  <para>  <para>
2554  <literal>debian/rules clean</literal> runs <literal>dh clean</literal>; which  <literal>debian/rules clean</literal> runs <literal>dh clean</literal>, which
2555  in turn runs the following:  in turn runs the following:
2556  </para>  </para>
2557  <screen>  <screen>
# Line 2358  dh_auto_test Line 2575  dh_auto_test
2575  <listitem>  <listitem>
2576  <para>  <para>
2577  <literal>fakeroot debian/rules binary</literal> runs <literal>fakeroot dh  <literal>fakeroot debian/rules binary</literal> runs <literal>fakeroot dh
2578  binary</literal>; which in turn runs the following<footnote><para> This assumes  binary</literal>; which in turn runs the following<footnote><para>The following
2579  that the <systemitem role="package">python-support</systemitem> package is  example assumes your <filename>debian/compat</filename> has a value equal or
2580  installed on the system.  </para> </footnote>:  more than 9 to avoid invoking any python support commands automatically.
2581    </para>
2582    </footnote>:
2583  </para>  </para>
2584  <screen>  <screen>
2585  dh_testroot  dh_testroot
# Line 2378  dh_installdebconf Line 2597  dh_installdebconf
2597  dh_installemacsen  dh_installemacsen
2598  dh_installifupdown  dh_installifupdown
2599  dh_installinfo  dh_installinfo
 dh_pysupport  
2600  dh_installinit  dh_installinit
2601  dh_installmenu  dh_installmenu
2602  dh_installmime  dh_installmime
# Line 2428  for each remaining command. Line 2646  for each remaining command.
2646  </listitem>  </listitem>
2647  </itemizedlist>  </itemizedlist>
2648  <para>  <para>
2649  The function of <command>dh_*</command> commands are almost self-evident from  The functions of <command>dh_*</command> commands are largely self-evident from
2650  their names.  <footnote><para> For complete information on what do all these  their names.  <footnote><para> For complete information on what all these
2651  <command>dh_*</command> scripts exactly do, and what their other options are,  <command>dh_*</command> scripts do exactly, and what their other options are,
2652  please read their respective manual pages and the <systemitem role="package">debhelper</systemitem> documentation.  </para> </footnote> There  please read their respective manual pages and the <systemitem role="package">debhelper</systemitem> documentation.  </para> </footnote> There
2653  are few notable ones worth making (over)simplified explanation here assuming  are a few notable ones that are worth giving (over)simplified explanations here assuming
2654  typical build environment based on <filename>Makefile</filename>.  a typical build environment based on a <filename>Makefile</filename>.
2655  <footnote><para> These commands support other build environments such as  <footnote><para> These commands support other build environments such as
2656  <filename>setup.py</filename> which can be listed by executing  <filename>setup.py</filename> which can be listed by executing
2657  <literal>dh_auto_build --list</literal> in a package source directory.  </para>  <literal>dh_auto_build --list</literal> in a package source directory.  </para>
# Line 2442  typical build environment based on <file Line 2660  typical build environment based on <file
2660  <itemizedlist>  <itemizedlist>
2661  <listitem>  <listitem>
2662  <para>  <para>
2663  <command>dh_auto_clean</command> usually executes the following if  <command>dh_auto_clean</command> usually executes the following if a
2664  <filename>Makefile</filename> exists with the <literal>distclean</literal>  <filename>Makefile</filename> exists with the <literal>distclean</literal>
2665  target.  <footnote><para> It actually looks for the first available target of  target.  <footnote><para> It actually looks for the first available target
2666  <literal>distclean</literal>, <literal>realclean</literal> or  in the <filename>Makefile</filename> out of
2667  <literal>clean</literal> in <filename>Makefile</filename> and execute it.  <literal>distclean</literal>, <literal>realclean</literal>, or
2668    <literal>clean</literal>, and executes that.
2669  </para> </footnote>  </para> </footnote>
2670  </para>  </para>
2671  <screen>  <screen>
# Line 2474  make Line 2693  make
2693  </listitem>  </listitem>
2694  <listitem>  <listitem>
2695  <para>  <para>
2696  <command>dh_auto_test</command> usually executes the following if  <command>dh_auto_test</command> usually executes the following if a
2697  <filename>Makefile</filename> exists with the <literal>test</literal> target.  <filename>Makefile</filename> exists with the <literal>test</literal> target.
2698  <footnote><para> It actually looks for the first available target of  <footnote><para> It actually looks for the first available target in
2699  <literal>test</literal> or <literal>check</literal> in  the <filename>Makefile</filename> out of <literal>test</literal> or
2700  <filename>Makefile</filename> and execute it.  </para> </footnote>  <literal>check</literal>, and executes that.</para> </footnote>
2701  </para>  </para>
2702  <screen>  <screen>
2703  make test  make test
# Line 2486  make test Line 2705  make test
2705  </listitem>  </listitem>
2706  <listitem>  <listitem>
2707  <para>  <para>
2708  <command>dh_auto_install</command> usually executes the following if  <command>dh_auto_install</command> usually executes the following if a
2709  <filename>Makefile</filename> exists with the <literal>install</literal> target  <filename>Makefile</filename> exists with the <literal>install</literal> target
2710  (line folded for readability).  (line folded for readability).
2711  </para>  </para>
# Line 2497  make install \ Line 2716  make install \
2716  </listitem>  </listitem>
2717  </itemizedlist>  </itemizedlist>
2718  <para>  <para>
2719  Targets which require the <command>fakeroot</command> command contain  All targets which require the <command>fakeroot</command> command will contain
2720  <command>dh_testroot</command>.  If you are not pretending to be root using  <command>dh_testroot</command>, which exits with an error if you are not
2721  this command, it exits with an error.  using this command to pretend to be root.
2722  </para>  </para>
2723  <para>  <para>
2724  The important part to know about the <filename>rules</filename> file created by  The important part to know about the <filename>rules</filename> file created by
2725  <command>dh_make</command>, is that it is just a suggestion.  It will work for  <command>dh_make</command> is that it is just a suggestion.  It will work for
2726  most packages but for more complicated ones, don't be afraid to customize it to  most packages but for more complicated ones, don't be afraid to customize it to
2727  fit your needs.  Only things that you must not change are the names of the  fit your needs.
 rules, because all the tools use these names, as mandated by the Debian Policy.  
2728  </para>  </para>
2729  <para>  <para>
2730  Although <literal>install</literal> is not required target, it is supported.  Although <literal>install</literal> is not a required target, it is supported.
2731  <literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh  <literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh
2732  binary</literal> but stops after <command>dh_fixperms</command>.  binary</literal> but stops after <command>dh_fixperms</command>.
2733  </para>  </para>
# Line 2523  with the new <command>dh</command> comma Line 2741  with the new <command>dh</command> comma
2741  The <literal>dh $@</literal> command can be customized as follows.  The <literal>dh $@</literal> command can be customized as follows.
2742  <footnote><para> If a package installs the  <footnote><para> If a package installs the
2743  <filename>/usr/share/perl5/Debian/Debhelper/Sequence/<replaceable>custom_name</replaceable>.pm</filename>  <filename>/usr/share/perl5/Debian/Debhelper/Sequence/<replaceable>custom_name</replaceable>.pm</filename>
2744  file, you should activate its customization function by <literal>dh --with  file, you should activate its customization function by <literal>dh $@ --with
2745  <replaceable>custom-name</replaceable> $@</literal>.  </para> </footnote>  <replaceable>custom-name</replaceable></literal>.  </para> </footnote>
2746  </para>  </para>
2747  <itemizedlist>  <itemizedlist>
2748  <listitem>  <listitem>
2749  <para>  <para>
2750  Add support of the <command>dh_pysupport</command> command.  (The best choice  Add support for the <command>dh_python2</command> command.  (The best choice
2751  for Python.) <footnote><para> Use of the <command>dh_pysupport</command>  for Python.) <footnote><para> Use of the <command>dh_python2</command> command
2752  command is preferred over use of the <command>dh_pycentral</command> command.  is preferred over use of <command>dh_pysupport</command> or
2753  Do not use the <command>dh_python</command> command.  </para> </footnote>  <command>dh_pycentral</command> commands.  Do not use the
2754    <command>dh_python</command> command.  </para> </footnote>
2755  </para>  </para>
2756  <itemizedlist>  <itemizedlist>
2757  <listitem>  <listitem>
2758  <para>  <para>
2759  Install the <systemitem role="package">python-support</systemitem> package in  Include the <systemitem role="package">python</systemitem> package in
2760  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2761  </para>  </para>
2762  </listitem>  </listitem>
2763  <listitem>  <listitem>
2764  <para>  <para>
2765  Use <literal>dh $@</literal> as usual.  (This is enabled by default)  Use <literal>dh $@ --with python2</literal>.
2766    </para>
2767    </listitem>
2768    <listitem>
2769    <para>
2770    This handles Python modules using the <systemitem role="package">python</systemitem> framework.
2771    </para>
2772    </listitem>
2773    </itemizedlist>
2774    </listitem>
2775    <listitem>
2776    <para>
2777    Add support for the <command>dh_pysupport</command> command. (deprecated)
2778    </para>
2779    <itemizedlist>
2780    <listitem>
2781    <para>
2782    Include the <systemitem role="package">python-support</systemitem> package in
2783    <literal>Build-Depends</literal>.
2784    </para>
2785    </listitem>
2786    <listitem>
2787    <para>
2788    Use <literal>dh $@ --with pysupport</literal>.
2789  </para>  </para>
2790  </listitem>  </listitem>
2791  <listitem>  <listitem>
# Line 2555  This handles Python modules using the <s Line 2797  This handles Python modules using the <s
2797  </listitem>  </listitem>
2798  <listitem>  <listitem>
2799  <para>  <para>
2800  Add support of the <command>dh_pycentral</command> command.  Add support for the <command>dh_pycentral</command> command. (deprecated)
2801  </para>  </para>
2802  <itemizedlist>  <itemizedlist>
2803  <listitem>  <listitem>
2804  <para>  <para>
2805  Install the <systemitem role="package">python-central</systemitem> package in  Include the <systemitem role="package">python-central</systemitem> package in
2806  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2807  </para>  </para>
2808  </listitem>  </listitem>
2809  <listitem>  <listitem>
2810  <para>  <para>
2811  Use <literal>dh --with python-central $@</literal> instead.  Use <literal>dh $@ --with python-central</literal> instead.
2812  </para>  </para>
2813  </listitem>  </listitem>
2814  <listitem>  <listitem>
# Line 2583  This handles Python modules using the <s Line 2825  This handles Python modules using the <s
2825  </listitem>  </listitem>
2826  <listitem>  <listitem>
2827  <para>  <para>
2828  Add support of the <command>dh_installtex</command> command.  Add support for the <command>dh_installtex</command> command.
2829  </para>  </para>
2830  <itemizedlist>  <itemizedlist>
2831  <listitem>  <listitem>
2832  <para>  <para>
2833  Install the <systemitem role="package">tex-common</systemitem> package in  Include the <systemitem role="package">tex-common</systemitem> package in
2834  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2835  </para>  </para>
2836  </listitem>  </listitem>
2837  <listitem>  <listitem>
2838  <para>  <para>
2839  Use <literal>dh --with tex $@</literal> instead.  Use <literal>dh $@ --with tex</literal> instead.
2840  </para>  </para>
2841  </listitem>  </listitem>
2842  <listitem>  <listitem>
2843  <para>  <para>
2844  This registers Type 1 fonts, hyphenation patterns, or formats with TeX.  This registers Type 1 fonts, hyphenation patterns, and formats with TeX.
2845  </para>  </para>
2846  </listitem>  </listitem>
2847  </itemizedlist>  </itemizedlist>
2848  </listitem>  </listitem>
2849  <listitem>  <listitem>
2850  <para>  <para>
2851  Add support of the <command>dh_quilt_patch</command> and  Add support for the <command>dh_quilt_patch</command> and
2852  <command>dh_quilt_unpatch</command> commands.  <command>dh_quilt_unpatch</command> commands.
2853  </para>  </para>
2854  <itemizedlist>  <itemizedlist>
2855  <listitem>  <listitem>
2856  <para>  <para>
2857  Install the <systemitem role="package">quilt</systemitem> package in  Include the <systemitem role="package">quilt</systemitem> package in
2858  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2859  </para>  </para>
2860  </listitem>  </listitem>
2861  <listitem>  <listitem>
2862  <para>  <para>
2863  Use <literal>dh --with quilt $@</literal> instead.  Use <literal>dh $@ --with quilt</literal> instead.
2864  </para>  </para>
2865  </listitem>  </listitem>
2866  <listitem>  <listitem>
2867  <para>  <para>
2868  This applies and un-applies patches to the upstream source from files in the  This applies and un-applies patches to the upstream source from files in the
2869  <filename>debian/patches</filename> directory for the <literal>1.0</literal>  <filename>debian/patches</filename> directory for a source package in the <literal>1.0</literal> format.
 source package.  
2870  </para>  </para>
2871  </listitem>  </listitem>
2872  <listitem>  <listitem>
2873  <para>  <para>
2874  This is not needed if you use the new <literal>3.0 (quilt)</literal> source  This is not needed if you use the new <literal>3.0 (quilt)</literal> source
2875  package.  package format.
2876  </para>  </para>
2877  </listitem>  </listitem>
2878  </itemizedlist>  </itemizedlist>
2879  </listitem>  </listitem>
2880  <listitem>  <listitem>
2881  <para>  <para>
2882  Add support of the <command>dh_dkms</command> command.  Add support for the <command>dh_dkms</command> command.
2883  </para>  </para>
2884  <itemizedlist>  <itemizedlist>
2885  <listitem>  <listitem>
2886  <para>  <para>
2887  Install the <systemitem role="package">dkms</systemitem> package in  Include the <systemitem role="package">dkms</systemitem> package in
2888  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2889  </para>  </para>
2890  </listitem>  </listitem>
2891  <listitem>  <listitem>
2892  <para>  <para>
2893  Use <literal>dh --with dkms $@</literal> instead.  Use <literal>dh $@ --with dkms</literal> instead.
2894  </para>  </para>
2895  </listitem>  </listitem>
2896  <listitem>  <listitem>
2897  <para>  <para>
2898  This correctly handles DKMS usage by the kernel module package.  This correctly handles DKMS usage by kernel module packages.
2899  </para>  </para>
2900  </listitem>  </listitem>
2901  </itemizedlist>  </itemizedlist>
2902  </listitem>  </listitem>
2903  <listitem>  <listitem>
2904  <para>  <para>
2905  Add support of the <command>dh_autotools-dev_updateconfig</command> and  Add support for the <command>dh_autotools-dev_updateconfig</command> and
2906  <command>dh_autotools-dev_restoreconfig</command> commands.  <command>dh_autotools-dev_restoreconfig</command> commands.
2907  </para>  </para>
2908  <itemizedlist>  <itemizedlist>
2909  <listitem>  <listitem>
2910  <para>  <para>
2911  Install the <systemitem role="package">autotools-dev</systemitem> package in  Include the <systemitem role="package">autotools-dev</systemitem> package in
2912  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2913  </para>  </para>
2914  </listitem>  </listitem>
2915  <listitem>  <listitem>
2916  <para>  <para>
2917  Use <literal>dh --with autotools-dev $@</literal> instead.  Use <literal>dh $@ --with autotools-dev</literal> instead.
2918  </para>  </para>
2919  </listitem>  </listitem>
2920  <listitem>  <listitem>
# Line 2686  This updates and restores <filename>conf Line 2927  This updates and restores <filename>conf
2927  </listitem>  </listitem>
2928  <listitem>  <listitem>
2929  <para>  <para>
2930  Add support of the <command>dh_autoreconf</command> and  Add support for the <command>dh_autoreconf</command> and
2931  <command>dh_autoreconf_clean</command> commands.  <command>dh_autoreconf_clean</command> commands.
2932  </para>  </para>
2933  <itemizedlist>  <itemizedlist>
2934  <listitem>  <listitem>
2935  <para>  <para>
2936  Install the <systemitem role="package">dh-autoreconf</systemitem> package in  Include the <systemitem role="package">dh-autoreconf</systemitem> package in
2937  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2938  </para>  </para>
2939  </listitem>  </listitem>
2940  <listitem>  <listitem>
2941  <para>  <para>
2942  Use <literal>dh --with autoreconf $@</literal> instead.  Use <literal>dh $@ --with autoreconf</literal> instead.
2943  </para>  </para>
2944  </listitem>  </listitem>
2945  <listitem>  <listitem>
# Line 2710  This updates the GNU Build System files Line 2951  This updates the GNU Build System files
2951  </listitem>  </listitem>
2952  <listitem>  <listitem>
2953  <para>  <para>
2954  Add support to the <command>bash</command> completion feature.  Add support for the <command>bash</command> completion feature.
2955  </para>  </para>
2956  <itemizedlist>  <itemizedlist>
2957  <listitem>  <listitem>
2958  <para>  <para>
2959  Install the <systemitem role="package">bash-completion</systemitem> package in  Includes the <systemitem role="package">bash-completion</systemitem> package in
2960  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2961  </para>  </para>
2962  </listitem>  </listitem>
2963  <listitem>  <listitem>
2964  <para>  <para>
2965  Use <literal>dh --with bash-completion $@</literal> instead.  Use <literal>dh $@ --with bash-completion</literal> instead.
2966  </para>  </para>
2967  </listitem>  </listitem>
2968  <listitem>  <listitem>
2969  <para>  <para>
2970  This installs <command>bash</command> completions using configuration file at  This installs <command>bash</command> completions using a configuration file at
2971  <filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.  <filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.
2972  </para>  </para>
2973  </listitem>  </listitem>
# Line 2740  command can be customized by the corresp Line 2981  command can be customized by the corresp
2981  manpage of each command for the customization of such features.  manpage of each command for the customization of such features.
2982  </para>  </para>
2983  <para>  <para>
2984  Some <command>dh_*</command> commands invoked by the new <command>dh</command>  You may need to run <command>dh_*</command> commands invoked via the new <command>dh</command>
2985  command may require you to run it with some arguments or to run additional  with added arguments, or to run additional commands with them, or to skip them.
2986  commands with them or to skip them.  For such cases, you create an  For such cases, you create an
2987  <literal>override_dh_<replaceable>foo</replaceable></literal> target with its  <literal>override_dh_<replaceable>foo</replaceable></literal> target with its
2988  rule in the <filename>rules</filename> file only for the  rule in the <filename>rules</filename> file defining an
2989    <literal>override_dh_<replaceable>foo</replaceable></literal> target for the
2990  <command>dh_<replaceable>foo</replaceable></command> command you want to  <command>dh_<replaceable>foo</replaceable></command> command you want to
2991  change.  It basically say <emphasis>run me instead</emphasis>.  change.  It basically says <emphasis>run me instead</emphasis>.
2992  <footnote><para> Under <literal>lenny</literal>, if you wanted to change the  <footnote><para> Under <literal>lenny</literal>, if you wanted to change the
2993  behavior of a <command>dh_*</command> script you found the relevant line in the  behavior of a <command>dh_*</command> script you found the relevant line in the
2994  <filename>rules</filename> file and adjusted it.  </para> </footnote>  <filename>rules</filename> file and adjusted it.  </para> </footnote>
2995  </para>  </para>
2996  <para>  <para>
2997  Please note that the <command>dh_auto_*</command> commands tend to do more than  Please note that the <command>dh_auto_*</command> commands tend to do more than
2998  what has been discussed as (over)simplified explanation to take care all the  what has been discussed in this (over)simplified explanation to take care of all the
2999  corner cases.  Use of simplified equivalent command instead of these in  corner cases.  It is a bad idea to use <literal>override_dh_*</literal> targets
3000  <literal>override_dh_*</literal> targets except the  to substitute simplified equivalent commands (except for the
3001  <literal>override_dh_auto_clean</literal> target is a bad idea since it may  <literal>override_dh_auto_clean</literal> target) since it may
3002  kill such <systemitem role="package">debhelper</systemitem>'s smart features.  bypass such smart <systemitem role="package">debhelper</systemitem> features.
3003  </para>  </para>
3004  <para>  <para>
3005  If you want to store the system configuration data in the  So, for instance, if you want to store system configuration data in the
3006  <filename>/etc/gentoo</filename> directory instead of the usual  <filename>/etc/gentoo</filename> directory instead of the usual
3007  <filename>/etc</filename> directory for the recent  <filename>/etc</filename> directory for the recent
3008  <systemitem role="package">gentoo</systemitem> package using Autotools, you can override the default  <systemitem role="package">gentoo</systemitem> package using Autotools, you can override the default
# Line 2775  override_dh_auto_configure: Line 3017  override_dh_auto_configure:
3017  <para>  <para>
3018  The arguments given after <literal>--</literal> are appended to the default  The arguments given after <literal>--</literal> are appended to the default
3019  arguments of the auto-executed program to override them.  Using the  arguments of the auto-executed program to override them.  Using the
3020  <command>dh_auto_configure</command> command is better than the  <command>dh_auto_configure</command> command is better than directly invoking the
3021  <command>./configure</command> command here since it will only override the  <command>./configure</command> command here since it will only override the
3022  <literal>--sysconfig</literal> argument and keeps well intended other arguments  <literal>--sysconfig</literal> argument and retains any other, benign arguments
3023  to the <command>./configure</command> command.  to the <command>./configure</command> command.
3024  </para>  </para>
3025  <para>  <para>
3026  If <filename>Makefile</filename> of a source for <systemitem role="package">gentoo</systemitem> requires you to specify  If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> requires you to specify
3027  <literal>build</literal> as its target to build it <footnote><para>  <literal>build</literal> as its target to build it <footnote><para>
3028  <command>dh_auto_build</command> without any arguments will execute the first  <command>dh_auto_build</command> without any arguments will execute the first
3029  target in the <filename>Makefile</filename> file.  </para> </footnote>, you  target in the <filename>Makefile</filename>.  </para> </footnote>, you
3030  create an <literal>override_dh_auto_build</literal> target to enable it.  create an <literal>override_dh_auto_build</literal> target to enable this.
3031  </para>  </para>
3032  <screen>  <screen>
3033  override_dh_auto_build:  override_dh_auto_build:
3034          dh_auto_build -- build          dh_auto_build -- build
3035  </screen>  </screen>
3036  <para>  <para>
3037  This ensures to run $(MAKE) with all the default arguments given by the  This ensures <literal>$(MAKE)</literal> is run with all the default arguments given by the
3038  <command>dh_auto_build</command> command and <literal>build</literal> argument.  <command>dh_auto_build</command> command plus the <literal>build</literal> argument.
3039  </para>  </para>
3040  <para>  <para>
3041  If <filename>Makefile</filename> of a source for <systemitem role="package">gentoo</systemitem> requires you to specify the  If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> requires you to specify the
3042  <literal>packageclean</literal> target to clean it for Debian package instead  <literal>packageclean</literal> target to clean it for the Debian package instead
3043  of the <literal>distclean</literal> or <literal>clean</literal> targets in the  of using <literal>distclean</literal> or <literal>clean</literal> targets,
3044  <filename>Makefile</filename> file, you create an  you can create an
3045  <literal>override_dh_auto_clean</literal> target to enable it.  <literal>override_dh_auto_clean</literal> target to enable thit.
3046  </para>  </para>
3047  <screen>  <screen>
3048  override_dh_auto_clean:  override_dh_auto_clean:
3049          $(MAKE) packageclean          $(MAKE) packageclean
3050  </screen>  </screen>
3051  <para>  <para>
3052  If <filename>Makefile</filename> of a source for <systemitem role="package">gentoo</systemitem> contains <literal>test</literal> target  If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> contains a <literal>test</literal> target
3053  which you do not want to run for the Debian package building process, you can  which you do not want to run for the Debian package building process, you can
3054  use empty <literal>override_dh_auto_test</literal> target to skip it.  use an empty <literal>override_dh_auto_test</literal> target to skip it.
3055  </para>  </para>
3056  <screen>  <screen>
3057  override_dh_auto_test:  override_dh_auto_test:
# Line 2821  changelog file called <filename>FIXES</f Line 3063  changelog file called <filename>FIXES</f
3063  The <command>dh_installchangelogs</command> command requires  The <command>dh_installchangelogs</command> command requires
3064  <filename>FIXES</filename> as its argument to install it.  <footnote><para> The  <filename>FIXES</filename> as its argument to install it.  <footnote><para> The
3065  <filename>debian/changelog</filename> and <filename>debian/NEWS</filename>  <filename>debian/changelog</filename> and <filename>debian/NEWS</filename>
3066  files are always automatically installed.  The upstream changelog is searched  files are always automatically installed.  The upstream changelog is found
3067  by converting filenames to the lower case and matching them with the  by converting filenames to lower case and matching them against
3068  <filename>changelog</filename>, <filename>changes</filename>,  <filename>changelog</filename>, <filename>changes</filename>,
3069  <filename>changelog.txt</filename>, and <filename>changes.txt</filename>.  <filename>changelog.txt</filename>, and <filename>changes.txt</filename>.
3070  </para> </footnote>  </para> </footnote>
# Line 2833  override_dh_installchangelogs: Line 3075  override_dh_installchangelogs:
3075  </screen>  </screen>
3076  <para>  <para>
3077  When you use the new <command>dh</command> command, use of explicit targets  When you use the new <command>dh</command> command, use of explicit targets
3078  such as the ones listed in <xref linkend="targets"/> except  such as the ones listed in <xref linkend="targets"/>, other than the
3079  <literal>get-orig-source</literal> target may make it difficult to understand  <literal>get-orig-source</literal> target, may make it difficult to understand
3080  their exact effects.  Please limit explicit targets to  their exact effects.  Please limit explicit targets to
3081  <literal>override_dh_*</literal> targets and completely independent ones, if  <literal>override_dh_*</literal> targets and completely independent ones, if
3082  possible.  possible.
# Line 2846  possible. Line 3088  possible.
3088  <para>  <para>
3089  To control most of what <systemitem role="package">debhelper</systemitem> does  To control most of what <systemitem role="package">debhelper</systemitem> does
3090  while building the package, you put optional configuration files under the  while building the package, you put optional configuration files under the
3091  <filename>debian</filename> directory.  This chapter will make an overview of  <filename>debian</filename> directory.  This chapter will provide an overview of
3092  what each of these does and its format.  Please read <ulink url="&debian-policy;">Debian Policy  what each of these does and its format.  Please read the <ulink url="&debian-policy;">Debian Policy
3093  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's
3094  Reference</ulink> for guidelines for the packaging.  Reference</ulink> for guidelines for packaging.
3095  </para>  </para>
3096  <para>  <para>
3097  The <command>dh_make</command> command will create some template configuration  The <command>dh_make</command> command will create some template configuration
# Line 2860  prefixed by the binary package name such Line 3102  prefixed by the binary package name such
3102  them.  them.
3103  <footnote><para>  <footnote><para>
3104  In this chapter, files in the <filename>debian</filename> directory are  In this chapter, files in the <filename>debian</filename> directory are
3105  referred without preceding <filename>debian/</filename> for simplicity whenever  referred to without the leading <filename>debian/</filename> for simplicity whenever
3106  they are obvious.  the meaning is obvious.
3107  </para></footnote>  </para></footnote>
3108  </para>  </para>
3109  <para>  <para>
3110  The <command>dh_make</command> command may not create some template  Some template configuration files for <systemitem role="package">debhelper</systemitem>
3111  configuration files for <systemitem role="package">debhelper</systemitem>.  In  may not be created by the <command>dh_make</command> command.  In
3112  such cases, you need to create them with the editor.  such cases, you need to create them with an editor.
3113  </para>  </para>
3114  <para>  <para>
3115  If you wish or need to activate any of those, please do the following.  If you wish or need to activate any of these, please do the following:
3116  </para>  </para>
3117  <itemizedlist>  <itemizedlist>
3118  <listitem>  <listitem>
3119  <para>  <para>
3120  rename template files by removing the <literal>.ex</literal> or  rename template files by removing the <literal>.ex</literal> or
3121  <literal>.EX</literal> suffix if the template files have one.  <literal>.EX</literal> suffix if they have one;
3122  </para>  </para>
3123  </listitem>  </listitem>
3124  <listitem>  <listitem>
3125  <para>  <para>
3126  rename the name of these configuration files using the actual binary package  rename the configuration files to use the actual binary package
3127  name in place of <literal><replaceable>package</replaceable></literal>.  name in place of <literal><replaceable>package</replaceable></literal>;
3128  </para>  </para>
3129  </listitem>  </listitem>
3130  <listitem>  <listitem>
3131  <para>  <para>
3132  modify template file contents to suit your needs.  modify template file contents to suit your needs;
3133  </para>  </para>
3134  </listitem>  </listitem>
3135  <listitem>  <listitem>
3136  <para>  <para>
3137  remove template files which you do not need.  remove template files which you do not need;
3138  </para>  </para>
3139  </listitem>  </listitem>
3140  <listitem>  <listitem>
3141  <para>  <para>
3142  modify the <filename>control</filename> file (see <xref linkend="control"/>),  modify the <filename>control</filename> file (see <xref linkend="control"/>),
3143  if necessary.  if necessary;
3144  </para>  </para>
3145  </listitem>  </listitem>
3146  <listitem>  <listitem>
# Line 2909  necessary. Line 3151  necessary.
3151  </listitem>  </listitem>
3152  </itemizedlist>  </itemizedlist>
3153  <para>  <para>
3154  Those <systemitem role="package">debhelper</systemitem> configuration files  Any <systemitem role="package">debhelper</systemitem> configuration files
3155  without <filename><replaceable>package</replaceable></filename> prefix such as  without a <filename><replaceable>package</replaceable></filename> prefix, such as
3156  <filename>install</filename> apply to the first binary package.  When there are  <filename>install</filename>, apply to the first binary package.  When there are
3157  many binary packages, their configurations can be specified by prefixing their  many binary packages, their configurations can be specified by prefixing their
3158  name to their configuration filenames such as  name to their configuration filenames such as
3159  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3160  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3161  </para>  </para>
3162  <section id="readme"><title><filename>README.Debian</filename> file</title>  <section id="readme"><title><filename>README.Debian</filename></title>
3163  <para>  <para>
3164  Any extra details or discrepancies between the original package and your Debian  Any extra details or discrepancies between the original package and your Debian
3165  version should be documented here.  version should be documented here.
3166  </para>  </para>
3167  <para>  <para>
3168  <command>dh_make</command> created a default one, this is what it looks like:  <command>dh_make</command> created a default one; this is what it looks like:
3169  </para>  </para>
3170  <screen>  <screen>
3171  gentoo for Debian  gentoo for Debian
# Line 2937  If you have nothing to be documented, re Line 3179  If you have nothing to be documented, re
3179  </citerefentry>.  </citerefentry>.
3180  </para>  </para>
3181  </section>  </section>
3182  <section id="compat"><title><filename>compat</filename> file</title>  <section id="compat"><title><filename>compat</filename></title>
3183  <para>  <para>
3184  The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level.  Currently, you  The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level.  Currently, you
3185  should set it to the <systemitem role="package">debhelper</systemitem> V7 by  should set it to the <systemitem role="package">debhelper</systemitem> v7 as
3186  the following.  follows:
3187  </para>  </para>
3188  <screen>  <screen>
3189  $ echo 7 &gt; debian/compat  $ echo 7 &gt; debian/compat
3190  </screen>  </screen>
3191  </section>  </section>
3192  <section id="conffiles"><title><filename>conffiles</filename> file</title>  <section id="conffiles"><title><filename>conffiles</filename></title>
3193  <para>  <para>
3194  One of the most annoying things about software is when you spend a great deal  One of the most annoying things about software is when you spend a great deal
3195  of time and effort customizing a program, only to have an upgrade stomp all  of time and effort customizing a program, only to have an upgrade stomp all
3196  over your changes.  Debian solves this problem by marking such configuration files as conffiles.  over your changes.  Debian solves this problem by marking such configuration files as conffiles.
3197  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>
3198  <manvolnum>1</manvolnum> </citerefentry> and  <manvolnum>1</manvolnum> </citerefentry> and
3199  <ulink url="&policy-conffiles;">Debian Policy Manual 'D.2.5 Conffiles'</ulink>.  <ulink url="&policy-conffiles;">Debian Policy Manual "D.2.5 Conffiles"</ulink>.
3200  </para></footnote>  </para></footnote>
3201  When you upgrade a package, you'll be prompted whether you want to keep  When you upgrade a package, you'll be asked whether you want to keep
3202  your old configuration files or not.  your old configuration files or not.
3203  </para>  </para>
3204  <para>  <para>
3205  Since <systemitem role="package">debhelper</systemitem> V3, <citerefentry>  <citerefentry><refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>
3206  <refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>  </citerefentry> <emphasis>automatically</emphasis> flags any files under
 </citerefentry> will <emphasis>automatically</emphasis> flag any files under  
3207  the <filename>/etc</filename> directory as conffiles, so if your program only  the <filename>/etc</filename> directory as conffiles, so if your program only
3208  has conffiles there you do not need to specify them in this file.  For most  has conffiles there you do not need to specify them in this file.  For most
3209  package types, the only place there is (and should be conffiles) is under  package types, the only place conffiles should ever be is under
3210  <filename>/etc</filename> and so this file doesn't need to exist.  <filename>/etc</filename>, and so this file doesn't need to exist.
3211  </para>  </para>
3212  <para>  <para>
3213  If your program uses configuration files but also rewrites them on its own,  If your program uses configuration files but also rewrites them on its own,
3214  it's best not to make them as conffiles because <command>dpkg</command> will  it's best not to make them conffiles because <command>dpkg</command> will
3215  then prompt users to verify the changes all the time.  then prompt users to verify the changes all the time.
3216  </para>  </para>
3217  <para>  <para>
3218  If the program you're packaging requires every user to modify the configuration  If the program you're packaging requires every user to modify the configuration
3219  files in the <filename>/etc</filename> directory, there are 2 popular ways to  files in the <filename>/etc</filename> directory, there are two popular ways to
3220  make them not as conffiles to keep <command>dpkg</command> quiet.  arrange for them to not be conffiles, keeping <command>dpkg</command> quiet.
3221  </para>  </para>
3222  <itemizedlist>  <itemizedlist>
3223  <listitem>  <listitem>
3224  <para>  <para>
3225  You make a symlink under the <filename>/etc</filename> directory pointing to a  Create a symlink under the <filename>/etc</filename> directory pointing to a
3226  file under the <filename>/var</filename> directory generated by the  file under the <filename>/var</filename> directory generated by the
3227  <emphasis>maintainer scripts</emphasis>.  maintainer scripts.
3228  </para>  </para>
3229  </listitem>  </listitem>
3230  <listitem>  <listitem>
3231  <para>  <para>
3232  You make a file generated by the <emphasis>maintainer scripts</emphasis> under  Create a file generated by the maintainer scripts under the <filename>/etc</filename> directory.
 the <filename>/etc</filename> directory.  
3233  </para>  </para>
3234  </listitem>  </listitem>
3235  </itemizedlist>  </itemizedlist>
3236  <para>  <para>
3237  For more information on the <emphasis>maintainer scripts</emphasis>, see <xref linkend="maintscripts"/>.  For information on maintainer scripts, see <xref linkend="maintscripts"/>.
3238  </para>  </para>
3239  </section>  </section>
3240  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename> files</title>  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename></title>
3241  <para>  <para>
3242  If your package requires regularly scheduled tasks to operate properly, you can  If your package requires regularly scheduled tasks to operate properly, you can
3243  use this file to set it up.  You can either setup regular tasks that happen  use these files to set that up.  You can set up regular tasks that either happen
3244  hourly, daily, weekly or monthly or alternatively happen any other time that  hourly, daily, weekly, or monthly, or alternatively happen at any other time that
3245  you wish.  The filenames are:  you wish.  The filenames are:
3246  </para>  </para>
3247  <itemizedlist>  <itemizedlist>
3248  <listitem>  <listitem>
3249  <para>  <para>
3250  <filename>cron.hourly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.hourly</filename> - Installed as
3251  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>; run
3252  once an hour every hour.  once an hour.
3253  </para>  </para>
3254  </listitem>  </listitem>
3255  <listitem>  <listitem>
3256  <para>  <para>
3257  <filename>cron.daily</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.daily</filename> - Installed as
3258  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>; run
3259  once a day, usually early morning.  once a day.
3260  </para>  </para>
3261  </listitem>  </listitem>
3262  <listitem>  <listitem>
3263  <para>  <para>
3264  <filename>cron.weekly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.weekly</filename> - Installed as
3265  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>; run
3266  once a week, usually early Sunday morning.  once a week.
3267  </para>  </para>
3268  </listitem>  </listitem>
3269  <listitem>  <listitem>
3270  <para>  <para>
3271  <filename>cron.monthly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.monthly</filename> - Installed as
3272  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run
3273  once a month, usually early morning on the first of the month.  once a month.
3274  </para>  </para>
3275  </listitem>  </listitem>
3276  <listitem>  <listitem>
3277  <para>  <para>
3278  <filename>cron.d</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.d</filename> - Installed as
3279  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any
3280  other time  other time.
3281  </para>  </para>
3282  </listitem>  </listitem>
3283  </itemizedlist>  </itemizedlist>
3284  <para>  <para>
3285  For the named files, the format of them is the shell script.  The different one  Most of these files are shell scripts, with the exception of
3286  is <filename><replaceable>package</replaceable>.cron.d</filename> which follows  <filename><replaceable>package</replaceable>.cron.d</filename> which follows
3287  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>
3288  <manvolnum>5</manvolnum> </citerefentry>.  <manvolnum>5</manvolnum> </citerefentry>.
3289  </para>  </para>
3290  <para>  <para>
3291  Note that this doesn't include log rotation; for that, see <citerefentry>  No explicit <filename>cron.*</filename> file is needed to set up log rotation;
3292  <refentrytitle>dh_installlogrotate</refentrytitle> <manvolnum>1</manvolnum>  for that, see
3293  </citerefentry> and <citerefentry> <refentrytitle>logrotate</refentrytitle>  <citerefentry><refentrytitle>dh_installlogrotate</refentrytitle>
3294  <manvolnum>8</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum></citerefentry> and
3295    <citerefentry><refentrytitle>logrotate</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
3296  </para>  </para>
3297  </section>  </section>
3298  <section id="dirs"><title><filename>dirs</filename> file</title>  <section id="dirs"><title><filename>dirs</filename></title>
3299  <para>  <para>
3300  This file specifies the directories which we need but the normal installation  This file specifies any directories which we need but which are not created by the normal installation
3301  procedure (<literal>make install DESTDIR=...</literal> invoked by  procedure (<literal>make install DESTDIR=...</literal> invoked by
3302  <literal>dh_auto_install</literal>) somehow doesn't create.  This generally  <literal>dh_auto_install</literal>).  This generally
3303  means there is a problem with the <filename>Makefile</filename>.  means there is a problem with the <filename>Makefile</filename>.
3304  </para>  </para>
3305  <para>  <para>
3306  Files listed in the <filename>install</filename> file doesn't need the  Files listed in an <filename>install</filename> file don't need their
3307  directories created first.  See <xref linkend="install"/>.  directories created first.  See <xref linkend="install"/>.
3308  </para>  </para>
3309  <para>  <para>
3310  It is best to try to run the installation first and only use this if you  It is best to try to run the installation first and only use this if you
3311  run into trouble.  There is no preceding slash on the directory names listed in  run into trouble.  There is no preceding slash on the directory names listed in
3312  the <filename>dirs</filename> file.  the <filename>dirs</filename> file.
3313  </para>  </para>
3314  </section>  </section>
3315  <section id="doc-base"><title><filename><replaceable>package</replaceable>.doc-base</filename> file</title>  <section id="doc-base"><title><filename><replaceable>package</replaceable>.doc-base</filename></title>
3316  <para>  <para>
3317  If your package has documentation other than manual pages and info docs, you  If your package has documentation other than manual and info pages, you
3318  should use the <systemitem role="package">doc-base</systemitem> file to  should use the <systemitem role="package">doc-base</systemitem> file to
3319  register it, so the user can find it with e.g.  <citerefentry>  register it, so the user can find it with e.g.  <citerefentry>
3320  <refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
3321  <citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>
3322  </citerefentry> or <citerefentry> <refentrytitle>doccentral</refentrytitle>  </citerefentry>, or <citerefentry> <refentrytitle>doccentral</refentrytitle>
3323  <manvolnum>1</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum> </citerefentry>.
3324  </para>  </para>
3325  <para>  <para>
# Line 3086  This usually includes HTML, PS and PDF f Line 3327  This usually includes HTML, PS and PDF f
3327  <filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.  <filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.
3328  </para>  </para>
3329  <para>  <para>
3330  This is how <systemitem role="package">gentoo</systemitem>'s doc-base file  This is what <systemitem role="package">gentoo</systemitem>'s doc-base file
3331  <filename>gentoo.doc-base</filename> looks like:  <filename>gentoo.doc-base</filename> looks like:
3332  </para>  </para>
3333  <screen>  <screen>
# Line 3109  manual, in <ulink url="&doc-base;">Debia Line 3350  manual, in <ulink url="&doc-base;">Debia
3350  For more details on installing additional documentation, look in <xref linkend="destdir"/>.  For more details on installing additional documentation, look in <xref linkend="destdir"/>.
3351  </para>  </para>
3352  </section>  </section>
3353  <section id="docs"><title><filename>docs</filename> file</title>  <section id="docs"><title><filename>docs</filename></title>
3354  <para>  <para>
3355  This file specifies the file names of documentation files we can have  This file specifies the file names of documentation files we can have
3356  <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>  <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
# Line 3122  directory that are called <filename>BUGS Line 3363  directory that are called <filename>BUGS
3363  <filename>README*</filename>, <filename>TODO</filename> etc.  <filename>README*</filename>, <filename>TODO</filename> etc.
3364  </para>  </para>
3365  <para>  <para>
3366  For <systemitem role="package">gentoo</systemitem>, I also included some other  For <systemitem role="package">gentoo</systemitem>, some other files
3367  files:  are also included:
3368  </para>  </para>
3369  <screen>  <screen>
3370  BUGS  BUGS
# Line 3135  README.gtkrc Line 3376  README.gtkrc
3376  TODO  TODO
3377  </screen>  </screen>
3378  </section>  </section>
3379  <section id="emacsen"><title><filename>emacsen-*</filename> file</title>  <section id="emacsen"><title><filename>emacsen-*</filename></title>
3380  <para>  <para>
3381  If your package supplies Emacs files that can be bytecompiled at package  If your package supplies Emacs files that can be bytecompiled at package
3382  installation time, you can use these files to set it up.  installation time, you can use these files to set it up.
# Line 3149  They are installed into the temporary di Line 3390  They are installed into the temporary di
3390  If you don't need these, remove them.  If you don't need these, remove them.
3391  </para>  </para>
3392  </section>  </section>
3393  <section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename> file</title>  <section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename></title>
3394  <para>  <para>
3395  The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>  The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>
3396  <manvolnum>1</manvolnum> </citerefentry> command installs files and directories  <manvolnum>1</manvolnum> </citerefentry> command installs files and directories
3397  listed in this file as example files.  listed in this file as example files.
3398  </para>  </para>
3399  </section>  </section>
3400  <section id="initd"><title><filename><replaceable>package</replaceable>.init</filename> and <filename><replaceable>package</replaceable>.default</filename> files</title>  <section id="initd"><title><filename><replaceable>package</replaceable>.init</filename> and <filename><replaceable>package</replaceable>.default</filename></title>
3401  <para>  <para>
3402  If your package is a daemon that needs to be run at the system start-up, you've  If your package is a daemon that needs to be run at system start-up, you've
3403  obviously disregarded my initial recommendation, haven't you?  :-)  obviously disregarded my initial recommendation, haven't you?  :-)
3404  </para>  </para>
3405  <para>  <para>
3406  The <filename><replaceable>package</replaceable>.init</filename> file is  The <filename><replaceable>package</replaceable>.init</filename> file is
3407  installed as the  installed as the
3408  <filename>/etc/init.d/<replaceable>package</replaceable></filename> script  <filename>/etc/init.d/<replaceable>package</replaceable></filename> script
3409  for the <emphasis>init script</emphasis> which starts and stops a daemon.  which starts and stops the daemon.
3410  Its fairly generic skeleton template is provided by the  Its fairly generic skeleton template is provided by the
3411  <command>dh_make</command> command as <filename>init.d.ex</filename>.  You'll  <command>dh_make</command> command as <filename>init.d.ex</filename>.  You'll
3412  likely have to rename and edit it, a lot, while making sure to provide  likely have to rename and edit it, a lot, while making sure to provide
# Line 3176  gets installed into the temporary direct Line 3417  gets installed into the temporary direct
3417  </para>  </para>
3418  <para>  <para>
3419  The <filename><replaceable>package</replaceable>.default</filename> file will  The <filename><replaceable>package</replaceable>.default</filename> file will
3420  be installed into  be installed as
3421  <filename>/etc/default/<replaceable>package</replaceable></filename>.  This  <filename>/etc/default/<replaceable>package</replaceable></filename>.  This
3422  file sets defaults that are sourced by the <emphasis>init script</emphasis>.  Most times this  file sets defaults that are sourced by the init script.  This
3423  <filename><replaceable>package</replaceable>.default</filename> file is used to disable running a daemon, set some default flags or  <filename><replaceable>package</replaceable>.default</filename> file
3424  timeouts.  If your <emphasis>init script</emphasis> has certain <emphasis>settable</emphasis>  is most often used to disable running a daemon, or to set some default flags or
3425  features you want to install these into the <filename><replaceable>package</replaceable>.default</filename> file, not the <emphasis>init script</emphasis>.  timeouts.  If your init script has certain configurable
3426    features, you can set them in the <filename><replaceable>package</replaceable>.default</filename> file,
3427    instead of in the init script itself.
3428  </para>  </para>
3429  <para>  <para>
3430  If your upstream program provides a file for the <emphasis>init script</emphasis>, you can either use it or not.  If you  If your upstream program provides a file for the init script, you can either use it or not.  If you
3431  don't use their <emphasis>init script</emphasis> then create a new one in  don't use their init script then create a new one in
3432  <filename><replaceable>package</replaceable>.init</filename>.  However  <filename><replaceable>package</replaceable>.init</filename>.  However
3433  if the upstream <emphasis>init script</emphasis> looks fine and installs in the right place you  if the upstream init script looks fine and installs in the right place you
3434  still need to setup the <filename>rc*</filename> symlinks.  To do this you will  still need to set up the <filename>rc*</filename> symlinks.  To do this you will
3435  need to override <command>dh_installinit</command> in the  need to override <command>dh_installinit</command> in the
3436  <filename>rules</filename> file with the following lines:  <filename>rules</filename> file with the following lines:
3437  </para>  </para>
# Line 3200  override_dh_installinit: Line 3443  override_dh_installinit:
3443  If you don't need this, remove the files.  If you don't need this, remove the files.
3444  </para>  </para>
3445  </section>  </section>
3446  <section id="install"><title><filename>install</filename> file</title>  <section id="install"><title><filename>install</filename></title>
3447  <para>  <para>
3448  If there are files that need to be installed into your package but your  If there are files that need to be installed into your package but your
3449  standard <literal>make install</literal> won't do it, you put the filenames and  standard <literal>make install</literal> won't do it, put the filenames and
3450  destinations into this <filename>install</filename> file.  They are installed  destinations into this <filename>install</filename> file.  They are installed
3451  by <citerefentry> <refentrytitle>dh_install</refentrytitle>  by <citerefentry> <refentrytitle>dh_install</refentrytitle>
3452  <manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the  <manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the
# Line 3216  the <filename>docs</filename> file and n Line 3459  the <filename>docs</filename> file and n
3459  <para>  <para>
3460  This <filename>install</filename> file has one line per file installed, with  This <filename>install</filename> file has one line per file installed, with
3461  the name of the file (relative to the top build directory) then a space then  the name of the file (relative to the top build directory) then a space then
3462  the installation directory (relative to the install directory).  One example of  the installation directory (relative to the install directory).  One example of where this is used is if a binary <filename>src/<replaceable>bar</replaceable></filename> is left uninstalled; the
3463  where this is used is where a binary is forgotten to be installed, the  <filename>install</filename> file might look like:
 <filename>install</filename> file would look like:  
3464  </para>  </para>
3465  <screen>  <screen>
3466  src/foo/mybin usr/bin  src/<replaceable>bar</replaceable> usr/bin
3467  </screen>  </screen>
3468  <para>  <para>
3469  This will mean when this package is installed, there will be a binary file  This means when this package is installed, there will be an executable command
3470  <filename>/usr/bin/mybin</filename>.  <filename>/usr/bin/<replaceable>bar</replaceable></filename>.
3471  </para>  </para>
3472  <para>  <para>
3473  Alternatively, this <filename>install</filename> can have the name of the file  Alternatively, this <filename>install</filename> can have the name of the file
3474  only without the installation directory when the relative directory path does  only without the installation directory when the relative directory path does
3475  not change.  This format is usually used for a large package that splits build  not change.  This format is usually used for a large package that splits the
3476  result into multiple binary packages using  output of its build into multiple binary packages using
3477  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3478  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3479  </para>  </para>
3480  <para>  <para>
3481  The <command>dh_install</command> command will fall back to look in  The <command>dh_install</command> command will fall back to looking in
3482  <filename>debian/tmp</filename> for files, if it doesn't find them in the  <filename>debian/tmp</filename> for files, if it doesn't find them in the
3483  current directory (or wherever you've told it to look using  current directory (or wherever you've told it to look using
3484  <literal>--sourcedir</literal>).  <literal>--sourcedir</literal>).
3485  </para>  </para>
3486  </section>  </section>
3487  <section id="info"><title><filename><replaceable>package</replaceable>.info</filename> file</title>  <section id="info"><title><filename><replaceable>package</replaceable>.info</filename></title>
3488  <para>  <para>
3489  If your package has info pages, you should install them using <citerefentry>  If your package has info pages, you should install them using <citerefentry>
3490  <refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>
3491  </citerefentry> by listing them in the  </citerefentry> by listing them in a
3492  <filename><replaceable>package</replaceable>.info</filename> files.  <filename><replaceable>package</replaceable>.info</filename> file.
3493  </para>  </para>
3494  </section>  </section>
3495  <section id="lintian"><title><filename>{<replaceable>package</replaceable>.|source/}lintian-overrides</filename> files</title>  <section id="lintian"><title><filename>{<replaceable>package</replaceable>.,source/}lintian-overrides</filename></title>
3496  <para>  <para>
3497  If <systemitem role="package">lintian</systemitem> reports an erroneous  If <systemitem role="package">lintian</systemitem> reports an erroneous
3498  diagnostics for a case when the policy allows exceptions to some rule, you can  diagnostic for a case where Debian policy allows exceptions to some rule, you can
3499  use <filename><replaceable>package</replaceable>.lintian-overrides</filename>  use <filename><replaceable>package</replaceable>.lintian-overrides</filename>
3500  or <filename>source/lintian-overrides</filename> to quiet it.  Please read  or <filename>source/lintian-overrides</filename> to quieten it.  Please read
3501  <ulink url="&lintian-doc;">Lintian User's Manual</ulink> and refrain  <ulink url="&lintian-doc;">Lintian User's Manual</ulink> and refrain
3502  from abusing this.  from abusing this.
3503  </para>  </para>
3504  <para>  <para>
3505  <filename><replaceable>package</replaceable>.lintian-overrides</filename> is  <filename><replaceable>package</replaceable>.lintian-overrides</filename> is
3506  for the binary package named as <systemitem role="package"><replaceable>package</replaceable></systemitem> and is installed  for the binary package named <systemitem role="package"><replaceable>package</replaceable></systemitem> and is installed
3507  into  into
3508  <filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>  <filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>
3509  by the <command>dh_lintian</command> command.  by the <command>dh_lintian</command> command.
# Line 3271  by the <command>dh_lintian</command> com Line 3513  by the <command>dh_lintian</command> com
3513  is not installed.  is not installed.
3514  </para>  </para>
3515  </section>  </section>
3516  <section id="manpage"><title><filename>manpage.*</filename> files</title>  <section id="manpage"><title><filename>manpage.*</filename></title>
3517  <para>  <para>
3518  Your program(s) should have a manual page.  If they don't, you should create  Your program(s) should have a manual page.  If they don't, you should create
3519  them.  The <command>dh_make</command> command creates few template files for a  them.  The <command>dh_make</command> command creates some template files for
3520  manual page.  These need to be copied and edited for each command without its  manual pages.  These need to be copied and edited for each command missing its
3521  manual page.  Please make sure to remove unused templates.  manual page.  Please make sure to remove unused templates.
3522  </para>  </para>
3523  <section id="manpage1"><title><filename>manpage.1.ex</filename> file</title>  <section id="manpage1"><title><filename>manpage.1.ex</filename></title>
3524  <para>  <para>
3525  Manual pages are normally written in <citerefentry>  Manual pages are normally written in <citerefentry>
3526  <refentrytitle>nroff</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.  <refentrytitle>nroff</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.
# Line 3288  The <filename>manpage.1.ex</filename> te Line 3530  The <filename>manpage.1.ex</filename> te
3530  manual page for a brief description of how to edit such a file.  manual page for a brief description of how to edit such a file.
3531  </para>  </para>
3532  <para>  <para>
3533  The final manual page file name should include the name of the program it is  The final manual page file name should give the name of the program it is
3534  documenting, so we will rename it from <literal>manpage</literal> to  documenting, so we will rename it from <literal>manpage</literal> to
3535  <literal>gentoo</literal>.  The file name also includes <literal>.1</literal>  <literal>gentoo</literal>.  The file name also includes <literal>.1</literal>
3536  as the first suffix, which means it's a manual page for a user command.  Be  as the first suffix, which means it's a manual page for a user command.  Be
3537  sure to verify that this section is indeed the correct one.  Here's a short  sure to verify that this section is indeed the correct one.  Here's a short
3538  list of manual page sections:  list of manual page sections:
3539  </para>  </para>
3540  <table id="manpage-sections" pgwide="0" frame="topbot" rowsep="1" colsep="1">  <informaltable id="manpage-sections" pgwide="0" frame="topbot" rowsep="1" colsep="1">
 <title>manual page sections</title>  
3541  <tgroup cols="3">  <tgroup cols="3">
3542    <colspec colwidth="8*" align="left"/> <colspec colwidth="24*" align="left"/> <colspec colwidth="40*" align="left"/>    <colspec colwidth="8*" align="left"/> <colspec colwidth="24*" align="left"/> <colspec colwidth="40*" align="left"/>
3543    <thead>    <thead>
# Line 3314  list of manual page sections: Line 3555  list of manual page sections:
3555      <row> <entry>9</entry> <entry>Kernel routines</entry> <entry>Non-standard calls and internals</entry> </row>      <row> <entry>9</entry> <entry>Kernel routines</entry> <entry>Non-standard calls and internals</entry> </row>
3556    </tbody>    </tbody>
3557  </tgroup>  </tgroup>
3558  </table>  </informaltable>
3559  <para>  <para>
3560  So <systemitem role="package">gentoo</systemitem>'s man page should be called  So <systemitem role="package">gentoo</systemitem>'s man page should be called
3561  <filename>gentoo.1</filename>.  If there was no <filename>gentoo.1</filename>  <filename>gentoo.1</filename>.  If there was no <filename>gentoo.1</filename>
3562  man page in the original source, you should create it by renaming the  man page in the original source, you should create it by renaming the
3563  <filename>manpage.1.ex</filename> template to <filename>gentoo.1</filename> and  <filename>manpage.1.ex</filename> template to <filename>gentoo.1</filename> and
3564  edit it by using information from the example and from upstream docs.  editing it using information from the example and from the upstream docs.
3565  </para>  </para>
3566  <para>  <para>
3567  You can use the <command>help2man</command> command to generate a man page out  You can use the <command>help2man</command> command to generate a man page out
3568  of <literal>--help</literal> and <literal>--version</literal> output of each  of the <literal>--help</literal> and <literal>--version</literal> output of each
3569  program, too.  <footnote><para> If the command is missing  program, too.  <footnote><para> Note that <command>help2man</command>'s
3570  <command>info</command> page but have documentation files in the  placeholder man page will claim that more detailed documentation is
3571  <filename>/usr/share/<replaceable>package</replaceable></filename> directory,  available in the info system. If the command is missing an
3572  you should manually edit generated the man page created by the  <command>info</command> page, you
3573    should manually edit the man page created by the
3574  <command>help2man</command> command.  </para> </footnote>  <command>help2man</command> command.  </para> </footnote>
3575  </para>  </para>
3576  </section>  </section>
3577  <section id="manpagesgml"><title><filename>manpage.sgml.ex</filename> file</title>  <section id="manpagesgml"><title><filename>manpage.sgml.ex</filename></title>
3578  <para>  <para>
3579  If on the other hand you prefer writing SGML instead of  If on the other hand you prefer writing SGML instead of
3580  <command>nroff</command>, you can use the <filename>manpage.sgml.ex</filename>  <command>nroff</command>, you can use the <filename>manpage.sgml.ex</filename>
# Line 3357  line in the <filename>control</filename> Line 3599  line in the <filename>control</filename>
3599  </listitem>  </listitem>
3600  <listitem>  <listitem>
3601  <para>  <para>
3602  add a <literal>override_dh_auto_build</literal> target to your  add an <literal>override_dh_auto_build</literal> target to your
3603  <filename>rules</filename> file:  <filename>rules</filename> file:
3604  </para>  </para>
3605  <screen>  <screen>
# Line 3368  override_dh_auto_build: Line 3610  override_dh_auto_build:
3610  </listitem>  </listitem>
3611  </itemizedlist>  </itemizedlist>
3612  </section>  </section>
3613  <section id="manpagexml"><title><filename>manpage.xml.ex</filename> file</title>  <section id="manpagexml"><title><filename>manpage.xml.ex</filename></title>
3614  <para>  <para>
3615  If you prefer XML over SGML, you can use the <literal>manpage.xml.ex</literal>  If you prefer XML over SGML, you can use the <literal>manpage.xml.ex</literal>
3616  template.  If you do this, you have to:  template.  If you do this, you have to:
# Line 3388  XSLT processor like <systemitem role="pa Line 3630  XSLT processor like <systemitem role="pa
3630  </listitem>  </listitem>
3631  <listitem>  <listitem>
3632  <para>  <para>
3633  add the <literal>docbook-xsl</literal>, <literal>docbook-xml</literal> and  add the <literal>docbook-xsl</literal>, <literal>docbook-xml</literal>, and
3634  <literal>xsltproc</literal> packages to the <literal>Build-Depends</literal>  <literal>xsltproc</literal> packages to the <literal>Build-Depends</literal>
3635  line in the <literal>control</literal> file  line in the <literal>control</literal> file
3636  </para>  </para>
3637  </listitem>  </listitem>
3638  <listitem>  <listitem>
3639  <para>  <para>
3640  add a <literal>override_dh_auto_build</literal> target to your  add an <literal>override_dh_auto_build</literal> target to your
3641  <filename>rules</filename> file:  <filename>rules</filename> file:
3642  </para>  </para>
3643  <screen>  <screen>
# Line 3413  override_dh_auto_build: Line 3655  override_dh_auto_build:
3655  </itemizedlist>  </itemizedlist>
3656  </section>  </section>
3657  </section>  </section>
3658  <section id="manpages"><title><filename><replaceable>package</replaceable>.manpages</filename> file</title>  <section id="manpages"><title><filename><replaceable>package</replaceable>.manpages</filename></title>
3659  <para>  <para>
3660  If your package has manual pages, you should install them using <citerefentry>  If your package has manual pages, you should install them using <citerefentry>
3661  <refentrytitle>dh_installman</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dh_installman</refentrytitle> <manvolnum>1</manvolnum>
3662  </citerefentry> by listing them in the  </citerefentry> by listing them in a
3663  <filename><replaceable>package</replaceable>.manpages</filename> files.  <filename><replaceable>package</replaceable>.manpages</filename> file.
3664  </para>  </para>
3665  <para>  <para>
3666  To install <filename>docs/gentoo.1</filename> for the <systemitem role="package">gentoo</systemitem> package as its manpage, you create a  To install <filename>docs/gentoo.1</filename> as a manpage for the <systemitem role="package">gentoo</systemitem> package, create a
3667  <filename>gentoo.manpages</filename> file as the following.  <filename>gentoo.manpages</filename> file as follows.
3668  </para>  </para>
3669  <screen>  <screen>
3670  docs/gentoo.1  docs/gentoo.1
3671  </screen>  </screen>
3672  </section>  </section>
3673  <section id="menu"><title><filename>menu</filename> file</title>  <section id="menu"><title><filename>menu</filename></title>
3674  <para>  <para>
3675  X Window System users usually have a window manager with a menu that can be  X Window System users usually have a window manager with a menu that can be
3676  customized to launch programs.  If they have installed the Debian <systemitem role="package">menu</systemitem> package, a set of menus for every program on  customized to launch programs.  If they have installed the Debian <systemitem role="package">menu</systemitem> package, a set of menus for every program on
# Line 3449  specifies what kind of interface the pro Line 3691  specifies what kind of interface the pro
3691  listed alternatives, e.g.  <literal>text</literal> or <literal>X11</literal>.  listed alternatives, e.g.  <literal>text</literal> or <literal>X11</literal>.
3692  </para>  </para>
3693  <para>  <para>
3694  The next is <literal>section</literal>, where the menu and submenu entry  The next is the <literal>section</literal> that the menu and submenu entry
3695  should appear in.  should appear in.
3696  <footnote><para> The current list of sections is at  <footnote><para> The current list of sections is in
3697  <ulink url="&menu-structure;">The Debian Menu sub-policy 2.1 'Preferred menu structure'</ulink>.  <ulink url="&menu-structure;">The Debian Menu sub-policy 2.1 "Preferred menu structure"</ulink>.
3698  There were a major reorganization of menu structure for <literal>squeeze</literal>.  There was a major reorganization of menu structure for <literal>squeeze</literal>.
3699  </para> </footnote>  </para> </footnote>
3700  </para>  </para>
3701  <para>  <para>
# Line 3480  You can also add other fields like <lite Line 3722  You can also add other fields like <lite
3722  </citerefentry>, <citerefentry> <refentrytitle>menufile</refentrytitle>  </citerefentry>, <citerefentry> <refentrytitle>menufile</refentrytitle>
3723  <manvolnum>5</manvolnum> </citerefentry>, <citerefentry>  <manvolnum>5</manvolnum> </citerefentry>, <citerefentry>
3724  <refentrytitle>update-menus</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>update-menus</refentrytitle> <manvolnum>1</manvolnum>
3725  </citerefentry> and  </citerefentry>, and
3726  <ulink url="&menu-policy;">The Debian Menu sub-policy</ulink> for more  <ulink url="&policy-menu;">The Debian Menu sub-policy</ulink> for more
3727  information.  information.
3728  </para>  </para>
3729  </section>  </section>
3730  <section id="news"><title><filename>NEWS</filename> file</title>  <section id="news"><title><filename>NEWS</filename></title>
3731  <para>  <para>
3732  The <citerefentry> <refentrytitle>dh_installchangelogs</refentrytitle>  The <citerefentry> <refentrytitle>dh_installchangelogs</refentrytitle>
3733  <manvolnum>1</manvolnum> </citerefentry> command installs this.  <manvolnum>1</manvolnum> </citerefentry> command installs this.
3734  </para>  </para>
3735  </section>  </section>
3736  <section id="maintscripts"><title><filename>{post|pre}{inst|rm}</filename> files</title>  <section id="maintscripts"><title><filename>{pre,post}{inst,rm}</filename></title>
3737  <para>  <para>
3738  These <filename>postinst</filename>, <filename>preinst</filename>,  These <filename>postinst</filename>, <filename>preinst</filename>,
3739  <filename>postrm</filename>, and <filename>prerm</filename> files  <filename>postrm</filename>, and <filename>prerm</filename> files
3740  <footnote><para> Although I used Bash short hand expression to indicate these  <footnote><para> Despite this use of the <command>bash</command>
3741  files as <filename>{post|pre}{inst|rm}</filename> here, I recommend you to use  shorthand expression <filename>{pre,post}{inst,rm}</filename> to indicate these
3742  pure POSIX (non-Bash) shell for these <emphasis>maintainer scripts</emphasis>  filenames, you should use pure POSIX syntax for these maintainer scripts for
3743  as much as possible for the better compatibility.  </para> </footnote> are  compatibility with <command>dash</command> as the system shell.  </para> </footnote> are
3744  called <emphasis>maintainer scripts</emphasis>.  They are scripts which are put  called <emphasis>maintainer scripts</emphasis>.  They are scripts which are put
3745  in the control area of the package and run by <command>dpkg</command> when your  in the control area of the package and run by <command>dpkg</command> when your
3746  package is installed, upgraded or removed.  package is installed, upgraded, or removed.
3747  </para>  </para>
3748  <para>  <para>
3749  As a novice maintainer, you should avoid any manual editing of  As a novice maintainer, you should avoid any manual editing of
3750  <emphasis>maintainer scripts</emphasis> because they are problematic.  For more  maintainer scripts because they are problematic.  For more
3751  information look in the <ulink url="&policy-mantainerscripts;">Debian  information refer to the <ulink url="&policy-mantainerscripts;">Debian
3752  Policy Manual, 6 'Package maintainer scripts and installation  Policy Manual, 6 "Package maintainer scripts and installation
3753  procedure'</ulink>, and take a look at these example files provided by  procedure"</ulink>, and take a look at the example files provided by
3754  <command>dh_make</command>.  <command>dh_make</command>.
3755  </para>  </para>
3756  <para>  <para>
3757  If you did not listen to me and made your custom <emphasis>maintainer  If you did not listen to me and have created custom maintainer
3758  scripts</emphasis> for a package, you should make sure to test them not only  scripts for a package, you should make sure to test them not only
3759  for <emphasis role="strong">install</emphasis> and <emphasis role="strong">upgrade</emphasis> but also for <emphasis role="strong">remove</emphasis> and <emphasis role="strong">purge</emphasis>.  for <emphasis role="strong">install</emphasis> and
3760    <emphasis role="strong">upgrade</emphasis> but also for
3761    <emphasis role="strong">remove</emphasis> and
3762    <emphasis role="strong">purge</emphasis>.
3763  </para>  </para>
3764  <para>  <para>
3765  Upgrades to the new version should be silent and non-intrusive (existing users  Upgrades to the new version should be silent and non-intrusive (existing users
3766  should not notice the upgrade except by discovering that old bugs have been  should not notice the upgrade except by discovering that old bugs have been
3767  fixed and there perhaps are new features).  fixed and perhaps that there are new features).
3768  </para>  </para>
3769  <para>  <para>
3770  When the upgrade is necessarily intrusive (eg., config files scattered through  When the upgrade is necessarily intrusive (eg., config files scattered through
3771  various home directories with totally different structure), you may consider to  various home directories with totally different structure), you may
3772  set package to the safe default (e.g., disabled service) and provide proper  consider as the last resort switching the package to a safe fallback state
3773  documentations required by the policy (<filename>README.Debian</filename> and  (e.g., disabling a service) and providing the proper documentation
3774  <filename>NEWS.Debian</filename>) as the last resort.  Don't bother user with  required by policy (<filename>README.Debian</filename> and
3775  the <command>debconf</command> note invoked from these <emphasis>maintainer  <filename>NEWS.Debian</filename>).  Don't bother the user with
3776  scripts</emphasis> for upgrades.  <command>debconf</command> notes invoked from these maintainer scripts
3777    for upgrades.
3778  </para>  </para>
3779  <para>  <para>
3780  The <systemitem role="package">ucf</systemitem> package provides  The <systemitem role="package">ucf</systemitem> package provides a
3781  <emphasis>conffile-like</emphasis> handling infrastructure to preserve user  <emphasis>conffile-like</emphasis> handling infrastructure to preserve user
3782  changes for files that may not be labeled <emphasis>conffiles</emphasis> such  changes for files that may not be labeled as <emphasis>conffiles</emphasis> such
3783  as ones managed by the <emphasis>maintainer scripts</emphasis>.  This should  as those managed by the maintainer scripts.  This should
3784  minimize issues associated with them.  minimize issues associated with them.
3785  </para>  </para>
3786  <para>  <para>
3787  These <emphasis>maintainer scripts</emphasis> are the Debian enhancements that  These maintainer scripts are among the Debian enhancements that
3788  explain <emphasis role="strong">why people choose Debian</emphasis>.  You must  explain <emphasis role="strong">why people choose Debian</emphasis>.  You must
3789  be very careful not to annoy them with these.  be very careful not to turn them into a source of annoyance.
3790  </para>  </para>
3791  </section>  </section>
3792  <section id="todo"><title><filename>TODO</filename> file</title>  <section id="todo"><title><filename>TODO</filename></title>
3793  <para>  <para>
3794  The <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>  The <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
3795  <manvolnum>1</manvolnum> </citerefentry> command installs this.  <manvolnum>1</manvolnum> </citerefentry> command installs this.
3796  </para>  </para>
3797  </section>  </section>
3798  <section id="watch"><title><filename>watch</filename> file</title>  <section id="watch"><title><filename>watch</filename></title>
3799  <para>  <para>
3800  The <filename>watch</filename> file format is documented in the <citerefentry>  The <filename>watch</filename> file format is documented in the <citerefentry>
3801  <refentrytitle>uscan</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>uscan</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
3802  manpage.  The <filename>watch</filename> file configures the  manpage.  The <filename>watch</filename> file configures the
3803  <command>uscan</command> program (in the <systemitem role="package">devscripts</systemitem> package) to watch the site where you  <command>uscan</command> program (in the <systemitem role="package">devscripts</systemitem> package) to watch the site where you
3804  originally got the source from.  This is also used by <ulink url="&dehs;">Debian External Health Status (DEHS)</ulink>.  originally got the source from.  This is also used by the
3805    <ulink url="&dehs;">Debian External Health Status (DEHS)</ulink> service.
3806  </para>  </para>
3807  <para>  <para>
3808  Here's what I put in it:  Here are its contents:
3809  </para>  </para>
3810  <screen>  <screen>
3811  # watch control file for uscan  # watch control file for uscan
# Line 3566  version=3 Line 3813  version=3
3813  &sf-net;/gentoo/gentoo-(.+)\.tar\.gz debian uupdate  &sf-net;/gentoo/gentoo-(.+)\.tar\.gz debian uupdate
3814  </screen>  </screen>
3815  <para>  <para>
3816  Normally with this <filename>watch</filename> file, the URL at  Normally with a <filename>watch</filename> file, the URL at
3817  <literal>&sf-net;/gentoo</literal> is downloaded and searched for links of  <literal>&sf-net;/gentoo</literal> is downloaded and searched for links of
3818  the form <literal>&lt;a href=...&gt;</literal>.  The base name (just the part  the form <literal>&lt;a href=...&gt;</literal>.  The basename (just the part
3819  after the final <literal>/</literal>) of these linked URLs are matched against  after the final <literal>/</literal>) of each linked URL is compared against
3820  Perl regular expression (see <citerefentry> <refentrytitle>perlre</refentrytitle>  the Perl regular expression pattern (see <citerefentry> <refentrytitle>perlre</refentrytitle>
3821  <manvolnum>1</manvolnum> </citerefentry>) pattern  <manvolnum>1</manvolnum> </citerefentry>)
3822  <literal>gentoo-(.+)\.tar\.gz</literal>.  Out of matched files, the file with  <literal>gentoo-(.+)\.tar\.gz</literal>.  Out of the files that match, the one with
3823  the greatest version number is downloaded and the <command>uupdate</command>  the greatest version number is downloaded and the <command>uupdate</command>
3824  program is run to create the updated source tree from them.  program is run to create an updated source tree.
3825  </para>  </para>
3826  <para>  <para>
3827  Although this is true for other sites, the SourceForge download service at  Although this is true for other sites, the SourceForge download service at
3828  <ulink url="&sf-net;"/> is an exception.  When the  <ulink url="&sf-net;"/> is an exception.  When the
3829  <filename>watch</filename> file has an URL matching with the Perl regexp  <filename>watch</filename> file has an URL matching the Perl regexp
3830  <literal>^http://sf\.net/</literal>, the <command>uscan</command> program  <literal>^http://sf\.net/</literal>, the <command>uscan</command> program
3831  substitutes it with <literal>&qa-do;watch/sf.php/</literal> and  replaces it with <literal>&qa-do;watch/sf.php/</literal> and
3832  then applies this rule.  The URL redirector service at this <ulink url="&qa-do;"/> is designed to offer  then applies this rule.  The URL redirector service at <ulink url="&qa-do;"/> is designed to offer
3833  a stable redirect service to the desired file for the  a stable redirect service to the desired file for any
3834  <filename>watch</filename> file having  <filename>watch</filename> pattern of the form
3835  <literal>&sf-net;/<replaceable>project</replaceable>/<replaceable>tar-name</replaceable>-(.+)\.tar\.gz</literal>.  <literal>&sf-net;/<replaceable>project</replaceable>/<replaceable>tar-name</replaceable>-(.+)\.tar\.gz</literal>.
3836  This solves issues related to the periodically changing URL there.  This solves issues related to periodically changing SourceForge URLs.
3837  </para>  </para>
3838  </section>  </section>
3839  <section id="sourcef"><title><filename>source/format</filename> file</title>  <section id="sourcef"><title><filename>source/format</filename></title>
3840  <para>  <para>
3841  In the <filename>debian/source/format</filename> file, there should be a single  In the <filename>debian/source/format</filename> file, there should be a single
3842  line indicating the desired format for the source package (check <citerefentry>  line indicating the desired format for the source package (check <citerefentry>
# Line 3613  should say either: Line 3860  should say either:
3860  The newer <literal>3.0 (quilt)</literal> source format records modifications in  The newer <literal>3.0 (quilt)</literal> source format records modifications in
3861  a <command>quilt</command> patch series within  a <command>quilt</command> patch series within
3862  <filename>debian/patches</filename>.  Those changes are then automatically  <filename>debian/patches</filename>.  Those changes are then automatically
3863  applied during extraction of the source package.  <footnote><para> See <ulink url="&debsrc3;">DebSrc3.0</ulink> for the  applied during extraction of the source package.  <footnote><para> See
3864  summary information concerning the switch to the new <literal>3.0  <ulink url="&debsrc3;">DebSrc3.0</ulink> for a summary on the switch to the new <literal>3.0
3865  (quilt)</literal> and <literal>3.0 (native)</literal> source formats.  </para>  (quilt)</literal> and <literal>3.0 (native)</literal> source formats.  </para>
3866  </footnote> The Debian modifications are simply stored in a  </footnote> The Debian modifications are simply stored in a
3867  <filename>debian.tar.gz</filename> archive containing all files under the  <filename>debian.tar.gz</filename> archive containing all files under the
3868  <filename>debian</filename> directory.  This new format supports inclusion of  <filename>debian</filename> directory.  This new format supports inclusion of
3869  binary files such as PNG icons by the package maintainer without requiring  binary files such as PNG icons by the package maintainer without requiring
3870  tricks.  <footnote><para> Actually, this new format also supports multiple  tricks.  <footnote><para>Actually, this new format also supports multiple
3871  upstream tarballs and more compression methods.  These are beyond the scope of  upstream tarballs and more compression methods.  These are beyond the scope of
3872  this document.  </para> </footnote>  this document.</para> </footnote>
3873  </para>  </para>
3874  <para>  <para>
3875  When <command>dpkg-source</command> extracts a source package in <literal>3.0  When <command>dpkg-source</command> extracts a source package in <literal>3.0
# Line 3631  When <command>dpkg-source</command> extr Line 3878  When <command>dpkg-source</command> extr
3878  the end of the extraction with the <literal>--skip-patches</literal> option.  the end of the extraction with the <literal>--skip-patches</literal> option.
3879  </para>  </para>
3880  </section>  </section>
3881  <section id="sourcel"><title><filename>source/local-options</filename> file</title>  <section id="sourcel"><title><filename>source/local-options</filename></title>
3882  <para>  <para>
3883  When you want to manage Debian packaging activities under a VCS, you typically  When you want to manage Debian packaging activities under a VCS, you typically
3884  create one branch (e.g.  <literal>upstream</literal>) tracking the upstream  create one branch (e.g.  <literal>upstream</literal>) tracking the upstream
# Line 3656  unapply-patches Line 3903  unapply-patches
3903  abort-on-upstream-changes  abort-on-upstream-changes
3904  </screen>  </screen>
3905  </section>  </section>
3906  <section id="sourceopt"><title><filename>source/options</filename> file</title>  <section id="sourceopt"><title><filename>source/options</filename></title>
3907  <para>  <para>
3908  The autogenerated files in the source tree can be quite annoying for packaging  The autogenerated files in the source tree can be quite annoying for packaging
3909  since they generate meaningless large patch files.  There are custom modules  since they generate meaningless large patch files.  There are custom modules
# Line 3671  You can provide a Perl regular expressio Line 3918  You can provide a Perl regular expressio
3918  creating the source package.  creating the source package.
3919  </para>  </para>
3920  <para>  <para>
3921  You can store such <command>dpkg-source</command> option argument in the  As a general solution to address this problem of the autogenerated files,
3922  <filename>source/options</filename> file of the source package as the generic  you can store such a <command>dpkg-source</command> option argument in the
3923  solution to address this problem of the autogenerated files.  The following  <filename>source/options</filename> file of the source package.  The following
3924  will skip creating patch files for <filename>config.sub</filename>,  will skip creating patch files for <filename>config.sub</filename>,
3925  <filename>config.guess</filename> and <filename>Makefile</filename>.  <filename>config.guess</filename>, and <filename>Makefile</filename>.
3926  </para>  </para>
3927  <screen>  <screen>
3928  extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"  extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"
3929  </screen>  </screen>
3930  </section>  </section>
3931  <section id="patches"><title><filename>patches/*</filename> files</title>  <section id="patches"><title><filename>patches/*</filename></title>
3932  <para>  <para>
3933  The old <literal>1.0</literal> source format created a single large  The old <literal>1.0</literal> source format created a single large
3934  <filename>diff.gz</filename> file which contains package maintenance files in  <filename>diff.gz</filename> file containing package maintenance files in
3935  <filename>debian</filename> and patch files to the source.  Such a package is a  <filename>debian</filename> and patch files for the source.  Such a package is a
3936  bit cumbersome to inspect and understand for each source tree modification  bit cumbersome to inspect and understand for each source tree modification
3937  later.  This is not so nice.  later.  This is not so nice.
3938  </para>  </para>
3939  <para>  <para>
3940  The newer <literal>3.0 (quilt)</literal> source format stores patches in  The newer <literal>3.0 (quilt)</literal> source format stores patches in
3941  <filename>debian/patches/*</filename> files using the <command>quilt</command>  <filename>debian/patches/*</filename> files using the <command>quilt</command>
3942  command.  These patches and other package data which are all constrained under  command.  These patches and other package data which are all contained under
3943  the <filename>debian</filename> directory are packaged as the  the <filename>debian</filename> directory are packaged as the
3944  <filename>debian.tar.gz</filename> file.  Since the  <filename>debian.tar.gz</filename> file.  Since the
3945  <command>dpkg-source</command> command can handle <command>quilt</command>  <command>dpkg-source</command> command can handle <command>quilt</command>
3946  formatted patch data in the <literal>3.0 (quilt)</literal> source without the  formatted patch data in the <literal>3.0 (quilt)</literal> source without the
3947  <systemitem role="package">quilt</systemitem> package, it does not need to  <systemitem role="package">quilt</systemitem> package, it does not need a
3948  <literal>Build-Depends</literal> on the <systemitem role="package">quilt</systemitem> package.  <footnote><para> Several methods  <literal>Build-Depends</literal> on <systemitem role="package">quilt</systemitem>.
3949  for the patch set maintenance have been proposed and are in use with Debian  <footnote><para> Several methods of patch set maintenance have been proposed and are in use for Debian
3950  packages.  The <command>quilt</command> system is the preferred maintenance  packages.  The <command>quilt</command> system is the preferred maintenance
3951  system in use.  Other ones are <command>dpatch</command>,  system in use.  Others include <command>dpatch</command>,
3952  <command>dbs</command>, <command>cdbs</command>, etc.  Many of these keep such  <command>dbs</command>, and <command>cdbs</command>.  Many of these keep such
3953  patches as <filename>debian/patches/*</filename> files.  </para> </footnote>  patches as <filename>debian/patches/*</filename> files.  </para> </footnote>
3954  </para>  </para>
3955  <para>  <para>
# Line 3711  The <command>quilt</command> command is Line 3958  The <command>quilt</command> command is
3958  It records modifications to the source as a stack of <literal>-p1</literal>  It records modifications to the source as a stack of <literal>-p1</literal>
3959  patch files in the <filename>debian/patches</filename> directory and the source  patch files in the <filename>debian/patches</filename> directory and the source
3960  tree is untouched outside of the <filename>debian</filename> directory.  The  tree is untouched outside of the <filename>debian</filename> directory.  The
3961  order of these patches are recorded in the  order of these patches is recorded in the
3962  <filename>debian/patches/series</filename> file.  You can apply (=push),  <filename>debian/patches/series</filename> file.  You can apply (=push),
3963  un-apply (=pop), and refresh patches easily.  <footnote><para> If you are  un-apply (=pop), and refresh patches easily.  <footnote><para> If you are
3964  asking a sponsor to upload your package, this kind of clear separation and  asking a sponsor to upload your package, this kind of clear separation and
3965  documentation of your changes are very important to expedite the package review  documentation of your changes is very important to expedite the package review
3966  by your sponsor.  </para> </footnote>  by your sponsor.  </para> </footnote>
3967  </para>  </para>
3968  <para>  <para>
3969  For <xref linkend="modify"/>, we created 3 patches in  For <xref linkend="modify"/>, we created three patches in
3970  <filename>debian/patches</filename>.  <filename>debian/patches</filename>.
3971  </para>  </para>
3972  <para>  <para>
3973  Since Debian patches are located in <filename>debian/patches</filename>, please  Since Debian patches are located in <filename>debian/patches</filename>, please
3974  make sure to setup the <command>dquilt</command> command properly as described  make sure to set up the <command>dquilt</command> command properly as described
3975  in <xref linkend="quiltrc"/>.  in <xref linkend="quiltrc"/>.
3976  </para>  </para>
3977  <para>  <para>
3978  When someone (including yourself) provides you with a patch  When anyone (including yourself) provides a patch
3979  <filename><replaceable>foo</replaceable>.patch</filename> to the source later,  <filename><replaceable>foo</replaceable>.patch</filename> to the source later,
3980  then the modification of a <literal>3.0 (quilt)</literal> source package is  modifying a <literal>3.0 (quilt)</literal> source package is
3981  quite simple:  quite simple:
3982  </para>  </para>
3983  <screen>  <screen>
# Line 3744  $ dquilt header -e Line 3991  $ dquilt header -e
3991  </screen>  </screen>
3992  <para>  <para>
3993  The patches stored in the newer <literal>3.0 (quilt)</literal> source format  The patches stored in the newer <literal>3.0 (quilt)</literal> source format
3994  must be <emphasis>fuzz</emphasis> free.  You should ensure it as <literal>dquilt  must be <emphasis>fuzz</emphasis> free.  You can ensure this with <literal>dquilt
3995  pop -a; while dquilt push; do dquilt refresh; done</literal>.  pop -a; while dquilt push; do dquilt refresh; done</literal>.
3996  </para>  </para>
3997  </section>  </section>
# Line 3755  We should now be ready to build the pack Line 4002  We should now be ready to build the pack
4002  </para>  </para>
4003  <section id="completebuild"><title>Complete (re)build</title>  <section id="completebuild"><title>Complete (re)build</title>
4004  <para>  <para>
4005  In order to properly make complete (re)build of a package, you have to ensure  In order to perform a complete (re)build of a package properly, you
4006  to install  need to make sure you have installed
4007  </para>  </para>
4008  <itemizedlist>  <itemizedlist>
4009  <listitem>  <listitem>
# Line 3829  Debian archives.  See Line 4076  Debian archives.  See
4076  <ulink url="&keycreate;">Creating a new GPG key</ulink> and  <ulink url="&keycreate;">Creating a new GPG key</ulink> and
4077  <ulink url="&keysigning; ">Debian Wiki on Keysigning</ulink>.  <ulink url="&keysigning; ">Debian Wiki on Keysigning</ulink>.
4078  </para></footnote>  </para></footnote>
4079    If you are building Debian packages only for your own local use, you can skip
4080    promptings for the GPG signatures on the <filename>.dsc</filename> file and the
4081    <filename>.changes</filename> file like this:
4082  </para>  </para>
4083    <screen>
4084    $ dpkg-buildpackage -us -uc
4085    </screen>
4086  <para>  <para>
4087  After all this is done, you will see the following files in the directory above  For a non-native Debian package, e.g.,
4088  (<filename>~/gentoo</filename>):  <systemitem role="package">gentoo</systemitem>, you will see the following
4089    files in the parent directory (<filename>~/gentoo</filename>) after building
4090    packages:
4091  </para>  </para>
4092  <itemizedlist>  <itemizedlist>
4093  <listitem>  <listitem>
# Line 3840  After all this is done, you will see the Line 4095  After all this is done, you will see the
4095  <filename>gentoo_0.9.12.orig.tar.gz</filename>  <filename>gentoo_0.9.12.orig.tar.gz</filename>
4096  </para>  </para>
4097  <para>  <para>
4098  This is the original source code tarball, merely renamed to the above so that  This is the original upstream source code tarball, merely renamed to the above so that
4099  it adheres to the Debian standard.  Note that this was created initially by the  it adheres to the Debian standard.  Note that this was created initially by the
4100  <literal>dh_make -f ../gentoo-0.9.12.tar.gz</literal>.  <literal>dh_make -f ../gentoo-0.9.12.tar.gz</literal>.
4101  </para>  </para>
# Line 3863  people can be sure that it's really your Line 4118  people can be sure that it's really your
4118  </para>  </para>
4119  <para>  <para>
4120  This compressed tarball contains your <filename>debian</filename> directory  This compressed tarball contains your <filename>debian</filename> directory
4121  contents.  Each and every addition you made to the original source code are  contents.  Each and every addition you made to the original source code is
4122  stored as <command>quilt</command> patches in  stored as a <command>quilt</command> patch in
4123  <filename>debian/patches</filename>.  <filename>debian/patches</filename>.
4124  </para>  </para>
4125  <para>  <para>
# Line 3892  install and remove this just like any ot Line 4147  install and remove this just like any ot
4147  <filename>gentoo_0.9.12-1_i386.changes</filename>  <filename>gentoo_0.9.12-1_i386.changes</filename>
4148  </para>  </para>
4149  <para>  <para>
4150  This file describes all the changes made in the current package revision, and  This file describes all the changes made in the current package revision;
4151  it is used by the Debian FTP archive maintenance programs to install the binary  it is used by the Debian FTP archive maintenance programs to install the binary
4152  and source packages in it.  It is partly generated from the  and source packages.  It is partly generated from the
4153  <filename>changelog</filename> file and the <filename>.dsc</filename> file.  <filename>changelog</filename> file and the <filename>.dsc</filename> file.
4154  This file is GPG signed, so that people can be sure that it's really yours.  This file is GPG signed, so that people can be sure that it's really yours.
4155  </para>  </para>
4156  <para>  <para>
4157  As you keep working on the package, behavior will change and new features will  As you keep working on the package, its behavior will change and new features will
4158  be added.  People downloading your package can look at this file and quickly  be added.  People downloading your package can look at this file and quickly
4159  see what has changed.  Debian archive maintenance programs will also post the  see what has changed.  Debian archive maintenance programs will also post the
4160  contents of this file to the <ulink url="&debian-devel-announce-ldo;">debian-devel-announce@lists.debian.org</ulink>  contents of this file to the <ulink url="&debian-devel-announce-ldo;">debian-devel-announce@lists.debian.org</ulink>
# Line 3909  mailing list. Line 4164  mailing list.
4164  </itemizedlist>  </itemizedlist>
4165  <para>  <para>
4166  The long strings of numbers in the <filename>.dsc</filename> and  The long strings of numbers in the <filename>.dsc</filename> and
4167  <filename>.changes</filename> files are MD5/SHA1/SHA256 checksums for the files  <filename>.changes</filename> files are SHA1/SHA256 checksums for the files
4168  mentioned.  A person downloading your files can test them with <citerefentry>  mentioned.  Anyone downloading your files can test them with <citerefentry>
4169  <refentrytitle>md5sum</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>sha1sum</refentrytitle> <manvolnum>1</manvolnum>
4170  <citerefentry> <refentrytitle>sha1sum</refentrytitle> <manvolnum>1</manvolnum>  </citerefentry> or <citerefentry> <refentrytitle>sha256sum</refentrytitle>
 </citerefentry>, or <citerefentry> <refentrytitle>sha256sum</refentrytitle>  
4171  <manvolnum>1</manvolnum> </citerefentry> and if the numbers don't match,  <manvolnum>1</manvolnum> </citerefentry> and if the numbers don't match,
4172  they'll know the file is corrupt or has been tampered with.  they'll know the file is corrupt or has been tampered with.
4173  </para>  </para>
4174    <para>
4175    For a native Debian package, e.g.,
4176    <systemitem role="package">mypackage</systemitem>, you will see the following
4177    files in the parent directory after building packages:
4178    </para>
4179    <itemizedlist>
4180    <listitem>
4181    <para>
4182    <filename>mypackage_1.0.tar.gz</filename>
4183    </para>
4184    <para>
4185    This is the source code tarball created from the
4186    <filename>mypackage-1.0</filename> directory by the
4187    <command>dpkg-source</command> command.  (Its suffix is not <filename>orig.tar.gz</filename>.)
4188    </para>
4189    </listitem>
4190    <listitem>
4191    <para>
4192    <filename>mypackage_1.0.dsc</filename>
4193    </para>
4194    <para>
4195    This is a summary of the contents of the source code as in the non-native
4196    Debian package. (There is no Debian revision.)
4197    </para>
4198    </listitem>
4199    <listitem>
4200    <para>
4201    <filename>mypackage_1.0_i386.deb</filename>
4202    </para>
4203    <para>
4204    This is your completed binary package as in the non-native Debian package.
4205    (There is no Debian revision.)
4206    </para>
4207    </listitem>
4208    <listitem>
4209    <para>
4210    <filename>mypackage_1.0_i386.changes</filename>
4211    </para>
4212    <para>
4213    This file describes all the changes made in the current package version as in
4214    the non-native Debian package. (There is no Debian revision.)
4215    </para>
4216    </listitem>
4217    </itemizedlist>
4218  </section>  </section>
4219  <section id="autobuilder"><title>Autobuilder</title>  <section id="autobuilder"><title>Autobuilder</title>
4220  <para>  <para>
4221  Debian supports many <ulink url="&ports;">ports</ulink>  Debian supports many <ulink url="&ports;">ports</ulink>
4222  with the <ulink url="&buildd;">autobuilder  with the <ulink url="&buildd;">autobuilder
4223  network</ulink> running <command>buildd</command> daemons on many different  network</ulink> running <command>buildd</command> daemons on computers
4224  architecture computers.  Although you do not need to do this by yourself, you  of many different architectures.  Although you do not need to do this yourself, you
4225  should be aware of what will happen on your packages.  Let's look into roughly  should be aware of what will happen to your packages.  Let's look into roughly
4226  how your packages are rebuild for many different architectures by them.  how they rebuild your packages for multiple architectures.
4227  <footnote><para> The actual autobuilder system involves much more complicated  <footnote><para> The actual autobuilder system involves much more complicated
4228  schemes than the one documented here.  Such details are beyond the scope of  schemes than the one documented here.  Such details are beyond the scope of
4229  this document.  </para> </footnote>  this document.  </para> </footnote>
4230  </para>  </para>
4231  <para>  <para>
4232  For <literal>Architecture: any</literal> packages, the autobuilder system  For <literal>Architecture: any</literal> packages, the autobuilder system
4233  rebuild them.  It ensures to install  performs a rebuild.  It ensures the installation of
4234  </para>  </para>
4235  <itemizedlist>  <itemizedlist>
4236  <listitem>  <listitem>
# Line 3989  create and sign the upload <filename>.ch Line 4287  create and sign the upload <filename>.ch
4287  This is why you see your package for other architectures.  This is why you see your package for other architectures.
4288  </para>  </para>
4289  <para>  <para>
4290  Although packages listed in the <literal>Build-Depends-indep</literal> field  Although packages listed in the <literal>Build-Depends-Indep</literal> field
4291  are required to be installed for the normal packaging by us (see <xref linkend="completebuild"/>), they are not required to be installed for the  are required to be installed for our normal packaging work (see
4292  autobuilder system since it build only architecture dependent binary packages.  <xref linkend="completebuild"/>), they are not required to be installed for the
4293    autobuilder system since it builds only architecture dependent binary packages.
4294  <footnote><para> Unlike under the <systemitem role="package">pbuilder</systemitem> package, the <command>chroot</command>  <footnote><para> Unlike under the <systemitem role="package">pbuilder</systemitem> package, the <command>chroot</command>
4295  environment under the <systemitem role="package">sbuild</systemitem> package  environment under the <systemitem role="package">sbuild</systemitem> package
4296  used by the autobuilder system does not force the minimal system and may leave  used by the autobuilder system does not enforce the use of a minimal
4297  many packages installed.  </para> </footnote> This difference between normal  system and may have many leftover packages installed.  </para>
4298  packaging and autobuilder situation dictates whether you record such required  </footnote> This distinction between normal packaging and autobuilding
4299    procedures is what dictates whether you should record such required
4300  packages in the <literal>Build-Depends</literal> or  packages in the <literal>Build-Depends</literal> or
4301  <literal>Build-Depends-indep</literal> fields of the  <literal>Build-Depends-Indep</literal> fields of the
4302  <filename>debian/control</filename> file (see <xref linkend="control"/>).  <filename>debian/control</filename> file (see <xref linkend="control"/>).
4303  </para>  </para>
4304  </section>  </section>
 <section id="option-sa"><title>Including <filename>orig.tar.gz</filename> for upload</title>  
 <para>  
 When you first upload the package to the archive, you need to include the  
 original <filename>orig.tar.gz</filename> source, too.  If the Debian revision  
 number of such package is neither <literal>1</literal> nor  
 <literal>0</literal>, you must provide <command>dpkg-buildpackage</command>  
 command with the <literal>-sa</literal> option.  On the other hand, the  
 <literal>-sd</literal> option will force to exclude the original  
 <filename>orig.tar.gz</filename> source.  
 </para>  
 </section>  
4305  <section id="debuild"><title><command>debuild</command> command</title>  <section id="debuild"><title><command>debuild</command> command</title>
4306  <para>  <para>
4307  You can automate package build process of the  You can automate the <command>dpkg-buildpackage</command> command's
4308  <command>dpkg-buildpackage</command> command further with the  package build process further with the
4309  <command>debuild</command> command.  See <citerefentry>  <command>debuild</command> command.  See <citerefentry>
4310  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum>
4311  </citerefentry>.  </citerefentry>.
# Line 4024  You can automate package build process o Line 4313  You can automate package build process o
4313  <para>  <para>
4314  Customization of the <command>debuild</command> command can be done through  Customization of the <command>debuild</command> command can be done through
4315  <filename>/etc/devscripts.conf</filename> or  <filename>/etc/devscripts.conf</filename> or
4316  <filename>~/.devscripts</filename>.  I would suggest at least following items:  <filename>~/.devscripts</filename>.  I would suggest at least the following items:
4317  </para>  </para>
4318  <screen>  <screen>
4319  DEBSIGN_KEYID=Your_GPG_keyID  DEBSIGN_KEYID=Your_GPG_keyID
 DEBUILD_LINTIAN=yes  
4320  DEBUILD_LINTIAN_OPTS=-i -I --show-overrides  DEBUILD_LINTIAN_OPTS=-i -I --show-overrides
4321  </screen>  </screen>
4322  <para>  <para>
4323  With these, packages are signed by your specified GPG key ID (good for  With these, packages are signed by your specified GPG key ID (good for
4324  sponsoring packages) and checked by the <command>lintian</command> command in  sponsoring packages) and checked in detail by the <command>lintian</command> command.
 details.  
4325  </para>  </para>
4326  <para>  <para>
4327  Cleaning source and rebuilding package from a user account is as simple as:  Cleaning the source and rebuilding the package from your user account is as simple as:
4328  </para>  </para>
4329  <screen>  <screen>
4330  $ debuild  $ debuild
4331  </screen>  </screen>
4332  <para>  <para>
4333  Please note that the <command>dpkg-buildpackage</command> option  Here, if you are building Debian packages only for your own local use, you can skip
4334  <literal>-sa</literal> to include the original <filename>orig.tar.gz</filename>  promptings for the GPG signatures on the <filename>.dsc</filename> file and the
4335  source can be specified as:  <filename>.changes</filename> file like this:
4336  </para>  </para>
4337  <screen>  <screen>
4338  $ debuild -sa  $ debuild -us -uc
4339  </screen>  </screen>
4340  <para>  <para>
4341  You can clean source tree as simple as:  You can clean the source tree as simply as:
4342  </para>  </para>
4343  <screen>  <screen>
4344  $ debuild clean  $ debuild clean
# Line 4061  $ debuild clean Line 4348  $ debuild clean
4348  <para>  <para>
4349  For a clean room (<command>chroot</command>) build environment to verify the  For a clean room (<command>chroot</command>) build environment to verify the
4350  build dependencies, the <systemitem role="package">pbuilder</systemitem>  build dependencies, the <systemitem role="package">pbuilder</systemitem>
4351  package is very useful.  <footnote><para> Since the <systemitem role="package">pbuilder</systemitem> package is still evolving, you have to  package is very useful.  <footnote><para> Since the <systemitem
4352    role="package">pbuilder</systemitem> package is still evolving, you should
4353  check the actual configuration situation by consulting the latest official  check the actual configuration situation by consulting the latest official
4354  documentation.</para> </footnote> This ensures a clean build from the source  documentation.</para> </footnote> This ensures a clean build from the source
4355  under the <literal>sid</literal> auto-builder for different architectures and  under the <literal>sid</literal> auto-builder for different architectures and
4356  avoids the severity serious FTBFS (Fails To Build From Source) bug which is  avoids a severity serious FTBFS (Fails To Build From Source) bug which is
4357  always in the RC (release critical) category.  always in the RC (release critical) category.
4358  <footnote><para>See <ulink url="&buildd-do;"/> for more on the  <footnote><para>See <ulink url="&buildd-do;"/> for more on
4359  auto-builder of the Debian package.</para></footnote>  Debian package auto-building.</para></footnote>
4360  </para>  </para>
4361  <para>  <para>
4362  Let's customize the <systemitem role="package">pbuilder</systemitem> package by  Let's customize the <systemitem role="package">pbuilder</systemitem> package as
4363  the following.  follows:
4364  </para>  </para>
4365  <itemizedlist>  <itemizedlist>
4366  <listitem>  <listitem>
4367  <para>  <para>
4368  setting <filename>/var/cache/pbuilder/result</filename> directory writable by  setting the <filename>/var/cache/pbuilder/result</filename> directory writable by
4369  the user.  for your user account.
4370  </para>  </para>
4371  </listitem>  </listitem>
4372  <listitem>  <listitem>
4373  <para>  <para>
4374  creating a directory, e.g.  creating a directory, e.g.
4375  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable></filename>,  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable></filename>,
4376  writable by the user to place hook scripts.  writable by the user, to place hook scripts in.
4377  </para>  </para>
4378  </listitem>  </listitem>
4379  <listitem>  <listitem>
4380  <para>  <para>
4381  setting <filename>~/.pbuilderrc</filename> or  configuring <filename>~/.pbuilderrc</filename> or
4382  <filename>/etc/pbuilderrc</filename> to include as follows.  <filename>/etc/pbuilderrc</filename> to include the followsing.
4383  </para>  </para>
4384  <screen>  <screen>
4385  AUTO_DEBSIGN=yes  AUTO_DEBSIGN=${AUTO_DEBSIGN:-yes}
4386  HOOKDIR=<replaceable>/var/cache/pbuilder/hooks</replaceable>  HOOKDIR=<replaceable>/var/cache/pbuilder/hooks</replaceable>
4387  </screen>  </screen>
4388  </listitem>  </listitem>
# Line 4104  This will allow you to sign generated pa Line 4392  This will allow you to sign generated pa
4392  <filename>~/.gnupg/</filename> directory.  <filename>~/.gnupg/</filename> directory.
4393  </para>  </para>
4394  <para>  <para>
4395  Let's then initialize the local <systemitem role="package">pbuilder</systemitem> <command>chroot</command> system first as  First let's initialize the local <systemitem role="package">pbuilder</systemitem> <command>chroot</command> system as
4396  follows.  follows.
4397  </para>  </para>
4398  <screen>  <screen>
4399  $ sudo pbuilder create  $ sudo pbuilder create
4400  </screen>  </screen>
4401  <para>  <para>
4402  If you already have the completed source packages, issue the following commands  If you already have a completed source package, issue the following commands
4403  in the directory where the  in the directory where the
4404  <filename><replaceable>foo</replaceable>.orig.tar.gz</filename>,  <filename><replaceable>foo</replaceable>.orig.tar.gz</filename>,
4405  <filename><replaceable>foo</replaceable>.debian.tar.gz</filename>, and  <filename><replaceable>foo</replaceable>.debian.tar.gz</filename>, and
# Line 4121  the local <systemitem role="package">pbu Line 4409  the local <systemitem role="package">pbu
4409  </para>  </para>
4410  <screen>  <screen>
4411  $ sudo pbuilder --update  $ sudo pbuilder --update
4412  $ sudo pbuilder --build <replaceable>foo</replaceable>.dsc  $ sudo pbuilder --build <replaceable>foo_version</replaceable>.dsc
4413  </screen>  </screen>
4414  <para>  <para>
4415  Please note that the <command>dpkg-buildpackage</command> option  The newly built packages without the GPG signatures will be located in
4416  <literal>-sa</literal> to include the original <filename>orig.tar.gz</filename>  <filename>/var/cache/pbuilder/result/</filename> with non-root ownership.
 source can be specified as:  
4417  </para>  </para>
 <screen>  
 $ sudo pbuilder --build --debbuildopts -sa <replaceable>foo</replaceable>.dsc  
 </screen>  
4418  <para>  <para>
4419  The newly built packages will be located in  The GPG signatures on the <filename>.dsc</filename> file and the
4420  <filename>/var/cache/pbuilder/result/</filename> with non-root ownership.  <filename>.changes</filename> file can be generated as:
4421  </para>  </para>
4422    <screen>
4423    $ cd /var/cache/pbuilder/result/
4424    $ debsign <replaceable>foo_version</replaceable>.dsc
4425    $ debsign <replaceable>foo_version_arch</replaceable>.changes
4426    </screen>
4427  <para>  <para>
4428  If you already have the updated source tree without generating the matching  If you have an updated source tree but have not generated the matching
4429  source packages, issue the following commands in the source directory where the  source package, issue the following commands in the source directory where the
4430  <filename>debian</filename> directory exists, instead.  <filename>debian</filename> directory exists, instead.
4431  </para>  </para>
4432  <screen>  <screen>
# Line 4145  $ sudo pbuilder --update Line 4434  $ sudo pbuilder --update
4434  $ pdebuild  $ pdebuild
4435  </screen>  </screen>
4436  <para>  <para>
4437  Please note that the <command>dpkg-buildpackage</command> option  Here, if you are building Debian packages only for your local use, you can skip
4438  <literal>-sa</literal> to include the original <filename>orig.tar.gz</filename>  promptings for the GPG signatures on the <filename>.dsc</filename> file and the
4439  source can be specified as:  <filename>.changes</filename> file as:
4440  </para>  </para>
4441  <screen>  <screen>
4442  $ pdebuild --debbuildopts -sa  $ AUTO_DEBSIGN=no pdebuild
4443  </screen>  </screen>
4444  <para>  <para>
4445  You can log into its <command>chroot</command> environment with the  You can log into its <command>chroot</command> environment with the
# Line 4164  the <literal>chroot</literal> environmen Line 4453  the <literal>chroot</literal> environmen
4453  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable>/B90lintian</filename>  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable>/B90lintian</filename>
4454  configured as follows.  <footnote><para> This assumes  configured as follows.  <footnote><para> This assumes
4455  <literal>HOOKDIR=/var/cache/pbuilder/hooks</literal>.  You can find many  <literal>HOOKDIR=/var/cache/pbuilder/hooks</literal>.  You can find many
4456  examples of the hook script in the  examples of hook scripts in the
4457  <filename>/usr/share/doc/pbuilder/examples</filename> directory.  </para>  <filename>/usr/share/doc/pbuilder/examples</filename> directory.  </para>
4458  </footnote>  </footnote>
4459  </para>  </para>
# Line 4183  echo +++ end of lintian output +++ Line 4472  echo +++ end of lintian output +++
4472  </screen>  </screen>
4473  <para>  <para>
4474  You need to have access to the latest <literal>sid</literal> environment to  You need to have access to the latest <literal>sid</literal> environment to
4475  build packages properly for <literal>sid</literal>.  In reality,  build packages properly for <literal>sid</literal>.  In practice,
4476  <literal>sid</literal> may be experiencing issues which makes it not desirable  <literal>sid</literal> may be experiencing issues which makes it undesirable
4477  for you to migrate your whole system.  The <systemitem role="package">pbuilder</systemitem> package can help you to cope with this  for you to migrate your whole system.  The <systemitem role="package">pbuilder</systemitem> package can help you to cope with this
4478  kind of situation.  kind of situation.
4479  </para>  </para>
# Line 4193  You may need to update your <literal>sta Line 4482  You may need to update your <literal>sta
4482  release for <literal>stable-proposed-updates</literal>,  release for <literal>stable-proposed-updates</literal>,
4483  <literal>stable/updates</literal>, etc.  <footnote><para> There are some  <literal>stable/updates</literal>, etc.  <footnote><para> There are some
4484  restrictions for such updates of your <literal>stable</literal> package.  restrictions for such updates of your <literal>stable</literal> package.
4485  </para> </footnote> For such occasions, I am running <literal>sid</literal>  </para> </footnote> For such occasions, the fact you may be running a <literal>sid</literal>
4486  system is not good enough excuse not to update them promptly.  The <systemitem role="package">pbuilder</systemitem> package can help you to access  system is not a good enough excuse for failing to update them promptly.  The <systemitem role="package">pbuilder</systemitem> package can help you to access
4487  environments of almost any Debian derivative distributions of the same CPU  environments of almost any Debian derivative distribution of the same
4488  architecture.  architecture.
4489  </para>  </para>
4490  <para>  <para>
# Line 4209  See <ulink url="&pbuilder;"/>, Line 4498  See <ulink url="&pbuilder;"/>,
4498  </section>  </section>
4499  <section id="git-buildpackage"><title><command>git-buildpackage</command> command and similars</title>  <section id="git-buildpackage"><title><command>git-buildpackage</command> command and similars</title>
4500  <para>  <para>
4501  If your upstream uses the source code management system (VCS)  If your upstream uses a source code management system (VCS)
4502  <footnote><para>See <ulink url="&debref-vcs;">Version control systems</ulink> for more.</para></footnote>  <footnote><para>See <ulink url="&debref-vcs;">Version control systems</ulink> for more.</para></footnote>
4503  to maintain their code, you should consider to use them.  That makes merging  to maintain their code, you should consider using it as well.  This makes merging
4504  and cherry-picking upstream patches much easier.  There are several specialized  and cherry-picking upstream patches much easier.  There are several specialized
4505  wrapper script packages for the Debian package building for each VCS.  wrapper script packages for Debian package building for each VCS.
4506  </para>  </para>
4507  <itemizedlist>  <itemizedlist>
4508  <listitem>  <listitem>
4509  <para>  <para>
4510  <systemitem role="package">git-buildpackage</systemitem>: Suite to help with  <systemitem role="package">git-buildpackage</systemitem>: a suite to help with
4511  Debian packages in Git repositories.  Debian packages in Git repositories.
4512  </para>  </para>
4513  </listitem>  </listitem>
# Line 4230  maintain Debian packages with Subversion Line 4519  maintain Debian packages with Subversion
4519  </listitem>  </listitem>
4520  <listitem>  <listitem>
4521  <para>  <para>
4522  <systemitem role="package">cvs-buildpackage</systemitem>: A set of Debian  <systemitem role="package">cvs-buildpackage</systemitem>: a set of Debian
4523  package scripts for CVS source trees.  package scripts for CVS source trees.
4524  </para>  </para>
4525  </listitem>  </listitem>
4526  </itemizedlist>  </itemizedlist>
4527  <para>  <para>
4528  There are packages which <emphasis>automate</emphasis> building of packages  For advanced audiences, there are packages which <emphasis>automate</emphasis>
4529  under VCS managed source tree for advanced audiences.  I will not explain them  the building of packages under a VCS-managed source tree.  I will not explain them
4530  in this tutorial.  in this tutorial.
4531  <footnote><para> Here are few web resources available for advanced audiences.  </para>  <footnote><para> Here are some web resources available for advanced audiences.  </para>
4532  <itemizedlist>  <itemizedlist>
4533  <listitem> <para> <ulink url="&git-buildpackage-doc;">Building Debian Packages with git-buildpackage</ulink> </para> </listitem>  <listitem> <para> <ulink url="&git-buildpackage-doc;">Building Debian Packages with git-buildpackage</ulink> </para> </listitem>
4534  <listitem> <para> <ulink url="&debian-packages-git;">debian packages in git</ulink> </para> </listitem>  <listitem> <para> <ulink url="&debian-packages-git;">debian packages in git</ulink> </para> </listitem>
4535  <listitem> <para> <ulink url="&git-debian-packaging;">Using Git for Debian Packaging</ulink> </para> </listitem>  <listitem> <para> <ulink url="&git-debian-packaging;">Using Git for Debian Packaging</ulink> </para> </listitem>
4536  <listitem> <para> <ulink url="&git-dpm;">git-dpm: Debian packages in Git manager</ulink> </para> </listitem>  <listitem> <para> <ulink url="&git-dpm;">git-dpm: Debian packages in Git manager</ulink> </para> </listitem>
4537  <listitem> <para> <ulink url="&topgit;">Using TopGit to generate quilt series for Debian packaging</ulink> </para> </listitem>  <listitem> <para> <ulink url="&topgit;">Using TopGit to generate quilt series for Debian packaging</ulink> </para> </listitem>
# Line 4253  in this tutorial. Line 4542  in this tutorial.
4542  <section id="quickrebuild"><title>Quick rebuild</title>  <section id="quickrebuild"><title>Quick rebuild</title>
4543  <para>  <para>
4544  With a large package, you may not want to rebuild from scratch every time while  With a large package, you may not want to rebuild from scratch every time while
4545  you tune details in <filename>debian/rules</filename>.  For testing purposes,  you're tuning details in <filename>debian/rules</filename>.  For testing purposes,
4546  you can make a <filename>.deb</filename> file without rebuilding the upstream  you can make a <filename>.deb</filename> file without rebuilding the upstream
4547  sources like this <footnote><para> Environment variables which are normally  sources like this<footnote><para> Environment variables which are normally
4548  configured to proper values are not set by this method.  Never create real  configured to proper values are not set by this method.  Never create real
4549  packages to be uploaded using this <emphasis role="strong">quick</emphasis>  packages to be uploaded using this <emphasis role="strong">quick</emphasis>
4550  method.  </para> </footnote>:  method.  </para> </footnote>:
# Line 4264  method.  </para> </footnote>: Line 4553  method.  </para> </footnote>:
4553  $ fakeroot debian/rules binary  $ fakeroot debian/rules binary
4554  </screen>  </screen>
4555  <para>  <para>
4556  Or, simply as following to see if it build or not.  Or simply do the following to see if it builds or not:
4557  </para>  </para>
4558  <screen>  <screen>
4559  $ fakeroot debian/rules build  $ fakeroot debian/rules build
# Line 4278  proper procedure.  You may not be able t Line 4567  proper procedure.  You may not be able t
4567  </chapter>  </chapter>
4568  <chapter id="checkit"><title>Checking the package for errors</title>  <chapter id="checkit"><title>Checking the package for errors</title>
4569  <para>  <para>
4570  There are few chores you should know to check the package for errors by  There are some techniques you should know for checking a package for errors
4571  yourself before uploading packages to public archives.  before uploading it to the public archives.
4572  </para>  </para>
4573  <para>  <para>
4574  Testing on machine other than your own is also good idea.  You must watch  It's also a good idea to carry out testing on a machine other than your own.  You must watch
4575  closely for any warnings or errors for all the test described here.  closely for any warnings or errors for all the tests described here.
4576  </para>  </para>
4577  <section id="pinstall"><title>Verifying package for install</title>  <section id="inadvent"><title>Suspicious changes</title>
4578  <para>  <para>
4579  You must test your package if it installs without problem.  The <citerefentry>  If you find a new autogenerated patch file such as
4580    <filename>debian-changes-*</filename> in the
4581    <filename>debian/patches</filename> directory after building your non-native
4582    Debian package in <literal>3.0 (quilt)</literal> format, chances are you
4583    changed some files by accident or the build script modified the upstream
4584    source.  If it is your mistake, fix it.  If it is caused by the build script,
4585    fix the root cause with <command>dh-autoreconf</command> as in
4586    <xref linkend="customrules"/> or work around it with
4587    <filename>source/options</filename> as in <xref linkend="sourceopt"/>.
4588    </para>
4589    </section>
4590    <section id="pinstall"><title>Verifying a package's installation</title>
4591    <para>
4592    You must test your package for whether it installs without problem.  The <citerefentry>
4593  <refentrytitle>debi</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>debi</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
4594  command helps you to test to install all the generated binary packages.  command helps you to test installing all the generated binary packages.
4595  </para>  </para>
4596  <screen>  <screen>
4597  $ sudo debi gentoo_0.9.12-1_i386.changes  $ sudo debi gentoo_0.9.12-1_i386.changes
4598  </screen>  </screen>
4599  <para>  <para>
4600  You have to make sure that there are no overlapped files with other existing  To prevent installation problem on different systems, you must make
4601  packages using the  sure that there are no filenames conflicting with other existing packages,
4602    using the
4603  <filename>Contents-<replaceable>i386</replaceable></filename> file downloaded  <filename>Contents-<replaceable>i386</replaceable></filename> file downloaded
4604  from the Debian archive to prevent installation problem on different systems.  from the Debian archive.
4605  The <command>apt-file</command> command may be handy for this task.  If there  The <command>apt-file</command> command may be handy for this task.  If there
4606  are overlapped files, please take actions to avoid the real problem using the  are collisions, please take action to avoid this real problem, whether by
4607  alternatives mechanism (see <citerefentry>  renaming the file, moving a common file to a separate package that
4608  <refentrytitle>update-alternatives</refentrytitle> <manvolnum>1</manvolnum>  multiple packages can depend on, using the alternatives mechanism (see
4609  </citerefentry>) by coordinating with other affected packages or by setting the  <citerefentry><refentrytitle>update-alternatives</refentrytitle>
4610  <literal>Conflicts</literal> entry in the <filename>debian/control</filename>  <manvolnum>1</manvolnum></citerefentry>) in coordination with the
4611  file.  maintainers of other affected packages, or declaring a
4612    <literal>Conflicts</literal> relationship in the
4613    <filename>debian/control</filename> file.
4614  </para>  </para>
4615  </section>  </section>
4616  <section id="pmaintscripts"><title>Verifying package for <emphasis>maintainer scripts</emphasis></title>  <section id="pmaintscripts"><title>Verifying a package's maintainer scripts</title>
4617  <para>  <para>
4618  All <emphasis>maintainer scripts</emphasis>, i.e.,  All maintainer scripts (that is,
4619  <filename>preinst</filename>, <filename>prerm</filename>,  <filename>preinst</filename>, <filename>prerm</filename>,
4620  <filename>postinst</filename>, and <filename>postrm</filename> files, are  <filename>postinst</filename>, and <filename>postrm</filename> files) are
4621  non-trivial unless they are auto-generated by the <systemitem role="package">debhelper</systemitem> programs.  So do not use them if you are  hard to write correctly unless they are auto-generated by the
4622    <systemitem role="package">debhelper</systemitem> programs.  So do not use them if you are
4623  a novice maintainer (see <xref linkend="maintscripts"/>).  a novice maintainer (see <xref linkend="maintscripts"/>).
4624  </para>  </para>
4625  <para>  <para>
4626  If the package makes use of these non-trivial <emphasis>maintainer  If the package makes use of these non-trivial maintainer scripts, be sure to test not only for install but also for remove,
4627  scripts</emphasis>, be sure to test not only for install but also for remove,  purge, and upgrade processes.  Many maintainer script bugs show up
 purge, and upgrade.  Many <emphasis>maintainer script</emphasis> bugs show up  
4628  when packages are removed or purged.  Use the <command>dpkg</command> command  when packages are removed or purged.  Use the <command>dpkg</command> command
4629  as follows to test them.  as follows to test them.
4630  </para>  </para>
# Line 4383  people will often be upgrading to your p Line 4688  people will often be upgrading to your p
4688  last Debian release.  Remember to test upgrades from that version too.  last Debian release.  Remember to test upgrades from that version too.
4689  </para>  </para>
4690  <para>  <para>
4691  Although downgrade is not officially supported, it should be nice to support  Although downgrading is not officially supported, supporting it is a
4692  it.  friendly gesture.
4693  </para>  </para>
4694  </section>  </section>
4695  <section id="lintians"><title><systemitem role="package">lintian</systemitem> package</title>  <section id="lintians"><title>Using <systemitem role="package">lintian</systemitem></title>
4696  <para>  <para>
4697  Run <citerefentry> <refentrytitle>lintian</refentrytitle>  Run <citerefentry> <refentrytitle>lintian</refentrytitle>
4698  <manvolnum>1</manvolnum> </citerefentry> on your <filename>.changes</filename>  <manvolnum>1</manvolnum> </citerefentry> on your <filename>.changes</filename>
# Line 4404  $ lintian -i -I --show-overrides gentoo_ Line 4709  $ lintian -i -I --show-overrides gentoo_
4709  <para>  <para>
4710  Of course, replace the filename with the name of the  Of course, replace the filename with the name of the
4711  <filename>.changes</filename> file generated for your package.  The output of  <filename>.changes</filename> file generated for your package.  The output of
4712  the <command>lintian</command> command are marked as follows.  the <command>lintian</command> command uses the following flags.
4713  </para>  </para>
4714  <itemizedlist>  <itemizedlist>
4715  <listitem>  <listitem>
4716  <para>  <para>
4717  <literal>E:</literal> for error; a sure policy violation or a packaging error.  <literal>E:</literal> for error; a sure policy violation or packaging error.
4718  </para>  </para>
4719  </listitem>  </listitem>
4720  <listitem>  <listitem>
4721  <para>  <para>
4722  <literal>W:</literal> for warning; a possible policy violation or a packaging  <literal>W:</literal> for warning; a possible policy violation or packaging
4723  error.  error.
4724  </para>  </para>
4725  </listitem>  </listitem>
4726  <listitem>  <listitem>
4727  <para>  <para>
4728  <literal>I:</literal> for info; a information on certain packaging aspects.  <literal>I:</literal> for info; information on certain aspects of packaging.
4729  </para>  </para>
4730  </listitem>  </listitem>
4731  <listitem>  <listitem>
# Line 4437  error. Line 4742  error.
4742  </listitem>  </listitem>
4743  </itemizedlist>  </itemizedlist>
4744  <para>  <para>
4745  For warnings, tune the package to avoid them or verify that the warnings are  When you see warnings, tune the package to avoid them or verify that the warnings are
4746  spurious.  If spurious, set the <filename>lintian-overrides</filename> files as  spurious.  If spurious, set up <filename>lintian-overrides</filename> files as
4747  described in <xref linkend="lintian"/>.  described in <xref linkend="lintian"/>.
4748  </para>  </para>
4749  <para>  <para>
4750  Note that you can build the package with <command>dpkg-buildpackage</command>  Note that you can build the package with <command>dpkg-buildpackage</command>
4751  and run <command>lintian</command> on it in one command with <citerefentry>  and run <command>lintian</command> on it in one command, if you use <citerefentry>
4752  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
4753  or with <citerefentry> <refentrytitle>pdebuild</refentrytitle>  or <citerefentry> <refentrytitle>pdebuild</refentrytitle>
4754  <manvolnum>1</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum> </citerefentry>.
4755  </para>  </para>
4756  </section>  </section>
4757  <section id="debc"><title><command>debc</command> command</title>  <section id="debc"><title>The <command>debc</command> command</title>
4758  <para>  <para>
4759  You can list files in the binary Debian package by <citerefentry>  You can list files in the binary Debian package with the <citerefentry>
4760  <refentrytitle>debc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>debc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
4761  command.  command.
4762  </para>  </para>
# Line 4459  command. Line 4764  command.
4764  $ debc <replaceable>package</replaceable>.changes  $ debc <replaceable>package</replaceable>.changes
4765  </screen>  </screen>
4766  </section>  </section>
4767  <section id="debdiff"><title><command>debdiff</command> command</title>  <section id="debdiff"><title>The <command>debdiff</command> command</title>
4768  <para>  <para>
4769  You can compare file contents in two source Debian packages with the  You can compare file contents in two source Debian packages with the
4770  <citerefentry> <refentrytitle>debdiff</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>debdiff</refentrytitle> <manvolnum>1</manvolnum>
# Line 4477  You can also compare file lists in two s Line 4782  You can also compare file lists in two s
4782  $ debdiff <replaceable>old-package</replaceable>.changes <replaceable>new-package</replaceable>.changes  $ debdiff <replaceable>old-package</replaceable>.changes <replaceable>new-package</replaceable>.changes
4783  </screen>  </screen>
4784  <para>  <para>
4785  These are useful to identify what has been changed in the source packages, if  These are useful to identify what has been changed in the source packages
4786  no files have been unintentionally misplaced or removed in the binary packages,  and to check for inadvertent changes made when updating binary
4787  and if no other inadvertent changes were made when updating binary packages.  packages, such as unintentionally misplacing or removing files.
4788  </para>  </para>
4789  </section>  </section>
4790  <section id="interdiff"><title><command>interdiff</command> command</title>  <section id="interdiff"><title>The <command>interdiff</command> command</title>
4791  <para>  <para>
4792  You can compare two <filename>diff.gz</filename> files with the <citerefentry>  You can compare two <filename>diff.gz</filename> files with the <citerefentry>
4793  <refentrytitle>interdiff</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>interdiff</refentrytitle> <manvolnum>1</manvolnum>
# Line 4499  files as described in <xref linkend="pat Line 4804  files as described in <xref linkend="pat
4804  <filename>debian/patches/*</filename> file using <command>interdiff</command>, too.  <filename>debian/patches/*</filename> file using <command>interdiff</command>, too.
4805  </para>  </para>
4806  </section>  </section>
4807  <section id="mc"><title><command>mc</command> command</title>  <section id="mc"><title>The <command>mc</command> command</title>
4808  <para>  <para>
4809  Many of these file inspection operations can be made into an intuitive process  Many of these file inspection operations can be made into an intuitive process
4810  by using a file manager like <citerefentry> <refentrytitle>mc</refentrytitle>  by using a file manager like <citerefentry> <refentrytitle>mc</refentrytitle>
# Line 4511  contents of <filename>*.deb</filename> p Line 4816  contents of <filename>*.deb</filename> p
4816  <para>  <para>
4817  Be on the lookout for extra unneeded files or zero length files, both in the  Be on the lookout for extra unneeded files or zero length files, both in the
4818  binary and source package.  Often cruft doesn't get cleaned up properly; adjust  binary and source package.  Often cruft doesn't get cleaned up properly; adjust
4819  your <filename>rules</filename> file to compensate for that.  your <filename>rules</filename> file to compensate for this.
4820  </para>  </para>
4821  </section>  </section>
4822  </chapter>  </chapter>
# Line 4524  a public archive to share it. Line 4829  a public archive to share it.
4829  <para>  <para>
4830  Once you become an official developer,  Once you become an official developer,
4831  <footnote><para>  <footnote><para>
4832  See <xref linkend="socialdynamism"/>.  See <xref linkend="socialdynamics"/>.
4833  </para></footnote>  </para></footnote>
4834  you can upload the package to the Debian archive.  you can upload the package to the Debian archive.
4835  <footnote><para>  <footnote><para>
4836  There are publicly accessible archives such as <ulink url="&mentors-dn;"/>  There are publicly accessible archives such as <ulink url="&mentors-dn;"/>
4837  which work almost the same way as Debian archive and provide upload area for  which work almost the same way as the Debian archive and provide an upload area for
4838  the non-DD.  You can set up an equivalent archive by yourself using tools  non-DDs.  You can set up an equivalent archive by yourself using the tools
4839  listed at <ulink url="&deb-archive;"/>.  So this section is useful for the  listed at <ulink url="&deb-archive;"/>.  So this section is useful for