/[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 8611 by osamu, Thu Mar 31 16:47:55 2011 UTC revision 8786 by osamu, Tue May 3 01:59:08 2011 UTC
# Line 2  Line 2 
2  <!-- -*- DocBook -*- -->  <!-- -*- DocBook -*- -->
3  <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"  <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
5    <!ENTITY % trans    SYSTEM "po4a/maint-guide.en.ent">   %trans;
6  <!ENTITY % common   SYSTEM "common.ent">   %common;  <!ENTITY % common   SYSTEM "common.ent">   %common;
7  <!ENTITY % version  SYSTEM "version.ent">  %version;  <!ENTITY % version  SYSTEM "version.ent">  %version;
8  ]>  ]>
9  <book lang="en">  <book lang="en">
10  <!-- This is UTF-8 encoded. -->  <!-- This is UTF-8 encoded. -->
11  <title>Debian New Maintainers' Guide</title>  <!--
12  <bookinfo>  This is reorganized to make this document robust for translation
13  <authorgroup>  when some externally referenced information changes.
 <author> <personname> <firstname>Josip</firstname> <surname>Rodin</surname> </personname> <email>joy-mg@debian.org</email> <contrib>(original contents)</contrib> </author>  
 <author> <personname> <firstname>Osamu</firstname> <surname>Aoki</surname> </personname> <email>osamu@debian.org</email> <contrib>(updated contents)</contrib> </author>  
   
14    
15  <!-- BEGIN: Add othercredit for translator via po4a/maint-guide.*.patch -->  If you want to add extra contents to this document, please do so by
16  <!-- END: Add othercredit for translator via po4a/maint-guide.*.patch -->   * adding tag like &othercredit; in English and provide it for each language.
17     * add extra content within msgstr but within <footnote>...</footnote>
18    Please note there will be content checker to match tags of msgid and msgstr.
19    The second rule is a way to get exception to this rule.
20    
21    Please try to correct something in translation.  If you think contents needs fix,
22    Let's fix it in the root cause.
23    
24    Please understand to keep this document focused.  Not everything you think important
25    for new maintainer should be written down.  Something social needs to be elsewhere.
26    Some thing should be left to the practice.  Something needs to be left for exercise
27    for people to check official documentations.
28    -->
29    <title>Debian New Maintainers' Guide</title>
30    <bookinfo>
31    <authorgroup>
32    <!-- do not use firstname and surname tags it braks Japanese.  The same with othercredit -->
33    <author> <personname>Josip Rodin</personname> <email>joy-mg@debian.org</email> <contrib>original contents</contrib> </author>
34    <author> <personname>Osamu Aoki</personname> <email>osamu@debian.org</email> <contrib>updated contents</contrib> </author>
35    <!-- translator credits in po4a/translator.*.ent -->
36    &othercredit;
37  </authorgroup>  </authorgroup>
38  <releaseinfo>version &docversion;</releaseinfo>  <releaseinfo>version &docversion;</releaseinfo>
39  <pubdate>&docisodate;</pubdate>  <pubdate>&docisodate;</pubdate>
# Line 33  version 2 or higher. Line 49  version 2 or higher.
49  <para>  <para>
50  This document was made using with these two documents as examples:  This document was made using with these two documents as examples:
51  </para>  </para>
52    <itemizedlist>
53    <listitem>
54  <para>  <para>
55  Making a Debian Package (AKA the Debmake Manual), copyright © 1997 Jaldhar  Making a Debian Package (AKA the Debmake Manual), copyright © 1997 Jaldhar
56  Vyas.  Vyas.
57  </para>  </para>
58    </listitem>
59    <listitem>
60  <para>  <para>
61  The New-Maintainer's Debian Packaging Howto, copyright © 1997 Will Lowe.  The New-Maintainer's Debian Packaging Howto, copyright © 1997 Will Lowe.
62  </para>  </para>
63    </listitem>
64    </itemizedlist>
65  </legalnotice>  </legalnotice>
66  <!-- toc -->  <!-- toc -->
67  </bookinfo>  </bookinfo>
68  <chapter id="start"><title>Getting started The Right Way</title>  <chapter id="start"><title>Getting started The Right Way</title>
69  <para>  <para>
70  This document tries to describe building of a Debian package to the common  This document tries to describe the building of a Debian package to ordinary
71  Debian user, and the prospectus developer.  It uses pretty common language, and  Debian users and prospective developers.  It uses fairly non-technical language, and
72  it's well covered with working examples.  There is an old Roman saying,  it's well covered with working examples.  There is an old Latin saying:
73  <emphasis>Longum iter est per preaecepta, breve et efficax per  <emphasis>Longum iter est per praecepta, breve et efficax per
74  exempla!</emphasis> (It's a long way by the rules, but short and efficient with  exempla</emphasis> (It's a long way by the rules, but short and efficient with
75  examples!).  examples).
76  </para>  </para>
77  <para>  <para>
78  This document has been updated for the Debian <literal>squeeze</literal>  This document has been updated for the Debian <literal>&base-release;</literal>
79  release.  <footnote><para> The document assumes you are using the  release.
80  <literal>squeeze</literal> system.  If you need to follow this text in the  <footnote><para> The document assumes you are using a
81  <literal>lenny</literal> system, you must install backported <systemitem role="package">dpkg</systemitem> and <systemitem role="package">debhelper</systemitem> packages, at least.  </para> </footnote>  <literal>&base-release;</literal> or newer system.  If you need to follow this
82    text in an older system (including an older Ubuntu system etc.), you must
83    install backported <systemitem role="package">dpkg</systemitem> and
84    <systemitem role="package">debhelper</systemitem> packages, at least.
85    </para> </footnote>
86  </para>  </para>
87  <para>  <para>
88  One of the things that makes Debian such a top-notch distribution is its  One of the things that makes Debian such a top-notch distribution is its
89  package system.  While there is a vast quantity of software already in the  package system.  While there is a vast quantity of software already in the
90  Debian format, sometimes you need to install software that isn't.  You may be  Debian format, sometimes you need to install software that isn't.  You may be
91  wondering how you can make your own packages and perhaps you think it is a very  wondering how you can make your own packages; and perhaps you think it is a very
92  difficult task.  Well, if you are a real novice on Linux, it is hard, but if  difficult task.  Well, if you are a real novice on Linux, it is hard, but if
93  you were rookie, you wouldn't be reading this doc now.  :-) You do need to know  you were a rookie, you wouldn't be reading this document now&nbsp;:-)
94  a little about Unix programming but you certainly don't need to be a wizard.  You do need to know a little about Unix programming but you certainly
95    don't need to be a wizard.
96    <footnote><para>
97    You can learn about the basic handling of a Debian system from the
98    <ulink url="&debref;">Debian Reference</ulink>.  It contains some pointers to
99    learn about Unix programming, too.
100    </para></footnote>
101  </para>  </para>
102  <para>  <para>
103  One thing is certain, though: to properly create and maintain Debian packages  One thing is certain, though: to properly create and maintain Debian packages
104  you need many hours.  Make no mistake, for our system to work the maintainers  takes many hours.  Make no mistake, for our system to work the maintainers
105  need to be both technically competent and diligent.  need to be both technically competent and diligent.
106  </para>  </para>
107  <para>  <para>
108  This document will explain every little (at first maybe irrelevant) step, and  If you need some help on packaging, please read <xref linkend="helpme"/>.
 help you create that first package, and to gain some experience in building  
 next releases of that and maybe other packages later on.  
109  </para>  </para>
110  <para>  <para>
111  If you need some help on packaging, please read <xref linkend="helpme"/> .  Newer versions of this document should always be available online at
112    <ulink url="&maint-guide;"/> and in the
113    <systemitem role="package">maint-guide</systemitem> package.
114    The translations may be available in packages such as
115    <systemitem role="package">maint-guide-es</systemitem>.
116    Please note that this documentation may be slightly outdated.
117  </para>  </para>
118  <para>  <para>
119  Newer versions of this document should always be available online at <ulink url="http://www.debian.org/doc/maint-guide/">http://www.debian.org/doc/maint-guide/</ulink>  Since this is a tutorial, I choose to explain each detailed step for some
120  and in the <systemitem role="package">maint-guide</systemitem> package.  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>  </para>
124  <!--  <section id="socialdynamics"><title>Social dynamics of Debian</title>
  Translation in [[this language]] is also available in the  
 <systemitem role="package">maint-guide-xy</systemitem> package.  
 -->  
 <section id="needprogs"><title>Programs you need for development</title>  
125  <para>  <para>
126  Before you start anything, you should make sure that you have properly  Here are some observations of Debian's social dynamics, presented in the hope
127  installed some additional packages needed for development.  Note that the list  that it will prepare you for interactions with Debian.
 doesn't contain any packages marked <literal>essential</literal> or  
 <literal>required</literal> - we expect that you have those installed already.  
128  </para>  </para>
129    <itemizedlist>
130    <listitem><para>We all are volunteers.</para>
131        <itemizedlist>
132        <listitem><para>You cannot impose on others what to do.</para></listitem>
133        <listitem><para>You should be motivated to do things by yourself.</para></listitem>
134        </itemizedlist></listitem>
135    <listitem><para>Friendly cooperation is the driving force.</para>
136        <itemizedlist>
137        <listitem><para>Your contribution should not overstrain others.</para></listitem>
138        <listitem><para>Your contribution is valuable only when others appreciate it.</para></listitem>
139        </itemizedlist></listitem>
140    <listitem><para>Debian is not your school where you get automatic attention of teachers.</para>
141        <itemizedlist>
142        <listitem><para>You should be able to learn many things by yourself.</para></listitem>
143        <listitem><para>Attention from other volunteers is a very scarce resource.</para></listitem>
144        </itemizedlist></listitem>
145    <listitem><para>Debian is constantly improving.</para>
146        <itemizedlist>
147        <listitem><para>You are expected to make high quality packages.</para></listitem>
148        <listitem><para>You should adapt yourself to change.</para></listitem>
149        </itemizedlist></listitem>
150    </itemizedlist>
151  <para>  <para>
152  The following packages come with the standard Debian installation, so you  There are several types of people interacting around Debian with different
153  probably have them already (along with any additional packages they depend on).  roles.
 Still, you should check it with <literal>aptitude show  
 <replaceable>package</replaceable></literal>.  
154  </para>  </para>
155    <itemizedlist>
156    <listitem>
157  <para>  <para>
158  The most important package to install on your development system is the  <emphasis role="strong">upstream author</emphasis>: the person who made the
159  <systemitem role="package">build-essential</systemitem> package.  Once you try  original program.
 to install it, it will <emphasis>pull in</emphasis> other packages required to  
 have a basic build environment.  
160  </para>  </para>
161    </listitem>
162    <listitem>
163  <para>  <para>
164  For some types of packages, that is all you will require, however there is  <emphasis role="strong">upstream maintainer</emphasis>: the person who
165  another set of packages that while not essential for all package builds are  currently maintains the program.
 useful to have install or may be required by your package:  
166  </para>  </para>
167  <itemizedlist>  </listitem>
168  <listitem>  <listitem>
169  <para>  <para>
170  <systemitem role="package">file</systemitem> - this handy program can determine  <emphasis role="strong">maintainer</emphasis>: the person making the Debian
171  what type a file is.  (see <citerefentry> <refentrytitle>file</refentrytitle>  package of the program.
 <manvolnum>1</manvolnum> </citerefentry>)  
172  </para>  </para>
173  </listitem>  </listitem>
174  <listitem>  <listitem>
175  <para>  <para>
176  <systemitem role="package">patch</systemitem> - this very useful utility will  <emphasis role="strong">sponsor</emphasis>: a person who helps maintainers to
177  take a file containing a difference listing (produced by the  upload packages to the official Debian package archive (after checking their
178  <command>diff</command> program) and apply it to the original file, producing a  contents).
 patched version.  (see <citerefentry> <refentrytitle>patch</refentrytitle>  
 <manvolnum>1</manvolnum> </citerefentry>)  
179  </para>  </para>
180  </listitem>  </listitem>
181  <listitem>  <listitem>
182  <para>  <para>
183  <systemitem role="package">perl</systemitem> - Perl is one of the most used  <emphasis role="strong">mentor</emphasis>: a person who helps novice
184  interpreted scripting languages on today's Unix-like systems, often referred to  maintainers with packaging etc.
 as Unix's Swiss Army Chainsaw.  (see <citerefentry>  
 <refentrytitle>perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  
185  </para>  </para>
186  </listitem>  </listitem>
187  <listitem>  <listitem>
188  <para>  <para>
189  <systemitem role="package">python</systemitem> - Python is another of the most  <emphasis role="strong">Debian Developer</emphasis> (DD): a member of
190  used interpreted scripting languages on the Debian system that combines  the Debian project with full upload rights to the official Debian package
191  remarkable power with very clear syntax.  (see <citerefentry>  archive.
 <refentrytitle>python</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  
192  </para>  </para>
193  </listitem>  </listitem>
194  <listitem>  <listitem>
195  <para>  <para>
196  <systemitem role="package">autoconf</systemitem>, <systemitem role="package">automake</systemitem> and <systemitem role="package">autotools-dev</systemitem> - many newer programs use configure  <emphasis role="strong">Debian Maintainer</emphasis> (DM): a person with
197  scripts and <filename>Makefile</filename> files preprocessed with help of  limited upload rights to the official Debian package archive.
198  programs like these.  (see <literal>info autoconf</literal>, <literal>info  </para>
199  automake</literal>).  The <systemitem role="package">autotools-dev</systemitem>  </listitem>
200    </itemizedlist>
201    <para>
202    Please note that you cannot become an official
203    <emphasis role="strong">Debian Developer</emphasis> (DD) overnight, because it
204    takes more than technical skill.  Please do not be discouraged by this.  If it
205    is useful to others, you can still upload your package either as a
206    <emphasis role="strong">maintainer</emphasis> through a
207    <emphasis role="strong">sponsor</emphasis> or as a
208    <emphasis role="strong">Debian Maintainer</emphasis>.
209    </para>
210    <para>
211    Please note that you do not need to create any new package to become an
212    official Debian Developer.  Contributing to the existing packages can provide a
213    path to becoming an official Debian Developer too.  There are many packages
214    waiting for good maintainers (see <xref linkend="choose"/>).
215    </para>
216    <para>
217    Since we focus only on technical aspects of packaging in this document,
218    please refer to the following to learn how Debian functions and how you can get involved.
219    </para>
220    <itemizedlist>
221    <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>
223    <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>
225    <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>
227    </itemizedlist>
228    </section>
229    <section id="needprogs"><title>Programs needed for development</title>
230    <para>
231    Before you start anything, you should make sure that you have properly
232    installed some additional packages needed for development.  Note that the list
233    doesn't contain any packages marked <literal>essential</literal> or
234    <literal>required</literal> - we expect that you have those installed already.
235    </para>
236    <para>
237    The following packages come with the standard Debian installation, so you
238    probably have them already (along with any additional packages they depend on).
239    Still, you should check it with <literal>aptitude show
240    <replaceable>package</replaceable></literal>
241    or with <literal>dpkg -s <replaceable>package</replaceable></literal>.
242    </para>
243    <para>
244    The most important package to install on your development system is the
245    <systemitem role="package">build-essential</systemitem> package.  Once you try
246    to install that, it will <emphasis>pull in</emphasis> other packages required to
247    have a basic build environment.
248    </para>
249    <para>
250    For some types of packages, that is all you will require; however, there is
251    another set of packages that while not essential for all package builds are
252    useful to have installed or may be required by your package:
253    </para>
254    <itemizedlist>
255    <listitem>
256    <para>
257    <systemitem role="package">autoconf</systemitem>, <systemitem
258    role="package">automake</systemitem>, and <systemitem
259    role="package">autotools-dev</systemitem> - many newer programs use configure
260    scripts and <filename>Makefile</filename> files preprocessed with the help of
261    programs like these (see <literal>info autoconf</literal>, <literal>info
262    automake</literal>).  <systemitem role="package">autotools-dev</systemitem>
263  keeps up-to-date versions of certain auto files and has documentation about the  keeps up-to-date versions of certain auto files and has documentation about the
264  best way to use those files.  best way to use those files.
265  </para>  </para>
266  </listitem>  </listitem>
267  <listitem>  <listitem>
268  <para>  <para>
269  <systemitem role="package">dh-make</systemitem> and <systemitem role="package">debhelper</systemitem> - <systemitem role="package">dh-make</systemitem> is necessary to create the skeleton of our  <systemitem role="package">debhelper</systemitem> and
270  example package, and it will use some of the <systemitem role="package">debhelper</systemitem> tools for creating packages.  They are  <systemitem role="package">dh-make</systemitem> -
271  not essential for creation of packages, but are <emphasis>highly</emphasis>  <systemitem role="package">dh-make</systemitem> is necessary to create
272  recommended for new maintainers.  It makes the whole process very much easier  the skeleton of our example package, and it will use some of the
273  to start, and control afterwards.  (see <citerefentry>  <systemitem role="package">debhelper</systemitem> tools for creating
274  <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>  packages.  They are not essential for this purpose, but are
275  </citerefentry>, <citerefentry> <refentrytitle>debhelper</refentrytitle>  <emphasis>highly</emphasis> recommended for new maintainers.  It makes
276  <manvolnum>1</manvolnum> </citerefentry>,  the whole process very much easier to start, and to control afterwards.
277  <filename>/usr/share/doc/debhelper/README</filename>) <footnote><para> There  (See <citerefentry> <refentrytitle>dh_make</refentrytitle>
278  are few similar but specialized packages such as <systemitem role="package">dh-make-perl</systemitem>, <systemitem role="package">dh-make-php</systemitem>, etc.  </para> </footnote>  <manvolnum>1</manvolnum> </citerefentry>, <citerefentry>
279    <refentrytitle>debhelper</refentrytitle> <manvolnum>1</manvolnum>
280    </citerefentry>.) <footnote><para> There are also some more specialized
281    but similar packages such as
282    <systemitem role="package">dh-make-perl</systemitem>,
283    <systemitem role="package">dh-make-php</systemitem>, etc.  </para>
284    </footnote>
285  </para>  </para>
286  </listitem>  </listitem>
287  <listitem>  <listitem>
288  <para>  <para>
289  <systemitem role="package">devscripts</systemitem> - this package contains some  <systemitem role="package">devscripts</systemitem> - this package contains some
290  nice and useful scripts that can be helpful to the maintainers, but they are  useful scripts that can be helpful for maintainers, but they are also
291  also not necessary for building packages.  Packages recommended and suggested  not necessary for building packages.  Packages recommended and suggested
292  by this package are worth looking into.  (see  by this package are worth looking into.  (See <ulink url="&devscripts-readme;"/>.)
 <filename>/usr/share/doc/devscripts/README.gz</filename>)  
293  </para>  </para>
294  </listitem>  </listitem>
295  <listitem>  <listitem>
296  <para>  <para>
297  <systemitem role="package">fakeroot</systemitem> - this utility lets you  <systemitem role="package">fakeroot</systemitem> - this utility lets you
298  emulate being root which is necessary for some parts of the build process.  emulate being root which is necessary for some parts of the build process.
299  (see <citerefentry> <refentrytitle>fakeroot</refentrytitle>  (See <citerefentry> <refentrytitle>fakeroot</refentrytitle>
300  <manvolnum>1</manvolnum> </citerefentry>)  <manvolnum>1</manvolnum> </citerefentry>.)
301  </para>  </para>
302  </listitem>  </listitem>
303  <listitem>  <listitem>
304  <para>  <para>
305  <systemitem role="package">gnupg</systemitem> - a tool that enables you to  <systemitem role="package">file</systemitem> - this handy program can determine
306  digitally <emphasis>sign</emphasis> packages.  This is especially important if  what type a file is.  (See <citerefentry> <refentrytitle>file</refentrytitle>
307  you want to distribute it to other people, and you will certainly be doing that  <manvolnum>1</manvolnum> </citerefentry>.)
 when your work gets included in the Debian distribution.  (see <citerefentry>  
 <refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  
308  </para>  </para>
309  </listitem>  </listitem>
310  <listitem>  <listitem>
311  <para>  <para>
312  <systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,  <systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,
313  necessary if your program is written in Fortran.  (see <citerefentry>  necessary if your program is written in Fortran.  (See <citerefentry>
314  <refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>
315  </citerefentry>)  </citerefentry>.)
316    </para>
317    </listitem>
318    <listitem>
319    <para>
320    <systemitem role="package">git</systemitem> - this package provides a popular
321    version control system designed to handle very large projects with speed and
322    efficiency; it is used for many high profile open source projects, most notably
323    the Linux kernel.  (See <citerefentry> <refentrytitle>git</refentrytitle>
324    <manvolnum>1</manvolnum> </citerefentry>,
325    <ulink url="&git-doc;">git Manual</ulink>.)
326    </para>
327    </listitem>
328    <listitem>
329    <para>
330    <systemitem role="package">gnupg</systemitem> - a tool that enables you to
331    digitally <emphasis>sign</emphasis> packages.  This is especially important if
332    you want to distribute it to other people, and you will certainly be doing that
333    when your work gets included in the Debian distribution.  (See <citerefentry>
334    <refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
335  </para>  </para>
336  </listitem>  </listitem>
337  <listitem>  <listitem>
# Line 208  necessary if your program is written in Line 339  necessary if your program is written in
339  <systemitem role="package">gpc</systemitem> - the GNU Pascal compiler,  <systemitem role="package">gpc</systemitem> - the GNU Pascal compiler,
340  necessary if your program is written in Pascal.  Worthy of note here is  necessary if your program is written in Pascal.  Worthy of note here is
341  <systemitem role="package">fp-compiler</systemitem>, the Free Pascal Compiler,  <systemitem role="package">fp-compiler</systemitem>, the Free Pascal Compiler,
342  which is also good at this task.  (see <citerefentry>  which is also good at this task.  (See <citerefentry>
343  <refentrytitle>gpc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>gpc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
344  <citerefentry> <refentrytitle>ppc386</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>ppc386</refentrytitle>
345  </citerefentry>)  <manvolnum>1</manvolnum> </citerefentry>.)
346  </para>  </para>
347  </listitem>  </listitem>
348  <listitem>  <listitem>
349  <para>  <para>
350  <systemitem role="package">xutils-dev</systemitem> - some programs, usually  <systemitem role="package">lintian</systemitem> - this is the Debian package
351  those made for X11, also use these programs to generate  checker, which can let you know of any common mistakes after you build the
352  <filename>Makefile</filename> files from sets of macro functions.  (see  package, and explains the errors found.  (See <citerefentry>
353  <citerefentry> <refentrytitle>imake</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>lintian</refentrytitle> <manvolnum>1</manvolnum>
354  </citerefentry>, <citerefentry> <refentrytitle>xmkmf</refentrytitle>  </citerefentry>,
355  <manvolnum>1</manvolnum> </citerefentry>)  <ulink url="&lintian-doc;">Lintian User's Manual</ulink>.)
356  </para>  </para>
357  </listitem>  </listitem>
358  <listitem>  <listitem>
359  <para>  <para>
360  <systemitem role="package">lintian</systemitem> - this is the Debian package  <systemitem role="package">patch</systemitem> - this very useful utility will
361  checker that can let you know of any common mistakes after you build the  take a file containing a difference listing (produced by the
362  package, and explains the errors found.  (see <citerefentry>  <command>diff</command> program) and apply it to the original file, producing a
363  <refentrytitle>lintian</refentrytitle> <manvolnum>1</manvolnum>  patched version.  (See <citerefentry> <refentrytitle>patch</refentrytitle>
364  </citerefentry>,  <manvolnum>1</manvolnum> </citerefentry>.)
365  <filename>/usr/share/doc/lintian/lintian.html/index.html</filename>)  </para>
366    </listitem>
367    <listitem>
368    <para>
369    <systemitem role="package">patchutils</systemitem> - this package contains some
370    utilities to work with patches such as the <command>lsdiff</command>,
371    <command>interdiff</command> and <command>filterdiff</command> commands.
372  </para>  </para>
373  </listitem>  </listitem>
374  <listitem>  <listitem>
# Line 248  Build From Source) bugs.  (see <citerefe Line 385  Build From Source) bugs.  (see <citerefe
385  </listitem>  </listitem>
386  <listitem>  <listitem>
387  <para>  <para>
388  <systemitem role="package">patchutils</systemitem> - this package contains some  <systemitem role="package">perl</systemitem> - Perl is one of the most used
389  utilities to work with patches such as the <command>lsdiff</command>,  interpreted scripting languages on today's Unix-like systems, often referred to
390  <command>interdiff</command> and <command>filterdiff</command> commands.  as Unix's Swiss Army Chainsaw. (See <citerefentry>
391    <refentrytitle>perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
392    </para>
393    </listitem>
394    <listitem>
395    <para>
396    <systemitem role="package">python</systemitem> - Python is another of the most
397    used interpreted scripting languages on the Debian system, combining
398    remarkable power with very clear syntax. (See <citerefentry>
399    <refentrytitle>python</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
400  </para>  </para>
401  </listitem>  </listitem>
402  <listitem>  <listitem>
403  <para>  <para>
404  <systemitem role="package">quilt</systemitem> - this package helps you to  <systemitem role="package">quilt</systemitem> - this package helps you to
405  manage a series of patches by keeping track of the changes each of them makes.  manage large numbers of patches by keeping track of the changes each patch
406  They are logically organized as a stack, and you can apply (=push), un-apply  makes. Patches can be applied, un-applied, refreshed, and more.  (See
407  (=pop), refresh them easily by traveling into the stack.  (see <citerefentry>  <citerefentry> <refentrytitle>quilt</refentrytitle> <manvolnum>1</manvolnum></citerefentry>,
408  <refentrytitle>quilt</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <ulink url="&quilt-pdf;">quilt.pdf</ulink>.)
 <filename>/usr/share/doc/quilt/README.Debian</filename>)  
409  </para>  </para>
410  </listitem>  </listitem>
411  <listitem>  <listitem>
412  <para>  <para>
413  <systemitem role="package">git</systemitem> - this package provides popular  <systemitem role="package">xutils-dev</systemitem> - some programs, usually
414  version control system designed to handle very large projects with speed and  those made for X11, also use these programs to generate
415  efficiency; it is used for many high profile open source projects, most notably  <filename>Makefile</filename> files from sets of macro functions.  (See
416  the Linux kernel.  (see <citerefentry> <refentrytitle>git</refentrytitle>  <citerefentry> <refentrytitle>imake</refentrytitle> <manvolnum>1</manvolnum>
417  <manvolnum>1</manvolnum> </citerefentry>,  </citerefentry>, <citerefentry> <refentrytitle>xmkmf</refentrytitle>
418  <filename>/usr/share/doc/git-doc/index.html</filename>)  <manvolnum>1</manvolnum> </citerefentry>.)
419  </para>  </para>
420  </listitem>  </listitem>
421  </itemizedlist>  </itemizedlist>
422  <para>  <para>
423    The short descriptions that are given above only serve to introduce you to what
424    each package does.  Before continuing please read the documentation
425    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.
428    If you have specific questions later, I would suggest re-reading the documents
429    mentioned above.
430    </para>
431    </section>
432    <section id="needdocs"><title>Documentation needed for development</title>
433    <para>
434  The following is the <emphasis>very important</emphasis> documentation which  The following is the <emphasis>very important</emphasis> documentation which
435  you should read along with this document:  you should read along with this document:
436  </para>  </para>
437  <itemizedlist>  <itemizedlist>
438  <listitem>  <listitem>
439  <para>  <para>
440  <systemitem role="package">debian-policy</systemitem> - the <ulink url="http://www.debian.org/doc/devel-manuals#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 Filesystem Hierarchy Standard  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>
443  (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  satisfy to be included in the distribution. (See the local copies of
446  <filename>&debian-policy;</filename>).  <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>
450  <para>  <para>
451  <systemitem role="package">developers-reference</systemitem> - the <ulink url="http://www.debian.org/doc/devel-manuals#devref">Debian Developer's  <systemitem role="package">developers-reference</systemitem>
452  Reference</ulink> describes all matters not specifically about the technical  - the <ulink url="&developers-reference;">Debian Developer's Reference</ulink>
453    describes all matters not specifically about the technical
454  details of packaging, like the structure of the archive, how to rename, orphan,  details of packaging, like the structure of the archive, how to rename, orphan,
455  pick up packages, how to do NMUs, how to manage bugs, best packaging practices,  or adopt packages, how to do NMUs, how to manage bugs, best packaging practices,
456  when and where to upload etc.  (see  when and where to upload etc.  (See the local copy of
457  <filename>&developers-reference;</filename>).  <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>  <listitem>
467  <para>  <para>
468  <ulink url="http://www.lrde.epita.fr/~adl/autotools.html">Autotools  <ulink url="&autotools-tutorial;">Autotools
469  Tutorial</ulink> provides very good tutorial for <ulink url="http://en.wikipedia.org/wiki/GNU_build_system">the GNU Build System known  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,  as the GNU Autotools</ulink> whose most important components are Autoconf,
471  Automake, Libtool, and gettext.  Automake, Libtool, and gettext.
472  </para>  </para>
# Line 311  Automake, Libtool, and gettext. Line 474  Automake, Libtool, and gettext.
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
477  two pieces of documentation from the GNU project: <ulink url="http://www.gnu.org/prep/standards/html_node/index.html">GNU Coding  two pieces of documentation from the GNU project:
478  Standards</ulink>, and <ulink url="http://www.gnu.org/prep/maintain/html_node/index.html">Information for  <ulink url="&gnu-standard;">GNU Coding Standards</ulink>, and
479  Maintainers of GNU Software</ulink>.  Although Debian does not require these to  <ulink url="&gnu-maintainer;">Information for Maintainers of GNU Software</ulink>.
480  be followed, these are still helpful as guidelines and common sense.  (see  Although Debian does not require these to
481  <filename>/usr/share/doc/gnu-standards/standards.html</filename> and  be followed, these are still helpful as guidelines and common sense.
482  <filename>/usr/share/doc/gnu-standards/maintain.html</filename>).  (See the local copies of
483    <ulink url="&gnu-standard-pdf;">standards.pdf</ulink> and
484    <ulink url="&gnu-maintainer-pdf;">maintain.pdf</ulink>.)
485  </para>  </para>
486  </listitem>  </listitem>
487  </itemizedlist>  </itemizedlist>
488  <para>  <para>
489  If this document contradicts with what the Debian Policy Manual and Debian  If this document contradicts any of the documents mentioned above, they
490  Developer's Reference describes, they are correct.  Please file a bug report on  are correct.  Please file a bug report on the
491  the <systemitem role="package">maint-guide</systemitem> package.  <systemitem role="package">maint-guide</systemitem> package using
492  </para>  <command>reportbug</command>.
 <para>  
 The short descriptions that are given above only serve to introduce you to what  
 each package does.  Before continuing please thoroughly read the documentation  
 of each program, at least, for the standard usage.  It may seem like heavy  
 going now, but later on you'll be <emphasis>very</emphasis> glad you read it.  
493  </para>  </para>
494  </section>  </section>
495  <section id="terminology"><title>Basic terminology</title>  <section id="helpme"><title>Where to ask for help</title>
496  <para>  <para>
497  There are two types of packages.  Before you decide to ask your question in some public place, please read the fine documentation.
498  </para>  </para>
499  <itemizedlist>  <itemizedlist>
500  <listitem>  <listitem>
501  <para>  <para>
502  <emphasis role="strong">source package</emphasis>: A source package is a set of  files in <filename>/usr/share/doc/<replaceable>package</replaceable></filename> for all pertinent packages
 files which contain code and data which you can compile and process into  
 execution programs and formatted documents.  It usually comes as a combination  
 of <filename>*.orig.tar.gz</filename>, <filename>*.debian.tar.gz</filename> (or  
 <filename>*.diff.gz</filename>), and <filename>*.dsc</filename>.  Some other  
 archive and compression methods may be used, too.  
503  </para>  </para>
504  </listitem>  </listitem>
505  <listitem>  <listitem>
506  <para>  <para>
507  <emphasis role="strong">binary package</emphasis>: A binary package contains  contents of <literal><command>man</command> <replaceable>command</replaceable></literal> for all pertinent commands
 execution programs and formatted documents.  It usually comes as  
 <filename>*.deb</filename> for the normal Debian system and as  
 <filename>*.udeb</filename> for the Debian Installer.  
508  </para>  </para>
509  </listitem>  </listitem>
 </itemizedlist>  
 <para>  
 Don't mix terms like source of the program and the source package of the  
 program!  
 </para>  
 <para>  
 There are several role names used around Debian.  
 </para>  
 <itemizedlist>  
510  <listitem>  <listitem>
511  <para>  <para>
512  <emphasis role="strong">upstream author</emphasis>: The person who made the  contents of <literal><command>info</command> <replaceable>command</replaceable></literal> for all pertinent commands
 original program.  
513  </para>  </para>
514  </listitem>  </listitem>
515  <listitem>  <listitem>
516  <para>  <para>
517  <emphasis role="strong">upstream maintainer</emphasis>: The person who  contents of <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list archive</ulink>
 currently maintains the program.  
518  </para>  </para>
519  </listitem>  </listitem>
520  <listitem>  <listitem>
521  <para>  <para>
522  <emphasis role="strong">maintainer</emphasis>: The person who makes Debian  contents of <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list archive</ulink>
 package of the program.  
523  </para>  </para>
524  </listitem>  </listitem>
525  <listitem>  </itemizedlist>
526  <para>  <para>
527  <emphasis role="strong">sponsor</emphasis>: The person who helps maintainers to  You can use web search engines more effectively by including search strings
528  upload packages to the official Debian Package Archive after checking their  such as <literal>site:lists.debian.org</literal> to limit the domain.
 contents.  
529  </para>  </para>
 </listitem>  
 <listitem>  
530  <para>  <para>
531  <emphasis role="strong">mentor</emphasis>: The person who helps novice  Making a small test package is a good way to learn details of packaging.
532  maintainers on packaging etc.  Inspecting existing well maintained packages is the best way to learn how other
533    people make packages.
534  </para>  </para>
 </listitem>  
 <listitem>  
535  <para>  <para>
536  <emphasis role="strong">Debian Developer</emphasis> (DD): The person who is a  If you still have questions about packaging that you couldn't find answers to
537  member of Debian.  He has full upload right to the official Debian Package  in the available documentation and web resources, you can ask them interactively.
 Archive.  
538  </para>  </para>
539  </listitem>  <itemizedlist>
540  <listitem>  <listitem>
541  <para>  <para>
542  <emphasis role="strong">Debian Maintainer</emphasis> (DM): The person who has  <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list</ulink>. (This mailing list is for the novice.)
 limited upload right to the official Debian Package Archive.  
543  </para>  </para>
544  </listitem>  </listitem>
 </itemizedlist>  
 <para>  
 There are several version names used around Debian.  
 </para>  
 <itemizedlist>  
545  <listitem>  <listitem>
546  <para>  <para>
547  <emphasis role="strong">upstream source version</emphasis>: The upstream source  <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list</ulink>. (This mailing list is for the expert.)
 version is referred as <literal><replaceable>version</replaceable></literal>.  
548  </para>  </para>
549  </listitem>  </listitem>
550  <listitem>  <listitem>
551  <para>  <para>
552  <emphasis role="strong">Debian revision</emphasis>: The revision by Debian on  <ulink url="&irc-debian;">IRC</ulink> such as <literal>#debian-mentors</literal>.
 package is referred as <literal><replaceable>revision</replaceable></literal>.  
553  </para>  </para>
554  </listitem>  </listitem>
555  <listitem>  </itemizedlist>
556  <para>  <para>
557  <emphasis role="strong">Debian package version</emphasis>: The Debian package  The more experienced Debian developers will gladly help you, if you ask
558  version is referred as the following.  properly after making your required efforts.
559  </para>  </para>
 <itemizedlist>  
 <listitem>  
560  <para>  <para>
561  <literal><replaceable>version</replaceable></literal> for the native Debian  When you receive a bug report (yes, actual bug reports!), you will know that it
562  binary package and for the Debian source package.  is time for you to dig into the
563    <ulink url="&bts;">Debian Bug Tracking System</ulink>
564    and read the documentation there, to be able to
565    deal with the reports efficiently.  I highly recommend reading the
566    <ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8.
567    "Handling bugs"</ulink>.
568  </para>  </para>
 </listitem>  
 <listitem>  
569  <para>  <para>
570  <literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>  Even if it all worked well, it's time to start praying.  Why?  Because in just
571  for the non-native Debian binary package.  a few hours (or days) users from all around the world will start to use your
572    package, and if you made some critical error you'll get mailbombed by numerous
573    angry Debian users...  Just kidding.  :-)
574  </para>  </para>
 </listitem>  
 </itemizedlist>  
 </listitem>  
 </itemizedlist>  
575  <para>  <para>
576  Please read the other manuals if you need more details on terminology.  Relax and be ready for bug reports, because there is a lot more work to be done
577    before your package will be fully in line with Debian policies and its best
578    practice guidelines (once again, read the <emphasis>real
579    documentation</emphasis> for details).  Good luck!
580  </para>  </para>
581  </section>  </section>
582  <section id="debiandeveloper"><title>Official Debian Developer</title>  </chapter>
583    <chapter id="first"><title>First steps</title>
584  <para>  <para>
585  You can not become an official <emphasis role="strong">Debian  Let's start by creating a package of your own (or, even better,
586  Developer</emphasis> (DD) over night because it takes more than technical  adopting an existing one).
 skill.  Please do not be discouraged by this.  If it is useful to others, you  
 can still upload your package either as a <emphasis role="strong">maintainer</emphasis> through a <emphasis role="strong">sponsor</emphasis> or as a <emphasis role="strong">Debian  
 Maintainer</emphasis>.  See <ulink url="&newmaint;">Debian New  
 Maintainers</ulink> for more.  
587  </para>  </para>
588    <section id="workflow"><title>Debian package building workflow</title>
589  <para>  <para>
590  Please note that you do not need to create any new package to become an  If you are making a Debian package with an upstream program, the
591  official Debian Developer.  Contributing to the existing packages can provide a  typical workflow of Debian package building involves generating several
592  path to become an official Debian Developer too.  There are many packages  specifically named files for each step as follows.
 waiting for good maintainers (see <xref linkend="choose"/> ).  
593  </para>  </para>
594  </section>  <itemizedlist>
595  <section id="helpme"><title>Where to ask for help</title>  <listitem>
596  <!--  <para>Get a copy of the upstream software, usually in a compressed tar format.</para>
597   /usr/share/doc/debian is used be doc-debian and debian-faq    <itemizedlist>
598  -->    <listitem><literal><replaceable>package</replaceable>-<replaceable>version</replaceable>.tar.gz</literal></listitem>
599      </itemizedlist>
600    </listitem>
601    <listitem>
602  <para>  <para>
603  Before you decide to ask your question in some public place, please just RTFM.  Add Debian-specific packaging modifications to the upstream program under the
604  That includes documentation in <filename>/usr/share/doc/dpkg</filename>,  <filename>debian</filename> directory, and create a non-native source package
605  <filename>/usr/share/doc/debian</filename>,  (that is, the set of input files used for Debian package building) in
606  <filename>&autotools-dev;</filename>,  <literal>3.0 (quilt)</literal> format.
 <filename>/usr/share/doc/<replaceable>package</replaceable>/*</filename> files  
 and the <command>man</command>/<command>info</command> pages for all the  
 programs mentioned in this document.  See all the information at <ulink url="&nm-home;">&nm-home;</ulink>.  
607  </para>  </para>
608      <itemizedlist>
609      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.orig.tar.gz</literal></listitem>
610      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.debian.tar.gz</literal>
611        <footnote><para>For the older style of non-native Debian source packages in <literal>1.0</literal> format,
612        <literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.diff.gz</literal>
613        is used instead. </para></footnote></listitem>
614      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.dsc</literal></listitem>
615      </itemizedlist>
616    </listitem>
617    <listitem>
618  <para>  <para>
619  Making a small test package is good way to learn details of packaging.  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.
 Inspecting existing well maintained packages is the best way to learn how other  
 people make packages.  
620  </para>  </para>
621      <itemizedlist>
622      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
623      </itemizedlist>
624    </listitem>
625    </itemizedlist>
626  <para>  <para>
627  If you still have questions about packaging that you couldn't find answers to  Please note that the character separating
628  in the available documentation and web resources, you can ask them on the  <literal><replaceable>package</replaceable></literal> and
629  Debian Mentors' mailing list at <ulink url="http://lists.debian.org/debian-mentors/">debian-mentors@lists.debian.org</ulink>.  <literal><replaceable>version</replaceable></literal> was changed from
630  The more experienced Debian developers will gladly help you, but do read at  <literal>-</literal> (hyphen) in the tarball name to
631  least some of the documentation before asking a question!  <literal>_</literal> (underscore) in the Debian package filenames.
632  </para>  </para>
633  <para>  <para>
634  See <ulink url="http://lists.debian.org/debian-mentors/">http://lists.debian.org/debian-mentors/</ulink>  In the file names above, replace
635  for more information about this mailing list.  the <literal><replaceable>package</replaceable></literal> part with the <emphasis role="strong">package name</emphasis>,
636    the <literal><replaceable>version</replaceable></literal> part with the <emphasis role="strong">upstream version</emphasis>,
637    the <literal><replaceable>revision</replaceable></literal> part with the <emphasis role="strong">Debian revision</emphasis>,
638    and the <literal><replaceable>arch</replaceable></literal> part with the <emphasis role="strong">package architecture</emphasis>,
639    as defined in the Debian Policy Manual.
640    <footnote> <para> See
641    <ulink url="&policy-source;">5.6.1 Source</ulink>,
642    <ulink url="&policy-package;">5.6.7 Package</ulink>, and
643    <ulink url="&policy-version;">5.6.12 Version</ulink>.
644    The <emphasis role="strong">package architecture</emphasis> follows the
645    Debian Policy Manual: <ulink url="&policy-architecture;">5.6.8 Architecture</ulink>
646    and is automatically assigned by the package build process.</para></footnote>
647  </para>  </para>
648  <para>  <para>
649  When you receive a bug report (yes, actual bug reports!), you will know that it  If instead you are making a Debian-specific package with no upstream, the
650  is time for you to dig into the <ulink url="http://www.debian.org/Bugs/">Debian  typical workflow of Debian package building is simpler.
 Bug Tracking System</ulink> and read the documentation there, to be able to  
 deal with the reports efficiently.  I highly recommend reading the <ulink url="http://www.debian.org/doc/manuals/developers-reference/pkgs.html#bug-handling">Developer's  
 Reference, 5.8.  'Handling bugs'</ulink>.  
651  </para>  </para>
652    <itemizedlist>
653    <listitem>
654  <para>  <para>
655  If you still have questions, ask on the Debian Developers' mailing list at  Create a native Debian source package in the <literal>3.0 (native)</literal>
656  <ulink url="http://lists.debian.org/debian-devel/">debian-devel@lists.debian.org</ulink>.  format using a single compressed tar file in which all files are included.
 See <ulink url="http://lists.debian.org/debian-devel/">http://lists.debian.org/debian-devel/</ulink>  
 for more information about this mailing list.  
657  </para>  </para>
658      <itemizedlist>
659      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.tar.gz</literal></listitem>
660      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.dsc</literal></listitem>
661      </itemizedlist>
662    </listitem>
663    <listitem>
664  <para>  <para>
665  Even if it all worked well, it's time to start praying.  Why?  Because in just  Build Debian binary packages from the native Debian source package.
 a few hours (or days) users from all around the world will start to use your  
 package, and if you made some critical error you'll get mailbombed by numerous  
 angry Debian users...  Just kidding.  :-)  
666  </para>  </para>
667      <itemizedlist>
668      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
669      </itemizedlist>
670    </listitem>
671    </itemizedlist>
672  <para>  <para>
673  Relax and be ready for bug reports, because there is a lot more work to be done  Each step of this outline is explained with detailed examples in later sections.
 before your package will be fully in line with Debian policies and its best  
 practice guidelines (once again, read the <emphasis>real  
 documentation</emphasis> for details).  Good luck!  
674  </para>  </para>
675  </section>  </section>
 </chapter>  
 <chapter id="first"><title>First steps</title>  
 <para>  
 Let's try to make your own package (or, better even, adopt an existing one).  
 </para>  
676  <section id="choose"><title>Choose your program</title>  <section id="choose"><title>Choose your program</title>
677  <para>  <para>
678  You have probably chosen the package you want to create.  The first thing you  You have probably chosen the package you want to create.  The first thing you
679  need to do is check if the package is in the distribution archive already by  need to do is check if the package is in the distribution archive already by
680  using <command>aptitude</command>.  using the following.
 </para>  
 <para>  
 You can also check package information through <ulink url="http://www.debian.org/distrib/packages">package search page</ulink> and  
 <ulink url="http://packages.qa.debian.org/common/index.html">Debian Package  
 Tracking System</ulink>.  
681  </para>  </para>
682    <itemizedlist>
683    <listitem>
684    <para>the <command>aptitude</command> command</para>
685    </listitem>
686    <listitem>
687    <para>the <ulink url="&packages-do;">Debian packages</ulink> web page</para>
688    </listitem>
689    <listitem>
690    <para>the <ulink url="&packages-qa-do;">Debian Package Tracking System</ulink> web page</para>
691    </listitem>
692    </itemizedlist>
693  <para>  <para>
694  If the package already exists, well, install it!  :-) If it happens to be  If the package already exists, well, install it!  :-) If it happens to be
695  <emphasis role="strong">orphaned</emphasis> -- if its maintainer is set to  <emphasis role="strong">orphaned</emphasis> (that is, if its
696  <ulink url="http://qa.debian.org/">Debian QA Group</ulink>, you may be able to  maintainer is set to <ulink url="&qa-do;">Debian QA Group</ulink>),
697  pick it up if it's still available (check the ownership status at <ulink url="http://bugs.debian.org/wnpp">Debian Bug report logs: Bugs in package wnpp  you may be able to pick it up if it's still available.  You may also
698  in unstable</ulink>).  You may also adopt a package for which the corresponding  adopt a package whose maintainer has filed a Request for Adoption
699  maintainer has filed a Request for Adoption (<emphasis role="strong">RFA</emphasis>).  (<emphasis role="strong">RFA</emphasis>).<footnote> <para>See
700    <ulink url="&devref-adopt;">Debian Developer's Reference 5.9.5.
701    "Adopting a package"</ulink>.</para> </footnote>
702  </para>  </para>
703  <para>  <para>
704  Several different views of orphaned or RFA'ed packages are available at:  There are several package ownership status resources.
705  </para>  </para>
706  <itemizedlist>  <itemizedlist>
707  <listitem>  <listitem>
708  <para>  <para> <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> </para>
 <ulink url="http://www.debian.org/devel/wnpp/">Work-Needing and Prospective  
 Packages</ulink>  
 </para>  
709  </listitem>  </listitem>
710  <listitem>  <listitem>
711  <para>  <para> <ulink url="&wnpp-bts;">Debian Bug report logs: Bugs in pseudo-package <systemitem role="package">wnpp</systemitem> in <literal>unstable</literal></ulink> </para>
 <ulink url="http://wnpp.debian.net/">Debian Packages that Need Lovin'</ulink>  
 </para>  
712  </listitem>  </listitem>
713  <listitem>  <listitem>
714  <para>  <para> <ulink url="&wnpp-dn;">Debian Packages that Need Lovin'</ulink> </para>
715  <ulink url="http://members.hellug.gr/serzan/wnpp/">Browse WNPP bugs based on  </listitem>
716  debtags</ulink>  <listitem>
717  </para>  <para> <ulink url="&wnpp-debtags;">Browse <systemitem role="package">wnpp</systemitem> bugs based on debtags</ulink> </para>
718  </listitem>  </listitem>
719  </itemizedlist>  </itemizedlist>
720  <para>  <para>
# Line 573  for most kinds of programs, and the numb Line 723  for most kinds of programs, and the numb
723  archive is much larger than that of contributors with upload rights.  Thus,  archive is much larger than that of contributors with upload rights.  Thus,
724  contributions to packages already in the archive are far more appreciated (and  contributions to packages already in the archive are far more appreciated (and
725  more likely to receive sponsorship) by other developers <footnote><para> Having  more likely to receive sponsorship) by other developers <footnote><para> Having
726  said that, there will of course always be new programs that are worthwhile  said that, there will of course always be new programs that are worth
727  packaging.  </para> </footnote>.  You can do that in various ways.  packaging.  </para> </footnote>.  You can contribute in various ways.
728  </para>  </para>
729  <itemizedlist>  <itemizedlist>
730  <listitem>  <listitem>
# Line 584  taking over orphaned, yet actively used, Line 734  taking over orphaned, yet actively used,
734  </listitem>  </listitem>
735  <listitem>  <listitem>
736  <para>  <para>
737  joining <ulink url="http://wiki.debian.org/Teams">packaging teams</ulink>  joining <ulink url="&teams;">packaging teams</ulink>
738  </para>  </para>
739  </listitem>  </listitem>
740  <listitem>  <listitem>
# Line 594  triaging bugs of very popular packages Line 744  triaging bugs of very popular packages
744  </listitem>  </listitem>
745  <listitem>  <listitem>
746  <para>  <para>
747  preparing <ulink url="http://www.debian.org/doc/developers-reference/pkgs.html#nmu-qa-upload">QA  preparing <ulink url="&devref-nmu;">QA or NMU uploads</ulink>
 or NMU uploads</ulink>  
748  </para>  </para>
749  </listitem>  </listitem>
750  </itemizedlist>  </itemizedlist>
# Line 605  If you are able to adopt the package, ge Line 754  If you are able to adopt the package, ge
754  examine them.  This document unfortunately doesn't include comprehensive  examine them.  This document unfortunately doesn't include comprehensive
755  information about adopting packages.  Thankfully you shouldn't have a hard time  information about adopting packages.  Thankfully you shouldn't have a hard time
756  figuring out how the package works since someone has already done the initial  figuring out how the package works since someone has already done the initial
757  set up for you.  Keep reading, though, a lot of the advice below will still be  setup for you.  Keep reading, though; a lot of the advice below will still be
758  applicable for your case.  applicable for your case.
759  </para>  </para>
760  <para>  <para>
# Line 615  as follows: Line 764  as follows:
764  <itemizedlist>  <itemizedlist>
765  <listitem>  <listitem>
766  <para>  <para>
767  First, you must know that program works, and have tried it for some time to  First, you must know that the program works, and have tried it for some time to
768  confirm its usefulness.  confirm its usefulness.
769  </para>  </para>
770  </listitem>  </listitem>
771  <listitem>  <listitem>
772  <para>  <para>
773  You must check if no one else is working on the package already at <ulink url="http://www.de.debian.org/devel/wnpp/being_packaged">the list of packages  You must check that no one else is already working on the package on the
774  being worked on</ulink>.  If no one else is working on it, file an ITP (Intent  <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> site.
775    If no one else is working on it, file an ITP (Intent
776  To Package) bug report to the <systemitem role="package">wnpp</systemitem>  To Package) bug report to the <systemitem role="package">wnpp</systemitem>
777  pseudo-package using <command>reportbug</command>.  If someone's already on it,  pseudo-package using <command>reportbug</command>.  If someone's already on it,
778  contact them if you feel you need to.  If not - find another interesting  contact them if you feel you need to.  If not - find another interesting
779  program that nobody maintains.  program that nobody is maintaining.
780  </para>  </para>
781  </listitem>  </listitem>
782  <listitem>  <listitem>
783  <para>  <para>
784  That program <emphasis role="strong">must have a license</emphasis>.  The software <emphasis role="strong">must have a license</emphasis>.
785  </para>  </para>
786  <itemizedlist>  <itemizedlist>
787  <listitem>  <listitem>
788  <para>  <para>
789  For the <literal>main</literal> section, it <emphasis role="strong">must be  For the <literal>main</literal> section, Debian Policy requires it
790  compliant to all the Debian Free Software Guidelines (DFSG)</emphasis> (see  <emphasis role="strong">to be fully compliant with the Debian Free Software
791  <ulink url="http://www.debian.org/social_contract#guidelines">http://www.debian.org/social_contract#guidelines</ulink>)  Guidelines</emphasis> (<ulink url="&dfsg;">DFSG</ulink>)
792  and <emphasis role="strong">that program must not require a package outside of  and <emphasis role="strong">not to require a package outside of
793  <literal>main</literal></emphasis> for compilation or execution as required by  <literal>main</literal></emphasis> for compilation or execution.  This
794  the Debian Policy.  This is desired case.  is the desired case.
795  </para>  </para>
796  </listitem>  </listitem>
797  <listitem>  <listitem>
798  <para>  <para>
799  For the <literal>contrib</literal> section, it must be compliant to all the  For the <literal>contrib</literal> section, it must comply with the
800  DFSG but it may require a package outside of <literal>main</literal> for  DFSG but it may require a package outside of <literal>main</literal> for
801  compilation or execution.  compilation or execution.
802  </para>  </para>
803  </listitem>  </listitem>
804  <listitem>  <listitem>
805  <para>  <para>
806  For the <literal>non-free</literal> section, it may not be compliant to some of  For the <literal>non-free</literal> section, it may be non-compliant
807  the DFSG but it <emphasis role="strong">must be distributable</emphasis>.  with the DFSG but it <emphasis role="strong">must be distributable</emphasis>.
808  </para>  </para>
809  </listitem>  </listitem>
810  </itemizedlist>  <listitem>
811  <para>  <para>
812  If you are unsure about where it should go, post the license text on <ulink url="http://lists.debian.org/debian-legal/">debian-legal@lists.debian.org</ulink>  If you are unsure about where it should go, post the license text on
813    <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>
814  and ask for advice.  and ask for advice.
815  </para>  </para>
816  </listitem>  </listitem>
817    </itemizedlist>
818    </listitem>
819  <listitem>  <listitem>
820  <para>  <para>
821  That program certainly should <emphasis role="strong">not</emphasis> run setuid  The program should <emphasis role="strong">not</emphasis> introduce security
822  root, or even better - it shouldn't need to be setuid or setgid to anything.  and maintenance concerns to the Debian system.
823  </para>  </para>
824  </listitem>  <itemizedlist>
825  <listitem>  <listitem>
826  <para>  <para>
827  That program should not be a daemon, or something that goes in  The program should be well documented and its code needs to be understandable
828  <filename>*/sbin</filename> directories, or open a port as root.  (i.e.  not obfuscated).
829  </para>  </para>
830  </listitem>  </listitem>
831  <listitem>  <listitem>
832  <para>  <para>
833  That program should result in binary executable form, libraries are harder to  You should contact the program's author(s) to check if they agree with packaging it
834  handle.  and are amicable to Debian.  It is important to be able to consult with the author(s)
835    in case of any problems with the program, so don't try to package
836    unmaintained software.
837  </para>  </para>
838  </listitem>  </listitem>
839  <listitem>  <listitem>
840  <para>  <para>
841  That program should be well documented and its code needs to be understandable  The program certainly should <emphasis role="strong">not</emphasis> run setuid
842  (i.e.  not obfuscated).  root, or even better, it shouldn't need to be setuid or setgid to anything.
843  </para>  </para>
844  </listitem>  </listitem>
845  <listitem>  <listitem>
846  <para>  <para>
847  You should contact program's author(s) to check if they agree with packaging it  The program should not be a daemon, or go in an
848  and amicable to Debian.  It is important to be able to consult with author(s)  <filename>*/sbin</filename> directory, or open a port as root.
 about the program in case of any program specific problems, so don't try to  
 package unmaintained pieces of software.  
849  </para>  </para>
850  </listitem>  </listitem>
851  </itemizedlist>  </itemizedlist>
852    </listitem>
853    </itemizedlist>
854  <para>  <para>
855  Of course, these things 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
856  raging 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
857  some more experience in packaging, you'll be able to do such packages, but even  more experience in packaging, you'll be able to package such software.
 the experienced developers consult the <ulink url="http://lists.debian.org/debian-mentors/">debian-mentors@lists.debian.org</ulink>  
 mailing list when they are in doubt.  And people there will gladly help.  
858  </para>  </para>
859  <para>  <para>
860  For more help about these, check in <ulink url="http://www.debian.org/doc/devel-manuals#devref">Debian Developer's  As a new maintainer, you are encouraged to get some experience in packaging
861  Reference</ulink>.  with easier packages and discouraged from creating complicated packages.
862  </para>  </para>
863    <itemizedlist>
864    <listitem><para>Simple packages</para>
865    <itemizedlist>
866      <listitem><para>single binary package, arch = all (collection of data such as wallpaper graphics)</para></listitem>
867      <listitem><para>single binary package, arch = all (executables written in an interpreted language such as POSIX shell)</para></listitem>
868    </itemizedlist>
869    </listitem>
870    <listitem><para>Intermediate complexity packages</para>
871    <itemizedlist>
872      <listitem><para>single binary package, arch = any (executables written in compiled languages such as C and C++)</para></listitem>
873      <listitem><para>multiple binary packages, arch = any + all (packages for executables + documentation)</para></listitem>
874      <listitem><para>upstream source in a format other than <filename>tar.gz</filename> or <filename>tar.bz2</filename></para></listitem>
875      <listitem><para>upstream source containing undistributable contents</para></listitem>
876    </itemizedlist>
877    </listitem>
878    <listitem><para>High complexity packages</para>
879    <itemizedlist>
880      <listitem><para>interpreter module package used by other packages</para></listitem>
881      <listitem><para>generic library package used by other packages</para></listitem>
882      <listitem><para>multiple binary packages including a library package</para></listitem>
883      <listitem><para>source package with multiple upstream sources</para></listitem>
884      <listitem><para>kernel module packages</para></listitem>
885      <listitem><para>kernel patch packages</para></listitem>
886      <listitem><para>any package with non-trivial maintainer scripts</para></listitem>
887    </itemizedlist>
888    </listitem>
889    </itemizedlist>
890    <para>
891    Packaging high complexity packages is not too hard, but it requires a bit more
892    knowledge. You should seek specific guidance for every complex feature. For
893    example, some languages have their own sub-policy documents:
894    </para>
895    <itemizedlist>
896    <listitem><para><ulink url="&policy-perl;">Perl policy</ulink></para></listitem>
897    <listitem><para><ulink url="&policy-python;">Python policy</ulink></para></listitem>
898    <listitem><para><ulink url="&policy-java;">Java policy</ulink></para></listitem>
899    </itemizedlist>
900    <para>
901    There is another old Latin saying: <emphasis>fabricando fit faber</emphasis>
902    (practice makes perfect).  It is <emphasis>highly</emphasis> recommended to
903    practice and experiment with all the steps of Debian packaging with simple packages
904    while reading this tutorial.  A trivial upstream tarball
905    <filename>hello-sh-1.0.tar.gz</filename> created as followings may offer
906    a good starting point.<footnote><para>Do not worry about the missing
907    <filename>Makefile</filename>.  You can install the <command>hello</command>
908    command by simply using <command>debhelper</command> as in
909    <xref linkend="install"/>, or by modifying the upstream source to add a new
910    <filename>Makefile</filename> with the <literal>install</literal> target as in
911    <xref linkend="modify"/>.</para></footnote>
912    </para>
913    <screen>
914    $ mkdir -p hello-sh/hello-sh-1.0; cd hello-sh/hello-sh-1.0
915    $ cat &gt; hello &lt;&lt;EOF
916    #!/bin/sh
917    # (C) 2011 Foo Bar, GPL2+
918    echo "Hello!"
919    EOF
920    $ chmod 755 hello
921    $ cd ..
922    $ tar -cvzf hello-sh-1.0.tar.gz hello-sh-1.0
923    </screen>
924  </section>  </section>
925  <section id="getit"><title>Get the program, and try it out</title>  <section id="getit"><title>Get the program, and try it out</title>
926  <para>  <para>
927  So the first thing to do is to find and download the original source code.  I  So the first thing to do is to find and download the original source code.
928  presume that you already have the source file that you picked up at the  Presumably you already have the source file that you picked up at the
929  author's homepage.  Sources for free Unix programs usually come in  author's homepage.  Sources for free Unix programs usually come in
930  <command>tar</command>+<command>gzip</command> format with extension  <command>tar</command>+<command>gzip</command> format with the extension
931  <filename>.tar.gz</filename>, or  <filename>.tar.gz</filename>,
932  <command>tar</command>+<command>bzip2</command> format with extension  <command>tar</command>+<command>bzip2</command> format with the extension
933  <filename>.tar.bz2</filename>.  These usually contain the subdirectory called  <filename>.tar.bz2</filename>, or
934  <filename><replaceable>programname</replaceable>-<replaceable>version</replaceable></filename>  <command>tar</command>+<command>xz</command> format with the extension
935  in them and all the sources under it.  <filename>.tar.xz</filename>.  These usually contain a directory called
936    <filename><replaceable>package</replaceable>-<replaceable>version</replaceable></filename>
937    with all the sources inside.
938  </para>  </para>
939  <para>  <para>
940  If the latest version of such sources are available through VCS such as Git,  If the latest version of the source is available through a VCS such as Git,
941  Subversion, or CVS repository, you need to get it with <literal>git  Subversion, or CVS, you need to get it with <literal>git
942  clone</literal>, <literal>cvs co</literal>, or <literal>svn co</literal> and  clone</literal>, <literal>svn co</literal>, or <literal>cvs co</literal> and
943  repack it into <command>tar</command>+<command>gzip</command> format by  repack it into <command>tar</command>+<command>gzip</command> format yourself
944  yourself using the <literal>--exclude-vcs</literal> option.  by using the <literal>--exclude-vcs</literal> option.
945  </para>  </para>
946  <para>  <para>
947  If your program's source comes as some other sort of archive (for instance, the  If your program's source comes as some other sort of archive (for instance, the
948  filename ends in <filename>.Z</filename> or  filename ends in <filename>.Z</filename> or
949  <filename>.zip</filename><footnote><para> You can identify the archive format  <filename>.zip</filename><footnote><para> You can identify the archive format
950  using the <command>file</command> command when the file extension is not  using the <command>file</command> command when the file extension is not
951  enough.  </para> </footnote>), unpack it with appropriate tools and repack it,  enough.  </para> </footnote>), you should also unpack it with the
952  too.  appropriate tools and repack it.
953    </para>
954    <para>
955    If your program's source comes with some contents which do not comply with
956    DFSG, you should also unpack it to remove such contents and repack it with a
957    modified upstream version containg <literal>dfsg</literal>.
958  </para>  </para>
959  <para>  <para>
960  As an example, I'll use a program called <command>gentoo</command>, an X GTK+  As an example, I'll use a program called <command>gentoo</command>, a GTK+
961  file manager.<footnote><para> This program is already packaged.  Current  file manager.
962  version 0.15.3 has changed substantially from the version 0.9.12 in the  <footnote><para> This program is already packaged. The
963  following examples.  </para> </footnote>  <ulink url="&gentoo-package;">current version</ulink> uses Autotools as its
964    build structure and is substantially different from the following examples,
965    which were based on version 0.9.12.</para>
966    </footnote>
967  </para>  </para>
968  <para>  <para>
969  Create a subdirectory under your home directory named  Create a subdirectory under your home directory named
970  <filename>debian</filename> or <filename>deb</filename> or anything you find  <filename>debian</filename> or <filename>deb</filename> or anything you find
971  appropriate (e.g.  just <filename>~/gentoo</filename> would do fine in this  appropriate (e.g.  just <filename>~/gentoo</filename> would do fine in this
972  case).  Place the downloaded archive in it, and extract it (with <literal>tar  case).  Place the downloaded archive in it, and extract it (with <literal>tar
973  xzf gentoo-0.9.12.tar.gz</literal>).  Make sure there are no errors, even some  xzf gentoo-0.9.12.tar.gz</literal>).  Make sure there are no warning
974  <emphasis>irrelevant</emphasis> ones, because there will most probably be  messages, even <emphasis>irrelevant</emphasis> ones, because other
975  problems unpacking on other people's systems, whose unpacking tools may or may  people's unpacking tools may or may not ignore these anomalies, so they
976  not ignore those anomalies.  On your console screen, you should see the  may have problems unpacking them.  Your shell command line may look
977  following.  something like this:
978  </para>  </para>
979  <screen>  <screen>
980  $ mkdir ~/gentoo ; cd ~/gentoo  $ mkdir ~/gentoo ; cd ~/gentoo
# Line 765  Now you have another subdirectory, calle Line 989  Now you have another subdirectory, calle
989  Change to that directory and <emphasis>thoroughly</emphasis> read the provided  Change to that directory and <emphasis>thoroughly</emphasis> read the provided
990  documentation.  Usually there are files named <filename>README*</filename>,  documentation.  Usually there are files named <filename>README*</filename>,
991  <filename>INSTALL*</filename>, <filename>*.lsm</filename> or  <filename>INSTALL*</filename>, <filename>*.lsm</filename> or
992  <filename>*.html</filename>.  You must find instructions on how to correctly  <filename>*.html</filename>.  You must find instructions on how to
993  compile and install the program (most probably they'll assume you want to  compile and install the program (most probably they'll assume you want to
994  install to <filename>/usr/local/bin</filename> directory; you won't be doing  install to the <filename>/usr/local/bin</filename> directory; you won't be doing
995  that, but more on that later in <xref linkend="destdir"/> ).  that, but more on that later in <xref linkend="destdir"/>).
996  </para>  </para>
997  <para>  <para>
998  Simple programs come with a <filename>Makefile</filename> file in them and can  You should start packaging with a completely clean (pristine) source directory,
999  be compiled simply with <literal>make</literal>.  Some of them support  or simply with freshly unpacked sources.
1000  <literal>make check</literal>, which runs included self-checks.  Installation  </para>
1001    </section>
1002    <section id="simplemake"><title>Simple build systems</title>
1003    <para>
1004    Simple programs usually come with a <filename>Makefile</filename> and can
1005    be compiled just by invoking <literal>make</literal>.<footnote><para>
1006    Many modern programs come with a script <filename>configure</filename> which
1007    when executed creates a <filename>Makefile</filename> customized for
1008    your system.</para></footnote> Some of them support
1009    <literal>make check</literal>, which runs included self-tests.  Installation
1010  to the destination directories is usually done with <literal>make  to the destination directories is usually done with <literal>make
1011  install</literal>.  install</literal>.
1012  </para>  </para>
# Line 788  there's even a <literal>make uninstall</ Line 1021  there's even a <literal>make uninstall</
1021  all the installed files.  all the installed files.
1022  </para>  </para>
1023  </section>  </section>
1024  <section id="portable"><title>Free portable programs</title>  <section id="portable"><title>Popular portable build systems</title>
1025  <para>  <para>
1026  A lot of Free programs are written in the <ulink url="http://en.wikipedia.org/wiki/C_(programming_language)">C</ulink> and  A lot of free software programs are written in the <ulink url="&c-program;">C</ulink> and
1027  <ulink url="http://en.wikipedia.org/wiki/C++">C++</ulink> languages.  Many of  <ulink url="&cxx;">C++</ulink> languages.  Many of these use Autotools or
1028  these use Autotools or CMake to make them portable across different platforms.  CMake to make them portable across different platforms.  These build tools need
1029  These tools are used to generate <filename>Makefile</filename> and other  to be used to generate the <filename>Makefile</filename> and other
1030  required source files.  Then, such programs are built with usual <literal>make;  required source files first.  Then, such programs are built using the usual
1031  make install</literal>.  <literal>make; make install</literal>.
1032  </para>  </para>
1033  <para>  <para>
1034  <ulink url="http://en.wikipedia.org/wiki/GNU_build_system">Autotools</ulink>  <ulink url="&gnu-build-system;">Autotools</ulink> is the GNU build
1035  are the GNU build system comprising <ulink url="http://en.wikipedia.org/wiki/Autoconf">Autoconf</ulink>, <ulink url="http://en.wikipedia.org/wiki/Automake">Automake</ulink>, <ulink url="http://en.wikipedia.org/wiki/GNU_Libtool">Libtool</ulink>, and <ulink url="http://en.wikipedia.org/wiki/GNU_gettext">gettext</ulink>.  You can notice  system comprising <ulink url="&autoconf;">Autoconf</ulink>,
1036    <ulink url="&automake;">Automake</ulink>,
1037    <ulink url="&libtool;">Libtool</ulink>, and
1038    <ulink url="&gettext;">gettext</ulink>.  You can recognize
1039  such sources by the <filename>configure.ac</filename>,  such sources by the <filename>configure.ac</filename>,
1040  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.
1041  <footnote><para> See <ulink url="http://www.lrde.epita.fr/~adl/autotools.html">Autotools Tutorial</ulink>  <footnote><para>Autotools is too big to deal in this small tutorial. This
1042  and <filename>&autotools-dev;</filename>.  </para> </footnote>  section is meant to provide keywords and references only.  Please make sure to read the
1043    <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink> and
1044    <ulink url="&autotools-readme;"/>, if you need to use it.</para></footnote>
1045  </para>  </para>
1046  <para>  <para>
1047  The first step of Autotools work flow is usually that the upstream runs  The first step of the Autotools workflow is usually that upstream runs
1048  <literal>autoreconf -i -f</literal> in the source and distributes this source  <literal>autoreconf -i -f</literal> in the source directory and
1049  with generated files.  distributes the generated files along with the source.
1050  </para>  </para>
1051  <screen>  <screen>
1052  configure.ac-----+-&gt; autoreconf -+-&gt; configure  configure.ac-----+-&gt; autoreconf -+-&gt; configure
# Line 827  files requires some knowledge of <comman Line 1065  files requires some knowledge of <comman
1065  <literal>info automake</literal>.  <literal>info automake</literal>.
1066  </para>  </para>
1067  <para>  <para>
1068  The second step of Autotools work flow is usually that the user obtains this  The second step of the Autotools workflow is usually that the user obtains this
1069  distributed source and runs <literal>./configure &amp;&amp; make</literal> in  distributed source and runs <literal>./configure &amp;&amp; make</literal> in
1070  the source to compile program into a  the source directory to compile the program into a
1071  <command><replaceable>binary</replaceable></command>.  <command><replaceable>binary</replaceable></command> executable.
1072  </para>  </para>
1073  <screen>  <screen>
1074  Makefile.in -----+                +-&gt; Makefile -----+-&gt; make -&gt; <replaceable>binary</replaceable>  Makefile.in -----+                +-&gt; Makefile -----+-&gt; make -&gt; <replaceable>binary</replaceable>
# Line 841  config.h.in -----+                +-&gt; Line 1079  config.h.in -----+                +-&gt;
1079             config.guess --+             config.guess --+
1080  </screen>  </screen>
1081  <para>  <para>
1082  You can change many things in the <filename>Makefile</filename> file such as  You can change many things in the <filename>Makefile</filename>; for
1083  the default file install location using the command option, e.g.  instance you can change the default location for file installation
1084  <command>./configure --prefix=/usr</command>.  using the option <command>./configure --prefix=/usr</command>.
1085  </para>  </para>
1086  <para>  <para>
1087  Although it is not required, updating the <filename>configure</filename> and  Although it is not required, updating the <filename>configure</filename> and
1088  other files with <literal>autoreconf -i -f</literal> as the user may improve  other files with <literal>autoreconf -i -f</literal> may improve
1089  the compatibility of the source.  the compatibility of the source.
1090    <footnote><para>You can automate this by using
1091    <systemitem role="package">dh-autoreconf</systemitem> package.
1092    See <xref linkend="customrules"/>.</para></footnote>
1093  </para>  </para>
1094  <para>  <para>
1095  <ulink url="http://en.wikipedia.org/wiki/CMake">CMake</ulink> is an alternative  <ulink url="&cmake;">CMake</ulink> is an alternative
1096  build system.  You can notice such sources by the  build system.  You can recognize such sources by the
1097  <filename>CMakeLists.txt</filename> file.  <filename>CMakeLists.txt</filename> file.
1098  </para>  </para>
1099  </section>  </section>
1100  <section id="namever"><title>Package name and version</title>  <section id="namever"><title>Package name and version</title>
1101  <para>  <para>
1102  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
1103  or simply with freshly unpacked sources.  take <literal>gentoo</literal> as the (source) <emphasis role="strong">package name</emphasis>
1104    and <literal>0.9.12</literal> as the <emphasis role="strong">upstream version</emphasis>.
1105    These are used in the <filename>debian/changelog</filename> file described later in
1106    <xref linkend="changelog"/>, too.
1107    </para>
1108    <para>
1109    Although this simple approach works most of the times, you may need to adjust
1110    <emphasis role="strong">package name</emphasis> and
1111    <emphasis role="strong">upstream version</emphasis> by renaming the upstream
1112    source to follow Debian Policy and existing convention.
1113    </para>
1114    <para>
1115    You must choose the <emphasis role="strong">package name</emphasis>
1116    to consist only of lower case letters (<literal>a-z</literal>), digits
1117    (<literal>0-9</literal>), plus (<literal>+</literal>) and minus
1118    (<literal>-</literal>) signs, and periods (<literal>.</literal>). It must be
1119    at least two characters long, must start with an alphanumeric character, and
1120    must not be the same as existing ones.
1121    It is a good idea to keep its length within 30 characters.
1122    <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>
1123  </para>  </para>
1124    <!--
1125    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1126    === stat for package name string length ===
1127    11 1947 36.9%   mode
1128    14 1717 54.7%  50% median
1129    23 611 91.0%   90%
1130    32 89 99.0%    99%
1131    41 12 99.9%    99.9%
1132    52 1 100.0%
1133    Previous 20 chars is becoming too short for 17% of packages
1134    Default aptitude setting display up to 30 chars (98.3%).
1135    -->
1136  <para>  <para>
1137  For the package to be built correctly, you must make the program's original  If upstream uses some generic term such as <literal>test-suite</literal> for
1138  name lowercase (if it isn't already), and you should move the source directory  its name, it is a good idea to rename it to identify its contents explicitly and avoid namespace pollution.
1139  to  <footnote><para>If you follow the
1140  <filename><replaceable>packagename</replaceable>-<replaceable>version</replaceable></filename>.  <ulink url="&devref-newpackage;">Debian Developer's Reference 5.1. "New packages"</ulink>,
1141  </para>  the ITP process will usually catch this kind of issues.</para></footnote>
1142  <para>  </para>
1143  If the program name consists of more than one word, contract them to one word,  <para>
1144  or make an abbreviation.  For example, program John's little editor for X  You should choose the <emphasis role="strong">upstream version</emphasis>
1145  package would be named <systemitem role="package">johnledx</systemitem>, or  to consist only of
1146  <systemitem role="package">jle4x</systemitem>, or whatever you decide, as long  alphanumerics (<literal>0-9A-Za-z</literal>), plus (<literal>+</literal>),
1147  as it's under some reasonable limit, e.g.  20 characters.  tildes (<literal>~</literal>), and periods (<literal>.</literal>). It must
1148  </para>  start with a digit (<literal>0-9</literal>).  <footnote><para>This stricter
1149  <para>  rule should help you avoid confusing file names.</para></footnote>
1150  Also check for the exact version of the program (to be included in the package  It is good idea to keep its length within 8 characters if possible.
1151  version).  If that piece of software is not numbered with versions like  <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>
1152  <literal>X.Y.Z</literal>, but with some kind of date, feel free to use that  </para>
1153  date as the version number, as long as newer version numbers will look larger.  <!--
1154  While it is best to use the same version number as what upstream uses, if it is  Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1155  in the format of <literal>09Oct23</literal> you may need to convert it to  === stat for upstream version string length ===
1156  <literal>YYYYMMDD</literal> format, which would be <literal>20091023</literal>,  5 9765 60.2%  50% median and mode
1157  to ensure proper order for upgrade with the <command>dpkg</command>  6 3765 73.3%
1158  program.<footnote><para> Version string can be compared by <literal>dpkg  7 2789 82.9%
1159  --compare-versions <replaceable>ver1</replaceable>  8 1158 86.9%
1160  <replaceable>op</replaceable> <replaceable>ver2</replaceable></literal>.  See  9 501 88.6%
1161  <citerefentry> <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum>  10 773 91.3%  90%
1162  </citerefentry> manpage.  </para> </footnote>  18 55 99.1%   99%
1163  </para>  27 11 99.9%    99.9
1164  <para>  35 6 100.0%
1165  Some programs won't be numbered at all, in which case you should contact the  === stat for debian revision string length ===
1166  upstream maintainer to see if they've got some other revision-tracking method.  1 22556 83.3%  50% median and mode
1167  </para>  2 1106 87.2%
1168  </section>  3 1312 91.7%   90%
1169  <section id="dh-make"><title>Initial Debian package</title>  4 2127 99.1%   99%
1170  <para>  7 14 99.9%     99.9%
1171  Let's set up the shell environment variable <literal>$DEBEMAIL</literal> and  
1172  <literal>$DEBFULLNAME</literal> so many Debian maintenance tools recognize your  aptitude display 10 = 8char for up + 1char (for -) + 1char for deb
1173  name and email address to use for packages as follows.<footnote><para> The  90chars as max for file name of binary debs (package+up+deb+arch+.deb)
1174    -->
1175    <para>
1176    If upstream does not use a normal versioning scheme such as
1177    <literal>2.30.32</literal> but uses some kind of date such as
1178    <literal>09Oct23</literal>, a random codename string, or a VCS hash value as part
1179    of the version, make sure to remove them from the
1180    <emphasis role="strong">upstream version</emphasis>.  Such information can be
1181    recorded in the <filename>debian/changelog</filename> file.  If you need to
1182    invent a version string, use the <literal>YYYYMMDD</literal> format such as
1183    <literal>20110429</literal> as upstream version.  This ensures that
1184    <command>dpkg</command> interprets later versions correctly as upgrades.
1185    </para>
1186    <para>
1187    Version strings <footnote><para>Version strings may be
1188    <emphasis role="strong">upstream version</emphasis>
1189    (<literal><replaceable>version</replaceable></literal>),
1190    <emphasis role="strong">Debian revision</emphasis>
1191    (<literal><replaceable>revision</replaceable></literal>), or
1192    <emphasis role="strong">version</emphasis>
1193    (<literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>).
1194    See <xref linkend="newrevision"/> for how the
1195    <emphasis role="strong">Debian revision</emphasis> is incremented.
1196    </para></footnote>
1197    can be compared using <citerefentry>
1198    <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> as follows.
1199    </para>
1200    <screen>
1201     $ dpkg --compare-versions <replaceable>ver1</replaceable> <replaceable>op</replaceable> <replaceable>ver2</replaceable>
1202    </screen>
1203    <para>
1204    The version comparison rule can be summarized as:
1205    </para>
1206    <itemizedlist>
1207    <listitem><para>Strings are compared from the head to the tail.</para></listitem>
1208    <listitem><para>Letters are larger than digits.</para></listitem>
1209    <listitem><para>Numbers are compared as integers.</para></listitem>
1210    <listitem><para>Letters are compared in ASCII code order.</para></listitem>
1211    <listitem><para>There are special rules for period
1212    (<literal>.</literal>), plus (<literal>+</literal>), and tilde
1213    (<literal>~</literal>) characters, as follows.</para>
1214      <para>
1215      <literal>0.0</literal> &lt;
1216      <literal>0.5</literal> &lt;
1217      <literal>0.10</literal> &lt;
1218      <literal>0.99</literal> &lt;
1219      <literal>1</literal> &lt;
1220      <literal>1.0~rc1</literal> &lt;
1221      <literal>1.0</literal> &lt;
1222      <literal>1.0+b1</literal> &lt;
1223      <literal>1.0+nmu1</literal> &lt;
1224      <literal>1.1</literal> &lt;
1225      <literal>2.0</literal>
1226      </para>
1227    </listitem>
1228    </itemizedlist>
1229    <para>
1230    One tricky case occurs when upstream releases
1231    <filename>gentoo-0.9.12-ReleaseCandidate-99.tar.gz</filename> as the
1232    pre-release of <filename>gentoo-0.9.12.tar.gz</filename>.  You need to make
1233    sure that the upgrade works properly by renaming the upstream source to
1234    <filename>gentoo-0.9.12~rc99.tar.gz</filename>.
1235    </para>
1236    </section>
1237    <section id="dh-make"><title>Setting up <command>dh_make</command></title>
1238    <para>
1239    Set up the shell environment variables <literal>$DEBEMAIL</literal> and
1240    <literal>$DEBFULLNAME</literal> so that various Debian maintenance
1241    tools recognize your email address and name to use for packages. <footnote><para> The
1242  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
1243  other login shells such as Z shell, use their pertinent configuration files  some other login shell such as Z shell, use their corresponding
1244  instead of <filename>~/.bashrc</filename>.  </para> </footnote>.  configuration files instead of <filename>~/.bashrc</filename>. </para> </footnote>
1245  </para>  </para>
1246  <screen>  <screen>
1247  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF
# Line 909  DEBEMAIL=your.email.address@example.org Line 1249  DEBEMAIL=your.email.address@example.org
1249  DEBFULLNAME=Firstname Lastname  DEBFULLNAME=Firstname Lastname
1250  export DEBEMAIL DEBFULLNAME  export DEBEMAIL DEBFULLNAME
1251  EOF  EOF
1252    $ . ~/.bashrc
1253  </screen>  </screen>
1254    </section>
1255    <section id="non-native-dh-make"><title>Initial non-native Debian package</title>
1256  <para>  <para>
1257  Let's make an initial Debian package by issuing the <command>dh_make</command>  Normal Debian packages are non-native Debian packages made from upstream
1258    programs.  If you wish to create a non-native Debian package of an upstream
1259    source <filename>gentoo-0.9.12.tar.gz</filename>, you can create an initial
1260    non-native Debian package for it by issuing the <command>dh_make</command>
1261  command as follows.  command as follows.
1262  </para>  </para>
1263  <screen>  <screen>
1264  $ . ~/.bashrc  $ cd ~/gentoo
1265  $ cd ~/gentoo/gentoo-0.9.12  $ wget http://example.org/gentoo-0.9.12.tar.gz
1266    $ tar -xvzf gentoo-0.9.12.tar.gz
1267    $ cd gentoo-0.9.12
1268  $ dh_make -f ../gentoo-0.9.12.tar.gz  $ dh_make -f ../gentoo-0.9.12.tar.gz
1269  </screen>  </screen>
1270  <para>  <para>
1271  Of course, replace the filename with the name of your original source archive.  Of course, replace the filename with the name of your original source archive.
1272  <footnote><para> If the upstream source provides the  <footnote><para> If the upstream source provides the
1273  <filename>debian</filename> directory and its contents, run the  <filename>debian</filename> directory and its contents, run the
1274  <command>dh_make</command> command with the <literal>--addmissing</literal>  <command>dh_make</command> command with the extra option
1275  option, instead.  The new source <literal>3.0 (quilt)</literal> format is quite  <literal>--addmissing</literal>.  The new source <literal>3.0 (quilt)</literal> format is
1276  robust not to break even for these packages.  You may need to update contents  robust enough not to break even for these packages.  You may need to update the contents
1277  provided by the upstream for your Debian package.  </para> </footnote> See  provided by the upstream for your Debian package.  </para> </footnote> See
1278  <citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>
1279  </citerefentry> for details.  </citerefentry> for details.
1280  </para>  </para>
1281  <para>  <para>
1282  Some information will come up.  It will ask you what sort of package you want  You should see some output asking you what sort of package you want
1283  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,
1284  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
1285  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
1286  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.
1287  <footnote><para> There are few choices here: <literal>s</literal> for Single  <footnote><para> There are several choices here: <literal>s</literal> for
1288  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
1289  Multiple binary, <literal>l</literal> for Library, <literal>k</literal> for  Multiple binary packages, <literal>l</literal> for Library package, <literal>k</literal> for
1290  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>
1291  for <systemitem role="package">cdbs</systemitem>.  This document focuses on the  for <systemitem role="package">cdbs</systemitem> package.  This document focuses on the
1292  use of the <systemitem role="package">debhelper</systemitem> package with the  use of the <command>dh</command> command (from the package
1293  <command>dh</command> command.  This document focuses on the use of the new  <systemitem role="package">debhelper</systemitem>) to create a single binary package,
1294  <command>dh</command> command for Single binary and touches on it for  but also touches on how to use it for arch-independent or
1295  Arch-Independent and Multiple binary.  The <systemitem role="package">cdbs</systemitem> package offers alternative package script  multiple binary packages.  The package
1296  infrastructure to the <command>dh</command> command and outside of the scope of  <systemitem role="package">cdbs</systemitem> offers an alternative packaging script
1297    infrastructure to the <command>dh</command> command and is outside the scope of
1298  this document.  </para> </footnote>  this document.  </para> </footnote>
1299  </para>  </para>
1300  <para>  <para>
1301  After this execution of <command>dh_make</command>, a copy of the upstream  This execution of <command>dh_make</command> creates a copy of the upstream
1302  tarball is created as <filename>gentoo_0.9.12.orig.tar.gz</filename> in the  tarball as <filename>gentoo_0.9.12.orig.tar.gz</filename> in the
1303  parent directory to accommodate the creation of the non-native Debian source  parent directory to accommodate the creation of the non-native Debian source
1304  package with the <filename>debian.tar.gz</filename> later.  package with the name <filename>debian.tar.gz</filename> later.
1305  </para>  </para>
1306  <screen>  <screen>
1307  $ cd ~/gentoo ; ls -F  $ cd ~/gentoo ; ls -F
# Line 961  gentoo-0.9.12.tar.gz Line 1310  gentoo-0.9.12.tar.gz
1310  gentoo_0.9.12.orig.tar.gz  gentoo_0.9.12.orig.tar.gz
1311  </screen>  </screen>
1312  <para>  <para>
1313  Please note 2 key features in this  Please note two key features of this filename
1314  <filename>gentoo_0.9.12.orig.tar.gz</filename> file name:  <filename>gentoo_0.9.12.orig.tar.gz</filename>:
1315  </para>  </para>
1316  <itemizedlist>  <itemizedlist>
1317  <listitem>  <listitem>
1318  <para>  <para>
1319  Package name and version are separated by the <literal>_</literal>  Package name and version are separated by the character <literal>_</literal>
1320  (underscore).  (underscore).
1321  </para>  </para>
1322  </listitem>  </listitem>
1323  <listitem>  <listitem>
1324  <para>  <para>
1325  There is the <filename>.orig</filename> before the  The string <filename>.orig</filename> is inserted before the
1326  <filename>.tar.gz</filename>.  <filename>.tar.gz</filename>.
1327  </para>  </para>
1328  </listitem>  </listitem>
1329  </itemizedlist>  </itemizedlist>
1330  <para>  <para>
1331  You should also notice that many template files are created in the source under  You should also notice that many template files are created in the source under
1332  the <filename>debian</filename> directory.  These will be explained in <xref linkend="dreq"/> and <xref linkend="dother"/> .  You should also understand  the <filename>debian</filename> directory.  These will be explained in
1333  that the packaging is not automatic process.  You need to modify the upstream  <xref linkend="dreq"/> and <xref linkend="dother"/>.  You should also understand
1334  source for Debian as <xref linkend="modify"/> .  After all these, you need to  that packaging cannot be a fully automated process.  You will need to modify the upstream
1335  build Debian packages under the proper method as <xref linkend="build"/> ,  source for Debian (see <xref linkend="modify"/>).  After this, you need to
1336  check them as <xref linkend="checkit"/> , and upload them as <xref linkend="upload"/> .  I will explain all these steps.  use the proper methods for building Debian packages (<xref linkend="build"/>),
1337  </para>  testing them (<xref linkend="checkit"/>), and uploading them (<xref linkend="upload"/>).
1338  <para>  All the steps will be explained.
 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,  
1339  </para>  </para>
 </listitem>  
 <listitem>  
 <para>  
 kernel module packages,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel patch packages,  
 </para>  
 </listitem>  
 <listitem>  
1340  <para>  <para>
1341  the source file format being neither in <filename>tar.gz</filename> nor  If you accidentally erased some template files while working on them, you can
1342  <filename>tar.bz2</filename>, or  recover them by running <command>dh_make</command> with the
1343    <literal>--addmissing</literal> option again in a Debian package source tree.
1344  </para>  </para>
 </listitem>  
 <listitem>  
1345  <para>  <para>
1346  the source tarball containing undistributable contents.  Updating an existing package may get complicated since it may be using older
1347    techniques.  While learning the basics, please stick to creating a fresh
1348    package; further explanations are given in <xref linkend="update"/>.
1349  </para>  </para>
 </listitem>  
 </itemizedlist>  
1350  <para>  <para>
1351  It's not too hard, but it does require a bit more knowledge, so we won't  Please note that the source file does not need to contain any build system
1352  describe all of it here.  discussed in <xref linkend="simplemake"/> and <xref linkend="portable"/>.  It
1353    could be just a collection of graphical data etc.  Installation of files may be
1354    carried out using only <systemitem role="package">debhelper</systemitem> configuration
1355    files such as <filename>debian/install</filename> (see
1356    <xref linkend="install"/>).
1357  </para>  </para>
1358    </section>
1359    <section id="native-dh-make"><title>Initial native Debian package</title>
1360  <para>  <para>
1361  If you accidentally erased some template files while working on them, you can  If a package contains source files you are only maintaining for Debian,
1362  recover them by running <command>dh_make</command> with the  possibly only for local use, it may be simpler to create it as a Debian
1363  <literal>--addmissing</literal> option again in a Debian package source tree.  native package. If you have source
1364    files in <filename>~/mypackage-1.0</filename>, you can create an initial native
1365    Debian package for it by issuing the <command>dh_make</command> command as
1366    follows.
1367  </para>  </para>
1368    <screen>
1369    $ cd ~/mypackage-1.0
1370    $ dh_make --native
1371    </screen>
1372  <para>  <para>
1373  Updating an existing package may get complicated since it may be using older  Then the <filename>debian</filename> directory and its contents are created
1374  techniques.  Please stick with fresh packaging cases for now to learn basics.  just like <xref linkend="non-native-dh-make"/>.  This does not create a tarball
1375  I will come back to explain it later in <xref linkend="update"/> .  since this is a native Debian package.  But that is the only difference.
1376    The rest of the packaging activities are practically the same.
1377  </para>  </para>
1378  </section>  </section>
1379  </chapter>  </chapter>
# Line 1045  Please note that there isn't space here Line 1383  Please note that there isn't space here
1383  details of fixing upstream sources, but here are some basic steps and problems  details of fixing upstream sources, but here are some basic steps and problems
1384  people often run across.  people often run across.
1385  </para>  </para>
1386  <section id="quiltrc"><title>Set up <command>quilt</command></title>  <section id="quiltrc"><title>Setting up <command>quilt</command></title>
1387    <para>
1388    The program <command>quilt</command> offers a basic method for recording
1389    modifications to the upstream source for Debian packaging.  It's
1390    useful to have a slightly customized default, so let's create an alias
1391    <command>dquilt</command> for Debian packaging by adding the following
1392    line to <filename>~/.bashrc</filename>.
1393    </para>
1394    <screen>
1395    alias dquilt="quilt --quiltrc=~/.quiltrc-dpkg"
1396    </screen>
1397  <para>  <para>
1398  The <command>quilt</command> program offers the basic method to record  Then let's create <filename>~/.quiltrc-dpkg</filename> as follows.
 modification to the source for the Debian packaging.  Since slightly different  
 default is desirable for Debian packaging, let's set up  
 <filename>~/.quiltrc</filename> as follows.  <footnote><para> You can disable  
 this configuration by starting the <command>quilt</command> command as  
 <literal>quilt --quiltrc /dev/null ...</literal>.  </para> </footnote>  
1399  </para>  </para>
1400  <screen>  <screen>
1401  d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done  d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done
1402  if [ -d $d/debian ] &amp;&amp; [ -z $QUILT_PATCHES ]; then  if [ -d $d/debian ] &amp;&amp; [ -z $QUILT_PATCHES ]; then
1403      # Debian packaging case and unset $QUILT_PATCHES      # if in Debian packaging tree with unset $QUILT_PATCHES
1404      QUILT_PATCHES=debian/patches      QUILT_PATCHES="debian/patches"
1405      QUILT_PATCH_OPTS=--unified-reject-files      QUILT_PATCH_OPTS="--reject-format=unified"
1406      QUILT_DIFF_ARGS=-p ab --no-timestamps --no-index --color=auto      QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
1407      QUILT_REFRESH_ARGS=-p ab --no-timestamps --no-index      QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
1408      QUILT_COLORS=diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33      QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
1409      if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi      if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
1410  fi  fi
1411  </screen>  </screen>
1412  <para>  <para>
1413  See <citerefentry> <refentrytitle>quilt</refentrytitle>  See <citerefentry> <refentrytitle>quilt</refentrytitle>
1414  <manvolnum>1</manvolnum> </citerefentry> and  <manvolnum>1</manvolnum> </citerefentry> and
1415  <filename>/usr/share/doc/quilt/quilt.html</filename> for how to use  <ulink url="&quilt-pdf;">quilt.pdf</ulink> on how to use
1416  <command>quilt</command>.  <command>quilt</command>.
1417  </para>  </para>
1418  </section>  </section>
1419  <section id="fixupstream"><title>Fixing upstream bug</title>  <section id="fixupstream"><title>Fixing upstream bugs</title>
1420  <para>  <para>
1421  Let's assume you find an error in the upstream <filename>Makefile</filename>  Let's assume you find an error in the upstream <filename>Makefile</filename>
1422  file as follows where <literal>install: gentoo</literal> should have been  as follows where <literal>install: gentoo</literal> should have been
1423  <literal>install: gentoo-target</literal>.  <literal>install: gentoo-target</literal>.
1424  </para>  </para>
1425  <screen>  <screen>
# Line 1086  install: gentoo Line 1429  install: gentoo
1429          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1430  </screen>  </screen>
1431  <para>  <para>
1432  Let's fix this and record this with the <command>quilt</command> command as  Let's fix this and record it with the <command>dquilt</command> command as
1433  <filename>fix-gentoo-target.patch</filename>.  <footnote><para> The  <filename>fix-gentoo-target.patch</filename>.  <footnote><para> The
1434  <filename>debian/patches</filename> directory should exist now if you run  <filename>debian/patches</filename> directory should exist now if you ran
1435  <command>dh_make</command> as described before.  This example operation creates  <command>dh_make</command> as described before.  This example operation creates
1436  it just in case you are updating the existing package.  </para> </footnote>  it just in case you are updating an existing package.  </para> </footnote>
1437  </para>  </para>
1438  <screen>  <screen>
1439  $ mkdir debian/patches  $ mkdir debian/patches
1440  $ quilt new fix-gentoo-target.patch  $ dquilt new fix-gentoo-target.patch
1441  $ quilt add Makefile  $ dquilt add Makefile
1442  </screen>  </screen>
1443  <para>  <para>
1444  You change the <filename>Makefile</filename> file as follows.  You change the <filename>Makefile</filename> file as follows.
# Line 1107  install: gentoo-target Line 1450  install: gentoo-target
1450          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1451  </screen>  </screen>
1452  <para>  <para>
1453  Ask <command>quilt</command> to refresh the patch to create  Ask <command>dquilt</command> to generate the patch to create
1454  <filename>debian/patches/fix-gentoo-target.patch</filename> and add its  <filename>debian/patches/fix-gentoo-target.patch</filename> and add its
1455  description.  description following <ulink url="&dep3;">DEP-3: Patch Tagging Guidelines</ulink>.
1456  </para>  </para>
1457  <screen>  <screen>
1458  $ quilt refresh  $ dquilt refresh
1459  $ quilt header -e  $ dquilt header -e
1460  ... describe patch  ... describe patch
1461  </screen>  </screen>
1462  </section>  </section>
1463  <section id="destdir"><title>Installation of files to the destination</title>  <section id="destdir"><title>Installation of files to their destination</title>
1464  <para>  <para>
1465  Normally, programs install themselves in the <filename>/usr/local</filename>  Most third-party software installs itself in the <filename>/usr/local</filename>
1466  subdirectory.  Since it is reserved for system administrator's (or user's)  directory hierarchy.  On Debian this is reserved for private use
1467  private use, Debian packages must not use that directory but should use system  by the system administrator, so packages must not use directories such
1468  directories such as the <filename>/usr/bin</filename> subdirectory following  as <filename>/usr/local/bin</filename> but should instead use system
1469  the Filesystem Hierarchy Standard (<ulink url="http://www.debian.org/doc/packaging-manuals/fhs/fhs-2.3.html">FHS</ulink>,  directories such as <filename>/usr/bin</filename>, obeying the
1470  <filename>/usr/share/doc/debian-policy/fhs/fhs-2.3.html</filename>).  <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink> (FHS).
1471  </para>  </para>
1472  <para>  <para>
1473  Normally, <citerefentry> <refentrytitle>make</refentrytitle>  Normally, <citerefentry> <refentrytitle>make</refentrytitle>
1474  <manvolnum>1</manvolnum> </citerefentry> is used to automate building the  <manvolnum>1</manvolnum> </citerefentry> is used to automate building the
1475  program and the execution of <literal>make install</literal> installs programs  program, and executing <literal>make install</literal> installs programs
1476  directly to the desired destination by the <literal>install</literal> target of  directly to the desired destination (following the
1477  the <filename>Makefile</filename> file.  In order for Debian to provide binary  <literal>install</literal> target in the
1478  packages, the build system installs programs to the file tree image created  <filename>Makefile</filename>).  In order for Debian to provide
1479  under a temporary directory instead to the actual destination.  pre-built installable packages, it modifies the build system to install
1480    programs into a file tree image created under a temporary directory
1481    instead of the actual destination.
1482  </para>  </para>
1483  <para>  <para>
1484  These 2 differences between (1) the normal program installation and (2) the  These two differences between normal program installation on one hand and the
1485  Debian packaging can be transparently addressed by the <systemitem role="package">debhelper</systemitem> package through the  Debian packaging system on the other can be transparently addressed by the
1486    <systemitem role="package">debhelper</systemitem> package through the
1487  <command>dh_auto_configure</command> and <command>dh_auto_install</command>  <command>dh_auto_configure</command> and <command>dh_auto_install</command>
1488  commands if the following conditions are met.  commands if the following conditions are met.
1489  </para>  </para>
1490  <itemizedlist>  <itemizedlist>
1491  <listitem>  <listitem>
1492  <para>  <para>
1493  The <filename>Makefile</filename> file follows the GNU conventions to support  The <filename>Makefile</filename> must follow GNU conventions and
1494  <literal>$(DESTDIR)</literal> variable  support the <literal>$(DESTDIR)</literal> variable.
1495  (<filename>/usr/share/doc/gnu-standards/standards.html#Makefile-Conventions</filename>).  <footnote><para> See <ulink url="&gnu-destdir;">GNU Coding Standards: 7.2.4 DESTDIR: Support for Staged Installs</ulink>.</para></footnote>
1496  </para>  </para>
1497  </listitem>  </listitem>
1498  <listitem>  <listitem>
1499  <para>  <para>
1500  The source follows the Filesystem Hierarchy Standard (FHS).  The source must follow the Filesystem Hierarchy Standard (FHS).
1501  </para>  </para>
1502  </listitem>  </listitem>
1503  </itemizedlist>  </itemizedlist>
1504  <para>  <para>
1505  Programs that use GNU <command>autoconf</command>  Programs that use GNU <command>autoconf</command> follow the GNU conventions
1506  <emphasis>automatically</emphasis> follow the GNU conventions and their  automatically, so they can be trivial to package.  On the basis of
1507  packaging is almost <emphasis>automatic</emphasis>.  With this and other  this and other heuristics, it is estimated that the
1508  heuristics, the <systemitem role="package">debhelper</systemitem> package  <systemitem role="package">debhelper</systemitem> package will work for
1509  estimates that it works for about 90% of packages without making any intrusive  about 90% of packages without making any intrusive changes to their
1510  changes to their build system.  So the packaging is not as complicated as it  build system.  So packaging is not as complicated as it may seem.
 may seem.  
1511  </para>  </para>
1512  <para>  <para>
1513  If you need to make changes in the <filename>Makefile</filename> file, you  If you need to make changes in the <filename>Makefile</filename>, you
1514  should make sure to support these <literal>$(DESTDIR)</literal> variable.  The  should be careful to support the <literal>$(DESTDIR)</literal>
1515  <literal>$(DESTDIR)</literal> variable is unset in it and is prepended to each  variable.  Although it is unset by default, the <literal>$(DESTDIR)</literal>
1516  file path used for the program installation.  The packaging script will set  variable is prepended to each file path used for the program
1517  <literal>$(DESTDIR)</literal> to the temporary directory.  installation.  The packaging script will set
1518    <literal>$(DESTDIR)</literal> to the temporary directory.
1519  </para>  </para>
1520  <para>  <para>
1521  The temporary directory used by the <command>dh_auto_install</command> command  For packages of the single binary type, the temporary directory used
1522  is chosen as <filename>debian/<replaceable>package</replaceable></filename> for  by the <command>dh_auto_install</command> command will be set to
1523  single binary packages.  <footnote><para> For multiple binary packages, the  <filename>debian/<replaceable>package</replaceable></filename>.
1524    <footnote><para> For packages of the multiple binary type, the
1525  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>
1526  as the temporary directory while the <command>dh_install</command> command with  as the temporary directory while the <command>dh_install</command> command with
1527  the help of  the help of
1528  <filename>debian/<replaceable>package-1</replaceable>.install</filename> and  <filename>debian/<replaceable>package-1</replaceable>.install</filename> and
1529  <filename>debian/<replaceable>package-2</replaceable>.install</filename> files  <filename>debian/<replaceable>package-2</replaceable>.install</filename> files
1530  will split contents of <filename>debian/tmp</filename> into  will split the contents of <filename>debian/tmp</filename> into
1531  <filename>debian/<replaceable>package-1</replaceable></filename> and  <filename>debian/<replaceable>package-1</replaceable></filename> and
1532  <filename>debian/<replaceable>package-2</replaceable></filename> temporary  <filename>debian/<replaceable>package-2</replaceable></filename> temporary
1533  directories to create multiple binary <filename>*.deb</filename> packages.  directories, to create
1534    <filename><replaceable>package-1</replaceable>_*.deb</filename> and
1535    <filename><replaceable>package-2</replaceable>_*.deb</filename> binary
1536    packages.
1537  </para> </footnote> Everything that is contained in the temporary directory  </para> </footnote> Everything that is contained in the temporary directory
1538  will be installed on a user's system when they install your package, the only  will be installed on users' systems when they install your package; the only
1539  difference is that <command>dpkg</command> will be installing the files in the  difference is that <command>dpkg</command> will be installing the
1540  root directory.  files to paths relative to the root directory rather than your working
1541    directory.
1542  </para>  </para>
1543  <para>  <para>
1544  Bear in mind that even though your program installs in  Bear in mind that even though your program installs in
1545  <filename>debian/<replaceable>package</replaceable></filename>, it still needs  <filename>debian/<replaceable>package</replaceable></filename>, it still needs
1546  to behave correctly when placed in the root directory, i.e.  when installed  to behave correctly when installed from the <filename>.deb</filename>
1547  from the <filename>.deb</filename> package.  So you must not allow the build  package under the root directory.  So you must not allow the build
1548  system to hardcode strings like  system to hardcode strings like
1549  <literal>/home/me/deb/<replaceable>package</replaceable>-<replaceable>version</replaceable>/usr/share/<replaceable>package</replaceable></literal>  <literal>/home/me/deb/<replaceable>package</replaceable>-<replaceable>version</replaceable>/usr/share/<replaceable>package</replaceable></literal>
1550  into the package file.  into files in the package.
1551  </para>  </para>
1552  <para>  <para>
1553  Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s  Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s
1554  <filename>Makefile</filename> file <footnote><para> This is just an example to  <filename>Makefile</filename><footnote><para> This is just an example to
1555  show how the <filename>Makefile</filename> file should look like.  If the  show what a <filename>Makefile</filename> should look like.  If the
1556  <filename>Makefile</filename> file is created by the  <filename>Makefile</filename> is created by the
1557  <command>./configure</command> command, the correct way to fix this kind of  <command>./configure</command> command, the correct way to fix this kind of
1558  <filename>Makefile</filename> is to executed the <command>./configure</command>  <filename>Makefile</filename> is to execute <command>./configure</command>
1559  command from the <command>dh_auto_configure</command> command with default  from the <command>dh_auto_configure</command> command with default
1560  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:
1561  </para>  </para>
1562  <screen>  <screen>
1563  # Where to put binary on 'make install'?  # Where to put binary executables on 'make install'?
1564  BIN     = /usr/local/bin  BIN     = /usr/local/bin
1565  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1566  ICONS   = /usr/local/share/gentoo  ICONS   = /usr/local/share/gentoo
1567  </screen>  </screen>
1568  <para>  <para>
1569  We see that the files are set to install under <filename>/usr/local</filename>.  We see that the files are set to install under <filename>/usr/local</filename>.
1570  Change those paths to:  As explained above, that directory hierarchy is reserved for local use on
1571    Debian, so change those paths to:
1572  </para>  </para>
1573  <screen>  <screen>
1574  # Where to put binary on 'make install'?  # Where to put binary executables on 'make install'?
1575  BIN     = $(DESTDIR)/usr/bin  BIN     = $(DESTDIR)/usr/bin
1576  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1577  ICONS   = $(DESTDIR)/usr/share/gentoo  ICONS   = $(DESTDIR)/usr/share/gentoo
1578  </screen>  </screen>
1579  <para>  <para>
1580  But why in that directory, and not some other?  Because Debian packages never  The exact locations that should be used for binaries, icons,
1581  install files beneath <filename>/usr/local</filename> -- that tree is reserved  documentation, etc. are specified in the Filesystem Hierarchy Standard
1582  for the system administrator's use.  Such files on Debian systems go under  (FHS).  You should browse through it and read the sections relevant to
1583  <filename>/usr</filename> instead.  your package.
 </para>  
 <para>  
 The more exact locations for binaries, icons, documentation etc.  are specified  
 in the Filesystem Hierarchy Standard (see  
 <filename>/usr/share/doc/debian-policy/fhs/</filename>).  I recommend you  
 browse it and read the sections that might concern your package.  
1584  </para>  </para>
1585  <para>  <para>
1586  So, we should install the binary in <filename>/usr/bin</filename> instead of  So, we should install binary executables in <filename>/usr/bin</filename> instead of
1587  <filename>/usr/local/bin</filename>, the manual page in  <filename>/usr/local/bin</filename>, the manual page in
1588  <filename>/usr/share/man/man1</filename> instead of  <filename>/usr/share/man/man1</filename> instead of
1589  <filename>/usr/local/man/man1</filename> etc.  Notice how there's no manual  <filename>/usr/local/man/man1</filename>, and so on.  Notice how there's no manual
1590  page mentioned in <systemitem role="package">gentoo</systemitem>'s  page mentioned in <systemitem role="package">gentoo</systemitem>'s
1591  <filename>Makefile</filename>, but since the Debian Policy requires that every  <filename>Makefile</filename>, but since Debian Policy requires that every
1592  program has one, we'll make one later and install it in  program has one, we'll make one later and install it in
1593  <filename>/usr/share/man/man1</filename>.  <filename>/usr/share/man/man1</filename>.
1594  </para>  </para>
# Line 1253  to fix them to use the right locations. Line 1599  to fix them to use the right locations.
1599  for?  You can find this out by issuing:  for?  You can find this out by issuing:
1600  </para>  </para>
1601  <screen>  <screen>
1602  $ grep -nr -e 'usr/local/lib' --include='*.[c|h]' .  $ grep -nr --include='*.[c|h]' -e 'usr/local/lib' .
1603  </screen>  </screen>
1604  <para>  <para>
1605  <command>grep</command> will run recursively through the source tree and tell  <command>grep</command> will run recursively through the source tree and tell
# Line 1261  you the filename and the line number for Line 1607  you the filename and the line number for
1607  </para>  </para>
1608  <para>  <para>
1609  Edit those files and in those lines replace <literal>usr/local/lib</literal>  Edit those files and in those lines replace <literal>usr/local/lib</literal>
1610  with <literal>usr/lib</literal>.  with <literal>usr/lib</literal>.  This can be done automatically as follows:
1611  </para>  </para>
1612  <screen>  <screen>
1613  $ vim '+argdo %s/usr\/local\/lib/usr\/lib/gce|update' +q \  $ sed -i -e 's#usr/local/lib#usr/lib#g' \
1614        $(find . -type f -name '*.[c|h]')        $(find . -type f -name '*.[c|h]')
1615  </screen>  </screen>
1616  <para>  <para>
1617  Be careful that you don't mess up the rest of the code!  :-)  If you want to confirm each substitution instead, this can be done interactively as follows:
1618  </para>  </para>
1619    <screen>
1620    $ vim '+argdo %s#usr/local/lib#usr/lib#gce|update' +q \
1621          $(find . -type f -name '*.[c|h]')
1622    </screen>
1623    
1624  <para>  <para>
1625  After that you should find the install target (search for line that starts with  Next you should find the <literal>install</literal> target (searching
1626  <literal>install:</literal>, that will usually work) and rename all references  for the line that starts with <literal>install:</literal> will usually
1627  to directories other than ones defined at the top of the  work) and rename all references to directories other than ones defined
1628  <filename>Makefile</filename>.  at the top of the <filename>Makefile</filename>.
1629  </para>  </para>
1630  <para>  <para>
1631  After your upstream bug fix, <systemitem role="package">gentoo</systemitem>'s  Originally, <systemitem role="package">gentoo</systemitem>'s
1632  install target said:  install target said:
1633  </para>  </para>
1634  <screen>  <screen>
# Line 1287  install: gentoo-target Line 1638  install: gentoo-target
1638          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1639  </screen>  </screen>
1640  <para>  <para>
1641  Let's fix this and record this with the <command>quilt</command> command as  Let's fix this upstream bug and record it with the <command>dquilt</command> command as
1642  <filename>debian/patches/install.patch</filename>.  <filename>debian/patches/install.patch</filename>.
1643  </para>  </para>
1644  <screen>  <screen>
1645  $ quilt new install.patch  $ dquilt new install.patch
1646  $ quilt add Makefile  $ dquilt add Makefile
1647  </screen>  </screen>
1648  <para>  <para>
1649  Let's change this for Debian package as following using the editor:  In your editor, change this for the Debian package as follows:
1650  </para>  </para>
1651  <screen>  <screen>
1652  install: gentoo-target  install: gentoo-target
# Line 1305  install: gentoo-target Line 1656  install: gentoo-target
1656          install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc          install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc
1657  </screen>  </screen>
1658  <para>  <para>
1659  You've surely noticed that there's now a <literal>install -d</literal> command  You'll have noticed that there's now an <literal>install -d</literal> command
1660  before the other commands in the rule.  The original  before the other commands in the rule.  The original
1661  <filename>Makefile</filename> didn't have it because usually the  <filename>Makefile</filename> didn't have it because usually
1662  <literal>/usr/local/bin</literal> and other directories already exist on the  <literal>/usr/local/bin</literal> and other directories already exist on the
1663  system where one runs <literal>make install</literal>.  However, since we will  system where you are running <literal>make install</literal>.  However, since we will
1664  install into our own empty (or even nonexistent) directory, we will have to  be installing into a newly created private directory tree, we will have to
1665  create each and every one of those directories.  create each and every one of those directories.
1666  </para>  </para>
1667  <para>  <para>
# Line 1322  of additional documentation that the ups Line 1673  of additional documentation that the ups
1673          cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html          cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html
1674  </screen>  </screen>
1675  <para>  <para>
1676  After careful check, if everything is fine, ask <command>quilt</command> to  Check carefully, and if everything is okay, ask <command>dquilt</command> to
1677  refresh the patch to create <filename>debian/patches/install.patch</filename>  generate the patch to create <filename>debian/patches/install.patch</filename>
1678  and add its description.  and add its description.
1679  </para>  </para>
1680  <screen>  <screen>
1681  $ quilt refresh  $ dquilt refresh
1682  $ quilt header -e  $ dquilt header -e
1683  ... describe patch  ... describe patch
1684  </screen>  </screen>
1685  <para>  <para>
# Line 1351  Debian specific packaging modification: Line 1702  Debian specific packaging modification:
1702  Whenever you make changes that are not specifically related to Debian package  Whenever you make changes that are not specifically related to Debian package
1703  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
1704  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
1705  program revision and be useful to everyone else.  Also remember to make your  revision of the program and be useful to everyone else.  Also remember
1706  fixes not specific to Debian or Linux (or even Unix!) prior to sending them --  to avoid making your fixes specific to Debian or Linux - or even Unix!
1707  make them portable.  This will make your fixes much easier to apply.  Make them portable.  This will make your fixes much easier to apply.
1708  </para>  </para>
1709  <para>  <para>
1710  Note that you don't have to send the <filename>debian/*</filename> files  Note that you don't have to send the <filename>debian/*</filename> files
# Line 1364  upstream. Line 1715  upstream.
1715  <para>  <para>
1716  There is one other common problem: libraries are often different from platform  There is one other common problem: libraries are often different from platform
1717  to platform.  For example, a <filename>Makefile</filename> can contain a  to platform.  For example, a <filename>Makefile</filename> can contain a
1718  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
1719  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
1720  purpose.  purpose.
1721  </para>  </para>
1722  <para>  <para>
1723  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
1724  <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 :-) </para> </footnote>:  
1725  </para>  </para>
1726  <screen>  <screen>
1727  LIBS = -lcurses -lsomething -lsomethingelse  LIBS = -lfoo -lbar
1728  </screen>  </screen>
1729  <para>  <para>
1730  Let's fix this as <filename>debian/patches/ncurse.patch</filename> by changing  If your program doesn't compile since the <literal>foo</literal> library
1731  <literal>curses</literal> into <literal>ncurses</literal>.  doesn't exist and its equivalent is provided by the <literal>foo2</literal>
1732    library on the Debian system, you can fix this build problem as
1733    <filename>debian/patches/foo2.patch</filename> by changing
1734    <literal>foo</literal> into <literal>foo2</literal>.<footnote><para>If there
1735    are API changes from the <literal>foo</literal> library to the
1736    <literal>foo2</literal> library, required changes to the source code need to be
1737    made to match the new API.</para> </footnote>
1738  </para>  </para>
1739  <screen>  <screen>
1740  $ quilt new ncurse.patch  $ dquilt new foo2.patch
1741  $ quilt add Makefile  $ dquilt add Makefile
1742  $ sed -i -e s/-lcurses/-lncurses/g Makefile  $ sed -i -e 's/-lfoo/-lfoo2/g' Makefile
1743  $ quilt refresh  $ dquilt refresh
1744  $ quilt header -e  $ dquilt header -e
1745  ... describe patch  ... describe patch
1746  </screen>  </screen>
1747  </section>  </section>
1748  </chapter>  </chapter>
1749  <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>
1750  <para>  <para>
1751  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
1752  <filename>debian</filename>.  There are a number of files in this directory  <filename>debian</filename>.  There are a number of files in this directory
1753  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
1754  most important of them are <filename>control</filename>,  most important of them are <filename>control</filename>,
1755  <filename>changelog</filename>, <filename>copyright</filename> and  <filename>changelog</filename>, <filename>copyright</filename>, and
1756  <filename>rules</filename>, which are required for all packages.  <filename>rules</filename>, which are required for all packages.
1757    <footnote><para>
1758    In this chapter, files in the <filename>debian</filename> directory are
1759    referred to without the leading <filename>debian/</filename> for simplicity whenever
1760    the meaning is obvious.
1761    </para></footnote>
1762  </para>  </para>
1763  <section id="control"><title><filename>control</filename> file</title>  <section id="control"><title><filename>control</filename></title>
1764  <para>  <para>
1765  This file contains various values which <command>dpkg</command>,  This file contains various values which <command>dpkg</command>,
1766  <command>dselect</command>, <command>apt-get</command>,  <command>dselect</command>, <command>apt-get</command>,
1767  <command>apt-cache</command>, <command>aptitude</command>, and other package  <command>apt-cache</command>, <command>aptitude</command>, and other package
1768  management tools will use to manage the package.  It is defined by the <ulink url="http://www.debian.org/doc/debian-policy/ch-controlfields.html">Debian  management tools will use to manage the package.  It is defined by the
1769  Policy Manual, 5 'Control files and their fields'</ulink>.  <ulink url="&policy-control;">Debian Policy Manual, 5 "Control files and their fields"</ulink>.
1770  </para>  </para>
1771  <para>  <para>
1772  Here is the <filename>control</filename> file <command>dh_make</command>  Here is the <filename>control</filename> file <command>dh_make</command>
# Line 1433  created for us: Line 1791  created for us:
1791  (I've added the line numbers.)  (I've added the line numbers.)
1792  </para>  </para>
1793  <para>  <para>
1794  Lines 1-6 are the control information for the source package.  Lines 1-7 are the control information for the source package.
1795    Lines 9-13 are the control information for the binary package.
1796  </para>  </para>
1797  <para>  <para>
1798  Line 1 is the name of the source package.  Line 1 is the name of the source package.
# Line 1442  Line 1 is the name of the source package Line 1801  Line 1 is the name of the source package
1801  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.
1802  </para>  </para>
1803  <para>  <para>
1804  As you may have noticed, Debian archive is divided in sections:  As you may have noticed, the Debian archive is divided into multiple areas:
1805  <literal>main</literal> (the free software), <literal>non-free</literal> (the  <literal>main</literal> (the free software), <literal>non-free</literal> (the
1806  not really free software) and <literal>contrib</literal> (free software that  not really free software) and <literal>contrib</literal> (free software that
1807  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
1808  describe in short what packages are in.  So we have <literal>admin</literal>  classify packages into rough categories.  So we have <literal>admin</literal>
1809  for administrator-only programs, <literal>base</literal> for the basic tools,  for administrator-only programs,
1810  <literal>devel</literal> for programmer tools, <literal>doc</literal> for  <literal>devel</literal> for programmer tools, <literal>doc</literal> for
1811  documentation, <literal>libs</literal> for libraries, <literal>mail</literal>  documentation, <literal>libs</literal> for libraries, <literal>mail</literal>
1812  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
1813  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,
1814  and many more.  See the <ulink url="http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections">Debian  and many more.
1815  Policy Manual, 2.4 'Sections'</ulink> and <ulink url="http://packages.debian.org/unstable/">List of sections in 'sid'</ulink>  <footnote> <para>See
1816  for the guidance.  <ulink url="&policy-subsections;">Debian Policy Manual, 2.4 "Sections"</ulink> and
1817    <ulink url="&sections-unstable;">List of sections in <literal>sid</literal></ulink>.</para>
1818    </footnote>
1819  </para>  </para>
1820  <para>  <para>
1821  Let's change it then to x11.  (A <literal>main/</literal> prefix is implied so  Let's change it then to x11.  (A <literal>main/</literal> prefix is implied so
1822  we can omit it.)  we can omit it.)
1823  </para>  </para>
1824  <para>  <para>
1825  Line 3 describes how important it is that the user installs this package.  See  Line 3 describes how important it is that the user installs this package.
1826  the <ulink url="http://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities">Debian  <footnote> <para>See
1827  Policy Manual, 2.5 'Priorities'</ulink> for the guidance.  <ulink url="&policy-priorities;">Debian Policy Manual, 2.5 "Priorities"</ulink>.
1828    </para>
1829    </footnote>
1830  </para>  </para>
1831  <itemizedlist>  <itemizedlist>
1832  <listitem>  <listitem>
1833  <para>  <para>
1834  The <literal>optional</literal> priority will usually work for new packages  The <literal>optional</literal> priority will usually work for new packages
1835  that do not conflict with others with <literal>required</literal>,  that do not conflict with others claiming <literal>required</literal>,
1836  <literal>important</literal> or <literal>standard</literal> priorities.  <literal>important</literal>, or <literal>standard</literal> priority.
1837  </para>  </para>
1838  </listitem>  </listitem>
1839  <listitem>  <listitem>
# Line 1481  conflict with others with non-<literal>e Line 1844  conflict with others with non-<literal>e
1844  </listitem>  </listitem>
1845  </itemizedlist>  </itemizedlist>
1846  <para>  <para>
1847  Section and priority are used by the frontends like <command>aptitude</command>  Section and priority are used by front-ends like <command>aptitude</command>
1848  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
1849  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
1850  maintainers, in which case you will be notified by email.  maintainers, in which case you will be notified by email.
# Line 1492  we will change the priority to <literal> Line 1855  we will change the priority to <literal>
1855  </para>  </para>
1856  <para>  <para>
1857  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
1858  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
1859  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
1860  you.  Avoid using commas, ampersands and parenthesis.  you.  Avoid using commas, ampersands, or parentheses.
1861  </para>  </para>
1862  <para>  <para>
1863  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
1864  the <literal>Build-Depends</literal> field.  You can also have the  the <literal>Build-Depends</literal> field.  You can also have the
1865  <literal>Build-Depends-Indep</literal> field as an additional line, here.  (see  <literal>Build-Depends-Indep</literal> field as an additional line, here.
1866  the <ulink url="http://www.debian.org/doc/debian-policy/ch-relationships.html#s-sourcebinarydeps">Debian  <footnote><para>See
1867  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>
1868  Build-Depends, Build-Depends-Indep, Build-Conflicts,  Some packages like
1869  Build-Conflicts-Indep'</ulink>).  Some packages like <systemitem role="package">gcc</systemitem> and <systemitem role="package">make</systemitem> which are required by the <systemitem role="package">build-essential</systemitem> package are implied.  If you need  <systemitem role="package">gcc</systemitem> and
1870    <systemitem role="package">make</systemitem> which are required by the
1871    <systemitem role="package">build-essential</systemitem> package are implied.  If you need
1872  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.
1873  Multiple entries are separated with commas; read on for the explanation of  Multiple entries are separated with commas; read on for the explanation of
1874  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.
1875  </para>  </para>
1876  <itemizedlist>  <itemizedlist>
1877  <listitem>  <listitem>
# Line 1519  satisfy the Debian Policy requirement fo Line 1884  satisfy the Debian Policy requirement fo
1884  </listitem>  </listitem>
1885  <listitem>  <listitem>
1886  <para>  <para>
1887  For source packages which have some binary packages with <literal>Architecture:  Source packages which have binary packages with <literal>Architecture:
1888  any</literal>, they are rebuild by the autobuilder.  Since this autobuilder  any</literal> are rebuilt by the autobuilder.  Since this autobuilder
1889  procedure runs <literal>debian/rules build</literal> in it while installing  procedure installs only the packages listed in the
1890  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
1891  list practically all the required packages and the  <literal>debian/rules build</literal> (see <xref
1892  <literal>Build-Depends-indep</literal> is rarely used.  linkend="autobuilder"/>), the <literal>Build-Depends</literal> field
1893    needs to  list practically all the required packages and
1894    <literal>Build-Depends-Indep</literal> is rarely used.
1895  </para>  </para>
1896  </listitem>  </listitem>
1897  <listitem>  <listitem>
1898  <para>  <para>
1899  For source packages which have binary packages only with <literal>Architecture:  For source packages with binary packages all of which are <literal>Architecture:
1900  all</literal>, the <literal>Build-Depends-Indep</literal> field may list all  all</literal>, the <literal>Build-Depends-Indep</literal> field may list all
1901  the required packages unless they are already listed in the  the required packages unless they are already listed in the
1902  <literal>Build-Depends</literal> field to satisfy the Debian Policy requirement  <literal>Build-Depends</literal> field to satisfy the Debian Policy requirement
# Line 1541  for the <literal>clean</literal> target. Line 1908  for the <literal>clean</literal> target.
1908  If you are not sure which one should be used, use the  If you are not sure which one should be used, use the
1909  <literal>Build-Depends</literal> field to be on the safe side.  <literal>Build-Depends</literal> field to be on the safe side.
1910  <footnote><para> This somewhat strange situation is a feature well documented  <footnote><para> This somewhat strange situation is a feature well documented
1911  in the <ulink url="http://www.debian.org/doc/debian-policy/footnotes.html#f48">Debian Policy  in the <ulink url="&policy-build-depends-indep;">Debian Policy
1912  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
1913  <command>dh</command> command in the <filename>debian/rules</filename> file but  <command>dh</command> command in the <filename>debian/rules</filename> file but
1914  due to how the <command>dpkg-buildpackage</command> works.  The same situation  due to how the <command>dpkg-buildpackage</command> works.  The same situation
1915  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 1555  To find out what packages your package n Line 1922  To find out what packages your package n
1922  $ dpkg-depcheck -d ./configure  $ dpkg-depcheck -d ./configure
1923  </screen>  </screen>
1924  <para>  <para>
1925  To manually find exact build dependency for  To manually find exact build dependencies for
1926  <command><replaceable>/usr/bin/foo</replaceable></command>, you execute  <command><replaceable>/usr/bin/foo</replaceable></command>, execute
1927  </para>  </para>
1928  <screen>  <screen>
1929  $ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED  $ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED
# Line 1568  and for each library listed, e.g., <comm Line 1935  and for each library listed, e.g., <comm
1935  $ dpkg -S libfoo.so.6  $ dpkg -S libfoo.so.6
1936  </screen>  </screen>
1937  <para>  <para>
1938  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
1939  <literal>Build-Depends</literal> entry.  If you use <command>ldd</command> for  <literal>Build-Depends</literal> entry.  If you use <command>ldd</command> for
1940  this purpose, it will report indirect lib dependencies as well, resulting in  this purpose, it will report indirect lib dependencies as well, resulting in
1941  the problem of excessive build dependencies.  the problem of excessive build dependencies.
# Line 1579  the problem of excessive build dependenc Line 1946  the problem of excessive build dependenc
1946  next to <systemitem role="package">debhelper</systemitem>.  next to <systemitem role="package">debhelper</systemitem>.
1947  </para>  </para>
1948  <para>  <para>
1949  Line 6 is the version of the <ulink url="http://www.debian.org/doc/devel-manuals#policy">Debian Policy  Line 6 is the version of the <ulink url="&debian-policy;">Debian Policy
1950  Manual</ulink> standards this package follows, the one you read while making  Manual</ulink> standards this package follows, the one you read while making
1951  your package.  your package.
1952  </para>  </para>
1953  <para>  <para>
1954  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.
1955  </para>  </para>
1956  <para>  <para>
1957  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
1958  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.
1959  </para>  </para>
1960  <para>  <para>
1961  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.
1962  We'll leave this as <literal>any</literal> because <citerefentry>  This value is usually one of the following depending
1963  <refentrytitle>dpkg-gencontrol</refentrytitle> <manvolnum>1</manvolnum>  on the type of the binary package.
1964  </citerefentry> will fill in the appropriate value for any machine this package  <footnote><para>See
1965  gets compiled on.  <ulink url="http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Architecture">Debian Policy Manua 5.6.8 "Architecture"</ulink>
1966    for exact details.
1967    </para></footnote>
1968    </para>
1969    <itemizedlist>
1970    <listitem><para><literal>Architecture: any</literal></para>
1971      <itemizedlist>
1972      <listitem><para>The generated binary package is an architecture dependent one
1973        usually in a compiled language.</para></listitem>
1974      </itemizedlist>
1975    </listitem>
1976    <listitem><para><literal>Architecture: all</literal></para>
1977      <itemizedlist>
1978      <listitem><para>The generated binary package is an architecture independent
1979        one usually consisting of text, images, or scripts in an interpreted
1980        language.</para></listitem>
1981      </itemizedlist>
1982    </listitem>
1983    </itemizedlist>
1984    <para>
1985    We leave line 10 as is since this is written in C.
1986    <citerefentry><refentrytitle>dpkg-gencontrol</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1987    will fill in the appropriate architecture value for any machine this source
1988    package gets compiled on.
1989  </para>  </para>
1990  <para>  <para>
1991  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 1614  Packages can relate to each other in var Line 2004  Packages can relate to each other in var
2004  </para>  </para>
2005  <para>  <para>
2006  The package management tools usually behave the same way when dealing with  The package management tools usually behave the same way when dealing with
2007  these relations; if not, it will be explained.  (see <citerefentry>  these relations; if not, it will be explained.  (See <citerefentry>
2008  <refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,  <refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,
2009  <citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>  <citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>
2010  </citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>  </citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>
2011  <manvolnum>8</manvolnum> </citerefentry>, <citerefentry>  <manvolnum>8</manvolnum> </citerefentry>, <citerefentry>
2012  <refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>
2013  </citerefentry> etc.)  </citerefentry>, etc.)
2014  </para>  </para>
2015  <para>  <para>
2016  This is what the dependencies mean:  Here is a simplified description of package relationships.
2017    <footnote><para>See
2018    <ulink url="&policy-relationships;">Debian Policy Manual, 7 "Declaring relationships between packages"</ulink>.
2019    </para></footnote>
2020  </para>  </para>
2021  <itemizedlist>  <itemizedlist>
2022  <listitem>  <listitem>
# Line 1642  severe breakage) unless a particular pac Line 2035  severe breakage) unless a particular pac
2035  </para>  </para>
2036  <para>  <para>
2037  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
2038  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
2039  likely prompt them to install the recommended packages.  probably prompt them to install the recommended packages.
2040  <command>aptitude</command> and <command>apt-get</command> install recommended  <command>aptitude</command> and <command>apt-get</command> install recommended
2041  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
2042  behaviour).  <command>dpkg</command> will ignore this field.  behavior).  <command>dpkg</command> will ignore this field.
2043  </para>  </para>
2044  </listitem>  </listitem>
2045  <listitem>  <listitem>
# Line 1655  behaviour).  <command>dpkg</command> wil Line 2048  behaviour).  <command>dpkg</command> wil
2048  </para>  </para>
2049  <para>  <para>
2050  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
2051  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
2052  prompt them to install the suggested packages.  <command>aptitude</command> can  prompted to install suggested packages.  <command>aptitude</command> can
2053  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
2054  not its default.  <command>dpkg</command> and <command>apt-get</command> will  not its default.  <command>dpkg</command> and <command>apt-get</command> will
2055  ignore this field.  ignore this field.
# Line 1670  ignore this field. Line 2063  ignore this field.
2063  This is stronger than <literal>Depends</literal>.  The package will not be  This is stronger than <literal>Depends</literal>.  The package will not be
2064  installed unless the packages it pre-depends on are installed and  installed unless the packages it pre-depends on are installed and
2065  <emphasis>correctly configured</emphasis>.  Use this <emphasis>very</emphasis>  <emphasis>correctly configured</emphasis>.  Use this <emphasis>very</emphasis>
2066  sparingly and only after discussing it on the <ulink url="http://lists.debian.org/debian-devel/">debian-devel@lists.debian.org</ulink>  sparingly and only after discussing it on the <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org</ulink>
2067  mailing list.  Read: don't use it at all.  :-)  mailing list.  Read: don't use it at all.  :-)
2068  </para>  </para>
2069  </listitem>  </listitem>
# Line 1689  severe problems if a particular package Line 2082  severe problems if a particular package
2082  <literal>Breaks</literal>  <literal>Breaks</literal>
2083  </para>  </para>
2084  <para>  <para>
2085  The package will be installed while all the listed packages will be broken.  When installed the package will break all the listed packages.
2086  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.
2087  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.  
2088  </para>  </para>
2089  </listitem>  </listitem>
2090  <listitem>  <listitem>
# Line 1702  package management tools. Line 2094  package management tools.
2094  <para>  <para>
2095  For some types of packages where there are multiple alternatives virtual names  For some types of packages where there are multiple alternatives virtual names
2096  have been defined.  You can get the full list in the  have been defined.  You can get the full list in the
2097  <filename>/usr/share/doc/debian-policy/virtual-package-names-list.txt.gz</filename>  <ulink url="&virtual-package;">virtual-package-names-list.txt.gz</ulink>
2098  file.  Use this if your program provides a function of an existing virtual  file.  Use this if your program provides a function of an existing virtual
2099  package.  package.
2100  </para>  </para>
# Line 1728  symbols). Line 2120  symbols).
2120  <para>  <para>
2121  The fields may restrict their applicability to particular versions of each  The fields may restrict their applicability to particular versions of each
2122  named package.  These versions are listed in parentheses after each individual  named package.  These versions are listed in parentheses after each individual
2123  package name, and they should contain a relation from the list below followed  package name, and should contain a relation from the list below followed
2124  by the version number.  The relations allowed are: <literal>&lt;&lt;</literal>,  by the version number.  The relations allowed are: <literal>&lt;&lt;</literal>,
2125  <literal>&lt;=</literal>, <literal>=</literal>, <literal>&gt;=</literal> and  <literal>&lt;=</literal>, <literal>=</literal>, <literal>&gt;=</literal>, and
2126  <literal>&gt;&gt;</literal> for strictly lower, lower or equal, exactly equal,  <literal>&gt;&gt;</literal> for strictly lower, lower or equal, exactly equal,
2127  greater or equal and strictly greater, respectively.  For example,  greater or equal, and strictly greater, respectively.  For example,
2128  </para>  </para>
2129  <screen>  <screen>
2130  Depends: foo (&gt;= 1.2), libbar1 (= 1.3.4)  Depends: foo (&gt;= 1.2), libbar1 (= 1.3.4)
# Line 1744  Replaces: quux (&lt;&lt; 5), quux-foo (& Line 2136  Replaces: quux (&lt;&lt; 5), quux-foo (&
2136  <para>  <para>
2137  The last feature you need to know about is  The last feature you need to know about is
2138  <literal>${shlibs:Depends}</literal>, <literal>${perl:Depends}</literal>,  <literal>${shlibs:Depends}</literal>, <literal>${perl:Depends}</literal>,
2139  <literal>${misc:Depends}</literal>, etc.  These entries are substituted by the  <literal>${misc:Depends}</literal>, etc.
 list generated by other <systemitem role="package">debhelper</systemitem>  
 components when the <citerefentry> <refentrytitle>dh_gencontrol</refentrytitle>  
 <manvolnum>1</manvolnum> </citerefentry> command is executed.  
2140  </para>  </para>
2141  <para>  <para>
2142  <citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>  <citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>
2143  <manvolnum>1</manvolnum> </citerefentry> will scan it for binaries and  <manvolnum>1</manvolnum> </citerefentry> calculates shared library dependencies
2144  libraries determine their shared library dependencies and detect which packages  for binary packages.  It generates a list of ELF executables and shared
2145  they are in, such as <systemitem role="package">libc6</systemitem> or  libraries it has found for each binary package.  This list is used for
2146  <systemitem role="package">xlib6g</systemitem>, after your package has been  substituting <literal>${shlibs:Depends}</literal>.
2147  built and installed into the temporary directory.  This list of shared library  </para>
2148  dependencies is used for <literal>${shlibs:Depends}</literal>.  <para>
2149  </para>  <citerefentry> <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum>
2150  <para>  </citerefentry> calculates Perl dependencies.  It generates a list of a
2151  The package list generated by the <citerefentry>  dependencies on <literal>perl</literal> or <literal>perlapi</literal> for each binary package.  This list is used for
2152  <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  substituting <literal>${perl:Depends}</literal>.
2153  is used for <literal>${perl:Depends}</literal>.  </para>
2154  </para>  <para>
2155  <para>  Some <systemitem role="package">debhelper</systemitem> commands may cause the
2156  Some <systemitem role="package">debhelper</systemitem> commands may make the  generated package to depend on some additional packages.  All such commands
2157  generated package need to depend on some other packages.  This list of required  generate a list of required packages for each binary package.
2158  packages is used for <literal>${misc:Depends}</literal>.  This list is used for substituting <literal>${misc:Depends}</literal>.
2159    </para>
2160    <para>
2161    <citerefentry> <refentrytitle>dh_gencontrol</refentrytitle>
2162    <manvolnum>1</manvolnum> </citerefentry> generates
2163    <filename>DEBIAN/control</filename> for each binary package while
2164    substituting <literal>${shlibs:Depends}</literal>,
2165    <literal>${perl:Depends}</literal>, <literal>${misc:Depends}</literal>, etc.
2166  </para>  </para>
2167  <para>  <para>
2168  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
2169  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:
2170  file</literal>, because <systemitem role="package">gentoo</systemitem> can use  file</literal>, because <systemitem role="package">gentoo</systemitem> can use
2171  some features provided by that <systemitem role="package">file</systemitem>  some features provided by the <systemitem role="package">file</systemitem>
2172  package.  package.
2173  </para>  </para>
2174    <para> Line 9 is the Homepage URL.  Let's assume this to be at
2175    <ulink url="&gentoo;"/>.
2176    </para>
2177  <para>  <para>
2178  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
2179  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
2180  <literal>fully GUI-configurable, two-pane X file manager</literal>.  <literal>fully GUI-configurable, two-pane X file manager</literal>.
2181  </para>  </para>
# Line 1785  Line 13 is where the long description go Line 2184  Line 13 is where the long description go
2184  gives more details about the package.  Column 1 of each line should be empty.  gives more details about the package.  Column 1 of each line should be empty.
2185  There must be no blank lines, but you can put a single <literal>.</literal>  There must be no blank lines, but you can put a single <literal>.</literal>
2186  (dot) in a column to simulate that.  Also, there must be no more than one blank  (dot) in a column to simulate that.  Also, there must be no more than one blank
2187  line after the long description.  line after the long description. <footnote><para>These descriptions are in
2188    English.  Translations of these descriptions are provided by
2189    <ulink url="&ddtp;">The Debian Description Translation Project - DDTP</ulink>.</para></footnote>
2190  </para>  </para>
2191  <para>  <para>
2192  Let's insert <literal>Vcs-*</literal> fields documented in <ulink url="http://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.html#bpp-vcs">Developer's  We can insert <literal>Vcs-*</literal> fields to document the Version Control
2193  Reference, 6.2.5.  'Version Control System location'</ulink> between line 6 and  System (VCS) location between lines 6 and 7.
2194  7.  Let's assume that the <systemitem role="package">gentoo</systemitem>  <footnote><para>See
2195  package is located in Debian Alioth Git Service at  <ulink url="&devref-bpp-vcs;">Debian Developer's Reference, 6.2.5. "Version Control System location"</ulink>.
2196    </para></footnote>
2197    Let's assume that the <systemitem role="package">gentoo</systemitem>
2198    package has its VCS located in the Debian Alioth Git Service at
2199  <literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.  <literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.
2200  </para>  </para>
2201  <para>  <para>
# Line 1806  Finally, here is the updated <filename>c Line 2210  Finally, here is the updated <filename>c
2210   6 Standards-Version: 3.8.4   6 Standards-Version: 3.8.4
2211   7 Vcs-Git: git://git.debian.org/git/collab-maint/gentoo.git   7 Vcs-Git: git://git.debian.org/git/collab-maint/gentoo.git
2212   8 Vcs-browser: http://git.debian.org/?p=collab-maint/gentoo.git   8 Vcs-browser: http://git.debian.org/?p=collab-maint/gentoo.git
2213   9 Homepage: http://www.obsession.se/gentoo/   9 Homepage: &gentoo;
2214  10  10
2215  11 Package: gentoo  11 Package: gentoo
2216  12 Architecture: any  12 Architecture: any
# Line 1819  Finally, here is the updated <filename>c Line 2223  Finally, here is the updated <filename>c
2223  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.
2224  20  .  20  .
2225  21  gentoo features a fairly complex and powerful file identification system,  21  gentoo features a fairly complex and powerful file identification system,
2226  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
2227  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.
2228  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
2229  25  type descriptions.  25  type descriptions.
2230  26  .  26  .
2231  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
2232  30  for its interface.  30  for its interface.
2233  </screen>  </screen>
2234  <para>  <para>
2235  (I've added the line numbers.)  (I've added the line numbers.)
2236  </para>  </para>
2237  </section>  </section>
2238  <section id="copyright"><title><filename>copyright</filename> file</title>  <section id="copyright"><title><filename>copyright</filename></title>
2239  <para>  <para>
2240  This file contains the information about package upstream resources, copyright  This file contains information about the copyright and license of the upstream sources.
2241  and license information.  Its format is not dictated by the Debian Policy  <ulink url="&policy-copyright;">Debian Policy Manual, 12.5 "Copyright information"</ulink>
2242  Manual, but the content is (<ulink url="http://www.debian.org/doc/debian-policy/ch-docs.html#s-copyrightfile">Debian  dictates its content and
2243  Policy Manual, 12.5 'Copyright information'</ulink>).  You may also consult  <ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>
2244  <ulink url="http://dep.debian.net/deps/dep5/">DEP-5: Machine-parseable  provides guidelines for its format.
 debian/copyright</ulink>.  
2245  </para>  </para>
2246  <para>  <para>
2247  <command>dh_make</command> can give you a template  <command>dh_make</command> can give you a template
# Line 1846  debian/copyright</ulink>. Line 2249  debian/copyright</ulink>.
2249  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.
2250  </para>  </para>
2251  <para>  <para>
2252  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
2253  from, the actual copyright notice and their license to complete this file.  For  from, the actual copyright notice, and the license.  For certain
2254  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,
2255  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
2256  license, you can just refer to the appropriate file in  license), you can just refer to the appropriate file in the
2257  <filename>/usr/share/common-licenses/</filename> directory that exists on every  <filename>/usr/share/common-licenses/</filename> directory that exists on every
2258  Debian system.  Otherwise, you must include the complete license.  Debian system.  Otherwise, you must include the complete license.
2259  </para>  </para>
2260  <para>  <para>
2261  In short, here's how <systemitem role="package">gentoo</systemitem>'s  In short, here's what <systemitem role="package">gentoo</systemitem>'s
2262  <filename>copyright</filename> file should look like:  <filename>copyright</filename> file should look like:
2263  </para>  </para>
2264  <screen>  <screen>
# Line 1885  In short, here's how <systemitem role="p Line 2288  In short, here's how <systemitem role="p
2288  24  but WITHOUT ANY WARRANTY; without even the implied warranty of  24  but WITHOUT ANY WARRANTY; without even the implied warranty of
2289  25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2290  26  GNU General Public License for more details.  26  GNU General Public License for more details.
2291  27 .  27  .
2292  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
2293  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.,
2294  30  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  30  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Line 1898  In short, here's how <systemitem role="p Line 2301  In short, here's how <systemitem role="p
2301  (I've added the line numbers.)  (I've added the line numbers.)
2302  </para>  </para>
2303  <para>  <para>
2304  Please follow the HOWTO provided by ftpmasters and sent to  Please follow the HOWTO provided by the ftpmasters and sent to
2305  debian-devel-announce: <ulink url="&copyright-howto;">&copyright-howto;</ulink>.  debian-devel-announce: <ulink url="&howto-copyright;"/>.
2306  </para>  </para>
2307  </section>  </section>
2308  <section id="changelog"><title><filename>changelog</filename> file</title>  <section id="changelog"><title><filename>changelog</filename></title>
2309  <para>  <para>
2310  This is a required file, which has a special format described in the <ulink url="http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog">Debian  This is a required file, which has a special format described in
2311  Policy Manual, 4.4 'debian/changelog'</ulink>.  This format is used by  <ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 "debian/changelog"</ulink>.
2312  <command>dpkg</command> and other programs to obtain the version number,  This format is used by <command>dpkg</command> and other programs to obtain the
2313  revision, distribution and urgency of your package.  version number, revision, distribution, and urgency of your package.
2314  </para>  </para>
2315  <para>  <para>
2316  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 1917  saved as <filename>/usr/share/doc/gentoo Line 2320  saved as <filename>/usr/share/doc/gentoo
2320  binary package.  binary package.
2321  </para>  </para>
2322  <para>  <para>
2323  <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
2324  like:  like:
2325  </para>  </para>
2326  <screen>  <screen>
# Line 1933  like: Line 2336  like:
2336  </para>  </para>
2337  <para>  <para>
2338  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
2339  match the source package name, distribution should be either  match the source package name; distribution should be
2340  <literal>unstable</literal> (or even <literal>experimental</literal>)  <literal>unstable</literal> (or even <literal>experimental</literal>)
2341  <footnote><para> Some people use invalid distribution values such as  <footnote><para> Some people use invalid distribution values such as
2342  <literal>UNRELEASED</literal> to prevent a package to be accidentally uploaded  <literal>UNRELEASED</literal> to prevent a package being accidentally uploaded
2343  when updating a package in a shared VCS.  </para> </footnote>, and urgency  when updating a package in a shared VCS.  </para> </footnote>, and urgency
2344  shouldn't be changed to anything higher than <literal>low</literal>.  :-)  shouldn't be changed to anything higher than <literal>low</literal>.  :-)
2345  </para>  </para>
2346  <para>  <para>
2347  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
2348  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,
2349  created by the upstream authors, which you will later install as  created by the upstream authors, which you will later install as
2350  <filename>/usr/share/doc/gentoo/changelog.gz</filename>).  Let's assume your  <filename>/usr/share/doc/gentoo/changelog.gz</filename>).  Let's assume your
2351  ITP (Intent To Package) bug report number was <literal>12345</literal>.  New  ITP (Intent To Package) bug report number was <literal>12345</literal>.  New
2352  lines must be inserted just before the uppermost line that begins with  lines must be inserted just below the uppermost line that begins with
2353  <literal>*</literal> (asterisk).  You can do it with <citerefentry>  <literal>*</literal> (asterisk).  You can do it with <citerefentry>
2354  <refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or  <refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or
2355  manually with a text editor.  manually with a text editor.
# Line 1969  You will end up with something like this Line 2372  You will end up with something like this
2372  </para>  </para>
2373  <para>  <para>
2374  You can read more about updating the <filename>changelog</filename> file later  You can read more about updating the <filename>changelog</filename> file later
2375  in <xref linkend="update"/> .  in <xref linkend="update"/>.
2376  </para>  </para>
2377  </section>  </section>
2378  <section id="rules"><title><filename>rules</filename> file</title>  <section id="rules"><title><filename>rules</filename></title>
2379  <para>  <para>
2380  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>
2381  <refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>
2382  </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
2383  another <filename>Makefile</filename>, but different from the one(s) in the  another <filename>Makefile</filename>, but different from the one(s) in the
2384  upstream source.  Unlike other files in <filename>debian</filename>, this one  upstream source.  Unlike other files in <filename>debian</filename>, this one
2385  is marked as executable.  is marked as executable.
2386  </para>  </para>
2387  <section id="targets"><title>Targets of <filename>rules</filename> file</title>  <section id="targets"><title>Targets of the <filename>rules</filename> file</title>
2388  <para>  <para>
2389  Every <filename>rules</filename> file, as any other  Every <filename>rules</filename> file, like any other
2390  <filename>Makefile</filename>, consists of several targets and their rules  <filename>Makefile</filename>, consists of several targets and their rules.
2391  specifying how to handle the source.  <ulink url="http://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules">Debian  <footnote><para>You can start learning how to write <filename>Makefile</filename> from
2392  Policy Manual, 4.9 'Main building script: debian/rules'</ulink> explains its  <ulink url="&debref-make;">Debian Reference, 12.2 "Make"</ulink>.
2393  details.  The full documentation is available as
2394    <ulink url="&gnu-make;"></ulink> or as the
2395    <systemitem role="package">make-doc</systemitem> package in the non-free archive area.
2396    </para></footnote>
2397    A new rule begins with its target declaration in the first column.  The
2398    following lines beginning with the TAB code (ASCII 9) specify its rule.
2399    Empty lines and lines beginning with <literal>#</literal> (hash) are treated as
2400    comments and ignored.
2401    <footnote><para><ulink url="&policy-debianrules;">Debian
2402    Policy Manual, 4.9 "Main building script: debian/rules"</ulink> explains the
2403    details.</para></footnote>
2404    </para>
2405    <para>
2406    A rule that you want to execute is invoked by its target name as a command line argument.  For
2407    example, <literal>debian/rules <replaceable>build</replaceable></literal> and
2408    <literal>fakeroot make -f debian/rules <replaceable>binary</replaceable></literal>
2409    execute rules for <literal><replaceable>build</replaceable></literal> and
2410    <literal><replaceable>binary</replaceable></literal> targets trespectively.
2411  </para>  </para>
2412  <para>  <para>
2413  The simplified explanation of targets are the following.  Here is a simplified explanation of the targets:
2414  </para>  </para>
2415  <itemizedlist>  <itemizedlist>
2416  <listitem>  <listitem>
2417  <para>  <para>
2418  <literal>clean</literal> target: to clean all compiled, generated, and useless  <literal>clean</literal> target: to clean all compiled, generated, and useless
2419  files in the build-tree.  (required)  files in the build-tree.  (Required)
2420  </para>  </para>
2421  </listitem>  </listitem>
2422  <listitem>  <listitem>
2423  <para>  <para>
2424  <literal>build</literal> target: to build the source into compiled programs and  <literal>build</literal> target: to build the source into compiled programs and
2425  formatted documents in the build-tree.  (required)  formatted documents in the build-tree.  (Required)
2426  </para>  </para>
2427  </listitem>  </listitem>
2428  <listitem>  <listitem>
# Line 2010  formatted documents in the build-tree. Line 2430  formatted documents in the build-tree.
2430  <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
2431  binary package under the <filename>debian</filename> directory.  If defined,  binary package under the <filename>debian</filename> directory.  If defined,
2432  <literal>binary*</literal> targets effectively depend on this target.  <literal>binary*</literal> targets effectively depend on this target.
2433  (optional)  (Optional)
2434  </para>  </para>
2435  </listitem>  </listitem>
2436  <listitem>  <listitem>
2437  <para>  <para>
2438  <literal>binary</literal> target: to create all binary packages (effectively  <literal>binary</literal> target: to create all binary packages (effectively
2439  combination of <literal>binary-arch</literal> and  a combination of <literal>binary-arch</literal> and
2440  <literal>binary-indep</literal> targets).  (required)<footnote><para> This  <literal>binary-indep</literal> targets).  (Required)<footnote><para> This
2441  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>
2442  </para>  </para>
2443  </listitem>  </listitem>
2444  <listitem>  <listitem>
2445  <para>  <para>
2446  <literal>binary-arch</literal> target: to create arch-dependent  <literal>binary-arch</literal> target: to create arch-dependent
2447  (<literal>Architecture: any</literal>) binary packages in the parent directory.  (<literal>Architecture: any</literal>) binary packages in the parent directory.
2448  (required)<footnote><para> This target is used by <literal>dpkg-buildpackage  (Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
2449  -B</literal> as in <xref linkend="autobuilder"/> .  </para> </footnote>  -B</literal> as in <xref linkend="autobuilder"/>.  </para> </footnote>
2450  </para>  </para>
2451  </listitem>  </listitem>
2452  <listitem>  <listitem>
2453  <para>  <para>
2454  <literal>binary-indep</literal> target: to create arch-independent  <literal>binary-indep</literal> target: to create arch-independent
2455  (<literal>Architecture: all</literal>) binary packages in the parent directory.  (<literal>Architecture: all</literal>) binary packages in the parent directory.
2456  (required)<footnote><para> This target is used by <literal>dpkg-buildpackage  (Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
2457  -A</literal>.  </para> </footnote>  -A</literal>.  </para> </footnote>
2458  </para>  </para>
2459  </listitem>  </listitem>
2460  <listitem>  <listitem>
2461  <para>  <para>
2462  <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
2463  the original source package from upstream archive site.  (optional)  the original source package from an upstream archive.  (Optional)
2464  </para>  </para>
2465  </listitem>  </listitem>
2466  </itemizedlist>  </itemizedlist>
2467  <para>  <para>
2468  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  
2469  <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
2470  default.  You should also read <literal>info make</literal> for more  default.
 information.  
2471  </para>  </para>
2472  </section>  </section>
2473  <section id="defaultrules"><title>Default <filename>rules</filename> file</title>  <section id="defaultrules"><title>Default <filename>rules</filename> file</title>
# Line 2083  Newer <command>dh_make</command> generat Line 2492  Newer <command>dh_make</command> generat
2492  </screen>  </screen>
2493  <para>  <para>
2494  (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,
2495  the leading white spaces are TAB codes.)  the leading spaces are a TAB code.)
2496  </para>  </para>
2497  <para>  <para>
2498  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 2091  It tells the operating system that this Line 2500  It tells the operating system that this
2500  <filename>/usr/bin/make</filename>.  <filename>/usr/bin/make</filename>.
2501  </para>  </para>
2502  <para>  <para>
2503  Line 10 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,
2504  Then, the <command>dh</command> command will output which  so that the <command>dh</command> command outputs which
2505  <command>dh_*</command> commands are executed by the <command>dh</command>  <command>dh_*</command> commands it is executing.
2506  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,
2507  Then each <command>dh_*</command> command will output which commands are  so that each <command>dh_*</command> command outputs which commands it
2508  executed by each <command>dh_*</command> command.  This helps you to understand  is executing.  This helps you to understand
2509  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
2510  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
2511  <systemitem role="package">debhelper</systemitem> tools and does not hide  <systemitem role="package">debhelper</systemitem> tools, and not to hide
2512  anything from you.  anything from you.
2513  </para>  </para>
2514  <para>  <para>
2515  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
2516  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
2517  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
2518  explained in <ulink url="http://joey.kitenet.net/talks/debhelper/debhelper-slides.pdf">Not Your  explained in <ulink url="&debhelper-slides;">Not Your
2519  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
2520  <literal>lenny</literal>, <command>dh_make</command> created a much more  <literal>lenny</literal>, <command>dh_make</command> created a much more
2521  complicated <filename>rules</filename> file with many <command>dh_*</command>  complicated <filename>rules</filename> file with explicit rules
2522  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
2523  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
2524  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
2525  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
2526  package building process like the <systemitem role="package">cdbs</systemitem>  package building process as the <systemitem role="package">cdbs</systemitem>
2527  package.  </para> </footnote> The <command>dh</command> command is a wrapper  package tends to.  </para> </footnote> The <command>dh</command> command is a wrapper
2528  script which runs appropriate sequences of <command>dh_*</command> programs  script which runs appropriate sequences of <command>dh_*</command> programs
2529  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
2530  <command>dh_*</command> programs invoked for a given  <command>dh_*</command> programs invoked for a given
2531  <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
2532  <replaceable>target</replaceable></literal> or <literal>debian/rules --  <replaceable>target</replaceable></literal> or <literal>debian/rules --
2533  '--no-act <replaceable>target</replaceable>'</literal> without really running  '--no-act <replaceable>target</replaceable>'</literal>.  </para> </footnote>
 them.  </para> </footnote>  
2534  </para>  </para>
2535  <itemizedlist>  <itemizedlist>
2536  <listitem>  <listitem>
2537  <para>  <para>
2538  <literal>debian/rules clean</literal> runs <literal>dh clean</literal>; which  <literal>debian/rules clean</literal> runs <literal>dh clean</literal>, which
2539  in turn runs the following:  in turn runs the following:
2540  </para>  </para>
2541  <screen>  <screen>
# Line 2221  for each remaining command. Line 2629  for each remaining command.
2629  </listitem>  </listitem>
2630  </itemizedlist>  </itemizedlist>
2631  <para>  <para>
2632  The function of <command>dh_*</command> commands are almost self-evident from  The functions of <command>dh_*</command> commands are largely self-evident from
2633  their names.  <footnote><para> For complete information on what do all these  their names.  <footnote><para> For complete information on what all these
2634  <command>dh_*</command> scripts exactly do, and what their other options are,  <command>dh_*</command> scripts do exactly, and what their other options are,
2635  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
2636  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
2637  typical build environment based on <filename>Makefile</filename>.  a typical build environment based on a <filename>Makefile</filename>.
2638  <footnote><para> These commands support other build environments such as  <footnote><para> These commands support other build environments such as
2639  <filename>setup.py</filename> which can be listed by executing  <filename>setup.py</filename> which can be listed by executing
2640  <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 2235  typical build environment based on <file Line 2643  typical build environment based on <file
2643  <itemizedlist>  <itemizedlist>
2644  <listitem>  <listitem>
2645  <para>  <para>
2646  <command>dh_auto_clean</command> usually executes the following if  <command>dh_auto_clean</command> usually executes the following if a
2647  <filename>Makefile</filename> exists with the <literal>distclean</literal>  <filename>Makefile</filename> exists with the <literal>distclean</literal>
2648  target.  <footnote><para> It actually looks for the first available target of  target.  <footnote><para> It actually looks for the first available target
2649  <literal>distclean</literal>, <literal>realclean</literal> or  in the <filename>Makefile</filename> out of
2650  <literal>clean</literal> in <filename>Makefile</filename> and execute it.  <literal>distclean</literal>, <literal>realclean</literal>, or
2651    <literal>clean</literal>, and executes that.
2652  </para> </footnote>  </para> </footnote>
2653  </para>  </para>
2654  <screen>  <screen>
# Line 2267  make Line 2676  make
2676  </listitem>  </listitem>
2677  <listitem>  <listitem>
2678  <para>  <para>
2679  <command>dh_auto_test</command> usually executes the following if  <command>dh_auto_test</command> usually executes the following if a
2680  <filename>Makefile</filename> exists with the <literal>test</literal> target.  <filename>Makefile</filename> exists with the <literal>test</literal> target.
2681  <footnote><para> It actually looks for the first available target of  <footnote><para> It actually looks for the first available target in
2682  <literal>test</literal> or <literal>check</literal> in  the <filename>Makefile</filename> out of <literal>test</literal> or
2683  <filename>Makefile</filename> and execute it.  </para> </footnote>  <literal>check</literal>, and executes thait.  </para> </footnote>
2684  </para>  </para>
2685  <screen>  <screen>
2686  make test  make test
# Line 2279  make test Line 2688  make test
2688  </listitem>  </listitem>
2689  <listitem>  <listitem>
2690  <para>  <para>
2691  <command>dh_auto_install</command> usually executes the following if  <command>dh_auto_install</command> usually executes the following if a
2692  <filename>Makefile</filename> exists with the <literal>install</literal> target  <filename>Makefile</filename> exists with the <literal>install</literal> target
2693  (line folded for readability).  (line folded for readability).
2694  </para>  </para>
# Line 2290  make install \ Line 2699  make install \
2699  </listitem>  </listitem>
2700  </itemizedlist>  </itemizedlist>
2701  <para>  <para>
2702  Targets which require the <command>fakeroot</command> command contain  All targets which require the <command>fakeroot</command> command will contain
2703  <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
2704  this command, it exits with an error.  using this command to pretend to be root.
2705  </para>  </para>
2706  <para>  <para>
2707  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
2708  <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
2709  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
2710  fit your needs.  Only things that you must not change are the names of the  fit your needs.  The only things that you must not change are the names of the
2711  rules, because all the tools use these names, as mandated by the Debian Policy.  rules, because all the tools use these names, as mandated by the Debian Policy.
2712  </para>  </para>
2713  <para>  <para>
2714  Although <literal>install</literal> is not required target, it is supported.  Although <literal>install</literal> is not a required target, it is supported.
2715  <literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh  <literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh
2716  binary</literal> but stops after <command>dh_fixperms</command>.  binary</literal> but stops after <command>dh_fixperms</command>.
2717  </para>  </para>
# Line 2322  file, you should activate its customizat Line 2731  file, you should activate its customizat
2731  <itemizedlist>  <itemizedlist>
2732  <listitem>  <listitem>
2733  <para>  <para>
2734  Add support of the <command>dh_pysupport</command> command.  (The best choice  Add support for the <command>dh_pysupport</command> command.  (The best choice
2735  for Python.) <footnote><para> Use of the <command>dh_pysupport</command>  for Python.) <footnote><para> Use of the <command>dh_pysupport</command>
2736  command is preferred over use of the <command>dh_pycentral</command> command.  command is preferred over use of the <command>dh_pycentral</command> command.
2737  Do not use the <command>dh_python</command> command.  </para> </footnote>  Do not use the <command>dh_python</command> command.  </para> </footnote>
# Line 2330  Do not use the <command>dh_python</comma Line 2739  Do not use the <command>dh_python</comma
2739  <itemizedlist>  <itemizedlist>
2740  <listitem>  <listitem>
2741  <para>  <para>
2742  Install the <systemitem role="package">python-support</systemitem> package in  Include the <systemitem role="package">python-support</systemitem> package in
2743  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2744  </para>  </para>
2745  </listitem>  </listitem>
2746  <listitem>  <listitem>
2747  <para>  <para>
2748  Use <literal>dh $@</literal> as usual.  (This is enabled by default)  Use <literal>dh $@</literal> as usual.  (Use of <command>dh_pysupport</command> is the default)
2749  </para>  </para>
2750  </listitem>  </listitem>
2751  <listitem>  <listitem>
# Line 2348  This handles Python modules using the <s Line 2757  This handles Python modules using the <s
2757  </listitem>  </listitem>
2758  <listitem>  <listitem>
2759  <para>  <para>
2760  Add support of the <command>dh_pycentral</command> command.  Add support for the <command>dh_pycentral</command> command.
2761  </para>  </para>
2762  <itemizedlist>  <itemizedlist>
2763  <listitem>  <listitem>
2764  <para>  <para>
2765  Install the <systemitem role="package">python-central</systemitem> package in  Include the <systemitem role="package">python-central</systemitem> package in
2766  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2767  </para>  </para>
2768  </listitem>  </listitem>
# Line 2376  This handles Python modules using the <s Line 2785  This handles Python modules using the <s
2785  </listitem>  </listitem>
2786  <listitem>  <listitem>
2787  <para>  <para>
2788  Add support of the <command>dh_installtex</command> command.  Add support for the <command>dh_installtex</command> command.
2789  </para>  </para>
2790  <itemizedlist>  <itemizedlist>
2791  <listitem>  <listitem>
2792  <para>  <para>
2793  Install the <systemitem role="package">tex-common</systemitem> package in  Include the <systemitem role="package">tex-common</systemitem> package in
2794  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2795  </para>  </para>
2796  </listitem>  </listitem>
# Line 2392  Use <literal>dh --with tex $@</literal> Line 2801  Use <literal>dh --with tex $@</literal>
2801  </listitem>  </listitem>
2802  <listitem>  <listitem>
2803  <para>  <para>
2804  This registers Type 1 fonts, hyphenation patterns, or formats with TeX.  This registers Type 1 fonts, hyphenation patterns, and formats with TeX.
2805  </para>  </para>
2806  </listitem>  </listitem>
2807  </itemizedlist>  </itemizedlist>
2808  </listitem>  </listitem>
2809  <listitem>  <listitem>
2810  <para>  <para>
2811  Add support of the <command>dh_quilt_patch</command> and  Add support for the <command>dh_quilt_patch</command> and
2812  <command>dh_quilt_unpatch</command> commands.  <command>dh_quilt_unpatch</command> commands.
2813  </para>  </para>
2814  <itemizedlist>  <itemizedlist>
2815  <listitem>  <listitem>
2816  <para>  <para>
2817  Install the <systemitem role="package">quilt</systemitem> package in  Include the <systemitem role="package">quilt</systemitem> package in
2818  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2819  </para>  </para>
2820  </listitem>  </listitem>
# Line 2417  Use <literal>dh --with quilt $@</literal Line 2826  Use <literal>dh --with quilt $@</literal
2826  <listitem>  <listitem>
2827  <para>  <para>
2828  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
2829  <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.  
2830  </para>  </para>
2831  </listitem>  </listitem>
2832  <listitem>  <listitem>
2833  <para>  <para>
2834  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
2835  package.  package format.
2836  </para>  </para>
2837  </listitem>  </listitem>
2838  </itemizedlist>  </itemizedlist>
2839  </listitem>  </listitem>
2840  <listitem>  <listitem>
2841  <para>  <para>
2842  Add support of the <command>dh_dkms</command> command.  Add support for the <command>dh_dkms</command> command.
2843  </para>  </para>
2844  <itemizedlist>  <itemizedlist>
2845  <listitem>  <listitem>
2846  <para>  <para>
2847  Install the <systemitem role="package">dkms</systemitem> package in  Include the <systemitem role="package">dkms</systemitem> package in
2848  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2849  </para>  </para>
2850  </listitem>  </listitem>
# Line 2447  Use <literal>dh --with dkms $@</literal> Line 2855  Use <literal>dh --with dkms $@</literal>
2855  </listitem>  </listitem>
2856  <listitem>  <listitem>
2857  <para>  <para>
2858  This correctly handles DKMS usage by the kernel module package.  This correctly handles DKMS usage by kernel module packages.
2859  </para>  </para>
2860  </listitem>  </listitem>
2861  </itemizedlist>  </itemizedlist>
2862  </listitem>  </listitem>
2863  <listitem>  <listitem>
2864  <para>  <para>
2865  Add support of the <command>dh_autotools-dev_updateconfig</command> and  Add support for the <command>dh_autotools-dev_updateconfig</command> and
2866  <command>dh_autotools-dev_restoreconfig</command> commands.  <command>dh_autotools-dev_restoreconfig</command> commands.
2867  </para>  </para>
2868  <itemizedlist>  <itemizedlist>
2869  <listitem>  <listitem>
2870  <para>  <para>
2871  Install the <systemitem role="package">autotools-dev</systemitem> package in  Include the <systemitem role="package">autotools-dev</systemitem> package in
2872  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2873  </para>  </para>
2874  </listitem>  </listitem>
# Line 2479  This updates and restores <filename>conf Line 2887  This updates and restores <filename>conf
2887  </listitem>  </listitem>
2888  <listitem>  <listitem>
2889  <para>  <para>
2890  Add support of the <command>dh_autoreconf</command> and  Add support for the <command>dh_autoreconf</command> and
2891  <command>dh_autoreconf_clean</command> commands.  <command>dh_autoreconf_clean</command> commands.
2892  </para>  </para>
2893  <itemizedlist>  <itemizedlist>
2894  <listitem>  <listitem>
2895  <para>  <para>
2896  Install the <systemitem role="package">dh-autoreconf</systemitem> package in  Include the <systemitem role="package">dh-autoreconf</systemitem> package in
2897  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2898  </para>  </para>
2899  </listitem>  </listitem>
# Line 2503  This updates the GNU Build System files Line 2911  This updates the GNU Build System files
2911  </listitem>  </listitem>
2912  <listitem>  <listitem>
2913  <para>  <para>
2914  Add support to the <command>bash</command> completion feature.  Add support for the <command>bash</command> completion feature.
2915  </para>  </para>
2916  <itemizedlist>  <itemizedlist>
2917  <listitem>  <listitem>
2918  <para>  <para>
2919  Install the <systemitem role="package">bash-completion</systemitem> package in  Includes the <systemitem role="package">bash-completion</systemitem> package in
2920  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2921  </para>  </para>
2922  </listitem>  </listitem>
# Line 2519  Use <literal>dh --with bash-completion $ Line 2927  Use <literal>dh --with bash-completion $
2927  </listitem>  </listitem>
2928  <listitem>  <listitem>
2929  <para>  <para>
2930  This installs <command>bash</command> completions using configuration file at  This installs <command>bash</command> completions using a configuration file at
2931  <filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.  <filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.
2932  </para>  </para>
2933  </listitem>  </listitem>
# Line 2527  This installs <command>bash</command> co Line 2935  This installs <command>bash</command> co
2935  </listitem>  </listitem>
2936  </itemizedlist>  </itemizedlist>
2937  <para>  <para>
 For sources using Autotools, use combination of above as <literal>dh --with  
 autotools-dev --with autoreconf $@</literal> to be most current with the GNU  
 Build System.  
 </para>  
 <para>  
2938  Many <command>dh_*</command> commands invoked by the new <command>dh</command>  Many <command>dh_*</command> commands invoked by the new <command>dh</command>
2939  command can be customized by the corresponding configuration files in the  command can be customized by the corresponding configuration files in the
2940  <filename>debian</filename> directory.  See <xref linkend="dother"/> and the  <filename>debian</filename> directory.  See <xref linkend="dother"/> and the
2941  manpage of each command for the customization of such features.  manpage of each command for the customization of such features.
2942  </para>  </para>
2943  <para>  <para>
2944  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>
2945  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.
2946  commands with them or to skip them.  For such cases, you create an  For such cases, you create an
2947  <literal>override_dh_<replaceable>foo</replaceable></literal> target with its  <literal>override_dh_<replaceable>foo</replaceable></literal> target with its
2948  rule in the <filename>rules</filename> file only for the  rule in the <filename>rules</filename> file defining an
2949    <literal>override_dh_<replaceable>foo</replaceable></literal> target for the
2950  <command>dh_<replaceable>foo</replaceable></command> command you want to  <command>dh_<replaceable>foo</replaceable></command> command you want to
2951  change.  It basically say <emphasis>run me instead</emphasis>.  change.  It basically says <emphasis>run me instead</emphasis>.
2952  <footnote><para> Under <literal>lenny</literal>, if you wanted to change the  <footnote><para> Under <literal>lenny</literal>, if you wanted to change the
2953  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
2954  <filename>rules</filename> file and adjusted it.  </para> </footnote>  <filename>rules</filename> file and adjusted it.  </para> </footnote>
2955  </para>  </para>
2956  <para>  <para>
2957  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
2958  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
2959  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
2960  <literal>override_dh_*</literal> targets except the  to substitute simplified equivalent commands (except for the
2961  <literal>override_dh_auto_clean</literal> target is a bad idea since it may  <literal>override_dh_auto_clean</literal> target) since it may
2962  kill such <systemitem role="package">debhelper</systemitem>'s smart features.  bypass such smart <systemitem role="package">debhelper</systemitem> features.
2963  </para>  </para>
2964  <para>  <para>
2965  If you want to store the system configuration data for the <systemitem role="package">gentoo</systemitem> package in the  So, for instance, if you want to store system configuration data in the
2966  <filename>/etc/gentoo</filename> directory instead of the usual  <filename>/etc/gentoo</filename> directory instead of the usual
2967  <filename>/etc</filename> directory, you can override the default  <filename>/etc</filename> directory for the recent
2968    <systemitem role="package">gentoo</systemitem> package using Autotools, you can override the default
2969  <literal>--sysconfig=/etc</literal> argument given by the  <literal>--sysconfig=/etc</literal> argument given by the
2970  <command>dh_auto_configure</command> command to the  <command>dh_auto_configure</command> command to the
2971  <command>./configure</command> command by the following.  <footnote><para> The  <command>./configure</command> command by the following.
 <systemitem role="package">gentoo</systemitem> package uses the GNU build  
 system, also known as the Autotools.  See <ulink url="http://en.wikipedia.org/wiki/GNU_build_system">http://en.wikipedia.org/wiki/GNU_build_system</ulink>.  
 </para> </footnote>  
2972  </para>  </para>
2973  <screen>  <screen>
2974  override_dh_auto_configure:  override_dh_auto_configure:
# Line 2575  override_dh_auto_configure: Line 2977  override_dh_auto_configure:
2977  <para>  <para>
2978  The arguments given after <literal>--</literal> are appended to the default  The arguments given after <literal>--</literal> are appended to the default
2979  arguments of the auto-executed program to override them.  Using the  arguments of the auto-executed program to override them.  Using the
2980  <command>dh_auto_configure</command> command is better than the  <command>dh_auto_configure</command> command is better than directly invoking the
2981  <command>./configure</command> command here since it will only override the  <command>./configure</command> command here since it will only override the
2982  <literal>--sysconfig</literal> argument and keeps well intended other arguments  <literal>--sysconfig</literal> argument and retains any other, benign arguments
2983  to the <command>./configure</command> command.  to the <command>./configure</command> command.
2984  </para>  </para>
2985  <para>  <para>
2986  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
2987  <literal>build</literal> as its target to build it <footnote><para>  <literal>build</literal> as its target to build it <footnote><para>
2988  <command>dh_auto_build</command> without any arguments will execute the first  <command>dh_auto_build</command> without any arguments will execute the first
2989  target in the <filename>Makefile</filename> file.  </para> </footnote>, you  target in the <filename>Makefile</filename>.  </para> </footnote>, you
2990  create an <literal>override_dh_auto_build</literal> target to enable it.  create an <literal>override_dh_auto_build</literal> target to enable this.
2991  </para>  </para>
2992  <screen>  <screen>
2993  override_dh_auto_build:  override_dh_auto_build:
2994          dh_auto_build -- build          dh_auto_build -- build
2995  </screen>  </screen>
2996  <para>  <para>
2997  This ensures to run $(MAKE) with all the default arguments given by the  This ensures $(MAKE) is run with all the default arguments given by the
2998  <command>dh_auto_build</command> command and <literal>build</literal> argument.  <command>dh_auto_build</command> command plus the <literal>build</literal> argument.
2999  </para>  </para>
3000  <para>  <para>
3001  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
3002  <literal>packageclean</literal> target to clean it for Debian package instead  <literal>packageclean</literal> target to clean it for the Debian package instead
3003  of the <literal>distclean</literal> or <literal>clean</literal> targets in the  of using <literal>distclean</literal> or <literal>clean</literal> targets,
3004  <filename>Makefile</filename> file, you create an  you can create an
3005  <literal>override_dh_auto_clean</literal> target to enable it.  <literal>override_dh_auto_clean</literal> target to enable thit.
3006  </para>  </para>
3007  <screen>  <screen>
3008  override_dh_auto_clean:  override_dh_auto_clean:
3009          $(MAKE) packageclean          $(MAKE) packageclean
3010  </screen>  </screen>
3011  <para>  <para>
3012  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
3013  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
3014  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.
3015  </para>  </para>
3016  <screen>  <screen>
3017  override_dh_auto_test:  override_dh_auto_test:
# Line 2621  changelog file called <filename>FIXES</f Line 3023  changelog file called <filename>FIXES</f
3023  The <command>dh_installchangelogs</command> command requires  The <command>dh_installchangelogs</command> command requires
3024  <filename>FIXES</filename> as its argument to install it.  <footnote><para> The  <filename>FIXES</filename> as its argument to install it.  <footnote><para> The
3025  <filename>debian/changelog</filename> and <filename>debian/NEWS</filename>  <filename>debian/changelog</filename> and <filename>debian/NEWS</filename>
3026  files are always automatically installed.  The upstream changelog is searched  files are always automatically installed.  The upstream changelog is found
3027  by converting filenames to the lower case and matching them with the  by converting filenames to lower case and matching them against
3028  <filename>changelog</filename>, <filename>changes</filename>,  <filename>changelog</filename>, <filename>changes</filename>,
3029  <filename>changelog.txt</filename>, and <filename>changes.txt</filename>.  <filename>changelog.txt</filename>, and <filename>changes.txt</filename>.
3030  </para> </footnote>  </para> </footnote>
# Line 2633  override_dh_installchangelogs: Line 3035  override_dh_installchangelogs:
3035  </screen>  </screen>
3036  <para>  <para>
3037  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
3038  such as the ones listed in <xref linkend="targets"/> except  such as the ones listed in <xref linkend="targets"/>, other than the
3039  <literal>get-orig-source</literal> target may make it difficult to understand  <literal>get-orig-source</literal> target, may make it difficult to understand
3040  their exact effects.  Please limit explicit targets to  their exact effects.  Please limit explicit targets to
3041  <literal>override_dh_*</literal> targets and completely independent ones, if  <literal>override_dh_*</literal> targets and completely independent ones, if
3042  possible.  possible.
# Line 2646  possible. Line 3048  possible.
3048  <para>  <para>
3049  To control most of what <systemitem role="package">debhelper</systemitem> does  To control most of what <systemitem role="package">debhelper</systemitem> does
3050  while building the package, you put optional configuration files under the  while building the package, you put optional configuration files under the
3051  <filename>debian</filename> directory.  This chapter will make an overview of  <filename>debian</filename> directory.  This chapter will provide an overview of
3052  what each of these does and its format.  Please read <ulink url="http://www.debian.org/doc/devel-manuals#policy">Debian Policy  what each of these does and its format.  Please read the <ulink url="&debian-policy;">Debian Policy
3053  Manual</ulink> and <ulink url="http://www.debian.org/doc/devel-manuals#devref">Debian Developer's  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's
3054  Reference</ulink> for guidelines for the packaging.  Reference</ulink> for guidelines for packaging.
3055  </para>  </para>
3056  <para>  <para>
3057  The <command>dh_make</command> command will create some template configuration  The <command>dh_make</command> command will create some template configuration
# Line 2658  filenames suffixed by <literal>.ex</lite Line 3060  filenames suffixed by <literal>.ex</lite
3060  prefixed by the binary package name such as  prefixed by the binary package name such as
3061  <literal><replaceable>package</replaceable></literal>.  Take a look at all of  <literal><replaceable>package</replaceable></literal>.  Take a look at all of
3062  them.  them.
3063    <footnote><para>
3064    In this chapter, files in the <filename>debian</filename> directory are
3065    referred to without the preceding <filename>debian/</filename> for simplicity whenever
3066    they are obvious.
3067    </para></footnote>
3068  </para>  </para>
3069  <para>  <para>
3070  The <command>dh_make</command> command may not create some template  Some template configuration files for <systemitem role="package">debhelper</systemitem>
3071  configuration files for <systemitem role="package">debhelper</systemitem>.  In  may not be created by the <command>dh_make</command> command.  In
3072  such cases, you need to create them with the editor.  such cases, you need to create them with an editor.
3073  </para>  </para>
3074  <para>  <para>
3075  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:
3076  </para>  </para>
3077  <itemizedlist>  <itemizedlist>
3078  <listitem>  <listitem>
3079  <para>  <para>
3080  rename template files by removing the <literal>.ex</literal> or  rename template files by removing the <literal>.ex</literal> or
3081  <literal>.EX</literal> suffix if the template files have one.  <literal>.EX</literal> suffix if they have one;
3082  </para>  </para>
3083  </listitem>  </listitem>
3084  <listitem>  <listitem>
3085  <para>  <para>
3086  rename the name of these configuration files using the actual binary package  rename the configuration files to use the actual binary package
3087  name in place of <literal><replaceable>package</replaceable></literal>.  name in place of <literal><replaceable>package</replaceable></literal>;
3088  </para>  </para>
3089  </listitem>  </listitem>
3090  <listitem>  <listitem>
3091  <para>  <para>
3092  modify template file contents to suit your needs.  modify template file contents to suit your needs;
3093  </para>  </para>
3094  </listitem>  </listitem>
3095  <listitem>  <listitem>
3096  <para>  <para>
3097  remove template files which you do not need.  remove template files which you do not need;
3098  </para>  </para>
3099  </listitem>  </listitem>
3100  <listitem>  <listitem>
3101  <para>  <para>
3102  modify the <filename>control</filename> file (see <xref linkend="control"/> ),  modify the <filename>control</filename> file (see <xref linkend="control"/>),
3103  if necessary.  if necessary;
3104  </para>  </para>
3105  </listitem>  </listitem>
3106  <listitem>  <listitem>
3107  <para>  <para>
3108  modify the <filename>rules</filename> file (see <xref linkend="rules"/> ), if  modify the <filename>rules</filename> file (see <xref linkend="rules"/>), if
3109  necessary.  necessary.
3110  </para>  </para>
3111  </listitem>  </listitem>
3112  </itemizedlist>  </itemizedlist>
3113  <para>  <para>
3114  Those <systemitem role="package">debhelper</systemitem> configuration files  Any <systemitem role="package">debhelper</systemitem> configuration files
3115  without <filename><replaceable>package</replaceable></filename> prefix such as  without a <filename><replaceable>package</replaceable></filename> prefix, such as
3116  <filename>install</filename> apply to the first binary package.  When there are  <filename>install</filename>, apply to the first binary package.  When there are
3117  many binary packages, their configurations can be specified by prefixing their  many binary packages, their configurations can be specified by prefixing their
3118  name to their configuration filenames such as  name to their configuration filenames such as
3119  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3120  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3121  </para>  </para>
3122  <section id="readme"><title><filename>README.Debian</filename> file</title>  <section id="readme"><title><filename>README.Debian</filename></title>
3123  <para>  <para>
3124  Any extra details or discrepancies between the original package and your Debian  Any extra details or discrepancies between the original package and your Debian
3125  version should be documented here.  version should be documented here.
3126  </para>  </para>
3127  <para>  <para>
3128  <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:
3129  </para>  </para>
3130  <screen>  <screen>
3131  gentoo for Debian  gentoo for Debian
# Line 2732  If you have nothing to be documented, re Line 3139  If you have nothing to be documented, re
3139  </citerefentry>.  </citerefentry>.
3140  </para>  </para>
3141  </section>  </section>
3142  <section id="compat"><title><filename>compat</filename> file</title>  <section id="compat"><title><filename>compat</filename></title>
3143  <para>  <para>
3144  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
3145  should set it to the <systemitem role="package">debhelper</systemitem> V7 by  should set it to the <systemitem role="package">debhelper</systemitem> v7 as
3146  the following.  follows:
3147  </para>  </para>
3148  <screen>  <screen>
3149  $ echo 7 &gt; debian/compat  $ echo 7 &gt; debian/compat
3150  </screen>  </screen>
3151  </section>  </section>
3152  <section id="conffiles"><title><filename>conffiles</filename> file</title>  <section id="conffiles"><title><filename>conffiles</filename></title>
3153  <para>  <para>
3154  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
3155  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
3156  over your changes.  Debian solves this problem by marking configuration files  over your changes.  Debian solves this problem by marking such configuration files as conffiles.
3157  so that when you upgrade a package, you'll be prompted whether you want to keep  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>
3158  your old configuration or not.  <manvolnum>1</manvolnum> </citerefentry> and
3159    <ulink url="&policy-conffiles;">Debian Policy Manual "D.2.5 Conffiles"</ulink>.
3160    </para></footnote>
3161    When you upgrade a package, you'll be asked whether you want to keep
3162    your old configuration files or not.
3163  </para>  </para>
3164  <para>  <para>
3165  Since <systemitem role="package">debhelper</systemitem> V3, <citerefentry>  <citerefentry><refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>
3166  <refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>  </citerefentry> <emphasis>automatically</emphasis> flags any files under
 </citerefentry> will <emphasis>automatically</emphasis> flag any files under  
3167  the <filename>/etc</filename> directory as conffiles, so if your program only  the <filename>/etc</filename> directory as conffiles, so if your program only
3168  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
3169  package types, the only place there is (and should be conffiles) is under  package types, the only place conffiles should ever be is under
3170  <filename>/etc</filename> and so this file doesn't need to exist.  <filename>/etc</filename>, and so this file doesn't need to exist.
3171  </para>  </para>
3172  <para>  <para>
3173  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,
3174  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
3175  then prompt users to verify the changes all the time.  then prompt users to verify the changes all the time.
3176  </para>  </para>
3177  <para>  <para>
3178  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
3179  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
3180  make them not as conffiles to keep <command>dpkg</command> quiet.  arrange for them to not be conffiles, keeping <command>dpkg</command> quiet.
3181  </para>  </para>
3182  <itemizedlist>  <itemizedlist>
3183  <listitem>  <listitem>
3184  <para>  <para>
3185  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
3186  file under the <filename>/var</filename> directory generated by the  file under the <filename>/var</filename> directory generated by the
3187  <emphasis>maintainer scripts</emphasis>.  maintainer scripts.
3188  </para>  </para>
3189  </listitem>  </listitem>
3190  <listitem>  <listitem>
3191  <para>  <para>
3192  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.  
3193  </para>  </para>
3194  </listitem>  </listitem>
3195  </itemizedlist>  </itemizedlist>
3196  <para>  <para>
3197  For more information on the <emphasis>maintainer scripts</emphasis>, see <xref linkend="maintscripts"/> .  For information on maintainer scripts, see <xref linkend="maintscripts"/>.
3198  </para>  </para>
3199  </section>  </section>
3200  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename> files</title>  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename></title>
3201  <para>  <para>
3202  If your package requires regularly scheduled tasks to operate properly, you can  If your package requires regularly scheduled tasks to operate properly, you can
3203  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
3204  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
3205  you wish.  The filenames are:  you wish.  The filenames are:
3206  </para>  </para>
3207  <itemizedlist>  <itemizedlist>
3208  <listitem>  <listitem>
3209  <para>  <para>
3210  <filename>cron.hourly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.hourly</filename> - Installed as
3211  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>; run
3212  once an hour every hour.  once an hour.
3213  </para>  </para>
3214  </listitem>  </listitem>
3215  <listitem>  <listitem>
3216  <para>  <para>
3217  <filename>cron.daily</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.daily</filename> - Installed as
3218  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>; run
3219  once a day, usually early morning.  once a day.
3220  </para>  </para>
3221  </listitem>  </listitem>
3222  <listitem>  <listitem>
3223  <para>  <para>
3224  <filename>cron.weekly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.weekly</filename> - Installed as
3225  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>; run
3226  once a week, usually early Sunday morning.  once a week.
3227  </para>  </para>
3228  </listitem>  </listitem>
3229  <listitem>  <listitem>
3230  <para>  <para>
3231  <filename>cron.monthly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.monthly</filename> - Installed as
3232  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run
3233  once a month, usually early morning on the first of the month.  once a month.
3234  </para>  </para>
3235  </listitem>  </listitem>
3236  <listitem>  <listitem>
3237  <para>  <para>
3238  <filename>cron.d</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.d</filename> - Installed as
3239  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any
3240  other time  other time.
3241  </para>  </para>
3242  </listitem>  </listitem>
3243  </itemizedlist>  </itemizedlist>
3244  <para>  <para>
3245  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
3246  is <filename><replaceable>package</replaceable>.cron.d</filename> which follows  <filename><replaceable>package</replaceable>.cron.d</filename> which follows
3247  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>
3248  <manvolnum>5</manvolnum> </citerefentry>.  <manvolnum>5</manvolnum> </citerefentry>.
3249  </para>  </para>
3250  <para>  <para>
3251  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;
3252  <refentrytitle>dh_installlogrotate</refentrytitle> <manvolnum>1</manvolnum>  for that, see
3253  </citerefentry> and <citerefentry> <refentrytitle>logrotate</refentrytitle>  <citerefentry><refentrytitle>dh_installlogrotate</refentrytitle>
3254  <manvolnum>8</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum></citerefentry> and
3255    <citerefentry><refentrytitle>logrotate</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
3256  </para>  </para>
3257  </section>  </section>
3258  <section id="dirs"><title><filename>dirs</filename> file</title>  <section id="dirs"><title><filename>dirs</filename></title>
3259  <para>  <para>
3260  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
3261  procedure (<literal>make install DESTDIR=...</literal> invoked by  procedure (<literal>make install DESTDIR=...</literal> invoked by
3262  <literal>dh_auto_install</literal>) somehow doesn't create.  This generally  <literal>dh_auto_install</literal>).  This generally
3263  means there is a problem with the <filename>Makefile</filename>.  means there is a problem with the <filename>Makefile</filename>.
3264  </para>  </para>
3265  <para>  <para>
3266  Files listed in the <filename>install</filename> file doesn't need the  Files listed in an <filename>install</filename> file don't need their
3267  directories created first.  See <xref linkend="install"/> .  directories created first.  See <xref linkend="install"/>.
3268  </para>  </para>
3269  <para>  <para>
3270  It is best to first 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
3271  run into trouble.  There is no preceding slash on the directory names.  run into trouble.  There is no preceding slash on the directory names listed in
3272    the <filename>dirs</filename> file.
3273  </para>  </para>
3274  </section>  </section>
3275  <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>
3276  <para>  <para>
3277  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
3278  should use the <systemitem role="package">doc-base</systemitem> file to  should use the <systemitem role="package">doc-base</systemitem> file to
3279  register it, so the user can find it with e.g.  <citerefentry>  register it, so the user can find it with e.g.  <citerefentry>
3280  <refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
3281  <citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>
3282  </citerefentry> or <citerefentry> <refentrytitle>doccentral</refentrytitle>  </citerefentry>, or <citerefentry> <refentrytitle>doccentral</refentrytitle>
3283  <manvolnum>1</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum> </citerefentry>.
3284  </para>  </para>
3285  <para>  <para>
# Line 2876  This usually includes HTML, PS and PDF f Line 3287  This usually includes HTML, PS and PDF f
3287  <filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.  <filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.
3288  </para>  </para>
3289  <para>  <para>
3290  This is how <systemitem role="package">gentoo</systemitem>'s doc-base file  This is what <systemitem role="package">gentoo</systemitem>'s doc-base file
3291  <filename>gentoo.doc-base</filename> looks like:  <filename>gentoo.doc-base</filename> looks like:
3292  </para>  </para>
3293  <screen>  <screen>
# Line 2893  Files: /usr/share/doc/gentoo/html/*.html Line 3304  Files: /usr/share/doc/gentoo/html/*.html
3304  For information on the file format, see <citerefentry>  For information on the file format, see <citerefentry>
3305  <refentrytitle>install-docs</refentrytitle> <manvolnum>8</manvolnum>  <refentrytitle>install-docs</refentrytitle> <manvolnum>8</manvolnum>
3306  </citerefentry> and the <systemitem role="package">doc-base</systemitem>  </citerefentry> and the <systemitem role="package">doc-base</systemitem>
3307  manual, in <filename>/usr/share/doc/doc-base/doc-base.html/</filename>.  manual, in <ulink url="&doc-base;">Debian doc-base Manual</ulink>.
3308  </para>  </para>
3309  <para>  <para>
3310  For more details on installing additional documentation, look in <xref linkend="destdir"/> .  For more details on installing additional documentation, look in <xref linkend="destdir"/>.
3311  </para>  </para>
3312  </section>  </section>
3313  <section id="docs"><title><filename>docs</filename> file</title>  <section id="docs"><title><filename>docs</filename></title>
3314  <para>  <para>
3315  This file specifies the file names of documentation files we can have  This file specifies the file names of documentation files we can have
3316  <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>  <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
# Line 2912  directory that are called <filename>BUGS Line 3323  directory that are called <filename>BUGS
3323  <filename>README*</filename>, <filename>TODO</filename> etc.  <filename>README*</filename>, <filename>TODO</filename> etc.
3324  </para>  </para>
3325  <para>  <para>
3326  For <systemitem role="package">gentoo</systemitem>, I also included some other  For <systemitem role="package">gentoo</systemitem>, some other files
3327  files:  are also included:
3328  </para>  </para>
3329  <screen>  <screen>
3330  BUGS  BUGS
# Line 2925  README.gtkrc Line 3336  README.gtkrc
3336  TODO  TODO
3337  </screen>  </screen>
3338  </section>  </section>
3339  <section id="emacsen"><title><filename>emacsen-*</filename> file</title>  <section id="emacsen"><title><filename>emacsen-*</filename></title>
3340  <para>  <para>
3341  If your package supplies Emacs files that can be bytecompiled at package  If your package supplies Emacs files that can be bytecompiled at package
3342  installation time, you can use these files to set it up.  installation time, you can use these files to set it up.
# Line 2939  They are installed into the temporary di Line 3350  They are installed into the temporary di
3350  If you don't need these, remove them.  If you don't need these, remove them.
3351  </para>  </para>
3352  </section>  </section>
3353  <section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename> file</title>  <section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename></title>
3354  <para>  <para>
3355  The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>  The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>
3356  <manvolnum>1</manvolnum> </citerefentry> command installs files and directories  <manvolnum>1</manvolnum> </citerefentry> command installs files and directories
3357  listed in this file as example files.  listed in this file as example files.
3358  </para>  </para>
3359  </section>  </section>
3360  <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>
3361  <para>  <para>
3362  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
3363  obviously disregarded my initial recommendation, haven't you?  :-)  obviously disregarded my initial recommendation, haven't you?  :-)
3364  </para>  </para>
3365  <para>  <para>
3366  The <filename><replaceable>package</replaceable>.init</filename> file is  The <filename><replaceable>package</replaceable>.init</filename> file is
3367  installed as the  installed as the
3368  <filename>/etc/init.d/<replaceable>package</replaceable></filename> script.  <filename>/etc/init.d/<replaceable>package</replaceable></filename> script
3369    which starts and stops the daemon.
3370  Its fairly generic skeleton template is provided by the  Its fairly generic skeleton template is provided by the
3371  <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
3372  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
3373  Filesystem Hierarchy Standard (see  <ulink url="&lsb;">Linux Standard Base</ulink> (LSB) compliant headers.  It
 <filename>/usr/share/doc/debian-policy/fhs/</filename>) compliant headers.  It  
3374  gets installed into the temporary directory by <citerefentry>  gets installed into the temporary directory by <citerefentry>
3375  <refentrytitle>dh_installinit</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dh_installinit</refentrytitle> <manvolnum>1</manvolnum>
3376  </citerefentry>.  </citerefentry>.
3377  </para>  </para>
3378  <para>  <para>
3379  The <filename><replaceable>package</replaceable>.default</filename> file will  The <filename><replaceable>package</replaceable>.default</filename> file will
3380  be installed into  be installed as
3381  <filename>/etc/default/<replaceable>package</replaceable></filename>.  This  <filename>/etc/default/<replaceable>package</replaceable></filename>.  This
3382  file sets defaults that are sourced by the init script.  Most times this  file sets defaults that are sourced by the init script.  This
3383  default file is used to disable running a daemon, set some default flags or  <filename><replaceable>package</replaceable>.default</filename> file
3384  timeouts.  If your init script has certain <emphasis>settable</emphasis>  is most often used to disable running a daemon, or to set some default flags or
3385  features you want to install these into the default file, not the init script.  timeouts.  If your init script has certain configurable
3386    features, you can set them in the <filename><replaceable>package</replaceable>.default</filename> file,
3387    instead of in the init script itself.
3388  </para>  </para>
3389  <para>  <para>
3390  If your upstream program has an init file 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
3391  don't use their init.d script then create a new one in  don't use their init script then create a new one in
3392  <filename>debian/<replaceable>package</replaceable>.init</filename>.  However  <filename><replaceable>package</replaceable>.init</filename>.  However
3393  if the upstream init script looks fine and installs in the right place you  if the upstream init script looks fine and installs in the right place you
3394  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
3395  need to override <command>dh_installinit</command> in the  need to override <command>dh_installinit</command> in the
3396  <filename>rules</filename> file with the following lines:  <filename>rules</filename> file with the following lines:
3397  </para>  </para>
# Line 2990  override_dh_installinit: Line 3403  override_dh_installinit:
3403  If you don't need this, remove the files.  If you don't need this, remove the files.
3404  </para>  </para>
3405  </section>  </section>
3406  <section id="install"><title><filename>install</filename> file</title>  <section id="install"><title><filename>install</filename></title>
3407  <para>  <para>
3408  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
3409  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
3410  destinations into this <filename>install</filename> file.  They are installed  destinations into this <filename>install</filename> file.  They are installed
3411  by <citerefentry> <refentrytitle>dh_install</refentrytitle>  by <citerefentry> <refentrytitle>dh_install</refentrytitle>
3412  <manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the  <manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the
# Line 3006  the <filename>docs</filename> file and n Line 3419  the <filename>docs</filename> file and n
3419  <para>  <para>
3420  This <filename>install</filename> file has one line per file installed, with  This <filename>install</filename> file has one line per file installed, with
3421  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
3422  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
3423  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:  
3424  </para>  </para>
3425  <screen>  <screen>
3426  src/foo/mybin usr/bin  src/<replaceable>bar</replaceable> usr/bin
3427  </screen>  </screen>
3428  <para>  <para>
3429  This will mean when this package is installed, there will be a binary file  This means when this package is installed, there will be a binary executable
3430  <filename>/usr/bin/mybin</filename>.  <filename>/usr/bin/<replaceable>bar</replaceable></filename>.
3431  </para>  </para>
3432  <para>  <para>
3433  Alternatively, this <filename>install</filename> can have the name of the file  Alternatively, this <filename>install</filename> can have the name of the file
3434  only without the installation directory when the relative directory path does  only without the installation directory when the relative directory path does
3435  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
3436  result into multiple binary packages using  output of its build into multiple binary packages using
3437  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3438  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3439  </para>  </para>
3440  <para>  <para>
3441  The <command>dh_install</command> command will fall back to look in  The <command>dh_install</command> command will fall back to looking in
3442  <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
3443  current directory (or wherever you've told it to look using  current directory (or wherever you've told it to look using
3444  <literal>--sourcedir</literal>).  <literal>--sourcedir</literal>).
3445  </para>  </para>
3446  </section>  </section>
3447  <section id="info"><title><filename><replaceable>package</replaceable>.info</filename> file</title>  <section id="info"><title><filename><replaceable>package</replaceable>.info</filename></title>
3448  <para>  <para>
3449  If your package has info pages, you should install them using <citerefentry>  If your package has info pages, you should install them using <citerefentry>
3450  <refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>
3451  </citerefentry> by listing them in the  </citerefentry> by listing them in a
3452  <filename><replaceable>package</replaceable>.info</filename> files.  <filename><replaceable>package</replaceable>.info</filename> file.
3453  </para>  </para>
3454  </section>  </section>
3455  <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>
3456  <para>  <para>
3457  If <systemitem role="package">lintian</systemitem> reports an erroneous  If <systemitem role="package">lintian</systemitem> reports an erroneous
3458  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
3459  use <filename><replaceable>package</replaceable>.lintian-overrides</filename>  use <filename><replaceable>package</replaceable>.lintian-overrides</filename>
3460  or <filename>source/lintian-overrides</filename> to quiet it.  Please read  or <filename>source/lintian-overrides</filename> to quieten it.  Please read
3461  <filename>/usr/share/doc/lintian/lintian.html/index.html</filename> and refrain  <ulink url="&lintian-doc;">Lintian User's Manual</ulink> and refrain
3462  from abusing this.  from abusing this.
3463  </para>  </para>
3464  <para>  <para>
3465  <filename><replaceable>package</replaceable>.lintian-overrides</filename> is  <filename><replaceable>package</replaceable>.lintian-overrides</filename> is
3466  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
3467  into  into
3468  <filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>  <filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>
3469  by the <command>dh_lintian</command> command.  by the <command>dh_lintian</command> command.
# Line 3061  by the <command>dh_lintian</command> com Line 3473  by the <command>dh_lintian</command> com
3473  is not installed.  is not installed.
3474  </para>  </para>
3475  </section>  </section>
3476  <section id="m