/[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 8642 by osamu, Thu Apr 7 08:48:36 2011 UTC revision 9044 by osamu, Sat Jan 14 15:29:01 2012 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  <!-- This is reorganized to make this document robust for translaion when some externally referenced information changes. -->  <!--
12  <title>Debian New Maintainers' Guide</title>  This is reorganized to make this document robust for translation
13  <bookinfo>  when some externally referenced information changes.
 <authorgroup>  
 <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    If you want to add extra contents to this document, please do so by
16     * 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  <!-- BEGIN: Add othercredit for translator via po4a/maint-guide.*.patch -->  Please understand to keep this document focused.  Not everything you think important
25  <!-- END: Add othercredit for translator via po4a/maint-guide.*.patch -->  for new maintainer should be written down.  Something social needs to be elsewhere.
26  <!-- dummy -->  Some thing should be left to the practice.  Something needs to be left for exercise
27  <!-- dummy -->  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 36  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>&base-release;</literal>  This document has been updated for the Debian <literal>&base-release;</literal>
79  release.  release.
80  <footnote><para> The document assumes you are using the  <footnote><para> The document assumes you are using a
81  <literal>&base-release;</literal> system or newer.  If you need to follow this  <literal>&base-release;</literal> or newer system.  If you need to follow this
82  text in the older system (including the older Ubuntu system etc.), you must  text in an older system (including an older Ubuntu system etc.), you must
83  install backported <systemitem role="package">dpkg</systemitem> and  install backported <systemitem role="package">dpkg</systemitem> and
84  <systemitem role="package">debhelper</systemitem> packages, at least.  <systemitem role="package">debhelper</systemitem> packages, at least.
85  </para> </footnote>  </para> </footnote>
# Line 69  install backported <systemitem role="pac Line 88  install backported <systemitem role="pac
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>  <footnote><para>
97  You can learn basic operations of the Debian system from  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  <ulink url="&debref;">Debian Reference</ulink>.  It contains some pointers to
99  learn about Unix programming, too.  learn about Unix programming, too.
100  </para></footnote>  </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.  
 </para>  
 <para>  
 If you need some help on packaging, please read <xref linkend="helpme"/> .  
109  </para>  </para>
110  <para>  <para>
111  Newer versions of this document should always be available online at  Newer versions of this document should always be available online at
112  <ulink url="&maint-guide;"/> and in the  <ulink url="&maint-guide;"/> and in the
113  <systemitem role="package">maint-guide</systemitem> package.  <systemitem role="package">maint-guide</systemitem> package.
114  The translations may be available in packages such as  The translations may be available in packages such as
115  <systemitem role="package">maint-guide-es</systemitem>.  <systemitem role="package">maint-guide-es</systemitem>.
116    Please note that this documentation may be slightly outdated.
117    </para>
118    <para>
119    Since this is a tutorial, I choose to explain each detailed step for some
120    important topics.  Some of them may look irrelevant to you.  Please be patient.
121    I have also intentionally skipped some corner cases and provided only pointers
122    to keep this document simple.
123    </para>
124    <section id="socialdynamics"><title>Social dynamics of Debian</title>
125    <para>
126    Here are some observations of Debian's social dynamics, presented in the hope
127    that it will prepare you for interactions with Debian.
128    </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>
152    There are several types of people interacting around Debian with different
153    roles.
154    </para>
155    <itemizedlist>
156    <listitem>
157    <para>
158    <emphasis role="strong">upstream author</emphasis>: the person who made the
159    original program.
160  </para>  </para>
161  <section id="needprogs"><title>Programs you need for development</title>  </listitem>
162    <listitem>
163    <para>
164    <emphasis role="strong">upstream maintainer</emphasis>: the person who
165    currently maintains the program.
166    </para>
167    </listitem>
168    <listitem>
169    <para>
170    <emphasis role="strong">maintainer</emphasis>: the person making the Debian
171    package of the program.
172    </para>
173    </listitem>
174    <listitem>
175    <para>
176    <emphasis role="strong">sponsor</emphasis>: a person who helps maintainers to
177    upload packages to the official Debian package archive (after checking their
178    contents).
179    </para>
180    </listitem>
181    <listitem>
182    <para>
183    <emphasis role="strong">mentor</emphasis>: a person who helps novice
184    maintainers with packaging etc.
185    </para>
186    </listitem>
187    <listitem>
188    <para>
189    <emphasis role="strong">Debian Developer</emphasis> (DD): a member of
190    the Debian project with full upload rights to the official Debian package
191    archive.
192    </para>
193    </listitem>
194    <listitem>
195    <para>
196    <emphasis role="strong">Debian Maintainer</emphasis> (DM): a person with
197    limited upload rights to the official Debian package archive.
198    </para>
199    </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 Member 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>  <para>
231  Before you start anything, you should make sure that you have properly  Before you start anything, you should make sure that you have properly
232  installed some additional packages needed for development.  Note that the list  installed some additional packages needed for development.  Note that the list
# Line 116  or with <literal>dpkg -s <replaceable>pa Line 243  or with <literal>dpkg -s <replaceable>pa
243  <para>  <para>
244  The most important package to install on your development system is the  The most important package to install on your development system is the
245  <systemitem role="package">build-essential</systemitem> package.  Once you try  <systemitem role="package">build-essential</systemitem> package.  Once you try
246  to install it, it will <emphasis>pull in</emphasis> other packages required to  to install that, it will <emphasis>pull in</emphasis> other packages required to
247  have a basic build environment.  have a basic build environment.
248  </para>  </para>
249  <para>  <para>
250  For some types of packages, that is all you will require, however there is  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  another set of packages that while not essential for all package builds are
252  useful to have install or may be required by your package:  useful to have installed or may be required by your package:
253  </para>  </para>
254  <itemizedlist>  <itemizedlist>
255  <listitem>  <listitem>
256  <para>  <para>
257  <systemitem role="package">file</systemitem> - this handy program can determine  <systemitem role="package">autoconf</systemitem>, <systemitem
258  what type a file is.  (see <citerefentry> <refentrytitle>file</refentrytitle>  role="package">automake</systemitem>, and <systemitem
259  <manvolnum>1</manvolnum> </citerefentry>)  role="package">autotools-dev</systemitem> - many newer programs use configure
260  </para>  scripts and <filename>Makefile</filename> files preprocessed with the help of
261  </listitem>  programs like these (see <literal>info autoconf</literal>, <literal>info
262  <listitem>  automake</literal>).  <systemitem role="package">autotools-dev</systemitem>
263  <para>  keeps up-to-date versions of certain auto files and has documentation about the
264  <systemitem role="package">patch</systemitem> - this very useful utility will  best way to use those files.
 take a file containing a difference listing (produced by the  
 <command>diff</command> program) and apply it to the original file, producing a  
 patched version.  (see <citerefentry> <refentrytitle>patch</refentrytitle>  
 <manvolnum>1</manvolnum> </citerefentry>)  
265  </para>  </para>
266  </listitem>  </listitem>
267  <listitem>  <listitem>
268  <para>  <para>
269  <systemitem role="package">perl</systemitem> - Perl is one of the most used  <systemitem role="package">debhelper</systemitem> and
270  interpreted scripting languages on today's Unix-like systems, often referred to  <systemitem role="package">dh-make</systemitem> -
271  as Unix's Swiss Army Chainsaw.  (see <citerefentry>  <systemitem role="package">dh-make</systemitem> is necessary to create
272  <refentrytitle>perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  the skeleton of our example package, and it will use some of the
273    <systemitem role="package">debhelper</systemitem> tools for creating
274    packages.  They are not essential for this purpose, but are
275    <emphasis>highly</emphasis> recommended for new maintainers.  It makes
276    the whole process very much easier to start, and to control afterwards.
277    (See <citerefentry> <refentrytitle>dh_make</refentrytitle>
278    <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">python</systemitem> - Python is another of the most  <systemitem role="package">devscripts</systemitem> - this package contains some
290  used interpreted scripting languages on the Debian system that combines  useful scripts that can be helpful for maintainers, but they are also
291  remarkable power with very clear syntax.  (see <citerefentry>  not necessary for building packages.  Packages recommended and suggested
292  <refentrytitle>python</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  by this package are worth looking into.  (See <ulink url="&devscripts-readme;"/>.)
293  </para>  </para>
294  </listitem>  </listitem>
295  <listitem>  <listitem>
296  <para>  <para>
297  <systemitem role="package">autoconf</systemitem>, <systemitem role="package">automake</systemitem> and <systemitem role="package">autotools-dev</systemitem> - many newer programs use configure  <systemitem role="package">fakeroot</systemitem> - this utility lets you
298  scripts and <filename>Makefile</filename> files preprocessed with help of  emulate being root which is necessary for some parts of the build process.
299  programs like these.  (see <literal>info autoconf</literal>, <literal>info  (See <citerefentry> <refentrytitle>fakeroot</refentrytitle>
300  automake</literal>).  The <systemitem role="package">autotools-dev</systemitem>  <manvolnum>1</manvolnum> </citerefentry>.)
 keeps up-to-date versions of certain auto files and has documentation about the  
 best way to use those files.  
301  </para>  </para>
302  </listitem>  </listitem>
303  <listitem>  <listitem>
304  <para>  <para>
305  <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">file</systemitem> - this handy program can determine
306  example package, and it will use some of the <systemitem role="package">debhelper</systemitem> tools for creating packages.  They are  what type a file is.  (See <citerefentry> <refentrytitle>file</refentrytitle>
307  not essential for creation of packages, but are <emphasis>highly</emphasis>  <manvolnum>1</manvolnum> </citerefentry>.)
 recommended for new maintainers.  It makes the whole process very much easier  
 to start, and control afterwards.  (see <citerefentry>  
 <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>  
 </citerefentry>, <citerefentry> <refentrytitle>debhelper</refentrytitle>  
 <manvolnum>1</manvolnum> </citerefentry>) <footnote><para> There  
 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>  
308  </para>  </para>
309  </listitem>  </listitem>
310  <listitem>  <listitem>
311  <para>  <para>
312  <systemitem role="package">devscripts</systemitem> - this package contains some  <systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,
313  nice and useful scripts that can be helpful to the maintainers, but they are  necessary if your program is written in Fortran.  (See <citerefentry>
314  also not necessary for building packages.  Packages recommended and suggested  <refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>
315  by this package are worth looking into.  (see  </citerefentry>.)
 <ulink url="&devscripts-readme;"/>.)  
316  </para>  </para>
317  </listitem>  </listitem>
318  <listitem>  <listitem>
319  <para>  <para>
320  <systemitem role="package">fakeroot</systemitem> - this utility lets you  <systemitem role="package">git</systemitem> - this package provides a popular
321  emulate being root which is necessary for some parts of the build process.  version control system designed to handle very large projects with speed and
322  (see <citerefentry> <refentrytitle>fakeroot</refentrytitle>  efficiency; it is used for many high profile open source projects, most notably
323  <manvolnum>1</manvolnum> </citerefentry>)  the Linux kernel.  (See <citerefentry> <refentrytitle>git</refentrytitle>
324    <manvolnum>1</manvolnum> </citerefentry>,
325    <ulink url="&git-doc;">git Manual</ulink>.)
326  </para>  </para>
327  </listitem>  </listitem>
328  <listitem>  <listitem>
# Line 202  emulate being root which is necessary fo Line 330  emulate being root which is necessary fo
330  <systemitem role="package">gnupg</systemitem> - a tool that enables you to  <systemitem role="package">gnupg</systemitem> - a tool that enables you to
331  digitally <emphasis>sign</emphasis> packages.  This is especially important if  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  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>  when your work gets included in the Debian distribution.  (See <citerefentry>
334  <refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  <refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,  
 necessary if your program is written in Fortran.  (see <citerefentry>  
 <refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>  
 </citerefentry>)  
335  </para>  </para>
336  </listitem>  </listitem>
337  <listitem>  <listitem>
# Line 219  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  <ulink url="&lintian-doc;">Lintian User's Manual</ulink>)  </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 259  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>.)
 <ulink url="&quilt-pdf;">quilt.pdf</ulink>)  
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  <ulink url="&git-doc;">git Manual</ulink>)  <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>
# Line 294  you should read along with this document Line 439  you should read along with this document
439  <para>  <para>
440  <systemitem role="package">debian-policy</systemitem> - the <ulink url="&debian-policy;">Debian Policy  <systemitem role="package">debian-policy</systemitem> - the <ulink url="&debian-policy;">Debian Policy
441  Manual</ulink> includes explanations of the structure and contents of the  Manual</ulink> includes explanations of the structure and contents of the
442  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>
443  (FHS, which says where each file and directory should be) etc.  For you, the most  (FHS, which says where each file and directory should be), etc.  For you, the most
444  important thing is that it describes requirements that each package must  important thing is that it describes requirements that each package must
445  satisfy to be included in the distribution (see the local copies of  satisfy to be included in the distribution. (See the local copies of
446  <ulink url="&policy-pdf;">policy.pdf</ulink> and <ulink url="&fhs-pdf;">fhs-2.3.pdf</ulink>).  <ulink url="&policy-pdf;">policy.pdf</ulink> and <ulink url="&fhs-pdf;">fhs-2.3.pdf</ulink>.)
447  </para>  </para>
448  </listitem>  </listitem>
449  <listitem>  <listitem>
# Line 307  satisfy to be included in the distributi Line 452  satisfy to be included in the distributi
452  - the <ulink url="&developers-reference;">Debian Developer's Reference</ulink>  - the <ulink url="&developers-reference;">Debian Developer's Reference</ulink>
453  describes all matters not specifically about the technical  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 the local copy of  when and where to upload etc.  (See the local copy of
457  <ulink url="&developers-refpdf;">developers-reference.pdf</ulink>).  <ulink url="&developers-refpdf;">developers-reference.pdf</ulink>.)
458  </para>  </para>
459  </listitem>  </listitem>
460    </itemizedlist>
461    <para>
462    The following is the <emphasis>important</emphasis> documentation which
463    you should read along with this document:
464    </para>
465    <itemizedlist>
466  <listitem>  <listitem>
467  <para>  <para>
468  <ulink url="&autotools-tutorial;">Autotools  <ulink url="&autotools-tutorial;">Autotools
469  Tutorial</ulink> provides very good tutorial for <ulink url="&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 327  two pieces of documentation from the GNU Line 478  two pieces of documentation from the GNU
478  <ulink url="&gnu-standard;">GNU Coding Standards</ulink>, and  <ulink url="&gnu-standard;">GNU Coding Standards</ulink>, and
479  <ulink url="&gnu-maintainer;">Information for Maintainers of GNU Software</ulink>.  <ulink url="&gnu-maintainer;">Information for Maintainers of GNU Software</ulink>.
480  Although Debian does not require these to  Although Debian does not require these to
481  be followed, these are still helpful as guidelines and common sense.  (see the local copies of  be followed, these are still helpful as guidelines and common sense.
482    (See the local copies of
483  <ulink url="&gnu-standard-pdf;">standards.pdf</ulink> and  <ulink url="&gnu-standard-pdf;">standards.pdf</ulink> and
484  <ulink url="&gnu-maintainer-pdf;">maintain.pdf</ulink>).  <ulink url="&gnu-maintainer-pdf;">maintain.pdf</ulink>.)
485  </para>  </para>
486  </listitem>  </listitem>
487  </itemizedlist>  </itemizedlist>
488  <para>  <para>
489  The short descriptions that are given above only serve to introduce you to what  If this document contradicts any of the documents mentioned above, they
490  each package does.  Before continuing please thoroughly read the documentation  are correct.  Please file a bug report on the
 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.  
 </para>  
 <para>  
 If you have specific questions later, I suggest you to read the documents  
 mentioned above again.  Since this is a tutorial, I intentionally skipped  
 details and provided only pointers to keep it simple.  
 </para>  
 <para>  
 If this document contradicts with any of the documents mentioned above, they  
 are correct.  Please file a bug report on the  
491  <systemitem role="package">maint-guide</systemitem> package using  <systemitem role="package">maint-guide</systemitem> package using
492  <command>reportbug</command>.  <command>reportbug</command>.
493  </para>  </para>
 </section>  
 <section id="terminology"><title>Basic terminology</title>  
494  <para>  <para>
495  There are two types of packages.  The following is an alternative tutorial documentation which you may
496    read along with this document:
497  </para>  </para>
498  <itemizedlist>  <itemizedlist>
499  <listitem>  <listitem><para><ulink url="&debpkg-tutorial0;">Debian Packaging Tutorial</ulink></para></listitem>
500  <para>  <listitem><para><ulink url="&debpkg-tutorial1;">Practical session 1: Modifying the grep package</ulink></para></listitem>
501  <emphasis role="strong">source package</emphasis>: A source package is a set of  <listitem><para><ulink url="&debpkg-tutorial2;">Practical session 2: Packaging GNUjump</ulink></para></listitem>
502  files which contain code and data which you can compile and process into  <listitem><para><ulink url="&debpkg-tutorial3;">Practical session 3: Packaging a Java library</ulink></para></listitem>
 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.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">binary package</emphasis>: A binary package contains  
 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.  
 </para>  
 </listitem>  
503  </itemizedlist>  </itemizedlist>
504    </section>
505    <section id="helpme"><title>Where to ask for help</title>
506  <para>  <para>
507  Don't mix terms like source of the program and the source package of the  Before you decide to ask your question in some public place, please read the fine documentation.
 program!  
 </para>  
 <para>  
 There are several role names used around Debian.  
508  </para>  </para>
509  <itemizedlist>  <itemizedlist>
510  <listitem>  <listitem>
511  <para>  <para>
512  <emphasis role="strong">upstream author</emphasis>: The person who made the  files in <filename>/usr/share/doc/<replaceable>package</replaceable></filename> for all pertinent packages
 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 <literal><command>man</command> <replaceable>command</replaceable></literal> for all pertinent commands
 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 <literal><command>info</command> <replaceable>command</replaceable></literal> for all pertinent commands
 package of the program.  
523  </para>  </para>
524  </listitem>  </listitem>
525  <listitem>  <listitem>
526  <para>  <para>
527  <emphasis role="strong">sponsor</emphasis>: The person who helps maintainers to  contents of <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list archive</ulink>
 upload packages to the official Debian Package Archive after checking their  
 contents.  
528  </para>  </para>
529  </listitem>  </listitem>
530  <listitem>  <listitem>
531  <para>  <para>
532  <emphasis role="strong">mentor</emphasis>: The person who helps novice  contents of <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list archive</ulink>
 maintainers on packaging etc.  
533  </para>  </para>
534  </listitem>  </listitem>
535  <listitem>  </itemizedlist>
536  <para>  <para>
537  <emphasis role="strong">Debian Developer</emphasis> (DD): The person who is a  You can use web search engines more effectively by including search strings
538  member of Debian.  He has full upload right to the official Debian Package  such as <literal>site:lists.debian.org</literal> to limit the domain.
 Archive.  
539  </para>  </para>
 </listitem>  
 <listitem>  
540  <para>  <para>
541  <emphasis role="strong">Debian Maintainer</emphasis> (DM): The person who has  Making a small test package is a good way to learn details of packaging.
542  limited upload right to the official Debian Package Archive.  Inspecting existing well maintained packages is the best way to learn how other
543    people make packages.
544  </para>  </para>
 </listitem>  
 </itemizedlist>  
545  <para>  <para>
546  There are several version names<footnote><para>see <ulink url="&policy-control;#s-f-Version">Debian Policy  Manual: 5.6.12 Version</ulink>.</para></footnote> used around Debian.  If you still have questions about packaging that you couldn't find answers to
547    in the available documentation and web resources, you can ask them interactively.
548  </para>  </para>
549  <itemizedlist>  <itemizedlist>
550  <listitem>  <listitem>
551  <para>  <para>
552  <emphasis role="strong">upstream source version</emphasis>: The upstream source  <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list</ulink>. (This mailing list is for the novice.)
 version is referred as <literal><replaceable>version</replaceable></literal>.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">Debian revision</emphasis>: The revision by Debian on  
 package is referred as <literal><replaceable>revision</replaceable></literal>.  
553  </para>  </para>
554  </listitem>  </listitem>
555  <listitem>  <listitem>
556  <para>  <para>
557  <emphasis role="strong">Debian package version</emphasis>: The Debian package  <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list</ulink>. (This mailing list is for the expert.)
 version is referred as the following.  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 <literal><replaceable>version</replaceable></literal> for the native Debian  
 binary package and for the Debian source package.  
558  </para>  </para>
559  </listitem>  </listitem>
560  <listitem>  <listitem>
561  <para>  <para>
562  <literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>  <ulink url="&irc-debian;">IRC</ulink> such as <literal>#debian-mentors</literal>.
 for the non-native Debian binary package.  
563  </para>  </para>
564  </listitem>  </listitem>
565  </itemizedlist>  </itemizedlist>
 </listitem>  
 </itemizedlist>  
566  <para>  <para>
567  Please read the other manuals if you need more details on terminology.  The more experienced Debian developers will gladly help you, if you ask
568    properly after making your required efforts.
569  </para>  </para>
 </section>  
 <section id="debiandeveloper"><title>Official Debian Developer</title>  
570  <para>  <para>
571  You can not become an official  When you receive a bug report (yes, actual bug reports!), you will know that it
572  <emphasis role="strong">Debian Developer</emphasis> (DD) over night because it  is time for you to dig into the
573  takes more than technical skill.  Please do not be discouraged by this.  If it  <ulink url="&bts;">Debian Bug Tracking System</ulink>
574  is useful to others, you can still upload your package either as a  and read the documentation there, to be able to
575  <emphasis role="strong">maintainer</emphasis> through a  deal with the reports efficiently.  I highly recommend reading the
576  <emphasis role="strong">sponsor</emphasis> or as a  <ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8.
577  <emphasis role="strong">Debian Maintainer</emphasis>.  "Handling bugs"</ulink>.
578  </para>  </para>
579  <para>  <para>
580  Please note that you do not need to create any new package to become an  Even if it all worked well, it's time to start praying.  Why?  Because in just
581  official Debian Developer.  Contributing to the existing packages can provide a  a few hours (or days) users from all around the world will start to use your
582  path to become an official Debian Developer too.  There are many packages  package, and if you made some critical error you'll get mailbombed by numerous
583  waiting for good maintainers (see <xref linkend="choose"/> ).  angry Debian users...  Just kidding.  :-)
584  </para>  </para>
585  <para>  <para>
586  We focus technical aspects of packaging in this document and do not elabrate on  Relax and be ready for bug reports, because there is a lot more work to be done
587  its social aspects.  Please reffer to the following to learn about the latest  before your package will be fully in line with Debian policies and its best
588  social aspect to be an official Debian Developer or alike.  practice guidelines (once again, read the <emphasis>real
589    documentation</emphasis> for details).  Good luck!
590  </para>  </para>
 <itemizedlist>  
 <listitem><para><ulink url="&nm-do;">Debian New Maintainer site</ulink> (official) </para> </listitem>  
 <listitem><para><ulink url="&debianmentorfaq;">Debian Mentors FAQ</ulink> (supplemental) </para> </listitem>  
 </itemizedlist>  
591  </section>  </section>
592  <section id="helpme"><title>Where to ask for help</title>  </chapter>
593  <para>  <chapter id="first"><title>First steps</title>
 Before you decide to ask your question in some public place, please read the fine documentation.  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 files in <filename>/usr/share/doc/dpkg</filename>  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 files in <filename>/usr/share/doc/debian</filename>  
 <!-- /usr/share/doc/debian is used be doc-debian and debian-faq -->  
 </para>  
 </listitem>  
 <listitem>  
594  <para>  <para>
595  files in <filename>/usr/share/doc/autotools-dev</filename>  Let's start by creating a package of your own (or, even better,
596    adopting an existing one).
597  </para>  </para>
598  </listitem>  <section id="workflow"><title>Debian package building workflow</title>
 <listitem>  
599  <para>  <para>
600  files in <filename>/usr/share/doc/<replaceable>package</replaceable></filename> for all pertinent packages.  If you are making a Debian package with an upstream program, the
601    typical workflow of Debian package building involves generating several
602    specifically named files for each step as follows.
603  </para>  </para>
604  </listitem>  <itemizedlist>
 <listitem>  
 <para>  
 contents of <literal><command>man</command> <replaceable>command</replaceable></literal> for all pertinent commands  
 </para>  
 </listitem>  
605  <listitem>  <listitem>
606  <para>  <para>Get a copy of the upstream software, usually in a compressed tar format.</para>
607  contents of <literal><command>info</command> <replaceable>command</replaceable></literal> for all pertinent commands    <itemizedlist>
608  </para>    <listitem><literal><replaceable>package</replaceable>-<replaceable>version</replaceable>.tar.gz</literal></listitem>
609      </itemizedlist>
610  </listitem>  </listitem>
611  <listitem>  <listitem>
612  <para>  <para>
613  contents of <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list archive</ulink>  Add Debian-specific packaging modifications to the upstream program under the
614    <filename>debian</filename> directory, and create a non-native source package
615    (that is, the set of input files used for Debian package building) in
616    <literal>3.0 (quilt)</literal> format.
617  </para>  </para>
618      <itemizedlist>
619      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.orig.tar.gz</literal></listitem>
620      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.debian.tar.gz</literal>
621        <footnote><para>For the older style of non-native Debian source packages in <literal>1.0</literal> format,
622        <literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.diff.gz</literal>
623        is used instead. </para></footnote></listitem>
624      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.dsc</literal></listitem>
625      </itemizedlist>
626  </listitem>  </listitem>
627  <listitem>  <listitem>
628  <para>  <para>
629  contents of <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list archive</ulink>  Build Debian binary packages, which are ordinary installable package files in <literal>.deb</literal> format (or <literal>.udeb</literal> format, used by the Debian Installer) from the Debian source package.
630  </para>  </para>
631      <itemizedlist>
632      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
633      </itemizedlist>
634  </listitem>  </listitem>
635  </itemizedlist>  </itemizedlist>
636  <para>  <para>
637  Please consider to use web search engine effectively by including search string  Please note that the character separating
638  such as <literal>site:lists.debian.org</literal> to limit the domain.  <literal><replaceable>package</replaceable></literal> and
639    <literal><replaceable>version</replaceable></literal> was changed from
640    <literal>-</literal> (hyphen) in the tarball name to
641    <literal>_</literal> (underscore) in the Debian package filenames.
642  </para>  </para>
643  <para>  <para>
644  Making a small test package is good way to learn details of packaging.  In the file names above, replace
645  Inspecting existing well maintained packages is the best way to learn how other  the <literal><replaceable>package</replaceable></literal> part with the <emphasis role="strong">package name</emphasis>,
646  people make packages.  the <literal><replaceable>version</replaceable></literal> part with the <emphasis role="strong">upstream version</emphasis>,
647    the <literal><replaceable>revision</replaceable></literal> part with the <emphasis role="strong">Debian revision</emphasis>,
648    and the <literal><replaceable>arch</replaceable></literal> part with the <emphasis role="strong">package architecture</emphasis>,
649    as defined in the Debian Policy Manual.
650    <footnote> <para> See
651    <ulink url="&policy-source;">5.6.1 Source</ulink>,
652    <ulink url="&policy-package;">5.6.7 Package</ulink>, and
653    <ulink url="&policy-version;">5.6.12 Version</ulink>.
654    The <emphasis role="strong">package architecture</emphasis> follows the
655    Debian Policy Manual: <ulink url="&policy-architecture;">5.6.8 Architecture</ulink>
656    and is automatically assigned by the package build process.</para></footnote>
657  </para>  </para>
658  <para>  <para>
659  If you still have questions about packaging that you couldn't find answers to  If instead you are making a Debian-specific package with no upstream, the
660  in the available documentation and web resources, you can ask them interactively.  typical workflow of Debian package building is simpler.
661  </para>  </para>
662  <itemizedlist>  <itemizedlist>
663  <listitem>  <listitem>
664  <para>  <para>
665  <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list</ulink>. (This mailing list is for the novice.)  Create a native Debian source package in the <literal>3.0 (native)</literal>
666  </para>  format using a single compressed tar file in which all files are included.
 </listitem>  
 <listitem>  
 <para>  
 <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list</ulink>. (This mailing list is for the expert.)  
667  </para>  </para>
668      <itemizedlist>
669      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.tar.gz</literal></listitem>
670      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.dsc</literal></listitem>
671      </itemizedlist>
672  </listitem>  </listitem>
673  <listitem>  <listitem>
674  <para>  <para>
675  <ulink url="&irc-debian;">IRC</ulink> such as <literal>#debian-mentors</literal>.  Build Debian binary packages from the native Debian source package.
676  </para>  </para>
677      <itemizedlist>
678      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
679      </itemizedlist>
680  </listitem>  </listitem>
681  </itemizedlist>  </itemizedlist>
682  <para>  <para>
683  The more experienced Debian developers will gladly help you, but do read at  Each step of this outline is explained with detailed examples in later sections.
 least some of the documentation before asking a question!  
 </para>  
 <para>  
 When you receive a bug report (yes, actual bug reports!), you will know that it  
 is time for you to dig into the  
 <ulink url="&bts;">Debian 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="&devref-bug-handling;">Debian Developer's Reference, 5.8.  'Handling bugs'</ulink>.  
 </para>  
 <para>  
 Even if it all worked well, it's time to start praying.  Why?  Because in just  
 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.  :-)  
 </para>  
 <para>  
 Relax and be ready for bug reports, because there is a lot more work to be done  
 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!  
684  </para>  </para>
685  </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>  
686  <section id="choose"><title>Choose your program</title>  <section id="choose"><title>Choose your program</title>
687  <para>  <para>
688  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
# Line 613  using the following. Line 694  using the following.
694  <para>the <command>aptitude</command> command</para>  <para>the <command>aptitude</command> command</para>
695  </listitem>  </listitem>
696  <listitem>  <listitem>
697  <para><ulink url="&packages-do;">Debian packages</ulink> web page</para>  <para>the <ulink url="&packages-do;">Debian packages</ulink> web page</para>
698  </listitem>  </listitem>
699  <listitem>  <listitem>
700  <para><ulink url="&packages-qa-do;">Debian Package Tracking System</ulink> web page</para>  <para>the <ulink url="&packages-qa-do;">Debian Package Tracking System</ulink> web page</para>
701  </listitem>  </listitem>
702  </itemizedlist>  </itemizedlist>
703  <para>  <para>
704  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
705  <emphasis role="strong">orphaned</emphasis> -- if its maintainer is set to  <emphasis role="strong">orphaned</emphasis> (that is, if its
706  <ulink url="&qa-do;">Debian QA Group</ulink>, you may be able to pick it up if  maintainer is set to <ulink url="&qa-do;">Debian QA Group</ulink>),
707  it's still available.  You may also adopt a package for which the corresponding  you may be able to pick it up if it's still available.  You may also
708  maintainer has filed a Request for Adoption  adopt a package whose maintainer has filed a Request for Adoption
709  (<emphasis role="strong">RFA</emphasis>).  (<emphasis role="strong">RFA</emphasis>).<footnote> <para>See
710    <ulink url="&devref-adopt;">Debian Developer's Reference 5.9.5.
711    "Adopting a package"</ulink>.</para> </footnote>
712  </para>  </para>
713  <para>  <para>
714  There are several package ownership status resorces.  There are several package ownership status resources.
715  </para>  </para>
716  <itemizedlist>  <itemizedlist>
717  <listitem>  <listitem>
718  <para> <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> </para>  <para> <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> </para>
719  </listitem>  </listitem>
720  <listitem>  <listitem>
721  <para> <ulink url="&wnpp-bts;">Debian Bug report logs: Bugs in package wnpp in unstable</ulink> </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>
722  </listitem>  </listitem>
723  <listitem>  <listitem>
724  <para> <ulink url="&wnpp-dn;">Debian Packages that Need Lovin'</ulink> </para>  <para> <ulink url="&wnpp-dn;">Debian Packages that Need Lovin'</ulink> </para>
725  </listitem>  </listitem>
726  <listitem>  <listitem>
727  <para> <ulink url="&wnpp-debtags;">Browse WNPP bugs based on debtags</ulink> </para>  <para> <ulink url="&wnpp-debtags;">Browse <systemitem role="package">wnpp</systemitem> bugs based on debtags</ulink> </para>
728  </listitem>  </listitem>
729  </itemizedlist>  </itemizedlist>
730  <para>  <para>
# Line 650  for most kinds of programs, and the numb Line 733  for most kinds of programs, and the numb
733  archive is much larger than that of contributors with upload rights.  Thus,  archive is much larger than that of contributors with upload rights.  Thus,
734  contributions to packages already in the archive are far more appreciated (and  contributions to packages already in the archive are far more appreciated (and
735  more likely to receive sponsorship) by other developers <footnote><para> Having  more likely to receive sponsorship) by other developers <footnote><para> Having
736  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
737  packaging.  </para> </footnote>.  You can do that in various ways.  packaging.  </para> </footnote>.  You can contribute in various ways.
738  </para>  </para>
739  <itemizedlist>  <itemizedlist>
740  <listitem>  <listitem>
# Line 681  If you are able to adopt the package, ge Line 764  If you are able to adopt the package, ge
764  examine them.  This document unfortunately doesn't include comprehensive  examine them.  This document unfortunately doesn't include comprehensive
765  information about adopting packages.  Thankfully you shouldn't have a hard time  information about adopting packages.  Thankfully you shouldn't have a hard time
766  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
767  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
768  applicable for your case.  applicable for your case.
769  </para>  </para>
770  <para>  <para>
# Line 691  as follows: Line 774  as follows:
774  <itemizedlist>  <itemizedlist>
775  <listitem>  <listitem>
776  <para>  <para>
777  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
778  confirm its usefulness.  confirm its usefulness.
779  </para>  </para>
780  </listitem>  </listitem>
781  <listitem>  <listitem>
782  <para>  <para>
783  You must check if no one else is working on the package already at the  You must check that no one else is already working on the package on the
784  <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> site.  <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> site.
785  If no one else is working on it, file an ITP (Intent  If no one else is working on it, file an ITP (Intent
786  To Package) bug report to the <systemitem role="package">wnpp</systemitem>  To Package) bug report to the <systemitem role="package">wnpp</systemitem>
787  pseudo-package using <command>reportbug</command>.  If someone's already on it,  pseudo-package using <command>reportbug</command>.  If someone's already on it,
788  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
789  program that nobody maintains.  program that nobody is maintaining.
790  </para>  </para>
791  </listitem>  </listitem>
792  <listitem>  <listitem>
793  <para>  <para>
794  That program <emphasis role="strong">must have a license</emphasis>.  The software <emphasis role="strong">must have a license</emphasis>.
795  </para>  </para>
796  <itemizedlist>  <itemizedlist>
797  <listitem>  <listitem>
798  <para>  <para>
799  For the <literal>main</literal> section, it <emphasis role="strong">must be  For the <literal>main</literal> section, Debian Policy requires it
800  compliant to all the Debian Free Software Guidelines</emphasis> (<ulink url="&dfsg;">DFSG</ulink>)  <emphasis role="strong">to be fully compliant with the Debian Free Software
801  and <emphasis role="strong">that program must not require a package outside of  Guidelines</emphasis> (<ulink url="&dfsg;">DFSG</ulink>)
802  <literal>main</literal></emphasis> for compilation or execution as required by  and <emphasis role="strong">not to require a package outside of
803  the Debian Policy.  This is desired case.  <literal>main</literal></emphasis> for compilation or execution.  This
804    is the desired case.
805  </para>  </para>
806  </listitem>  </listitem>
807  <listitem>  <listitem>
808  <para>  <para>
809  For the <literal>contrib</literal> section, it must be compliant to all the  For the <literal>contrib</literal> section, it must comply with the
810  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
811  compilation or execution.  compilation or execution.
812  </para>  </para>
813  </listitem>  </listitem>
814  <listitem>  <listitem>
815  <para>  <para>
816  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
817  the DFSG but it <emphasis role="strong">must be distributable</emphasis>.  with the DFSG but it <emphasis role="strong">must be distributable</emphasis>.
818    </para>
819    </listitem>
820    <listitem>
821    <para>
822    If you are unsure about where it should go, post the license text on
823    <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>
824    and ask for advice.
825    </para>
826    </listitem>
827    </itemizedlist>
828    </listitem>
829    <listitem>
830    <para>
831    The program should <emphasis role="strong">not</emphasis> introduce security
832    and maintenance concerns to the Debian system.
833    </para>
834    <itemizedlist>
835    <listitem>
836    <para>
837    The program should be well documented and its code needs to be understandable
838    (i.e.  not obfuscated).
839  </para>  </para>
840  </listitem>  </listitem>
841  </itemizedlist>  <listitem>
842  <para>  <para>
843  If you are unsure about where it should go, post the license text on <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>  You should contact the program's author(s) to check if they agree with packaging it
844  and ask for advice.  and are amicable to Debian.  It is important to be able to consult with the author(s)
845    in case of any problems with the program, so don't try to package
846    unmaintained software.
847  </para>  </para>
848  </listitem>  </listitem>
849  <listitem>  <listitem>
850  <para>  <para>
851  That program certainly should <emphasis role="strong">not</emphasis> run setuid  The program certainly should <emphasis role="strong">not</emphasis> run setuid
852  root, or even better - it shouldn't need to be setuid or setgid to anything.  root, or even better, it shouldn't need to be setuid or setgid to anything.
853  </para>  </para>
854  </listitem>  </listitem>
855  <listitem>  <listitem>
856  <para>  <para>
857  That program should not be a daemon, or something that goes in  The program should not be a daemon, or go in an
858  <filename>*/sbin</filename> directories, or open a port as root.  <filename>*/sbin</filename> directory, or open a port as root.
859  </para>  </para>
860  </listitem>  </listitem>
861  <listitem>  </itemizedlist>
862    </listitem>
863    </itemizedlist>
864  <para>  <para>
865  That program should result in binary executable form, libraries are harder to  Of course, the last one is just a safety measures, and intended to save you from
866  handle.  enraging users if you do something wrong in some setuid daemon...  When you gain
867    more experience in packaging, you'll be able to package such software.
868  </para>  </para>
 </listitem>  
 <listitem>  
869  <para>  <para>
870  That program should be well documented and its code needs to be understandable  As a new maintainer, you are encouraged to get some experience in packaging
871  (i.e.  not obfuscated).  with easier packages and discouraged from creating complicated packages.
872  </para>  </para>
873    <itemizedlist>
874    <listitem><para>Simple packages</para>
875    <itemizedlist>
876      <listitem><para>single binary package, arch = all (collection of data such as wallpaper graphics)</para></listitem>
877      <listitem><para>single binary package, arch = all (executables written in an interpreted language such as POSIX shell)</para></listitem>
878    </itemizedlist>
879  </listitem>  </listitem>
880  <listitem>  <listitem><para>Intermediate complexity packages</para>
881    <itemizedlist>
882      <listitem><para>single binary package, arch = any (ELF binary executables compiled from languages such as C and C++)</para></listitem>
883      <listitem><para>multiple binary packages, arch = any + all (packages for ELF binary executables + documentation)</para></listitem>
884      <listitem><para>upstream source in a format other than <filename>tar.gz</filename> or <filename>tar.bz2</filename></para></listitem>
885      <listitem><para>upstream source containing undistributable contents</para></listitem>
886    </itemizedlist>
887    </listitem>
888    <listitem><para>High complexity packages</para>
889    <itemizedlist>
890      <listitem><para>interpreter module package used by other packages</para></listitem>
891      <listitem><para>generic ELF library package used by other packages</para></listitem>
892      <listitem><para>multiple binary packages including an ELF library package</para></listitem>
893      <listitem><para>source package with multiple upstream sources</para></listitem>
894      <listitem><para>kernel module packages</para></listitem>
895      <listitem><para>kernel patch packages</para></listitem>
896      <listitem><para>any package with non-trivial maintainer scripts</para></listitem>
897    </itemizedlist>
898    </listitem>
899    </itemizedlist>
900  <para>  <para>
901  You should contact program's author(s) to check if they agree with packaging it  Packaging high complexity packages is not too hard, but it requires a bit more
902  and amicable to Debian.  It is important to be able to consult with author(s)  knowledge. You should seek specific guidance for every complex feature. For
903  about the program in case of any program specific problems, so don't try to  example, some languages have their own sub-policy documents:
 package unmaintained pieces of software.  
904  </para>  </para>
905  </listitem>  <itemizedlist>
906    <listitem><para><ulink url="&policy-perl;">Perl policy</ulink></para></listitem>
907    <listitem><para><ulink url="&policy-python;">Python policy</ulink></para></listitem>
908    <listitem><para><ulink url="&policy-java;">Java policy</ulink></para></listitem>
909  </itemizedlist>  </itemizedlist>
910  <para>  <para>
911  Of course, these things are just safety measures, and intended to save you from  There is another old Latin saying: <emphasis>fabricando fit faber</emphasis>
912  raging users if you do something wrong in some setuid daemon...  When you gain  (practice makes perfect).  It is <emphasis>highly</emphasis> recommended to
913  some more experience in packaging, you'll be able to package such packages.  practice and experiment with all the steps of Debian packaging with simple packages
914    while reading this tutorial.  A trivial upstream tarball
915    <filename>hello-sh-1.0.tar.gz</filename> created as followings may offer
916    a good starting point.<footnote><para>Do not worry about the missing
917    <filename>Makefile</filename>.  You can install the <command>hello</command>
918    command by simply using <command>debhelper</command> as in
919    <xref linkend="install"/>, or by modifying the upstream source to add a new
920    <filename>Makefile</filename> with the <literal>install</literal> target as in
921    <xref linkend="modify"/>.</para></footnote>
922  </para>  </para>
923    <screen>
924    $ mkdir -p hello-sh/hello-sh-1.0; cd hello-sh/hello-sh-1.0
925    $ cat &gt; hello &lt;&lt;EOF
926    #!/bin/sh
927    # (C) 2011 Foo Bar, GPL2+
928    echo "Hello!"
929    EOF
930    $ chmod 755 hello
931    $ cd ..
932    $ tar -cvzf hello-sh-1.0.tar.gz hello-sh-1.0
933    </screen>
934  </section>  </section>
935  <section id="getit"><title>Get the program, and try it out</title>  <section id="getit"><title>Get the program, and try it out</title>
936  <para>  <para>
937  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.
938  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
939  author's homepage.  Sources for free Unix programs usually come in  author's homepage.  Sources for free Unix programs usually come in
940  <command>tar</command>+<command>gzip</command> format with extension  <command>tar</command>+<command>gzip</command> format with the extension
941  <filename>.tar.gz</filename>, or  <filename>.tar.gz</filename>,
942  <command>tar</command>+<command>bzip2</command> format with extension  <command>tar</command>+<command>bzip2</command> format with the extension
943  <filename>.tar.bz2</filename>.  These usually contain the subdirectory called  <filename>.tar.bz2</filename>, or
944  <filename><replaceable>programname</replaceable>-<replaceable>version</replaceable></filename>  <command>tar</command>+<command>xz</command> format with the extension
945  in them and all the sources under it.  <filename>.tar.xz</filename>.  These usually contain a directory called
946    <filename><replaceable>package</replaceable>-<replaceable>version</replaceable></filename>
947    with all the sources inside.
948  </para>  </para>
949  <para>  <para>
950  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,
951  Subversion, or CVS repository, you need to get it with <literal>git  Subversion, or CVS, you need to get it with <literal>git
952  clone</literal>, <literal>svn co</literal>, or <literal>cvs co</literal> and  clone</literal>, <literal>svn co</literal>, or <literal>cvs co</literal> and
953  repack it into <command>tar</command>+<command>gzip</command> format by  repack it into <command>tar</command>+<command>gzip</command> format yourself
954  yourself using the <literal>--exclude-vcs</literal> option.  by using the <literal>--exclude-vcs</literal> option.
955  </para>  </para>
956  <para>  <para>
957  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
958  filename ends in <filename>.Z</filename> or  filename ends in <filename>.Z</filename> or
959  <filename>.zip</filename><footnote><para> You can identify the archive format  <filename>.zip</filename><footnote><para> You can identify the archive format
960  using the <command>file</command> command when the file extension is not  using the <command>file</command> command when the file extension is not
961  enough.  </para> </footnote>), unpack it with appropriate tools and repack it,  enough.  </para> </footnote>), you should also unpack it with the
962  too.  appropriate tools and repack it.
963    </para>
964    <para>
965    If your program's source comes with some contents which do not comply with
966    DFSG, you should also unpack it to remove such contents and repack it with a
967    modified upstream version containing <literal>dfsg</literal>.
968  </para>  </para>
969  <para>  <para>
970  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+
971  file manager.<footnote><para> This program is already packaged.  file manager.
972  <ulink url="&gentoo-package;">Current  <footnote><para> This program is already packaged. The
973  version</ulink> has changed substantially from the version 0.9.12 in the  <ulink url="&gentoo-package;">current version</ulink> uses Autotools as its
974  following examples.</para> </footnote>  build structure and is substantially different from the following examples,
975    which were based on version 0.9.12.</para>
976    </footnote>
977  </para>  </para>
978  <para>  <para>
979  Create a subdirectory under your home directory named  Create a subdirectory under your home directory named
980  <filename>debian</filename> or <filename>deb</filename> or anything you find  <filename>debian</filename> or <filename>deb</filename> or anything you find
981  appropriate (e.g.  just <filename>~/gentoo</filename> would do fine in this  appropriate (e.g.  just <filename>~/gentoo</filename> would do fine in this
982  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
983  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
984  <emphasis>irrelevant</emphasis> ones, because there will most probably be  messages, even <emphasis>irrelevant</emphasis> ones, because other
985  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
986  not ignore those anomalies.  On your console screen, you should see the  may have problems unpacking them.  Your shell command line may look
987  following.  something like this:
988  </para>  </para>
989  <screen>  <screen>
990  $ mkdir ~/gentoo ; cd ~/gentoo  $ mkdir ~/gentoo ; cd ~/gentoo
# Line 836  Now you have another subdirectory, calle Line 999  Now you have another subdirectory, calle
999  Change to that directory and <emphasis>thoroughly</emphasis> read the provided  Change to that directory and <emphasis>thoroughly</emphasis> read the provided
1000  documentation.  Usually there are files named <filename>README*</filename>,  documentation.  Usually there are files named <filename>README*</filename>,
1001  <filename>INSTALL*</filename>, <filename>*.lsm</filename> or  <filename>INSTALL*</filename>, <filename>*.lsm</filename> or
1002  <filename>*.html</filename>.  You must find instructions on how to correctly  <filename>*.html</filename>.  You must find instructions on how to
1003  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
1004  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
1005  that, but more on that later in <xref linkend="destdir"/> ).  that, but more on that later in <xref linkend="destdir"/>).
1006  </para>  </para>
1007  <para>  <para>
1008  Simple programs come with a <filename>Makefile</filename> file in them and can  You should start packaging with a completely clean (pristine) source directory,
1009  be compiled simply with <literal>make</literal>.<footnote><para>  or simply with freshly unpacked sources.
1010    </para>
1011    </section>
1012    <section id="simplemake"><title>Simple build systems</title>
1013    <para>
1014    Simple programs usually come with a <filename>Makefile</filename> and can
1015    be compiled just by invoking <literal>make</literal>.<footnote><para>
1016  Many modern programs come with a script <filename>configure</filename> which  Many modern programs come with a script <filename>configure</filename> which
1017  creates a <filename>Makefile</filename> file customized for your system upon  when executed creates a <filename>Makefile</filename> customized for
1018  its execution.</para></footnote> Some of them support  your system.</para></footnote> Some of them support
1019  <literal>make check</literal>, which runs included self-checks.  Installation  <literal>make check</literal>, which runs included self-tests.  Installation
1020  to the destination directories is usually done with <literal>make  to the destination directories is usually done with <literal>make
1021  install</literal>.  install</literal>.
1022  </para>  </para>
# Line 862  there's even a <literal>make uninstall</ Line 1031  there's even a <literal>make uninstall</
1031  all the installed files.  all the installed files.
1032  </para>  </para>
1033  </section>  </section>
1034  <section id="portable"><title>Free portable programs</title>  <section id="portable"><title>Popular portable build systems</title>
1035  <para>  <para>
1036  A lot of Free programs are written in the <ulink url="&c-program;">C</ulink> and  A lot of free software programs are written in the <ulink url="&c-program;">C</ulink> and
1037  <ulink url="&cxx;">C++</ulink> languages.  Many of  <ulink url="&cxx;">C++</ulink> languages.  Many of these use Autotools or
1038  these use Autotools or CMake to make them portable across different platforms.  CMake to make them portable across different platforms.  These build tools need
1039  These tools are used to generate <filename>Makefile</filename> and other  to be used to generate the <filename>Makefile</filename> and other
1040  required source files.  Then, such programs are built with usual <literal>make;  required source files first.  Then, such programs are built using the usual
1041  make install</literal>.  <literal>make; make install</literal>.
1042  </para>  </para>
1043  <para>  <para>
1044  <ulink url="&gnu-build-system;">Autotools</ulink>  <ulink url="&gnu-build-system;">Autotools</ulink> is the GNU build
1045  are the GNU build system comprising <ulink url="&autoconf;">Autoconf</ulink>, <ulink url="&automake;">Automake</ulink>, <ulink url="&libtool;">Libtool</ulink>, and <ulink url="&gettext;">gettext</ulink>.  You can notice  system comprising <ulink url="&autoconf;">Autoconf</ulink>,
1046    <ulink url="&automake;">Automake</ulink>,
1047    <ulink url="&libtool;">Libtool</ulink>, and
1048    <ulink url="&gettext;">gettext</ulink>.  You can recognize
1049  such sources by the <filename>configure.ac</filename>,  such sources by the <filename>configure.ac</filename>,
1050  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.
1051  <footnote><para> See <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink>  <footnote><para>Autotools is too big to deal in this small tutorial. This
1052  and <ulink url="&autotools-readme;"/>.  </para> </footnote>  section is meant to provide keywords and references only.  Please make sure to read the
1053    <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink> and
1054    <ulink url="&autotools-readme;"/>, if you need to use it.</para></footnote>
1055  </para>  </para>
1056  <para>  <para>
1057  The first step of Autotools work flow is usually that the upstream runs  The first step of the Autotools workflow is usually that upstream runs
1058  <literal>autoreconf -i -f</literal> in the source and distributes this source  <literal>autoreconf -i -f</literal> in the source directory and
1059  with generated files.  distributes the generated files along with the source.
1060  </para>  </para>
1061  <screen>  <screen>
1062  configure.ac-----+-&gt; autoreconf -+-&gt; configure  configure.ac-----+-&gt; autoreconf -+-&gt; configure
# Line 901  files requires some knowledge of <comman Line 1075  files requires some knowledge of <comman
1075  <literal>info automake</literal>.  <literal>info automake</literal>.
1076  </para>  </para>
1077  <para>  <para>
1078  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
1079  distributed source and runs <literal>./configure &amp;&amp; make</literal> in  distributed source and runs <literal>./configure &amp;&amp; make</literal> in
1080  the source to compile program into a  the source directory to compile the program into an executable command
1081  <command><replaceable>binary</replaceable></command>.  <command><replaceable>binary</replaceable></command>.
1082  </para>  </para>
1083  <screen>  <screen>
# Line 915  config.h.in -----+                +-&gt; Line 1089  config.h.in -----+                +-&gt;
1089             config.guess --+             config.guess --+
1090  </screen>  </screen>
1091  <para>  <para>
1092  You can change many things in the <filename>Makefile</filename> file such as  You can change many things in the <filename>Makefile</filename>; for
1093  the default file install location using the command option, e.g.  instance you can change the default location for file installation
1094  <command>./configure --prefix=/usr</command>.  using the option <literal>./configure --prefix=/usr</literal>.
1095  </para>  </para>
1096  <para>  <para>
1097  Although it is not required, updating the <filename>configure</filename> and  Although it is not required, updating the <filename>configure</filename> and
1098  other files with <literal>autoreconf -i -f</literal> as the user may improve  other files with <literal>autoreconf -i -f</literal> may improve
1099  the compatibility of the source.  the compatibility of the source.
1100    <footnote><para>You can automate this by using
1101    <systemitem role="package">dh-autoreconf</systemitem> package.
1102    See <xref linkend="customrules"/>.</para></footnote>
1103  </para>  </para>
1104  <para>  <para>
1105  <ulink url="&cmake;">CMake</ulink> is an alternative  <ulink url="&cmake;">CMake</ulink> is an alternative
1106  build system.  You can notice such sources by the  build system.  You can recognize such sources by the
1107  <filename>CMakeLists.txt</filename> file.  <filename>CMakeLists.txt</filename> file.
1108  </para>  </para>
1109  </section>  </section>
1110  <section id="namever"><title>Package name and version</title>  <section id="namever"><title>Package name and version</title>
1111  <para>  <para>
1112  You should start packaging with a completely clean (pristine) source directory,  If the upstream source comes as <filename>gentoo-0.9.12.tar.gz</filename>, you can
1113  or simply with freshly unpacked sources.  take <literal>gentoo</literal> as the (source) <emphasis role="strong">package name</emphasis>
1114    and <literal>0.9.12</literal> as the <emphasis role="strong">upstream version</emphasis>.
1115    These are used in the <filename>debian/changelog</filename> file described later in
1116    <xref linkend="changelog"/>, too.
1117    </para>
1118    <para>
1119    Although this simple approach works most of the times, you may need to adjust
1120    <emphasis role="strong">package name</emphasis> and
1121    <emphasis role="strong">upstream version</emphasis> by renaming the upstream
1122    source to follow Debian Policy and existing convention.
1123    </para>
1124    <para>
1125    You must choose the <emphasis role="strong">package name</emphasis>
1126    to consist only of lower case letters (<literal>a-z</literal>), digits
1127    (<literal>0-9</literal>), plus (<literal>+</literal>) and minus
1128    (<literal>-</literal>) signs, and periods (<literal>.</literal>). It must be
1129    at least two characters long, must start with an alphanumeric character, and
1130    must not be the same as existing ones.
1131    It is a good idea to keep its length within 30 characters.
1132    <footnote><para>The default package name field length of <command>aptitude</command> is 30.  For more than 90% of packages, the package name is less than 24 characters.</para></footnote>
1133    </para>
1134    <!--
1135    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1136    === stat for package name string length ===
1137    11 1947 36.9%   mode
1138    14 1717 54.7%  50% median
1139    23 611 91.0%   90%
1140    32 89 99.0%    99%
1141    41 12 99.9%    99.9%
1142    52 1 100.0%
1143    Previous 20 chars is becoming too short for 17% of packages
1144    Default aptitude setting display up to 30 chars (98.3%).
1145    -->
1146    <para>
1147    If upstream uses some generic term such as <literal>test-suite</literal> for
1148    its name, it is a good idea to rename it to identify its contents explicitly and avoid namespace pollution.
1149    <footnote><para>If you follow the
1150    <ulink url="&devref-newpackage;">Debian Developer's Reference 5.1. "New packages"</ulink>,
1151    the ITP process will usually catch this kind of issues.</para></footnote>
1152    </para>
1153    <para>
1154    You should choose the <emphasis role="strong">upstream version</emphasis>
1155    to consist only of
1156    alphanumerics (<literal>0-9A-Za-z</literal>), plus (<literal>+</literal>),
1157    tildes (<literal>~</literal>), and periods (<literal>.</literal>). It must
1158    start with a digit (<literal>0-9</literal>).  <footnote><para>This stricter
1159    rule should help you avoid confusing file names.</para></footnote>
1160    It is good idea to keep its length within 8 characters if possible.
1161    <footnote><para>The default version field length of <command>aptitude</command> is 10.  The Debian revision with preceding hyphen usually consumes 2.  For more than 80% of packages, the upstream version is less than 8 characters and the Debian revision is less than 2 characters.  For more than 90% of packages, the upstream version is less than 10 characters and the Debian revision is less than 3 characters.</para></footnote>
1162    </para>
1163    <!--
1164    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1165    === stat for upstream version string length ===
1166    5 9765 60.2%  50% median and mode
1167    6 3765 73.3%
1168    7 2789 82.9%
1169    8 1158 86.9%
1170    9 501 88.6%
1171    10 773 91.3%  90%
1172    18 55 99.1%   99%
1173    27 11 99.9%    99.9
1174    35 6 100.0%
1175    === stat for debian revision string length ===
1176    1 22556 83.3%  50% median and mode
1177    2 1106 87.2%
1178    3 1312 91.7%   90%
1179    4 2127 99.1%   99%
1180    7 14 99.9%     99.9%
1181    
1182    aptitude display 10 = 8char for up + 1char (for -) + 1char for deb
1183    90chars as max for file name of binary debs (package+up+deb+arch+.deb)
1184    -->
1185    <para>
1186    If upstream does not use a normal versioning scheme such as
1187    <literal>2.30.32</literal> but uses some kind of date such as
1188    <literal>11Apr29</literal>, a random codename string, or a VCS hash value as part
1189    of the version, make sure to remove them from the
1190    <emphasis role="strong">upstream version</emphasis>.  Such information can be
1191    recorded in the <filename>debian/changelog</filename> file.  If you need to
1192    invent a version string, use the <literal>YYYYMMDD</literal> format such as
1193    <literal>20110429</literal> as upstream version.  This ensures that
1194    <command>dpkg</command> interprets later versions correctly as upgrades.
1195    If you need to ensure smooth transition to the normal version scheme such as
1196    <literal>0.1</literal> in future, use the <literal>0~YYMMDD</literal> format
1197    such as <literal>0~110429</literal> as upstream version, instead.
1198    </para>
1199    <para>
1200    Version strings <footnote><para>Version strings may be
1201    <emphasis role="strong">upstream version</emphasis>
1202    (<literal><replaceable>version</replaceable></literal>),
1203    <emphasis role="strong">Debian revision</emphasis>
1204    (<literal><replaceable>revision</replaceable></literal>), or
1205    <emphasis role="strong">version</emphasis>
1206    (<literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>).
1207    See <xref linkend="newrevision"/> for how the
1208    <emphasis role="strong">Debian revision</emphasis> is incremented.
1209    </para></footnote>
1210    can be compared using <citerefentry>
1211    <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> as follows.
1212    </para>
1213    <screen>
1214     $ dpkg --compare-versions <replaceable>ver1</replaceable> <replaceable>op</replaceable> <replaceable>ver2</replaceable>
1215    </screen>
1216    <para>
1217    The version comparison rule can be summarized as:
1218    </para>
1219    <itemizedlist>
1220    <listitem><para>Strings are compared from the head to the tail.</para></listitem>
1221    <listitem><para>Letters are larger than digits.</para></listitem>
1222    <listitem><para>Numbers are compared as integers.</para></listitem>
1223    <listitem><para>Letters are compared in ASCII code order.</para></listitem>
1224    <listitem><para>There are special rules for period
1225    (<literal>.</literal>), plus (<literal>+</literal>), and tilde
1226    (<literal>~</literal>) characters, as follows.</para>
1227      <para>
1228      <literal>0.0</literal> &lt;
1229      <literal>0.5</literal> &lt;
1230      <literal>0.10</literal> &lt;
1231      <literal>0.99</literal> &lt;
1232      <literal>1</literal> &lt;
1233      <literal>1.0~rc1</literal> &lt;
1234      <literal>1.0</literal> &lt;
1235      <literal>1.0+b1</literal> &lt;
1236      <literal>1.0+nmu1</literal> &lt;
1237      <literal>1.1</literal> &lt;
1238      <literal>2.0</literal>
1239      </para>
1240    </listitem>
1241    </itemizedlist>
1242    <para>
1243    One tricky case occurs when upstream releases
1244    <filename>gentoo-0.9.12-ReleaseCandidate-99.tar.gz</filename> as the
1245    pre-release of <filename>gentoo-0.9.12.tar.gz</filename>.  You need to make
1246    sure that the upgrade works properly by renaming the upstream source to
1247    <filename>gentoo-0.9.12~rc99.tar.gz</filename>.
1248  </para>  </para>
1249    </section>
1250    <section id="dh-make"><title>Setting up <command>dh_make</command></title>
1251  <para>  <para>
1252  For the package to be built correctly, you must make the program's original  Set up the shell environment variables <literal>$DEBEMAIL</literal> and
1253  name lowercase (if it isn't already), and you should move the source directory  <literal>$DEBFULLNAME</literal> so that various Debian maintenance
1254  to  tools recognize your email address and name to use for packages. <footnote><para> The
 <filename><replaceable>packagename</replaceable>-<replaceable>version</replaceable></filename>.  
 </para>  
 <para>  
 If the program name consists of more than one word, contract them to one word,  
 or make an abbreviation.  For example, program John's little editor for X  
 package would be named <systemitem role="package">johnledx</systemitem>, or  
 <systemitem role="package">jle4x</systemitem>, or whatever you decide, as long  
 as it's under some reasonable limit, e.g.  20 characters.  
 </para>  
 <para>  
 Also check for the exact version of the program (to be included in the package  
 version).  If that piece of software is not numbered with versions like  
 <literal>X.Y.Z</literal>, but with some kind of date, feel free to use that  
 date as the version number, as long as newer version numbers will look larger.  
 While it is best to use the same version number as what upstream uses, if it is  
 in the format of <literal>09Oct23</literal> you may need to convert it to  
 <literal>YYYYMMDD</literal> format, which would be <literal>20091023</literal>,  
 to ensure proper order for upgrade with the <command>dpkg</command>  
 program.<footnote><para> Version string can be compared by <literal>dpkg  
 --compare-versions <replaceable>ver1</replaceable>  
 <replaceable>op</replaceable> <replaceable>ver2</replaceable></literal>.  See  
 <citerefentry> <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum>  
 </citerefentry> manpage.  </para> </footnote>  
 </para>  
 <para>  
 Some programs won't be numbered at all, in which case you should contact the  
 upstream maintainer to see if they've got some other revision-tracking method.  
 </para>  
 </section>  
 <section id="dh-make"><title>Initial Debian package</title>  
 <para>  
 Let's set up the shell environment variable <literal>$DEBEMAIL</literal> and  
 <literal>$DEBFULLNAME</literal> so many Debian maintenance tools recognize your  
 name and email address to use for packages as follows.<footnote><para> The  
1255  following text assumes you are using Bash as your login shell.  If you use  following text assumes you are using Bash as your login shell.  If you use
1256  other login shells such as Z shell, use their pertinent configuration files  some other login shell such as Z shell, use their corresponding
1257  instead of <filename>~/.bashrc</filename>.  </para> </footnote>.  configuration files instead of <filename>~/.bashrc</filename>. </para> </footnote>
1258  </para>  </para>
1259  <screen>  <screen>
1260  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF
1261  DEBEMAIL=your.email.address@example.org  DEBEMAIL="your.email.address@example.org"
1262  DEBFULLNAME=Firstname Lastname  DEBFULLNAME="Firstname Lastname"
1263  export DEBEMAIL DEBFULLNAME  export DEBEMAIL DEBFULLNAME
1264  EOF  EOF
1265    $ . ~/.bashrc
1266  </screen>  </screen>
1267    </section>
1268    <section id="non-native-dh-make"><title>Initial non-native Debian package</title>
1269  <para>  <para>
1270  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
1271    programs.  If you wish to create a non-native Debian package of an upstream
1272    source <filename>gentoo-0.9.12.tar.gz</filename>, you can create an initial
1273    non-native Debian package for it by issuing the <command>dh_make</command>
1274  command as follows.  command as follows.
1275  </para>  </para>
1276  <screen>  <screen>
1277  $ . ~/.bashrc  $ cd ~/gentoo
1278  $ cd ~/gentoo/gentoo-0.9.12  $ wget http://example.org/gentoo-0.9.12.tar.gz
1279    $ tar -xvzf gentoo-0.9.12.tar.gz
1280    $ cd gentoo-0.9.12
1281  $ dh_make -f ../gentoo-0.9.12.tar.gz  $ dh_make -f ../gentoo-0.9.12.tar.gz
1282  </screen>  </screen>
1283  <para>  <para>
1284  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.
1285  <footnote><para> If the upstream source provides the  <footnote><para> If the upstream source provides the
1286  <filename>debian</filename> directory and its contents, run the  <filename>debian</filename> directory and its contents, run the
1287  <command>dh_make</command> command with the <literal>--addmissing</literal>  <command>dh_make</command> command with the extra option
1288  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
1289  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
1290  provided by the upstream for your Debian package.  </para> </footnote> See  provided by the upstream for your Debian package.  </para> </footnote> See
1291  <citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>
1292  </citerefentry> for details.  </citerefentry> for details.
1293  </para>  </para>
1294  <para>  <para>
1295  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
1296  to create.  Gentoo is a single binary package - it creates only one binary, and  to create.  Gentoo is a single binary package - it creates only one binary package, i.e,
1297  thus one <filename>.deb</filename> file - so we will select the first option,  one <filename>.deb</filename> file - so we will select the first option
1298  with the <literal>s</literal> key, check the information on the screen and  (with the <literal>s</literal> key), check the information on the screen, and
1299  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.
1300  <footnote><para> There are few choices here: <literal>s</literal> for Single  <footnote><para> There are several choices here: <literal>s</literal> for
1301  binary, <literal>i</literal> for Arch-Independent, <literal>m</literal> for  Single binary package, <literal>i</literal> for arch-Independent package, <literal>m</literal> for
1302  Multiple binary, <literal>l</literal> for Library, <literal>k</literal> for  Multiple binary packages, <literal>l</literal> for Library package, <literal>k</literal> for
1303  Kernel module, <literal>n</literal> for Kernel patch and <literal>b</literal>  Kernel module package, <literal>n</literal> for kernel patch package, and <literal>b</literal>
1304  for <systemitem role="package">cdbs</systemitem>.  This document focuses on the  for <systemitem role="package">cdbs</systemitem> package.  This document focuses on the
1305  use of the <systemitem role="package">debhelper</systemitem> package with the  use of the <command>dh</command> command (from the package
1306  <command>dh</command> command.  This document focuses on the use of the new  <systemitem role="package">debhelper</systemitem>) to create a single binary package,
1307  <command>dh</command> command for Single binary and touches on it for  but also touches on how to use it for arch-independent or
1308  Arch-Independent and Multiple binary.  The <systemitem role="package">cdbs</systemitem> package offers alternative package script  multiple binary packages.  The package
1309  infrastructure to the <command>dh</command> command and outside of the scope of  <systemitem role="package">cdbs</systemitem> offers an alternative packaging script
1310    infrastructure to the <command>dh</command> command and is outside the scope of
1311  this document.  </para> </footnote>  this document.  </para> </footnote>
1312  </para>  </para>
1313  <para>  <para>
1314  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
1315  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
1316  parent directory to accommodate the creation of the non-native Debian source  parent directory to accommodate the creation of the non-native Debian source
1317  package with the <filename>debian.tar.gz</filename> later.  package with the name <filename>debian.tar.gz</filename> later.
1318  </para>  </para>
1319  <screen>  <screen>
1320  $ cd ~/gentoo ; ls -F  $ cd ~/gentoo ; ls -F
# Line 1035  gentoo-0.9.12.tar.gz Line 1323  gentoo-0.9.12.tar.gz
1323  gentoo_0.9.12.orig.tar.gz  gentoo_0.9.12.orig.tar.gz
1324  </screen>  </screen>
1325  <para>  <para>
1326  Please note 2 key features in this  Please note two key features of this filename
1327  <filename>gentoo_0.9.12.orig.tar.gz</filename> file name:  <filename>gentoo_0.9.12.orig.tar.gz</filename>:
1328  </para>  </para>
1329  <itemizedlist>  <itemizedlist>
1330  <listitem>  <listitem>
1331  <para>  <para>
1332  Package name and version are separated by the <literal>_</literal>  Package name and version are separated by the character <literal>_</literal>
1333  (underscore).  (underscore).
1334  </para>  </para>
1335  </listitem>  </listitem>
1336  <listitem>  <listitem>
1337  <para>  <para>
1338  There is the <filename>.orig</filename> before the  The string <filename>.orig</filename> is inserted before the
1339  <filename>.tar.gz</filename>.  <filename>.tar.gz</filename>.
1340  </para>  </para>
1341  </listitem>  </listitem>
1342  </itemizedlist>  </itemizedlist>
1343  <para>  <para>
1344  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
1345  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
1346  that the packaging is not automatic process.  You need to modify the upstream  <xref linkend="dreq"/> and <xref linkend="dother"/>.  You should also understand
1347  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
1348  build Debian packages under the proper method as <xref linkend="build"/> ,  source for Debian (see <xref linkend="modify"/>).  After this, you need to
1349  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"/>),
1350  </para>  testing them (<xref linkend="checkit"/>), and uploading them (<xref linkend="upload"/>).
1351  <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,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel module packages,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel patch packages,  
1352  </para>  </para>
 </listitem>  
 <listitem>  
1353  <para>  <para>
1354  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
1355  <filename>tar.bz2</filename>, or  recover them by running <command>dh_make</command> with the
1356    <literal>--addmissing</literal> option again in a Debian package source tree.
1357  </para>  </para>
 </listitem>  
 <listitem>  
1358  <para>  <para>
1359  the source tarball containing undistributable contents.  Updating an existing package may get complicated since it may be using older
1360    techniques.  While learning the basics, please stick to creating a fresh
1361    package; further explanations are given in <xref linkend="update"/>.
1362  </para>  </para>
 </listitem>  
 </itemizedlist>  
1363  <para>  <para>
1364  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
1365  describe all of it here.  discussed in <xref linkend="simplemake"/> and <xref linkend="portable"/>.  It
1366    could be just a collection of graphical data etc.  Installation of files may be
1367    carried out using only <systemitem role="package">debhelper</systemitem> configuration
1368    files such as <filename>debian/install</filename> (see
1369    <xref linkend="install"/>).
1370  </para>  </para>
1371    </section>
1372    <section id="native-dh-make"><title>Initial native Debian package</title>
1373  <para>  <para>
1374  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,
1375  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
1376  <literal>--addmissing</literal> option again in a Debian package source tree.  native package. If you have source
1377    files in <filename>~/mypackage-1.0</filename>, you can create an initial native
1378    Debian package for it by issuing the <command>dh_make</command> command as
1379    follows.
1380  </para>  </para>
1381    <screen>
1382    $ cd ~/mypackage-1.0
1383    $ dh_make --native
1384    </screen>
1385  <para>  <para>
1386  Updating an existing package may get complicated since it may be using older  Then the <filename>debian</filename> directory and its contents are created
1387  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
1388  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.
1389    The rest of the packaging activities are practically the same.
1390  </para>  </para>
1391  </section>  </section>
1392  </chapter>  </chapter>
# Line 1119  Please note that there isn't space here Line 1396  Please note that there isn't space here
1396  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
1397  people often run across.  people often run across.
1398  </para>  </para>
1399  <section id="quiltrc"><title>Set up <command>quilt</command></title>  <section id="quiltrc"><title>Setting up <command>quilt</command></title>
1400    <para>
1401    The program <command>quilt</command> offers a basic method for recording
1402    modifications to the upstream source for Debian packaging.  It's
1403    useful to have a slightly customized default, so let's create an alias
1404    <command>dquilt</command> for Debian packaging by adding the following
1405    line to <filename>~/.bashrc</filename>.
1406    </para>
1407    <screen>
1408    alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"
1409    </screen>
1410  <para>  <para>
1411  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>  
1412  </para>  </para>
1413  <screen>  <screen>
1414  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
1415  if [ -d $d/debian ] &amp;&amp; [ -z $QUILT_PATCHES ]; then  if [ -d $d/debian ] &amp;&amp; [ -z $QUILT_PATCHES ]; then
1416      # Debian packaging case and unset $QUILT_PATCHES      # if in Debian packaging tree with unset $QUILT_PATCHES
1417      QUILT_PATCHES=debian/patches      QUILT_PATCHES="debian/patches"
1418      QUILT_PATCH_OPTS=--reject-format=unified      QUILT_PATCH_OPTS="--reject-format=unified"
1419      QUILT_DIFF_ARGS=-p ab --no-timestamps --no-index --color=auto      QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
1420      QUILT_REFRESH_ARGS=-p ab --no-timestamps --no-index      QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
1421      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"
1422      if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi      if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
1423  fi  fi
1424  </screen>  </screen>
1425  <para>  <para>
1426  See <citerefentry> <refentrytitle>quilt</refentrytitle>  See <citerefentry> <refentrytitle>quilt</refentrytitle>
1427  <manvolnum>1</manvolnum> </citerefentry> and  <manvolnum>1</manvolnum> </citerefentry> and
1428  <ulink url="&quilt-pdf;">quilt.pdf</ulink> for how to use  <ulink url="&quilt-pdf;">quilt.pdf</ulink> on how to use
1429  <command>quilt</command>.  <command>quilt</command>.
1430  </para>  </para>
1431  </section>  </section>
1432  <section id="fixupstream"><title>Fixing upstream bug</title>  <section id="fixupstream"><title>Fixing upstream bugs</title>
1433  <para>  <para>
1434  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>
1435  file as follows where <literal>install: gentoo</literal> should have been  as follows where <literal>install: gentoo</literal> should have been
1436  <literal>install: gentoo-target</literal>.  <literal>install: gentoo-target</literal>.
1437  </para>  </para>
1438  <screen>  <screen>
# Line 1160  install: gentoo Line 1442  install: gentoo
1442          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1443  </screen>  </screen>
1444  <para>  <para>
1445  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
1446  <filename>fix-gentoo-target.patch</filename>.  <footnote><para> The  <filename>fix-gentoo-target.patch</filename>.  <footnote><para> The
1447  <filename>debian/patches</filename> directory should exist now if you run  <filename>debian/patches</filename> directory should exist now if you ran
1448  <command>dh_make</command> as described before.  This example operation creates  <command>dh_make</command> as described before.  This example operation creates
1449  it just in case you are updating the existing package.  </para> </footnote>  it just in case you are updating an existing package.  </para> </footnote>
1450  </para>  </para>
1451  <screen>  <screen>
1452  $ mkdir debian/patches  $ mkdir debian/patches
1453  $ quilt new fix-gentoo-target.patch  $ dquilt new fix-gentoo-target.patch
1454  $ quilt add Makefile  $ dquilt add Makefile
1455  </screen>  </screen>
1456  <para>  <para>
1457  You change the <filename>Makefile</filename> file as follows.  You change the <filename>Makefile</filename> file as follows.
# Line 1181  install: gentoo-target Line 1463  install: gentoo-target
1463          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1464  </screen>  </screen>
1465  <para>  <para>
1466  Ask <command>quilt</command> to refresh the patch to create  Ask <command>dquilt</command> to generate the patch to create
1467  <filename>debian/patches/fix-gentoo-target.patch</filename> and add its  <filename>debian/patches/fix-gentoo-target.patch</filename> and add its
1468  description following <ulink url="&dep3;">DEP-3: Patch Tagging Guidelines</ulink>.  description following <ulink url="&dep3;">DEP-3: Patch Tagging Guidelines</ulink>.
1469  </para>  </para>
1470  <screen>  <screen>
1471  $ quilt refresh  $ dquilt refresh
1472  $ quilt header -e  $ dquilt header -e
1473  ... describe patch  ... describe patch
1474  </screen>  </screen>
1475  </section>  </section>
1476    <section id="destdir"><title>Installation of files to their destination</title>
 <section id="destdir"><title>Installation of files to the destination</title>  
1477  <para>  <para>
1478  Normally, programs install themselves in the <filename>/usr/local</filename>  Most third-party software installs itself in the <filename>/usr/local</filename>
1479  subdirectory.  Since it is reserved for system administrator's (or user's)  directory hierarchy.  On Debian this is reserved for private use
1480  private use, Debian packages must not use that directory but should use system  by the system administrator, so packages must not use directories such
1481  directories such as the <filename>/usr/bin</filename> subdirectory following  as <filename>/usr/local/bin</filename> but should instead use system
1482  the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink> (FHS).  directories such as <filename>/usr/bin</filename>, obeying the
1483    <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink> (FHS).
1484  </para>  </para>
1485  <para>  <para>
1486  Normally, <citerefentry> <refentrytitle>make</refentrytitle>  Normally, <citerefentry> <refentrytitle>make</refentrytitle>
1487  <manvolnum>1</manvolnum> </citerefentry> is used to automate building the  <manvolnum>1</manvolnum> </citerefentry> is used to automate building the
1488  program and the execution of <literal>make install</literal> installs programs  program, and executing <literal>make install</literal> installs programs
1489  directly to the desired destination by the <literal>install</literal> target of  directly to the desired destination (following the
1490  the <filename>Makefile</filename> file.  In order for Debian to provide binary  <literal>install</literal> target in the
1491  packages, the build system installs programs to the file tree image created  <filename>Makefile</filename>).  In order for Debian to provide
1492  under a temporary directory instead to the actual destination.  pre-built installable packages, it modifies the build system to install
1493    programs into a file tree image created under a temporary directory
1494    instead of the actual destination.
1495  </para>  </para>
1496  <para>  <para>
1497  These 2 differences between (1) the normal program installation and (2) the  These two differences between normal program installation on one hand and the
1498  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
1499    <systemitem role="package">debhelper</systemitem> package through the
1500  <command>dh_auto_configure</command> and <command>dh_auto_install</command>  <command>dh_auto_configure</command> and <command>dh_auto_install</command>
1501  commands if the following conditions are met.  commands if the following conditions are met.
1502  </para>  </para>
1503  <itemizedlist>  <itemizedlist>
1504  <listitem>  <listitem>
1505  <para>  <para>
1506  The <filename>Makefile</filename> file follows the GNU conventions to support  The <filename>Makefile</filename> must follow GNU conventions and
1507  <literal>$(DESTDIR)</literal> variable.  support the <literal>$(DESTDIR)</literal> variable.
1508  <footnote><para> See <ulink url="&gnu-destdir;">GNU Coding Standards: 7.2.4 DESTDIR: Support for Staged Installs</ulink>.</para></footnote>  <footnote><para> See <ulink url="&gnu-destdir;">GNU Coding Standards: 7.2.4 DESTDIR: Support for Staged Installs</ulink>.</para></footnote>
1509  </para>  </para>
1510  </listitem>  </listitem>
1511  <listitem>  <listitem>
1512  <para>  <para>
1513  The source follows the Filesystem Hierarchy Standard (FHS).  The source must follow the Filesystem Hierarchy Standard (FHS).
1514  </para>  </para>
1515  </listitem>  </listitem>
1516  </itemizedlist>  </itemizedlist>
1517  <para>  <para>
1518  Programs that use GNU <command>autoconf</command>  Programs that use GNU <command>autoconf</command> follow the GNU conventions
1519  <emphasis>automatically</emphasis> follow the GNU conventions and their  automatically, so they can be trivial to package.  On the basis of
1520  packaging is almost <emphasis>automatic</emphasis>.  With this and other  this and other heuristics, it is estimated that the
1521  heuristics, the <systemitem role="package">debhelper</systemitem> package  <systemitem role="package">debhelper</systemitem> package will work for
1522  estimates that it works for about 90% of packages without making any intrusive  about 90% of packages without making any intrusive changes to their
1523  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.  
1524  </para>  </para>
1525  <para>  <para>
1526  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
1527  should make sure to support these <literal>$(DESTDIR)</literal> variable.  The  should be careful to support the <literal>$(DESTDIR)</literal>
1528  <literal>$(DESTDIR)</literal> variable is unset in it and is prepended to each  variable.  Although it is unset by default, the <literal>$(DESTDIR)</literal>
1529  file path used for the program installation.  The packaging script will set  variable is prepended to each file path used for the program
1530  <literal>$(DESTDIR)</literal> to the temporary directory.  installation.  The packaging script will set
1531    <literal>$(DESTDIR)</literal> to the temporary directory.
1532  </para>  </para>
1533  <para>  <para>
1534  The temporary directory used by the <command>dh_auto_install</command> command  For a source package generating a single binary package, the temporary directory used
1535  is chosen as <filename>debian/<replaceable>package</replaceable></filename> for  by the <command>dh_auto_install</command> command will be set to
1536  single binary packages.  <footnote><para> For multiple binary packages, the  <filename>debian/<replaceable>package</replaceable></filename>.
1537    <footnote><para> For a source package generating multiple binary packages, the
1538  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>
1539  as the temporary directory while the <command>dh_install</command> command with  as the temporary directory while the <command>dh_install</command> command with
1540  the help of  the help of
1541  <filename>debian/<replaceable>package-1</replaceable>.install</filename> and  <filename>debian/<replaceable>package-1</replaceable>.install</filename> and
1542  <filename>debian/<replaceable>package-2</replaceable>.install</filename> files  <filename>debian/<replaceable>package-2</replaceable>.install</filename> files
1543  will split contents of <filename>debian/tmp</filename> into  will split the contents of <filename>debian/tmp</filename> into
1544  <filename>debian/<replaceable>package-1</replaceable></filename> and  <filename>debian/<replaceable>package-1</replaceable></filename> and
1545  <filename>debian/<replaceable>package-2</replaceable></filename> temporary  <filename>debian/<replaceable>package-2</replaceable></filename> temporary
1546  directories to create multiple binary <filename>*.deb</filename> packages.  directories, to create
1547    <filename><replaceable>package-1</replaceable>_*.deb</filename> and
1548    <filename><replaceable>package-2</replaceable>_*.deb</filename> binary
1549    packages.
1550  </para> </footnote> Everything that is contained in the temporary directory  </para> </footnote> Everything that is contained in the temporary directory
1551  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
1552  difference is that <command>dpkg</command> will be installing the files in the  difference is that <command>dpkg</command> will be installing the
1553  root directory.  files to paths relative to the root directory rather than your working
1554    directory.
1555  </para>  </para>
1556  <para>  <para>
1557  Bear in mind that even though your program installs in  Bear in mind that even though your program installs in
1558  <filename>debian/<replaceable>package</replaceable></filename>, it still needs  <filename>debian/<replaceable>package</replaceable></filename>, it still needs
1559  to behave correctly when placed in the root directory, i.e.  when installed  to behave correctly when installed from the <filename>.deb</filename>
1560  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
1561  system to hardcode strings like  system to hardcode strings like
1562  <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>
1563  into the package file.  into files in the package.
1564  </para>  </para>
1565  <para>  <para>
1566  Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s  Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s
1567  <filename>Makefile</filename> file <footnote><para> This is just an example to  <filename>Makefile</filename><footnote><para> This is just an example to
1568  show how the <filename>Makefile</filename> file should look like.  If the  show what a <filename>Makefile</filename> should look like.  If the
1569  <filename>Makefile</filename> file is created by the  <filename>Makefile</filename> is created by the
1570  <command>./configure</command> command, the correct way to fix this kind of  <command>./configure</command> command, the correct way to fix this kind of
1571  <filename>Makefile</filename> is to executed the <command>./configure</command>  <filename>Makefile</filename> is to execute <command>./configure</command>
1572  command from the <command>dh_auto_configure</command> command with default  from the <command>dh_auto_configure</command> command with default
1573  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:
1574  </para>  </para>
1575  <screen>  <screen>
1576  # Where to put binary on 'make install'?  # Where to put executable commands on 'make install'?
1577  BIN     = /usr/local/bin  BIN     = /usr/local/bin
1578  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1579  ICONS   = /usr/local/share/gentoo  ICONS   = /usr/local/share/gentoo
1580  </screen>  </screen>
1581  <para>  <para>
1582  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>.
1583  Change those paths to:  As explained above, that directory hierarchy is reserved for local use on
1584    Debian, so change those paths to:
1585  </para>  </para>
1586  <screen>  <screen>
1587  # Where to put binary on 'make install'?  # Where to put executable commands on 'make install'?
1588  BIN     = $(DESTDIR)/usr/bin  BIN     = $(DESTDIR)/usr/bin
1589  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1590  ICONS   = $(DESTDIR)/usr/share/gentoo  ICONS   = $(DESTDIR)/usr/share/gentoo
1591  </screen>  </screen>
1592  <para>  <para>
1593  But why in that directory, and not some other?  Because Debian packages never  The exact locations that should be used for binaries, icons,
1594  install files beneath <filename>/usr/local</filename> -- that tree is reserved  documentation, etc. are specified in the Filesystem Hierarchy Standard
1595  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
1596  <filename>/usr</filename> instead.  your package.
 </para>  
 <para>  
 The more exact locations for binaries, icons, documentation etc.  are specified  
 in the Filesystem Hierarchy Standard (FHS).  I recommend you  
 browse it and read the sections that might concern your package.  
1597  </para>  </para>
1598  <para>  <para>
1599  So, we should install the binary in <filename>/usr/bin</filename> instead of  So, we should install executable commands in <filename>/usr/bin</filename> instead of
1600  <filename>/usr/local/bin</filename>, the manual page in  <filename>/usr/local/bin</filename>, the manual page in
1601  <filename>/usr/share/man/man1</filename> instead of  <filename>/usr/share/man/man1</filename> instead of
1602  <filename>/usr/local/man/man1</filename> etc.  Notice how there's no manual  <filename>/usr/local/man/man1</filename>, and so on.  Notice how there's no manual
1603  page mentioned in <systemitem role="package">gentoo</systemitem>'s  page mentioned in <systemitem role="package">gentoo</systemitem>'s
1604  <filename>Makefile</filename>, but since the Debian Policy requires that every  <filename>Makefile</filename>, but since Debian Policy requires that every
1605  program has one, we'll make one later and install it in  program has one, we'll make one later and install it in
1606  <filename>/usr/share/man/man1</filename>.  <filename>/usr/share/man/man1</filename>.
1607  </para>  </para>
# Line 1326  to fix them to use the right locations. Line 1612  to fix them to use the right locations.
1612  for?  You can find this out by issuing:  for?  You can find this out by issuing:
1613  </para>  </para>
1614  <screen>  <screen>
1615  $ grep -nr -e 'usr/local/lib' --include='*.[c|h]' .  $ grep -nr --include='*.[c|h]' -e 'usr/local/lib' .
1616  </screen>  </screen>
1617  <para>  <para>
1618  <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 1337  Edit those files and in those lines repl Line 1623  Edit those files and in those lines repl
1623  with <literal>usr/lib</literal>.  This can be done automatically as follows:  with <literal>usr/lib</literal>.  This can be done automatically as follows:
1624  </para>  </para>
1625  <screen>  <screen>
1626  $ vim '+argdo %s/usr\/local\/lib/usr\/lib/gce|update' +q \  $ sed -i -e 's#usr/local/lib#usr/lib#g' \
1627        $(find . -type f -name '*.[c|h]')        $(find . -type f -name '*.[c|h]')
1628  </screen>  </screen>
1629  <para>  <para>
1630  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:
1631  </para>  </para>
1632    <screen>
1633    $ vim '+argdo %s#usr/local/lib#usr/lib#gce|update' +q \
1634          $(find . -type f -name '*.[c|h]')
1635    </screen>
1636    
1637  <para>  <para>
1638  After that you should find the install target (search for line that starts with  Next you should find the <literal>install</literal> target (searching
1639  <literal>install:</literal>, that will usually work) and rename all references  for the line that starts with <literal>install:</literal> will usually
1640  to directories other than ones defined at the top of the  work) and rename all references to directories other than ones defined
1641  <filename>Makefile</filename>.  at the top of the <filename>Makefile</filename>.
1642  </para>  </para>
1643  <para>  <para>
1644  Before your upstream bug fix, <systemitem role="package">gentoo</systemitem>'s  Originally, <systemitem role="package">gentoo</systemitem>'s
1645  install target said:  <literal>install</literal> target said:
1646  </para>  </para>
1647  <screen>  <screen>
1648  install: gentoo-target  install: gentoo-target
# Line 1360  install: gentoo-target Line 1651  install: gentoo-target
1651          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1652  </screen>  </screen>
1653  <para>  <para>
1654  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
1655  <filename>debian/patches/install.patch</filename>.  <filename>debian/patches/install.patch</filename>.
1656  </para>  </para>
1657  <screen>  <screen>
1658  $ quilt new install.patch  $ dquilt new install.patch
1659  $ quilt add Makefile  $ dquilt add Makefile
1660  </screen>  </screen>
1661  <para>  <para>
1662  Let's change this for Debian package as following using the editor:  In your editor, change this for the Debian package as follows:
1663  </para>  </para>
1664  <screen>  <screen>
1665  install: gentoo-target  install: gentoo-target
# Line 1378  install: gentoo-target Line 1669  install: gentoo-target
1669          install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc          install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc
1670  </screen>  </screen>
1671  <para>  <para>
1672  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
1673  before the other commands in the rule.  The original  before the other commands in the rule.  The original
1674  <filename>Makefile</filename> didn't have it because usually the  <filename>Makefile</filename> didn't have it because usually
1675  <literal>/usr/local/bin</literal> and other directories already exist on the  <literal>/usr/local/bin</literal> and other directories already exist on the
1676  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
1677  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
1678  create each and every one of those directories.  create each and every one of those directories.
1679  </para>  </para>
1680  <para>  <para>
# Line 1395  of additional documentation that the ups Line 1686  of additional documentation that the ups
1686          cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html          cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html
1687  </screen>  </screen>
1688  <para>  <para>
1689  After careful check, if everything is fine, ask <command>quilt</command> to  Check carefully, and if everything is okay, ask <command>dquilt</command> to
1690  refresh the patch to create <filename>debian/patches/install.patch</filename>  generate the patch to create <filename>debian/patches/install.patch</filename>
1691  and add its description.  and add its description.
1692  </para>  </para>
1693  <screen>  <screen>
1694  $ quilt refresh  $ dquilt refresh
1695  $ quilt header -e  $ dquilt header -e
1696  ... describe patch  ... describe patch
1697  </screen>  </screen>
1698  <para>  <para>
# Line 1421  Debian specific packaging modification: Line 1712  Debian specific packaging modification:
1712  </listitem>  </listitem>
1713  </orderedlist>  </orderedlist>
1714  <para>  <para>
1715  Whenever you make changes that are not specifically related to Debian package  Whenever you make changes that are not specific to the Debian package
1716  such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to  such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to
1717  send them to the upstream maintainer so they can be included in the next  send them to the upstream maintainer so they can be included in the next
1718  program revision and be useful to everyone else.  Also remember to make your  version of the program and be useful to everyone else.  Also remember
1719  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!
1720  make them portable.  This will make your fixes much easier to apply.  Make them portable.  This will make your fixes much easier to apply.
1721  </para>  </para>
1722  <para>  <para>
1723  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 1437  upstream. Line 1728  upstream.
1728  <para>  <para>
1729  There is one other common problem: libraries are often different from platform  There is one other common problem: libraries are often different from platform
1730  to platform.  For example, a <filename>Makefile</filename> can contain a  to platform.  For example, a <filename>Makefile</filename> can contain a
1731  reference to a library which doesn't exist on Debian systems.  In that case, we  reference to a library which doesn't exist on the Debian system.  In that case, we
1732  need to change it to a library which does exist in Debian, and serves the same  need to change it to a library which does exist in Debian, and serves the same
1733  purpose.  purpose.
1734  </para>  </para>
1735  <para>  <para>
1736  So, if there is a line in your program's <filename>Makefile</filename> (or  Let's assume a line in your program's <filename>Makefile</filename> (or
1737  <filename>Makefile.in</filename>) that says something like this (and your  <filename>Makefile.in</filename>) as the following.
 program doesn't compile) <footnote><para> The author realizes that this is not  
 the best example considering our <systemitem role="package">libncurses</systemitem> package now ships with a  
 <filename>libcurses.so</filename> symlink, but he couldn't think of a better  
 one.  Suggestions very welcome :-) </para> </footnote>:  
1738  </para>  </para>
1739  <screen>  <screen>
1740  LIBS = -lcurses -lsomething -lsomethingelse  LIBS = -lfoo -lbar
1741  </screen>  </screen>
1742  <para>  <para>
1743  Let's fix this as <filename>debian/patches/ncurse.patch</filename> by changing  If your program doesn't compile since the <literal>foo</literal> library
1744  <literal>curses</literal> into <literal>ncurses</literal>.  doesn't exist and its equivalent is provided by the <literal>foo2</literal>
1745    library on the Debian system, you can fix this build problem as
1746    <filename>debian/patches/foo2.patch</filename> by changing
1747    <literal>foo</literal> into <literal>foo2</literal>.<footnote><para>If there
1748    are API changes from the <literal>foo</literal> library to the
1749    <literal>foo2</literal> library, required changes to the source code need to be
1750    made to match the new API.</para> </footnote>
1751  </para>  </para>
1752  <screen>  <screen>
1753  $ quilt new ncurse.patch  $ dquilt new foo2.patch
1754  $ quilt add Makefile  $ dquilt add Makefile
1755  $ sed -i -e s/-lcurses/-lncurses/g Makefile  $ sed -i -e 's/-lfoo/-lfoo2/g' Makefile
1756  $ quilt refresh  $ dquilt refresh
1757  $ quilt header -e  $ dquilt header -e
1758  ... describe patch  ... describe patch
1759  </screen>  </screen>
1760  </section>  </section>
1761  </chapter>  </chapter>
1762  <chapter id="dreq"><title>Required files under the <filename>debian</filename> directory</title>  <chapter id="dreq"><title>Required files under the <filename>debian</filename> directory</title>
1763  <para>  <para>
1764  There is a new subdirectory under the program's source directory, it's called  There is a new subdirectory under the program's source directory, called
1765  <filename>debian</filename>.  There are a number of files in this directory  <filename>debian</filename>.  There are a number of files in this directory
1766  that we should edit in order to customize the behavior of the package.  The  that we should edit in order to customize the behavior of the package.  The
1767  most important of them are <filename>control</filename>,  most important of them are <filename>control</filename>,
1768  <filename>changelog</filename>, <filename>copyright</filename> and  <filename>changelog</filename>, <filename>copyright</filename>, and
1769  <filename>rules</filename>, which are required for all packages.  <filename>rules</filename>, which are required for all packages.
1770    <footnote><para>
1771    In this chapter, files in the <filename>debian</filename> directory are
1772    referred to without the leading <filename>debian/</filename> for simplicity whenever
1773    the meaning is obvious.
1774    </para></footnote>
1775  </para>  </para>
1776  <section id="control"><title><filename>control</filename> file</title>  <section id="control"><title><filename>control</filename></title>
1777  <para>  <para>
1778  This file contains various values which <command>dpkg</command>,  This file contains various values which <command>dpkg</command>,
1779  <command>dselect</command>, <command>apt-get</command>,  <command>dselect</command>, <command>apt-get</command>,
1780  <command>apt-cache</command>, <command>aptitude</command>, and other package  <command>apt-cache</command>, <command>aptitude</command>, and other package
1781  management tools will use to manage the package.  It is defined by the <ulink url="&policy-control;">Debian  management tools will use to manage the package.  It is defined by the
1782  Policy Manual, 5 'Control files and their fields'</ulink>.  <ulink url="&policy-control;">Debian Policy Manual, 5 "Control files and their fields"</ulink>.
1783  </para>  </para>
1784  <para>  <para>
1785  Here is the <filename>control</filename> file <command>dh_make</command>  Here is the <filename>control</filename> file <command>dh_make</command>
# Line 1516  Line 1 is the name of the source package Line 1814  Line 1 is the name of the source package
1814  Line 2 is the section of the distribution the source package goes into.  Line 2 is the section of the distribution the source package goes into.
1815  </para>  </para>
1816  <para>  <para>
1817  As you may have noticed, Debian archive is divided in sections:  As you may have noticed, the Debian archive is divided into multiple areas:
1818  <literal>main</literal> (the free software), <literal>non-free</literal> (the  <literal>main</literal> (the free software), <literal>non-free</literal> (the
1819  not really free software) and <literal>contrib</literal> (free software that  not really free software) and <literal>contrib</literal> (free software that
1820  depends on non-free software).  Under those, there are logical subsections that  depends on non-free software).  Each of these is divided into sections that
1821  describe in short what packages are in.  So we have <literal>admin</literal>  classify packages into rough categories.  So we have <literal>admin</literal>
1822  for administrator-only programs, <literal>base</literal> for the basic tools,  for administrator-only programs,
1823  <literal>devel</literal> for programmer tools, <literal>doc</literal> for  <literal>devel</literal> for programmer tools, <literal>doc</literal> for
1824  documentation, <literal>libs</literal> for libraries, <literal>mail</literal>  documentation, <literal>libs</literal> for libraries, <literal>mail</literal>
1825  for e-mail readers and daemons, <literal>net</literal> for network apps and  for email readers and daemons, <literal>net</literal> for network apps and
1826  daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,  daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,
1827  and many more.  See the <ulink url="&policy-subsections;">Debian  and many more.
1828  Policy Manual, 2.4 'Sections'</ulink> and <ulink url="&sections-unstable;">List of sections in 'sid'</ulink>  <footnote> <para>See
1829  for the guidance.  <ulink url="&policy-subsections;">Debian Policy Manual, 2.4 "Sections"</ulink> and
1830    <ulink url="&sections-unstable;">List of sections in <literal>sid</literal></ulink>.</para>
1831    </footnote>
1832  </para>  </para>
1833  <para>  <para>
1834  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
1835  we can omit it.)  we can omit it.)
1836  </para>  </para>
1837  <para>  <para>
1838  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.
1839  the <ulink url="&policy-priorities;">Debian  <footnote> <para>See
1840  Policy Manual, 2.5 'Priorities'</ulink> for the guidance.  <ulink url="&policy-priorities;">Debian Policy Manual, 2.5 "Priorities"</ulink>.
1841    </para>
1842    </footnote>
1843  </para>  </para>
1844  <itemizedlist>  <itemizedlist>
1845  <listitem>  <listitem>
1846  <para>  <para>
1847  The <literal>optional</literal> priority will usually work for new packages  The <literal>optional</literal> priority will usually work for new packages
1848  that do not conflict with others with <literal>required</literal>,  that do not conflict with others claiming <literal>required</literal>,
1849  <literal>important</literal> or <literal>standard</literal> priorities.  <literal>important</literal>, or <literal>standard</literal> priority.
1850  </para>  </para>
1851  </listitem>  </listitem>
1852  <listitem>  <listitem>
# Line 1555  conflict with others with non-<literal>e Line 1857  conflict with others with non-<literal>e
1857  </listitem>  </listitem>
1858  </itemizedlist>  </itemizedlist>
1859  <para>  <para>
1860  Section and priority are used by the frontends like <command>aptitude</command>  Section and priority are used by front-ends like <command>aptitude</command>
1861  when they sort packages and select defaults.  Once you upload the package to  when they sort packages and select defaults.  Once you upload the package to
1862  Debian, the value of these two fields can be overridden by the archive  Debian, the value of these two fields can be overridden by the archive
1863  maintainers, in which case you will be notified by email.  maintainers, in which case you will be notified by email.
# Line 1566  we will change the priority to <literal> Line 1868  we will change the priority to <literal>
1868  </para>  </para>
1869  <para>  <para>
1870  Line 4 is the name and email address of the maintainer.  Make sure that this  Line 4 is the name and email address of the maintainer.  Make sure that this
1871  field includes a valid <literal>To</literal> header for an email, because after  field includes a valid <literal>To</literal> header for email, because after
1872  you upload it, the bug tracking system will use it to deliver bug emails to  you upload it, the bug tracking system will use it to deliver bug emails to
1873  you.  Avoid using commas, ampersands and parenthesis.  you.  Avoid using commas, ampersands, or parentheses.
1874  </para>  </para>
1875  <para>  <para>
1876  The 5th line includes the list of packages required to build your package as  Line 5 includes the list of packages required to build your package as
1877  the <literal>Build-Depends</literal> field.  You can also have the  the <literal>Build-Depends</literal> field.  You can also have the
1878  <literal>Build-Depends-Indep</literal> field as an additional line, here  <literal>Build-Depends-Indep</literal> field as an additional line, here.
1879  (see the <ulink url="&policy-relationships;#s-sourcebinarydeps">Debian  <footnote><para>See
1880  Policy Manual, 7.7 'Relationships between source and binary packages -  <ulink url="&policy-relationships;#s-sourcebinarydeps">Debian Policy Manual, 7.7 "Relationships between source and binary packages - Build-Depends, Build-Depends-Indep, Build-Conflicts, Build-Conflicts-Indep"</ulink>.</para></footnote>
1881  Build-Depends, Build-Depends-Indep, Build-Conflicts,  Some packages like
 Build-Conflicts-Indep'</ulink>).  Some packages like  
1882  <systemitem role="package">gcc</systemitem> and  <systemitem role="package">gcc</systemitem> and
1883  <systemitem role="package">make</systemitem> which are required by the  <systemitem role="package">make</systemitem> which are required by the
1884  <systemitem role="package">build-essential</systemitem> package are implied.  If you need  <systemitem role="package">build-essential</systemitem> package are implied.  If you need
1885  to have other tools to build your package, you should add them to these fields.  to have other tools to build your package, you should add them to these fields.
1886  Multiple entries are separated with commas; read on for the explanation of  Multiple entries are separated with commas; read on for the explanation of
1887  binary dependencies to find out more about the syntax of these lines.  binary package dependencies to find out more about the syntax of these lines.
1888  </para>  </para>
1889  <itemizedlist>  <itemizedlist>
1890  <listitem>  <listitem>
# Line 1596  satisfy the Debian Policy requirement fo Line 1897  satisfy the Debian Policy requirement fo
1897  </listitem>  </listitem>
1898  <listitem>  <listitem>
1899  <para>  <para>
1900  For source packages which have some binary packages with <literal>Architecture:  Source packages which have binary packages with <literal>Architecture:
1901  any</literal>, they are rebuild by the autobuilder.  Since this autobuilder  any</literal> are rebuilt by the autobuilder.  Since this autobuilder
1902  procedure runs <literal>debian/rules build</literal> in it while installing  procedure installs only the packages listed in the
1903  only packages listed in the <literal>Build-Depends</literal> field (see <xref linkend="autobuilder"/> ), the <literal>Build-Depends</literal> field needs to  <literal>Build-Depends</literal> field before running
1904  list practically all the required packages and the  <literal>debian/rules build</literal> (see <xref
1905  <literal>Build-Depends-indep</literal> is rarely used.  linkend="autobuilder"/>), the <literal>Build-Depends</literal> field
1906    needs to  list practically all the required packages and
1907    <literal>Build-Depends-Indep</literal> is rarely used.
1908  </para>  </para>
1909  </listitem>  </listitem>
1910  <listitem>  <listitem>
1911  <para>  <para>
1912  For source packages which have binary packages only with <literal>Architecture:  For source packages with binary packages all of which are <literal>Architecture:
1913  all</literal>, the <literal>Build-Depends-Indep</literal> field may list all  all</literal>, the <literal>Build-Depends-Indep</literal> field may list all
1914  the required packages unless they are already listed in the  the required packages unless they are already listed in the
1915  <literal>Build-Depends</literal> field to satisfy the Debian Policy requirement  <literal>Build-Depends</literal> field to satisfy the Debian Policy requirement
# Line 1619  If you are not sure which one should be Line 1922  If you are not sure which one should be
1922  <literal>Build-Depends</literal> field to be on the safe side.  <literal>Build-Depends</literal> field to be on the safe side.
1923  <footnote><para> This somewhat strange situation is a feature well documented  <footnote><para> This somewhat strange situation is a feature well documented
1924  in the <ulink url="&policy-build-depends-indep;">Debian Policy  in the <ulink url="&policy-build-depends-indep;">Debian Policy
1925  Manual, Footnotes 48</ulink>.  This is not due to the use of the  Manual, Footnotes 55</ulink>.  This is not due to the use of the
1926  <command>dh</command> command in the <filename>debian/rules</filename> file but  <command>dh</command> command in the <filename>debian/rules</filename> file but
1927  due to how the <command>dpkg-buildpackage</command> works.  The same situation  due to how the <command>dpkg-buildpackage</command> works.  The same situation
1928  applies to the <ulink url="https://bugs.launchpad.net/launchpad-buildd/+bug/238141">auto build system  applies to the <ulink url="https://bugs.launchpad.net/launchpad-buildd/+bug/238141">auto build system
# Line 1632  To find out what packages your package n Line 1935  To find out what packages your package n
1935  $ dpkg-depcheck -d ./configure  $ dpkg-depcheck -d ./configure
1936  </screen>  </screen>
1937  <para>  <para>
1938  To manually find exact build dependency for  To manually find exact build dependencies for
1939  <command><replaceable>/usr/bin/foo</replaceable></command>, you execute  <command><replaceable>/usr/bin/foo</replaceable></command>, execute
1940  </para>  </para>
1941  <screen>  <screen>
1942  $ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED  $ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED
# Line 1645  and for each library listed, e.g., <comm Line 1948  and for each library listed, e.g., <comm
1948  $ dpkg -S libfoo.so.6  $ dpkg -S libfoo.so.6
1949  </screen>  </screen>
1950  <para>  <para>
1951  Then you just take <literal>-dev</literal> version of every package as  Then just take the <literal>-dev</literal> version of every package as a
1952  <literal>Build-Depends</literal> entry.  If you use <command>ldd</command> for  <literal>Build-Depends</literal> entry.  If you use <command>ldd</command> for
1953  this purpose, it will report indirect lib dependencies as well, resulting in  this purpose, it will report indirect lib dependencies as well, resulting in
1954  the problem of excessive build dependencies.  the problem of excessive build dependencies.
# Line 1661  Manual</ulink> standards this package fo Line 1964  Manual</ulink> standards this package fo
1964  your package.  your package.
1965  </para>  </para>
1966  <para>  <para>
1967  On line 7 you can put the URL of the homepage for the upstream program.  On line 7 you can put the URL of the software's upstream homepage.
1968  </para>  </para>
1969  <para>  <para>
1970  Line 9 is the name of the binary package.  This is usually the same as the name  Line 9 is the name of the binary package.  This is usually the same as the name
1971  of the source package, but it doesn't necessarily have to be that way.  of the source package, but it doesn't necessarily have to be that way.
1972  </para>  </para>
1973  <para>  <para>
1974  Line 10 describes the CPU architecture the binary package can be compiled for.  Line 10 describes the architectures the binary package can be compiled for.
1975  We'll leave this as <literal>any</literal> because <citerefentry>  This value is usually one of the following depending
1976  <refentrytitle>dpkg-gencontrol</refentrytitle> <manvolnum>1</manvolnum>  on the type of the binary package.
1977  </citerefentry> will fill in the appropriate value for any machine this package  <footnote><para>See
1978  gets compiled on.  <ulink url="&policy-architecture;">Debian Policy Manual 5.6.8 "Architecture"</ulink>
1979    for exact details.
1980    </para></footnote>
1981    </para>
1982    <itemizedlist>
1983    <listitem><para><literal>Architecture: any</literal></para>
1984      <itemizedlist>
1985      <listitem><para>The generated binary package is an architecture dependent one
1986        usually in a compiled language.</para></listitem>
1987      </itemizedlist>
1988    </listitem>
1989    <listitem><para><literal>Architecture: all</literal></para>
1990      <itemizedlist>
1991      <listitem><para>The generated binary package is an architecture independent
1992        one usually consisting of text, images, or scripts in an interpreted
1993        language.</para></listitem>
1994      </itemizedlist>
1995    </listitem>
1996    </itemizedlist>
1997    <para>
1998    We leave line 10 as is since this is written in C.
1999    <citerefentry><refentrytitle>dpkg-gencontrol</refentrytitle><manvolnum>1</manvolnum></citerefentry>
2000    will fill in the appropriate architecture value for any machine this source
2001    package gets compiled on.
2002  </para>  </para>
2003  <para>  <para>
2004  If your package is architecture independent (for example, a shell or Perl  If your package is architecture independent (for example, a shell or Perl
# Line 1691  Packages can relate to each other in var Line 2017  Packages can relate to each other in var
2017  </para>  </para>
2018  <para>  <para>
2019  The package management tools usually behave the same way when dealing with  The package management tools usually behave the same way when dealing with
2020  these relations; if not, it will be explained.  (see <citerefentry>  these relations; if not, it will be explained.  (See <citerefentry>
2021  <refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,  <refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,
2022  <citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>  <citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>
2023  </citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>  </citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>
2024  <manvolnum>8</manvolnum> </citerefentry>, <citerefentry>  <manvolnum>8</manvolnum> </citerefentry>, <citerefentry>
2025  <refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>
2026  </citerefentry> etc.)  </citerefentry>, etc.)
2027  </para>  </para>
2028  <para>  <para>
2029  Here is a simplified description of package relationships.  Here is a simplified description of package relationships.
2030  <footnote><para>See  <footnote><para>See
2031  <ulink url="&policy-relationships;">Debian Policy Manual, 7 'Declaring relationships between packages'</ulink>  <ulink url="&policy-relationships;">Debian Policy Manual, 7 "Declaring relationships between packages"</ulink>.
2032  </para></footnote>:  </para></footnote>
2033  </para>  </para>
2034  <itemizedlist>  <itemizedlist>
2035  <listitem>  <listitem>
# Line 1722  severe breakage) unless a particular pac Line 2048  severe breakage) unless a particular pac
2048  </para>  </para>
2049  <para>  <para>
2050  Use this for packages that are not strictly necessary but are typically used  Use this for packages that are not strictly necessary but are typically used
2051  with your program.  When a user installs your program, all frontends will  with your program.  When a user installs your program, all front-ends will
2052  likely prompt them to install the recommended packages.  probably prompt them to install the recommended packages.
2053  <command>aptitude</command> and <command>apt-get</command> install recommended  <command>aptitude</command> and <command>apt-get</command> install recommended
2054  packages along with your package (but the user can disable this default  packages along with your package by default (but the user can disable this
2055  behaviour).  <command>dpkg</command> will ignore this field.  behavior).  <command>dpkg</command> will ignore this field.
2056  </para>  </para>
2057  </listitem>  </listitem>
2058  <listitem>  <listitem>
# Line 1735  behaviour).  <command>dpkg</command> wil Line 2061  behaviour).  <command>dpkg</command> wil
2061  </para>  </para>
2062  <para>  <para>
2063  Use this for packages which will work nicely with your program but are not at  Use this for packages which will work nicely with your program but are not at
2064  all necessary.  When a user installs your program, all frontends will likely  all necessary.  When a user installs your program, they will probably not be
2065  prompt them to install the suggested packages.  <command>aptitude</command> can  prompted to install suggested packages.  <command>aptitude</command> can
2066  be configured to install suggested packages along with your package but this is  be configured to install suggested packages along with your package but this is
2067  not its default.  <command>dpkg</command> and <command>apt-get</command> will  not its default.  <command>dpkg</command> and <command>apt-get</command> will
2068  ignore this field.  ignore this field.
# Line 1769  severe problems if a particular package Line 2095  severe problems if a particular package
2095  <literal>Breaks</literal>  <literal>Breaks</literal>
2096  </para>  </para>
2097  <para>  <para>
2098  The package will be installed while all the listed packages will be broken.  When installed the package will break all the listed packages.
2099  Normally a <literal>Breaks</literal> entry has an earlier than version clause.  Normally a <literal>Breaks</literal> entry specifies that it applies to versions earlier than a certain value.
2100  The resolution is generally to upgrade the listed packages by the higher-level  The resolution is generally to use higher-level package management tools to upgrade the listed packages.
 package management tools.  
2101  </para>  </para>
2102  </listitem>  </listitem>
2103  <listitem>  <listitem>
# Line 1807  symbols). Line 2132  symbols).
2132  </para>  </para>
2133  <para>  <para>
2134  The fields may restrict their applicability to particular versions of each  The fields may restrict their applicability to particular versions of each
2135  named package.  These versions are listed in parentheses after each individual  named package.  The restriction of each individual package is listed in
2136  package name, and they should contain a relation from the list below followed  parentheses after its name, and should contain a relation from the list below
2137  by the version number.  The relations allowed are: <literal>&lt;&lt;</literal>,  followed by a version number value.
2138  <literal>&lt;=</literal>, <literal>=</literal>, <literal>&gt;=</literal> and  The relations allowed are: <literal>&lt;&lt;</literal>,
2139    <literal>&lt;=</literal>, <literal>=</literal>, <literal>&gt;=</literal>, and
2140  <literal>&gt;&gt;</literal> for strictly lower, lower or equal, exactly equal,  <literal>&gt;&gt;</literal> for strictly lower, lower or equal, exactly equal,
2141  greater or equal and strictly greater, respectively.  For example,  greater or equal, and strictly greater, respectively.  For example,
2142  </para>  </para>
2143  <screen>  <screen>
2144  Depends: foo (&gt;= 1.2), libbar1 (= 1.3.4)  Depends: foo (&gt;= 1.2), libbar1 (= 1.3.4)
# Line 1824  Replaces: quux (&lt;&lt; 5), quux-foo (& Line 2150  Replaces: quux (&lt;&lt; 5), quux-foo (&
2150  <para>  <para>
2151  The last feature you need to know about is  The last feature you need to know about is
2152  <literal>${shlibs:Depends}</literal>, <literal>${perl:Depends}</literal>,  <literal>${shlibs:Depends}</literal>, <literal>${perl:Depends}</literal>,
2153  <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.  
2154  </para>  </para>
2155  <para>  <para>
2156  <citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>  <citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>
2157  <manvolnum>1</manvolnum> </citerefentry> will scan it for binaries and  <manvolnum>1</manvolnum> </citerefentry> calculates shared library dependencies
2158  libraries determine their shared library dependencies and detect which packages  for binary packages.  It generates a list of <ulink url="&elf;">ELF</ulink> executables and shared
2159  they are in, such as <systemitem role="package">libc6</systemitem> or  libraries it has found for each binary package.  This list is used for
2160  <systemitem role="package">xlib6g</systemitem>, after your package has been  substituting <literal>${shlibs:Depends}</literal>.
2161  built and installed into the temporary directory.  This package list is used  </para>
2162  for substituting <literal>${shlibs:Depends}</literal>.  <para>
2163  </para>  <citerefentry> <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum>
2164  <para>  </citerefentry> calculates Perl dependencies.  It generates a list of a
2165  The package list generated by <citerefentry>  dependencies on <literal>perl</literal> or <literal>perlapi</literal> for each binary package.  This list is used for
2166  <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  substituting <literal>${perl:Depends}</literal>.
2167  is used for substituting <literal>${perl:Depends}</literal>.  </para>
2168  </para>  <para>
2169  <para>  Some <systemitem role="package">debhelper</systemitem> commands may cause the
2170  Some <systemitem role="package">debhelper</systemitem> commands may make the  generated package to depend on some additional packages.  All such commands
2171  generated package need to depend on some other packages.  This list of required  generate a list of required packages for each binary package.
2172  packages is used for substituting <literal>${misc:Depends}</literal>.  This list is used for substituting <literal>${misc:Depends}</literal>.
2173    </para>
2174    <para>
2175    <citerefentry> <refentrytitle>dh_gencontrol</refentrytitle>
2176    <manvolnum>1</manvolnum> </citerefentry> generates
2177    <filename>DEBIAN/control</filename> for each binary package while
2178    substituting <literal>${shlibs:Depends}</literal>,
2179    <literal>${perl:Depends}</literal>, <literal>${misc:Depends}</literal>, etc.
2180  </para>  </para>
2181  <para>  <para>
2182  Having said all that, we can leave the <literal>Depends</literal> field exactly  Having said all that, we can leave the <literal>Depends</literal> field exactly
2183  as it is now, and insert another line after it saying <literal>Suggests:  as it is now, and insert another line after it saying <literal>Suggests:
2184  file</literal>, because <systemitem role="package">gentoo</systemitem> can use  file</literal>, because <systemitem role="package">gentoo</systemitem> can use
2185  some features provided by that <systemitem role="package">file</systemitem>  some features provided by the <systemitem role="package">file</systemitem>
2186  package.  package.
2187  </para>  </para>
2188  <para> Line 9 is the Homepage URL.  Let's assume this to be at  <para> Line 9 is the Homepage URL.  Let's assume this to be at
2189  <ulink url="&gentoo;"/>.  <ulink url="&gentoo;"/>.
2190  </para>  </para>
2191  <para>  <para>
2192  Line 12 is the short description.  Most people screens are 80 columns wide so  Line 12 is the short description.  Terminals are conventionally 80 columns wide so
2193  this shouldn't be longer than about 60 characters.  I'll change it to  this shouldn't be longer than about 60 characters.  I'll change it to
2194  <literal>fully GUI-configurable, two-pane X file manager</literal>.  <literal>fully GUI-configurable, two-pane X file manager</literal>.
2195  </para>  </para>
# Line 1873  English.  Translations of these descript Line 2203  English.  Translations of these descript
2203  <ulink url="&ddtp;">The Debian Description Translation Project - DDTP</ulink>.</para></footnote>  <ulink url="&ddtp;">The Debian Description Translation Project - DDTP</ulink>.</para></footnote>
2204  </para>  </para>
2205  <para>  <para>
2206  Let's insert <literal>Vcs-*</literal> fields documented in <ulink url="&devref-bpp-vcs;">Developer's  We can insert <literal>Vcs-*</literal> fields to document the Version Control
2207  Reference, 6.2.5.  'Version Control System location'</ulink> between line 6 and  System (VCS) location between lines 6 and 7.
2208  7.  Let's assume that the <systemitem role="package">gentoo</systemitem>  <footnote><para>See
2209  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>.
2210    </para></footnote>
2211    Let's assume that the <systemitem role="package">gentoo</systemitem>
2212    package has its VCS located in the Debian Alioth Git Service at
2213  <literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.  <literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.
2214  </para>  </para>
2215  <para>  <para>
# Line 1904  Finally, here is the updated <filename>c Line 2237  Finally, here is the updated <filename>c
2237  19  they're fairly easy to work with since they are written in an XML format.  19  they're fairly easy to work with since they are written in an XML format.
2238  20  .  20  .
2239  21  gentoo features a fairly complex and powerful file identification system,  21  gentoo features a fairly complex and powerful file identification system,
2240  22  coupled to a object-oriented style system, which together give you a lot  22  coupled to an object-oriented style system, which together give you a lot
2241  23  of control over how files of different types are displayed and acted upon.  23  of control over how files of different types are displayed and acted upon.
2242  24  Additionally, over a hundred pixmap images are available for use in file  24  Additionally, over a hundred pixmap images are available for use in file
2243  25  type descriptions.  25  type descriptions.
2244  26  .  26  .
2245  29  gentoo was written from scratch in ANSI C, and it utilises the GTK+ toolkit  29  gentoo was written from scratch in ANSI C, and it utilizes the GTK+ toolkit
2246  30  for its interface.  30  for its interface.
2247  </screen>  </screen>
2248  <para>  <para>
2249  (I've added the line numbers.)  (I've added the line numbers.)
2250  </para>  </para>
2251  </section>  </section>
2252  <section id="copyright"><title><filename>copyright</filename> file</title>  <section id="copyright"><title><filename>copyright</filename></title>
2253  <para>  <para>
2254  This file contains the information about package upstream resources, copyright  This file contains information about the copyright and license of the upstream sources.
2255  and license information.  Its format is not dictated by the Debian Policy  <ulink url="&policy-copyright;">Debian Policy Manual, 12.5 "Copyright information"</ulink>
2256  Manual, but the content is (<ulink url="&policy-copyright;">Debian  dictates its content and
2257  Policy Manual, 12.5 'Copyright information'</ulink>).  You may also consult  <ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>
2258  <ulink url="&dep5;">DEP-5: Machine-parseable  provides guidelines for its format.
 debian/copyright</ulink>.  
2259  </para>  </para>
2260  <para>  <para>
2261  <command>dh_make</command> can give you a template  <command>dh_make</command> can give you a template
# Line 1931  debian/copyright</ulink>. Line 2263  debian/copyright</ulink>.
2263  gpl2</literal> option here to get a template file for the <systemitem role="package">gentoo</systemitem> package released under GPL-2.  gpl2</literal> option here to get a template file for the <systemitem role="package">gentoo</systemitem> package released under GPL-2.
2264  </para>  </para>
2265  <para>  <para>
2266  You must fill in missing information such as the place you got the package  You must fill in missing information to complete this file, such as the place you got the package
2267  from, the actual copyright notice and their license to complete this file.  For  from, the actual copyright notice, and the license.  For certain
2268  the common free software licenses such as GNU GPL-1, GNU GPL-2, GNU GPL-3,  common free software licenses (GNU GPL-1, GNU GPL-2, GNU GPL-3,
2269  LGPL-2, LGPL-2.1, LGPL-3, GNU FDL-1.2, GNU FDL-1.3, Apache-2.0 or the Artistic  LGPL-2, LGPL-2.1, LGPL-3, GNU FDL-1.2, GNU FDL-1.3, Apache-2.0, or the Artistic
2270  license, you can just refer to the appropriate file in  license), you can just refer to the appropriate file in the
2271  <filename>/usr/share/common-licenses/</filename> directory that exists on every  <filename>/usr/share/common-licenses/</filename> directory that exists on every
2272  Debian system.  Otherwise, you must include the complete license.  Debian system.  Otherwise, you must include the complete license.
2273  </para>  </para>
2274  <para>  <para>
2275  In short, here's how <systemitem role="package">gentoo</systemitem>'s  In short, here's what <systemitem role="package">gentoo</systemitem>'s
2276  <filename>copyright</filename> file should look like:  <filename>copyright</filename> file should look like:
2277  </para>  </para>
2278  <screen>  <screen>
# Line 1970  In short, here's how <systemitem role="p Line 2302  In short, here's how <systemitem role="p
2302  24  but WITHOUT ANY WARRANTY; without even the implied warranty of  24  but WITHOUT ANY WARRANTY; without even the implied warranty of
2303  25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2304  26  GNU General Public License for more details.  26  GNU General Public License for more details.
2305  27 .  27  .
2306  28  You should have received a copy of the GNU General Public License along  28  You should have received a copy of the GNU General Public License along
2307  29  with this program; if not, write to the Free Software Foundation, Inc.,  29  with this program; if not, write to the Free Software Foundation, Inc.,
2308  30  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  30  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Line 1983  In short, here's how <systemitem role="p Line 2315  In short, here's how <systemitem role="p
2315  (I've added the line numbers.)  (I've added the line numbers.)
2316  </para>  </para>
2317  <para>  <para>
2318  Please follow the HOWTO provided by ftpmasters and sent to  Please follow the HOWTO provided by the ftpmasters and sent to
2319  debian-devel-announce: <ulink url="&howto-copyright;"/>.  debian-devel-announce: <ulink url="&howto-copyright;"/>.
2320  </para>  </para>
2321  </section>  </section>
2322  <section id="changelog"><title><filename>changelog</filename> file</title>  <section id="changelog"><title><filename>changelog</filename></title>
2323  <para>  <para>
2324  This is a required file, which has a special format described in the <ulink url="&policy-dpkgchangelog;">Debian  This is a required file, which has a special format described in
2325  Policy Manual, 4.4 'debian/changelog'</ulink>.  This format is used by  <ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 "debian/changelog"</ulink>.
2326  <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
2327  revision, distribution and urgency of your package.  version number, revision, distribution, and urgency of your package.
2328  </para>  </para>
2329  <para>  <para>
2330  For you, it is also important, since it is good to have documented all changes  For you, it is also important, since it is good to have documented all changes
# Line 2002  saved as <filename>/usr/share/doc/gentoo Line 2334  saved as <filename>/usr/share/doc/gentoo
2334  binary package.  binary package.
2335  </para>  </para>
2336  <para>  <para>
2337  <command>dh_make</command> created a default one, and this is how it looks  <command>dh_make</command> created a default one, and this is what it looks
2338  like:  like:
2339  </para>  </para>
2340  <screen>  <screen>
# Line 2018  like: Line 2350  like:
2350  </para>  </para>
2351  <para>  <para>
2352  Line 1 is the package name, version, distribution, and urgency.  The name must  Line 1 is the package name, version, distribution, and urgency.  The name must
2353  match the source package name, distribution should be either  match the source package name; distribution should be
2354  <literal>unstable</literal> (or even <literal>experimental</literal>)  <literal>unstable</literal> (or even <literal>experimental</literal>)
2355  <footnote><para> Some people use invalid distribution values such as  <footnote><para> Some people use invalid distribution values such as
2356  <literal>UNRELEASED</literal> to prevent a package to be accidentally uploaded  <literal>UNRELEASED</literal> to prevent a package being accidentally uploaded
2357  when updating a package in a shared VCS.  </para> </footnote>, and urgency  when updating a package in a shared VCS.  </para> </footnote>, and urgency
2358  shouldn't be changed to anything higher than <literal>low</literal>.  :-)  shouldn't be changed to anything higher than <literal>low</literal>.  :-)
2359  </para>  </para>
2360  <para>  <para>
2361  Lines 3-5 are a log entry, where you document changes made in this package  Lines 3-5 are a log entry, where you document changes made in this package
2362  revision (not the upstream changes - there is special file for that purpose,  revision (not the upstream changes - there is a special file for that purpose,
2363  created by the upstream authors, which you will later install as  created by the upstream authors, which you will later install as
2364  <filename>/usr/share/doc/gentoo/changelog.gz</filename>).  Let's assume your  <filename>/usr/share/doc/gentoo/changelog.gz</filename>).  Let's assume your
2365  ITP (Intent To Package) bug report number was <literal>12345</literal>.  New  ITP (Intent To Package) bug report number was <literal>12345</literal>.  New
2366  lines must be inserted just before the uppermost line that begins with  lines must be inserted just below the uppermost line that begins with
2367  <literal>*</literal> (asterisk).  You can do it with <citerefentry>  <literal>*</literal> (asterisk).  You can do it with <citerefentry>
2368  <refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or  <refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or
2369  manually with a text editor.  manually with a text editor.
# Line 2054  You will end up with something like this Line 2386  You will end up with something like this
2386  </para>  </para>
2387  <para>  <para>
2388  You can read more about updating the <filename>changelog</filename> file later  You can read more about updating the <filename>changelog</filename> file later
2389  in <xref linkend="update"/> .  in <xref linkend="update"/>.
2390  </para>  </para>
2391  </section>  </section>
2392  <section id="rules"><title><filename>rules</filename> file</title>  <section id="rules"><title><filename>rules</filename></title>
2393  <para>  <para>
2394  Now we need to take a look at the exact rules which <citerefentry>  Now we need to take a look at the exact rules which <citerefentry>
2395  <refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>
2396  </citerefentry> will use to actually create the package.  This file is actually  </citerefentry> will use to actually create the package.  This file is in fact
2397  another <filename>Makefile</filename>, but different from the one(s) in the  another <filename>Makefile</filename>, but different from the one(s) in the
2398  upstream source.  Unlike other files in <filename>debian</filename>, this one  upstream source.  Unlike other files in <filename>debian</filename>, this one
2399  is marked as executable.  is marked as executable.
2400  </para>  </para>
2401  <section id="targets"><title>Targets of <filename>rules</filename> file</title>  <section id="targets"><title>Targets of the <filename>rules</filename> file</title>
2402  <para>  <para>
2403  Every <filename>rules</filename> file, as any other  Every <filename>rules</filename> file, like any other
2404  <filename>Makefile</filename>, consists of several targets and their rules  <filename>Makefile</filename>, consists of several rules, each of
2405  specifying how to handle the source.  <ulink url="&policy-debianrules;">Debian  which defines a target and how it is carried out.
2406  Policy Manual, 4.9 'Main building script: debian/rules'</ulink> explains its  <footnote><para>You can start learning how to write <filename>Makefile</filename> from
2407  details.  <ulink url="&debref-make;">Debian Reference, 12.2. "Make"</ulink>.
2408    The full documentation is available as
2409    <ulink url="&gnu-make;"></ulink> or as the
2410    <systemitem role="package">make-doc</systemitem> package in the <literal>non-free</literal> archive area.
2411    </para></footnote>
2412    A new rule begins with its target declaration in the first column.  The
2413    following lines beginning with the TAB code (ASCII 9) specify the recipe for
2414    carrying out that target.
2415    Empty lines and lines beginning with <literal>#</literal> (hash) are treated as
2416    comments and ignored.
2417    <footnote><para><ulink url="&policy-debianrules;">Debian
2418    Policy Manual, 4.9 "Main building script: debian/rules"</ulink> explains the
2419    details.</para></footnote>
2420    </para>
2421    <para>
2422    A rule that you want to execute is invoked by its target name as a command line argument.  For
2423    example, <literal>debian/rules <replaceable>build</replaceable></literal> and
2424    <literal>fakeroot make -f debian/rules <replaceable>binary</replaceable></literal>
2425    execute rules for <literal><replaceable>build</replaceable></literal> and
2426    <literal><replaceable>binary</replaceable></literal> targets respectively.
2427  </para>  </para>
2428  <para>  <para>
2429  The simplified explanation of targets are the following.  Here is a simplified explanation of the targets:
2430  </para>  </para>
2431  <itemizedlist>  <itemizedlist>
2432  <listitem>  <listitem>
2433  <para>  <para>
2434  <literal>clean</literal> target: to clean all compiled, generated, and useless  <literal>clean</literal> target: to clean all compiled, generated, and useless
2435  files in the build-tree.  (required)  files in the build-tree.  (Required)
2436  </para>  </para>
2437  </listitem>  </listitem>
2438  <listitem>  <listitem>
2439  <para>  <para>
2440  <literal>build</literal> target: to build the source into compiled programs and  <literal>build</literal> target: to build the source into compiled programs and
2441  formatted documents in the build-tree.  (required)  formatted documents in the build-tree.  (Required)
2442  </para>  </para>
2443  </listitem>  </listitem>
2444  <listitem>  <listitem>
# Line 2095  formatted documents in the build-tree. Line 2446  formatted documents in the build-tree.
2446  <literal>install</literal> target: to install files into a file tree for each  <literal>install</literal> target: to install files into a file tree for each
2447  binary package under the <filename>debian</filename> directory.  If defined,  binary package under the <filename>debian</filename> directory.  If defined,
2448  <literal>binary*</literal> targets effectively depend on this target.  <literal>binary*</literal> targets effectively depend on this target.
2449  (optional)  (Optional)
2450  </para>  </para>
2451  </listitem>  </listitem>
2452  <listitem>  <listitem>
2453  <para>  <para>
2454  <literal>binary</literal> target: to create all binary packages (effectively  <literal>binary</literal> target: to create all binary packages (effectively
2455  combination of <literal>binary-arch</literal> and  a combination of <literal>binary-arch</literal> and
2456  <literal>binary-indep</literal> targets).  (required)<footnote><para> This  <literal>binary-indep</literal> targets).  (Required)<footnote><para> This
2457  target is used by <literal>dpkg-buildpackage</literal> as in <xref linkend="completebuild"/> .  </para> </footnote>  target is used by <literal>dpkg-buildpackage</literal> as in <xref linkend="completebuild"/>.  </para> </footnote>
2458  </para>  </para>
2459  </listitem>  </listitem>
2460  <listitem>  <listitem>
2461  <para>  <para>
2462  <literal>binary-arch</literal> target: to create arch-dependent  <literal>binary-arch</literal> target: to create arch-dependent
2463  (<literal>Architecture: any</literal>) binary packages in the parent directory.  (<literal>Architecture: any</literal>) binary packages in the parent directory.
2464  (required)<footnote><para> This target is used by <literal>dpkg-buildpackage  (Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
2465  -B</literal> as in <xref linkend="autobuilder"/> .  </para> </footnote>  -B</literal> as in <xref linkend="autobuilder"/>.  </para> </footnote>
2466  </para>  </para>
2467  </listitem>  </listitem>
2468  <listitem>  <listitem>
2469  <para>  <para>
2470  <literal>binary-indep</literal> target: to create arch-independent  <literal>binary-indep</literal> target: to create arch-independent
2471  (<literal>Architecture: all</literal>) binary packages in the parent directory.  (<literal>Architecture: all</literal>) binary packages in the parent directory.
2472  (required)<footnote><para> This target is used by <literal>dpkg-buildpackage  (Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
2473  -A</literal>.  </para> </footnote>  -A</literal>.  </para> </footnote>
2474  </para>  </para>
2475  </listitem>  </listitem>
2476  <listitem>  <listitem>
2477  <para>  <para>
2478  <literal>get-orig-source</literal> target: to obtain the most recent version of  <literal>get-orig-source</literal> target: to obtain the most recent version of
2479  the original source package from upstream archive site.  (optional)  the original source package from an upstream archive.  (Optional)
2480  </para>  </para>
2481  </listitem>  </listitem>
2482  </itemizedlist>  </itemizedlist>
2483  <para>  <para>
2484  Rules that you want to execute are invoked as command line arguments (for  You are probably overwhelmed by now, but things are much simpler upon examination of the
 example, <literal>./debian/rules build</literal> or <literal>fakeroot make -f  
 debian/rules binary</literal>).  After the target name, you can name the  
 dependency, program or file that the rule depends on.  After that, there can be  
 any number of commands, indented with  
 <literal><replaceable>TAB</replaceable></literal>.  A new rule begins with the  
 target declaration in the first column.  Empty lines and lines beginning with  
 <literal>#</literal> (hash) are treated as comments and ignored.  
 </para>  
 <para>  
 You are probably confused now, but it will all be clear upon examination of the  
2485  <filename>rules</filename> file that <command>dh_make</command> gives us as a  <filename>rules</filename> file that <command>dh_make</command> gives us as a
2486  default.  You should also read <literal>info make</literal> for more  default.
 information.  
2487  </para>  </para>
2488  </section>  </section>
2489  <section id="defaultrules"><title>Default <filename>rules</filename> file</title>  <section id="defaultrules"><title>Default <filename>rules</filename> file</title>
# Line 2168  Newer <command>dh_make</command> generat Line 2508  Newer <command>dh_make</command> generat
2508  </screen>  </screen>
2509  <para>  <para>
2510  (I've added the line numbers.  In the actual <filename>rules</filename> file,  (I've added the line numbers.  In the actual <filename>rules</filename> file,
2511  the leading white spaces are TAB codes.)  the leading spaces are a TAB code.)
2512  </para>  </para>
2513  <para>  <para>
2514  You are probably familiar with lines like line 1 from shell and Perl scripts.  You are probably familiar with lines like line 1 from shell and Perl scripts.
# Line 2176  It tells the operating system that this Line 2516  It tells the operating system that this
2516  <filename>/usr/bin/make</filename>.  <filename>/usr/bin/make</filename>.
2517  </para>  </para>
2518  <para>  <para>
2519  Line 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,
2520  Then, the <command>dh</command> command will output which  so that the <command>dh</command> command outputs which
2521  <command>dh_*</command> commands are executed by the <command>dh</command>  <command>dh_*</command> commands it is executing.
2522  command.  You can also add <literal>export DH_OPTIONS=-v</literal> line here.  You can also add a line <literal>export DH_OPTIONS=-v</literal> here,
2523  Then each <command>dh_*</command> command will output which commands are  so that each <command>dh_*</command> command outputs which commands it
2524  executed by each <command>dh_*</command> command.  This helps you to understand  is executing.  This helps you to understand
2525  what exactly is going on behind this simple <filename>rules</filename> file and  exactly what is going on behind this simple <filename>rules</filename> file and
2526  to debug its problems.  This new <command>dh</command> is a core part of the  to debug its problems.  This new <command>dh</command> is designed to form a core part of the
2527  <systemitem role="package">debhelper</systemitem> tools and does not hide  <systemitem role="package">debhelper</systemitem> tools, and not to hide
2528  anything from you.  anything from you.
2529  </para>  </para>
2530  <para>  <para>
2531  Lines 12 and 13 are where all the work is done.  The percent sign means any  Lines 12 and 13 are where all the work is done with an implicit rule using the pattern rule.  The percent sign means "any
2532  targets which then call a single program, <command>dh</command> with the target  targets", which then call a single program, <command>dh</command>, with the target
2533  name.  <footnote><para> This uses the new <systemitem role="package">debhelper</systemitem> V7 features.  Its design concepts are  name.  <footnote><para> This uses the new <systemitem role="package">debhelper</systemitem> v7 features.  Its design concepts are
2534  explained in <ulink url="&debhelper-slides;">Not Your  explained in <ulink url="&debhelper-slides;">Not Your
2535  Grandpa's Debhelper</ulink> presented at Debconf9 by the <systemitem role="package">debhelper</systemitem> upstream.  Under  Grandpa's Debhelper</ulink> presented at DebConf9 by the <systemitem role="package">debhelper</systemitem> upstream.  Under
2536  <literal>lenny</literal>, <command>dh_make</command> created a much more  <literal>lenny</literal>, <command>dh_make</command> created a much more
2537  complicated <filename>rules</filename> file with many <command>dh_*</command>  complicated <filename>rules</filename> file with explicit rules
2538  scripts listed for each required explicit targets and frozen them to the state  and many <command>dh_*</command> scripts listed for each one, most of
2539  when it was initially packaged.  This new <command>dh</command> command is  which are now unnecessary (and show the package's age). The new <command>dh</command> command is
2540  simpler and frees us from this constrain.  You still have full power to  simpler and frees us from doing the routine work "manually". You still have full power to
2541  customize this with <literal>override_dh_*</literal> targets.  See <xref linkend="customrules"/> .  It is based only on the <systemitem role="package">debhelper</systemitem> package and does not obfuscate the  customize the process with <literal>override_dh_*</literal> targets. See <xref linkend="customrules"/>.  It is based only on the <systemitem role="package">debhelper</systemitem> package and does not obfuscate the
2542  package building process like the <systemitem role="package">cdbs</systemitem>  package building process as the <systemitem role="package">cdbs</systemitem>
2543  package.  </para> </footnote> The <command>dh</command> command is a wrapper  package tends to.  </para> </footnote> The <command>dh</command> command is a wrapper
2544  script which runs appropriate sequences of <command>dh_*</command> programs  script which runs appropriate sequences of <command>dh_*</command> programs
2545  depending on its argument.  <footnote><para> You can verify actual sequences of  depending on its argument.  <footnote><para> You can verify the actual sequences of
2546  <command>dh_*</command> programs invoked for a given  <command>dh_*</command> programs invoked for a given
2547  <literal><replaceable>target</replaceable></literal> as <literal>dh --no-act  <literal><replaceable>target</replaceable></literal> without really running them by invoking <literal>dh --no-act
2548  <replaceable>target</replaceable></literal> or <literal>debian/rules --  <replaceable>target</replaceable></literal> or <literal>debian/rules --
2549  '--no-act <replaceable>target</replaceable>'</literal> without really running  '--no-act <replaceable>target</replaceable>'</literal>.  </para> </footnote>
 them.  </para> </footnote>  
2550  </para>  </para>
2551  <itemizedlist>  <itemizedlist>
2552  <listitem>  <listitem>
2553  <para>  <para>
2554  <literal>debian/rules clean</literal> runs <literal>dh clean</literal>; which  <literal>debian/rules clean</literal> runs <literal>dh clean</literal>, which
2555  in turn runs the following:  in turn runs the following:
2556  </para>  </para>
2557  <screen>  <screen>
# Line 2236  dh_auto_test Line 2575  dh_auto_test
2575  <listitem>  <listitem>
2576  <para>  <para>
2577  <literal>fakeroot debian/rules binary</literal> runs <literal>fakeroot dh  <literal>fakeroot debian/rules binary</literal> runs <literal>fakeroot dh
2578  binary</literal>; which in turn runs the following<footnote><para> This assumes  binary</literal>; which in turn runs the following<footnote><para>The following
2579  that the <systemitem role="package">python-support</systemitem> package is  example assumes your <filename>debian/compat</filename> has a value equal or
2580  installed on the system.  </para> </footnote>:  more than 9 to avoid invoking any python support commands automatically.
2581    </para>
2582    </footnote>:
2583  </para>  </para>
2584  <screen>  <screen>
2585  dh_testroot  dh_testroot
# Line 2256  dh_installdebconf Line 2597  dh_installdebconf
2597  dh_installemacsen  dh_installemacsen
2598  dh_installifupdown  dh_installifupdown
2599  dh_installinfo  dh_installinfo
 dh_pysupport  
2600  dh_installinit  dh_installinit
2601  dh_installmenu  dh_installmenu
2602  dh_installmime  dh_installmime
# Line 2306  for each remaining command. Line 2646  for each remaining command.
2646  </listitem>  </listitem>
2647  </itemizedlist>  </itemizedlist>
2648  <para>  <para>
2649  The function of <command>dh_*</command> commands are almost self-evident from  The functions of <command>dh_*</command> commands are largely self-evident from
2650  their names.  <footnote><para> For complete information on what do all these  their names.  <footnote><para> For complete information on what all these
2651  <command>dh_*</command> scripts exactly do, and what their other options are,  <command>dh_*</command> scripts do exactly, and what their other options are,
2652  please read their respective manual pages and the <systemitem role="package">debhelper</systemitem> documentation.  </para> </footnote> There  please read their respective manual pages and the <systemitem role="package">debhelper</systemitem> documentation.  </para> </footnote> There
2653  are few notable ones worth making (over)simplified explanation here assuming  are a few notable ones that are worth giving (over)simplified explanations here assuming
2654  typical build environment based on <filename>Makefile</filename>.  a typical build environment based on a <filename>Makefile</filename>.
2655  <footnote><para> These commands support other build environments such as  <footnote><para> These commands support other build environments such as
2656  <filename>setup.py</filename> which can be listed by executing  <filename>setup.py</filename> which can be listed by executing
2657  <literal>dh_auto_build --list</literal> in a package source directory.  </para>  <literal>dh_auto_build --list</literal> in a package source directory.  </para>
# Line 2320  typical build environment based on <file Line 2660  typical build environment based on <file
2660  <itemizedlist>  <itemizedlist>
2661  <listitem>  <listitem>
2662  <para>  <para>
2663  <command>dh_auto_clean</command> usually executes the following if  <command>dh_auto_clean</command> usually executes the following if a
2664  <filename>Makefile</filename> exists with the <literal>distclean</literal>  <filename>Makefile</filename> exists with the <literal>distclean</literal>
2665  target.  <footnote><para> It actually looks for the first available target of  target.  <footnote><para> It actually looks for the first available target
2666  <literal>distclean</literal>, <literal>realclean</literal> or  in the <filename>Makefile</filename> out of
2667  <literal>clean</literal> in <filename>Makefile</filename> and execute it.  <literal>distclean</literal>, <literal>realclean</literal>, or
2668    <literal>clean</literal>, and executes that.
2669  </para> </footnote>  </para> </footnote>
2670  </para>  </para>
2671  <screen>  <screen>
# Line 2352  make Line 2693  make
2693  </listitem>  </listitem>
2694  <listitem>  <listitem>
2695  <para>  <para>
2696  <command>dh_auto_test</command> usually executes the following if  <command>dh_auto_test</command> usually executes the following if a
2697  <filename>Makefile</filename> exists with the <literal>test</literal> target.  <filename>Makefile</filename> exists with the <literal>test</literal> target.
2698  <footnote><para> It actually looks for the first available target of  <footnote><para> It actually looks for the first available target in
2699  <literal>test</literal> or <literal>check</literal> in  the <filename>Makefile</filename> out of <literal>test</literal> or
2700  <filename>Makefile</filename> and execute it.  </para> </footnote>  <literal>check</literal>, and executes that.</para> </footnote>
2701  </para>  </para>
2702  <screen>  <screen>
2703  make test  make test
# Line 2364  make test Line 2705  make test
2705  </listitem>  </listitem>
2706  <listitem>  <listitem>
2707  <para>  <para>
2708  <command>dh_auto_install</command> usually executes the following if  <command>dh_auto_install</command> usually executes the following if a
2709  <filename>Makefile</filename> exists with the <literal>install</literal> target  <filename>Makefile</filename> exists with the <literal>install</literal> target
2710  (line folded for readability).  (line folded for readability).
2711  </para>  </para>
# Line 2375  make install \ Line 2716  make install \
2716  </listitem>  </listitem>
2717  </itemizedlist>  </itemizedlist>
2718  <para>  <para>
2719  Targets which require the <command>fakeroot</command> command contain  All targets which require the <command>fakeroot</command> command will contain
2720  <command>dh_testroot</command>.  If you are not pretending to be root using  <command>dh_testroot</command>, which exits with an error if you are not
2721  this command, it exits with an error.  using this command to pretend to be root.
2722  </para>  </para>
2723  <para>  <para>
2724  The important part to know about the <filename>rules</filename> file created by  The important part to know about the <filename>rules</filename> file created by
2725  <command>dh_make</command>, is that it is just a suggestion.  It will work for  <command>dh_make</command> is that it is just a suggestion.  It will work for
2726  most packages but for more complicated ones, don't be afraid to customize it to  most packages but for more complicated ones, don't be afraid to customize it to
2727  fit your needs.  Only things that you must not change are the names of the  fit your needs.
 rules, because all the tools use these names, as mandated by the Debian Policy.  
2728  </para>  </para>
2729  <para>  <para>
2730  Although <literal>install</literal> is not required target, it is supported.  Although <literal>install</literal> is not a required target, it is supported.
2731  <literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh  <literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh
2732  binary</literal> but stops after <command>dh_fixperms</command>.  binary</literal> but stops after <command>dh_fixperms</command>.
2733  </para>  </para>
# Line 2401  with the new <command>dh</command> comma Line 2741  with the new <command>dh</command> comma
2741  The <literal>dh $@</literal> command can be customized as follows.  The <literal>dh $@</literal> command can be customized as follows.
2742  <footnote><para> If a package installs the  <footnote><para> If a package installs the
2743  <filename>/usr/share/perl5/Debian/Debhelper/Sequence/<replaceable>custom_name</replaceable>.pm</filename>  <filename>/usr/share/perl5/Debian/Debhelper/Sequence/<replaceable>custom_name</replaceable>.pm</filename>
2744  file, you should activate its customization function by <literal>dh --with  file, you should activate its customization function by <literal>dh $@ --with
2745  <replaceable>custom-name</replaceable> $@</literal>.  </para> </footnote>  <replaceable>custom-name</replaceable></literal>.  </para> </footnote>
2746    </para>
2747    <itemizedlist>
2748    <listitem>
2749    <para>
2750    Add support for the <command>dh_python2</command> command.  (The best choice
2751    for Python.) <footnote><para> Use of the <command>dh_python2</command> command
2752    is preferred over use of <command>dh_pysupport</command> or
2753    <command>dh_pycentral</command> commands.  Do not use the
2754    <command>dh_python</command> command.  </para> </footnote>
2755  </para>  </para>
2756  <itemizedlist>  <itemizedlist>
2757  <listitem>  <listitem>
2758  <para>  <para>
2759  Add support of the <command>dh_pysupport</command> command.  (The best choice  Include the <systemitem role="package">python</systemitem> package in
2760  for Python.) <footnote><para> Use of the <command>dh_pysupport</command>  <literal>Build-Depends</literal>.
2761  command is preferred over use of the <command>dh_pycentral</command> command.  </para>
2762  Do not use the <command>dh_python</command> command.  </para> </footnote>  </listitem>
2763    <listitem>
2764    <para>
2765    Use <literal>dh $@ --with python2</literal>.
2766    </para>
2767    </listitem>
2768    <listitem>
2769    <para>
2770    This handles Python modules using the <systemitem role="package">python</systemitem> framework.
2771    </para>
2772    </listitem>
2773    </itemizedlist>
2774    </listitem>
2775    <listitem>
2776    <para>
2777    Add support for the <command>dh_pysupport</command> command. (deprecated)
2778  </para>  </para>
2779  <itemizedlist>  <itemizedlist>
2780  <listitem>  <listitem>
2781  <para>  <para>
2782  Install the <systemitem role="package">python-support</systemitem> package in  Include the <systemitem role="package">python-support</systemitem> package in
2783  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2784  </para>  </para>
2785  </listitem>  </listitem>
2786  <listitem>  <listitem>
2787  <para>  <para>
2788  Use <literal>dh $@</literal> as usual.  (This is enabled by default)  Use <literal>dh $@ --with pysupport</literal>.
2789  </para>  </para>
2790  </listitem>  </listitem>
2791  <listitem>  <listitem>
# Line 2433  This handles Python modules using the <s Line 2797  This handles Python modules using the <s
2797  </listitem>  </listitem>
2798  <listitem>  <listitem>
2799  <para>  <para>
2800  Add support of the <command>dh_pycentral</command> command.  Add support for the <command>dh_pycentral</command> command. (deprecated)
2801  </para>  </para>
2802  <itemizedlist>  <itemizedlist>
2803  <listitem>  <listitem>
2804  <para>  <para>
2805  Install the <systemitem role="package">python-central</systemitem> package in  Include the <systemitem role="package">python-central</systemitem> package in
2806  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2807  </para>  </para>
2808  </listitem>  </listitem>
2809  <listitem>  <listitem>
2810  <para>  <para>
2811  Use <literal>dh --with python-central $@</literal> instead.  Use <literal>dh $@ --with python-central</literal> instead.
2812  </para>  </para>
2813  </listitem>  </listitem>
2814  <listitem>  <listitem>
# Line 2461  This handles Python modules using the <s Line 2825  This handles Python modules using the <s
2825  </listitem>  </listitem>
2826  <listitem>  <listitem>
2827  <para>  <para>
2828  Add support of the <command>dh_installtex</command> command.  Add support for the <command>dh_installtex</command> command.
2829  </para>  </para>
2830  <itemizedlist>  <itemizedlist>
2831  <listitem>  <listitem>
2832  <para>  <para>
2833  Install the <systemitem role="package">tex-common</systemitem> package in  Include the <systemitem role="package">tex-common</systemitem> package in
2834  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2835  </para>  </para>
2836  </listitem>  </listitem>
2837  <listitem>  <listitem>
2838  <para>  <para>
2839  Use <literal>dh --with tex $@</literal> instead.  Use <literal>dh $@ --with tex</literal> instead.
2840  </para>  </para>
2841  </listitem>  </listitem>
2842  <listitem>  <listitem>
2843  <para>  <para>
2844  This registers Type 1 fonts, hyphenation patterns, or formats with TeX.  This registers Type 1 fonts, hyphenation patterns, and formats with TeX.
2845  </para>  </para>
2846  </listitem>  </listitem>
2847  </itemizedlist>  </itemizedlist>
2848  </listitem>  </listitem>
2849  <listitem>  <listitem>
2850  <para>  <para>
2851  Add support of the <command>dh_quilt_patch</command> and  Add support for the <command>dh_quilt_patch</command> and
2852  <command>dh_quilt_unpatch</command> commands.  <command>dh_quilt_unpatch</command> commands.
2853  </para>  </para>
2854  <itemizedlist>  <itemizedlist>
2855  <listitem>  <listitem>
2856  <para>  <para>
2857  Install the <systemitem role="package">quilt</systemitem> package in  Include the <systemitem role="package">quilt</systemitem> package in
2858  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2859  </para>  </para>
2860  </listitem>  </listitem>
2861  <listitem>  <listitem>
2862  <para>  <para>
2863  Use <literal>dh --with quilt $@</literal> instead.  Use <literal>dh $@ --with quilt</literal> instead.
2864  </para>  </para>
2865  </listitem>  </listitem>
2866  <listitem>  <listitem>
2867  <para>  <para>
2868  This applies and un-applies patches to the upstream source from files in the  This applies and un-applies patches to the upstream source from files in the
2869  <filename>debian/patches</filename> directory for the <literal>1.0</literal>  <filename>debian/patches</filename> directory for a source package in the <literal>1.0</literal> format.
 source package.  
2870  </para>  </para>
2871  </listitem>  </listitem>
2872  <listitem>  <listitem>
2873  <para>  <para>
2874  This is not needed if you use the new <literal>3.0 (quilt)</literal> source  This is not needed if you use the new <literal>3.0 (quilt)</literal> source
2875  package.  package format.
2876  </para>  </para>
2877  </listitem>  </listitem>
2878  </itemizedlist>  </itemizedlist>
2879  </listitem>  </listitem>
2880  <listitem>  <listitem>
2881  <para>  <para>
2882  Add support of the <command>dh_dkms</command> command.  Add support for the <command>dh_dkms</command> command.
2883  </para>  </para>
2884  <itemizedlist>  <itemizedlist>
2885  <listitem>  <listitem>
2886  <para>  <para>
2887  Install the <systemitem role="package">dkms</systemitem> package in  Include the <systemitem role="package">dkms</systemitem> package in
2888  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2889  </para>  </para>
2890  </listitem>  </listitem>
2891  <listitem>  <listitem>
2892  <para>  <para>
2893  Use <literal>dh --with dkms $@</literal> instead.  Use <literal>dh $@ --with dkms</literal> instead.
2894  </para>  </para>
2895  </listitem>  </listitem>
2896  <listitem>  <listitem>
2897  <para>  <para>
2898  This correctly handles DKMS usage by the kernel module package.  This correctly handles DKMS usage by kernel module packages.
2899  </para>  </para>
2900  </listitem>  </listitem>
2901  </itemizedlist>  </itemizedlist>
2902  </listitem>  </listitem>
2903  <listitem>  <listitem>
2904  <para>  <para>
2905  Add support of the <command>dh_autotools-dev_updateconfig</command> and  Add support for the <command>dh_autotools-dev_updateconfig</command> and
2906  <command>dh_autotools-dev_restoreconfig</command> commands.  <command>dh_autotools-dev_restoreconfig</command> commands.
2907  </para>  </para>
2908  <itemizedlist>  <itemizedlist>
2909  <listitem>  <listitem>
2910  <para>  <para>
2911  Install the <systemitem role="package">autotools-dev</systemitem> package in  Include the <systemitem role="package">autotools-dev</systemitem> package in
2912  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2913  </para>  </para>
2914  </listitem>  </listitem>
2915  <listitem>  <listitem>
2916  <para>  <para>
2917  Use <literal>dh --with autotools-dev $@</literal> instead.  Use <literal>dh $@ --with autotools-dev</literal> instead.
2918  </para>  </para>
2919  </listitem>  </listitem>
2920  <listitem>  <listitem>
# Line 2564  This updates and restores <filename>conf Line 2927  This updates and restores <filename>conf
2927  </listitem>  </listitem>
2928  <listitem>  <listitem>
2929  <para>  <para>
2930  Add support of the <command>dh_autoreconf</command> and  Add support for the <command>dh_autoreconf</command> and
2931  <command>dh_autoreconf_clean</command> commands.  <command>dh_autoreconf_clean</command> commands.
2932  </para>  </para>
2933  <itemizedlist>  <itemizedlist>
2934  <listitem>  <listitem>
2935  <para>  <para>
2936  Install the <systemitem role="package">dh-autoreconf</systemitem> package in  Include the <systemitem role="package">dh-autoreconf</systemitem> package in
2937  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2938  </para>  </para>
2939  </listitem>  </listitem>
2940  <listitem>  <listitem>
2941  <para>  <para>
2942  Use <literal>dh --with autoreconf $@</literal> instead.  Use <literal>dh $@ --with autoreconf</literal> instead.
2943  </para>  </para>
2944  </listitem>  </listitem>
2945  <listitem>  <listitem>
# Line 2588  This updates the GNU Build System files Line 2951  This updates the GNU Build System files
2951  </listitem>  </listitem>
2952  <listitem>  <listitem>
2953  <para>  <para>
2954  Add support to the <command>bash</command> completion feature.  Add support for the <command>bash</command> completion feature.
2955  </para>  </para>
2956  <itemizedlist>  <itemizedlist>
2957  <listitem>  <listitem>
2958  <para>  <para>
2959  Install the <systemitem role="package">bash-completion</systemitem> package in  Includes the <systemitem role="package">bash-completion</systemitem> package in
2960  <literal>Build-Depends</literal>.  <literal>Build-Depends</literal>.
2961  </para>  </para>
2962  </listitem>  </listitem>
2963  <listitem>  <listitem>
2964  <para>  <para>
2965  Use <literal>dh --with bash-completion $@</literal> instead.  Use <literal>dh $@ --with bash-completion</literal> instead.
2966  </para>  </para>
2967  </listitem>  </listitem>
2968  <listitem>  <listitem>
2969  <para>  <para>
2970  This installs <command>bash</command> completions using configuration file at  This installs <command>bash</command> completions using a configuration file at
2971  <filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.  <filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.
2972  </para>  </para>
2973  </listitem>  </listitem>
# Line 2612  This installs <command>bash</command> co Line 2975  This installs <command>bash</command> co
2975  </listitem>  </listitem>
2976  </itemizedlist>  </itemizedlist>
2977  <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>  
2978  Many <command>dh_*</command> commands invoked by the new <command>dh</command>  Many <command>dh_*</command> commands invoked by the new <command>dh</command>
2979  command can be customized by the corresponding configuration files in the  command can be customized by the corresponding configuration files in the
2980  <filename>debian</filename> directory.  See <xref linkend="dother"/> and the  <filename>debian</filename> directory.  See <xref linkend="dother"/> and the
2981  manpage of each command for the customization of such features.  manpage of each command for the customization of such features.
2982  </para>  </para>
2983  <para>  <para>
2984  Some <command>dh_*</command> commands invoked by the new <command>dh</command>  You may need to run <command>dh_*</command> commands invoked via the new <command>dh</command>
2985  command may require you to run it with some arguments or to run additional  with added arguments, or to run additional commands with them, or to skip them.
2986  commands with them or to skip them.  For such cases, you create an  For such cases, you create an
2987  <literal>override_dh_<replaceable>foo</replaceable></literal> target with its  <literal>override_dh_<replaceable>foo</replaceable></literal> target with its
2988  rule in the <filename>rules</filename> file only for the  rule in the <filename>rules</filename> file defining an
2989    <literal>override_dh_<replaceable>foo</replaceable></literal> target for the
2990  <command>dh_<replaceable>foo</replaceable></command> command you want to  <command>dh_<replaceable>foo</replaceable></command> command you want to
2991  change.  It basically say <emphasis>run me instead</emphasis>.  change.  It basically says <emphasis>run me instead</emphasis>.
2992  <footnote><para> Under <literal>lenny</literal>, if you wanted to change the  <footnote><para> Under <literal>lenny</literal>, if you wanted to change the
2993  behavior of a <command>dh_*</command> script you found the relevant line in the  behavior of a <command>dh_*</command> script you found the relevant line in the
2994  <filename>rules</filename> file and adjusted it.  </para> </footnote>  <filename>rules</filename> file and adjusted it.  </para> </footnote>
2995  </para>  </para>
2996  <para>  <para>
2997  Please note that the <command>dh_auto_*</command> commands tend to do more than  Please note that the <command>dh_auto_*</command> commands tend to do more than
2998  what has been discussed as (over)simplified explanation to take care all the  what has been discussed in this (over)simplified explanation to take care of all the
2999  corner cases.  Use of simplified equivalent command instead of these in  corner cases.  It is a bad idea to use <literal>override_dh_*</literal> targets
3000  <literal>override_dh_*</literal> targets except the  to substitute simplified equivalent commands (except for the
3001  <literal>override_dh_auto_clean</literal> target is a bad idea since it may  <literal>override_dh_auto_clean</literal> target) since it may
3002  kill such <systemitem role="package">debhelper</systemitem>'s smart features.  bypass such smart <systemitem role="package">debhelper</systemitem> features.
3003  </para>  </para>
3004  <para>  <para>
3005  If you want to store the system configuration data for the <systemitem role="package">gentoo</systemitem> package in the  So, for instance, if you want to store system configuration data in the
3006  <filename>/etc/gentoo</filename> directory instead of the usual  <filename>/etc/gentoo</filename> directory instead of the usual
3007  <filename>/etc</filename> directory, you can override the default  <filename>/etc</filename> directory for the recent
3008    <systemitem role="package">gentoo</systemitem> package using Autotools, you can override the default
3009  <literal>--sysconfig=/etc</literal> argument given by the  <literal>--sysconfig=/etc</literal> argument given by the
3010  <command>dh_auto_configure</command> command to the  <command>dh_auto_configure</command> command to the
3011  <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 <ulink url="&gnu-build-system;">GNU build  
 system</ulink>, also known as the Autotools.  
 </para> </footnote>  
3012  </para>  </para>
3013  <screen>  <screen>
3014  override_dh_auto_configure:  override_dh_auto_configure:
# Line 2660  override_dh_auto_configure: Line 3017  override_dh_auto_configure:
3017  <para>  <para>
3018  The arguments given after <literal>--</literal> are appended to the default  The arguments given after <literal>--</literal> are appended to the default
3019  arguments of the auto-executed program to override them.  Using the  arguments of the auto-executed program to override them.  Using the
3020  <command>dh_auto_configure</command> command is better than the  <command>dh_auto_configure</command> command is better than directly invoking the
3021  <command>./configure</command> command here since it will only override the  <command>./configure</command> command here since it will only override the
3022  <literal>--sysconfig</literal> argument and keeps well intended other arguments  <literal>--sysconfig</literal> argument and retains any other, benign arguments
3023  to the <command>./configure</command> command.  to the <command>./configure</command> command.
3024  </para>  </para>
3025  <para>  <para>
3026  If <filename>Makefile</filename> of a source for <systemitem role="package">gentoo</systemitem> requires you to specify  If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> requires you to specify
3027  <literal>build</literal> as its target to build it <footnote><para>  <literal>build</literal> as its target to build it <footnote><para>
3028  <command>dh_auto_build</command> without any arguments will execute the first  <command>dh_auto_build</command> without any arguments will execute the first
3029  target in the <filename>Makefile</filename> file.  </para> </footnote>, you  target in the <filename>Makefile</filename>.  </para> </footnote>, you
3030  create an <literal>override_dh_auto_build</literal> target to enable it.  create an <literal>override_dh_auto_build</literal> target to enable this.
3031  </para>  </para>
3032  <screen>  <screen>
3033  override_dh_auto_build:  override_dh_auto_build:
3034          dh_auto_build -- build          dh_auto_build -- build
3035  </screen>  </screen>
3036  <para>  <para>
3037  This ensures to run $(MAKE) with all the default arguments given by the  This ensures <literal>$(MAKE)</literal> is run with all the default arguments given by the
3038  <command>dh_auto_build</command> command and <literal>build</literal> argument.  <command>dh_auto_build</command> command plus the <literal>build</literal> argument.
3039  </para>  </para>
3040  <para>  <para>
3041  If <filename>Makefile</filename> of a source for <systemitem role="package">gentoo</systemitem> requires you to specify the  If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> requires you to specify the
3042  <literal>packageclean</literal> target to clean it for Debian package instead  <literal>packageclean</literal> target to clean it for the Debian package instead
3043  of the <literal>distclean</literal> or <literal>clean</literal> targets in the  of using <literal>distclean</literal> or <literal>clean</literal> targets,
3044  <filename>Makefile</filename> file, you create an  you can create an
3045  <literal>override_dh_auto_clean</literal> target to enable it.  <literal>override_dh_auto_clean</literal> target to enable thit.
3046  </para>  </para>
3047  <screen>  <screen>
3048  override_dh_auto_clean:  override_dh_auto_clean:
3049          $(MAKE) packageclean          $(MAKE) packageclean
3050  </screen>  </screen>
3051  <para>  <para>
3052  If <filename>Makefile</filename> of a source for <systemitem role="package">gentoo</systemitem> contains <literal>test</literal> target  If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> contains a <literal>test</literal> target
3053  which you do not want to run for the Debian package building process, you can  which you do not want to run for the Debian package building process, you can
3054  use empty <literal>override_dh_auto_test</literal> target to skip it.  use an empty <literal>override_dh_auto_test</literal> target to skip it.
3055  </para>  </para>
3056  <screen>  <screen>
3057  override_dh_auto_test:  override_dh_auto_test:
# Line 2706  changelog file called <filename>FIXES</f Line 3063  changelog file called <filename>FIXES</f
3063  The <command>dh_installchangelogs</command> command requires  The <command>dh_installchangelogs</command> command requires
3064  <filename>FIXES</filename> as its argument to install it.  <footnote><para> The  <filename>FIXES</filename> as its argument to install it.  <footnote><para> The
3065  <filename>debian/changelog</filename> and <filename>debian/NEWS</filename>  <filename>debian/changelog</filename> and <filename>debian/NEWS</filename>
3066  files are always automatically installed.  The upstream changelog is searched  files are always automatically installed.  The upstream changelog is found
3067  by converting filenames to the lower case and matching them with the  by converting filenames to lower case and matching them against
3068  <filename>changelog</filename>, <filename>changes</filename>,  <filename>changelog</filename>, <filename>changes</filename>,
3069  <filename>changelog.txt</filename>, and <filename>changes.txt</filename>.  <filename>changelog.txt</filename>, and <filename>changes.txt</filename>.
3070  </para> </footnote>  </para> </footnote>
# Line 2718  override_dh_installchangelogs: Line 3075  override_dh_installchangelogs:
3075  </screen>  </screen>
3076  <para>  <para>
3077  When you use the new <command>dh</command> command, use of explicit targets  When you use the new <command>dh</command> command, use of explicit targets
3078  such as the ones listed in <xref linkend="targets"/> except  such as the ones listed in <xref linkend="targets"/>, other than the
3079  <literal>get-orig-source</literal> target may make it difficult to understand  <literal>get-orig-source</literal> target, may make it difficult to understand
3080  their exact effects.  Please limit explicit targets to  their exact effects.  Please limit explicit targets to
3081  <literal>override_dh_*</literal> targets and completely independent ones, if  <literal>override_dh_*</literal> targets and completely independent ones, if
3082  possible.  possible.
# Line 2731  possible. Line 3088  possible.
3088  <para>  <para>
3089  To control most of what <systemitem role="package">debhelper</systemitem> does  To control most of what <systemitem role="package">debhelper</systemitem> does
3090  while building the package, you put optional configuration files under the  while building the package, you put optional configuration files under the
3091  <filename>debian</filename> directory.  This chapter will make an overview of  <filename>debian</filename> directory.  This chapter will provide an overview of
3092  what each of these does and its format.  Please read <ulink url="&debian-policy;">Debian Policy  what each of these does and its format.  Please read the <ulink url="&debian-policy;">Debian Policy
3093  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's
3094  Reference</ulink> for guidelines for the packaging.  Reference</ulink> for guidelines for packaging.
3095  </para>  </para>
3096  <para>  <para>
3097  The <command>dh_make</command> command will create some template configuration  The <command>dh_make</command> command will create some template configuration
# Line 2743  filenames suffixed by <literal>.ex</lite Line 3100  filenames suffixed by <literal>.ex</lite
3100  prefixed by the binary package name such as  prefixed by the binary package name such as
3101  <literal><replaceable>package</replaceable></literal>.  Take a look at all of  <literal><replaceable>package</replaceable></literal>.  Take a look at all of
3102  them.  them.
3103    <footnote><para>
3104    In this chapter, files in the <filename>debian</filename> directory are
3105    referred to without the leading <filename>debian/</filename> for simplicity whenever
3106    the meaning is obvious.
3107    </para></footnote>
3108  </para>  </para>
3109  <para>  <para>
3110  The <command>dh_make</command> command may not create some template  Some template configuration files for <systemitem role="package">debhelper</systemitem>
3111  configuration files for <systemitem role="package">debhelper</systemitem>.  In  may not be created by the <command>dh_make</command> command.  In
3112  such cases, you need to create them with the editor.  such cases, you need to create them with an editor.
3113  </para>  </para>
3114  <para>  <para>
3115  If you wish or need to activate any of those, please do the following.  If you wish or need to activate any of these, please do the following:
3116  </para>  </para>
3117  <itemizedlist>  <itemizedlist>
3118  <listitem>  <listitem>
3119  <para>  <para>
3120  rename template files by removing the <literal>.ex</literal> or  rename template files by removing the <literal>.ex</literal> or
3121  <literal>.EX</literal> suffix if the template files have one.  <literal>.EX</literal> suffix if they have one;
3122  </para>  </para>
3123  </listitem>  </listitem>
3124  <listitem>  <listitem>
3125  <para>  <para>
3126  rename the name of these configuration files using the actual binary package  rename the configuration files to use the actual binary package
3127  name in place of <literal><replaceable>package</replaceable></literal>.  name in place of <literal><replaceable>package</replaceable></literal>;
3128  </para>  </para>
3129  </listitem>  </listitem>
3130  <listitem>  <listitem>
3131  <para>  <para>
3132  modify template file contents to suit your needs.  modify template file contents to suit your needs;
3133  </para>  </para>
3134  </listitem>  </listitem>
3135  <listitem>  <listitem>
3136  <para>  <para>
3137  remove template files which you do not need.  remove template files which you do not need;
3138  </para>  </para>
3139  </listitem>  </listitem>
3140  <listitem>  <listitem>
3141  <para>  <para>
3142  modify the <filename>control</filename> file (see <xref linkend="control"/> ),  modify the <filename>control</filename> file (see <xref linkend="control"/>),
3143  if necessary.  if necessary;
3144  </para>  </para>
3145  </listitem>  </listitem>
3146  <listitem>  <listitem>
3147  <para>  <para>
3148  modify the <filename>rules</filename> file (see <xref linkend="rules"/> ), if  modify the <filename>rules</filename> file (see <xref linkend="rules"/>), if
3149  necessary.  necessary.
3150  </para>  </para>
3151  </listitem>  </listitem>
3152  </itemizedlist>  </itemizedlist>
3153  <para>  <para>
3154  Those <systemitem role="package">debhelper</systemitem> configuration files  Any <systemitem role="package">debhelper</systemitem> configuration files
3155  without <filename><replaceable>package</replaceable></filename> prefix such as  without a <filename><replaceable>package</replaceable></filename> prefix, such as
3156  <filename>install</filename> apply to the first binary package.  When there are  <filename>install</filename>, apply to the first binary package.  When there are
3157  many binary packages, their configurations can be specified by prefixing their  many binary packages, their configurations can be specified by prefixing their
3158  name to their configuration filenames such as  name to their configuration filenames such as
3159  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3160  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3161  </para>  </para>
3162  <section id="readme"><title><filename>README.Debian</filename> file</title>  <section id="readme"><title><filename>README.Debian</filename></title>
3163  <para>  <para>
3164  Any extra details or discrepancies between the original package and your Debian  Any extra details or discrepancies between the original package and your Debian
3165  version should be documented here.  version should be documented here.
3166  </para>  </para>
3167  <para>  <para>
3168  <command>dh_make</command> created a default one, this is what it looks like:  <command>dh_make</command> created a default one; this is what it looks like:
3169  </para>  </para>
3170  <screen>  <screen>
3171  gentoo for Debian  gentoo for Debian
# Line 2817  If you have nothing to be documented, re Line 3179  If you have nothing to be documented, re
3179  </citerefentry>.  </citerefentry>.
3180  </para>  </para>
3181  </section>  </section>
3182  <section id="compat"><title><filename>compat</filename> file</title>  <section id="compat"><title><filename>compat</filename></title>
3183  <para>  <para>
3184  The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level.  Currently, you  The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level.  Currently, you
3185  should set it to the <systemitem role="package">debhelper</systemitem> V7 by  should set it to the <systemitem role="package">debhelper</systemitem> v7 as
3186  the following.  follows:
3187  </para>  </para>
3188  <screen>  <screen>
3189  $ echo 7 &gt; debian/compat  $ echo 7 &gt; debian/compat
3190  </screen>  </screen>
3191  </section>  </section>
3192  <section id="conffiles"><title><filename>conffiles</filename> file</title>  <section id="conffiles"><title><filename>conffiles</filename></title>
3193  <para>  <para>
3194  One of the most annoying things about software is when you spend a great deal  One of the most annoying things about software is when you spend a great deal
3195  of time and effort customizing a program, only to have an upgrade stomp all  of time and effort customizing a program, only to have an upgrade stomp all
3196  over your changes.  Debian solves this problem by marking such configuration files as conffiles.  over your changes.  Debian solves this problem by marking such configuration files as conffiles.
3197  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>
3198  <manvolnum>1</manvolnum> </citerefentry> and  <manvolnum>1</manvolnum> </citerefentry> and
3199  <ulink url="&policy-conffiles;">Debian Policy Manual 'D.2.5 Conffiles'</ulink>.  <ulink url="&policy-conffiles;">Debian Policy Manual "D.2.5 Conffiles"</ulink>.
3200  </para></footnote>  </para></footnote>
3201  When you upgrade a package, you'll be prompted whether you want to keep  When you upgrade a package, you'll be asked whether you want to keep
3202  your old configuration files or not.  your old configuration files or not.
3203  </para>  </para>
3204  <para>  <para>
3205  Since <systemitem role="package">debhelper</systemitem> V3, <citerefentry>  <citerefentry><refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>
3206  <refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>  </citerefentry> <emphasis>automatically</emphasis> flags any files under
 </citerefentry> will <emphasis>automatically</emphasis> flag any files under  
3207  the <filename>/etc</filename> directory as conffiles, so if your program only  the <filename>/etc</filename> directory as conffiles, so if your program only
3208  has conffiles there you do not need to specify them in this file.  For most  has conffiles there you do not need to specify them in this file.  For most
3209  package types, the only place there is (and should be conffiles) is under  package types, the only place conffiles should ever be is under
3210  <filename>/etc</filename> and so this file doesn't need to exist.  <filename>/etc</filename>, and so this file doesn't need to exist.
3211  </para>  </para>
3212  <para>  <para>
3213  If your program uses configuration files but also rewrites them on its own,  If your program uses configuration files but also rewrites them on its own,
3214  it's best not to make them as conffiles because <command>dpkg</command> will  it's best not to make them conffiles because <command>dpkg</command> will
3215  then prompt users to verify the changes all the time.  then prompt users to verify the changes all the time.
3216  </para>  </para>
3217  <para>  <para>
3218  If the program you're packaging requires every user to modify the configuration  If the program you're packaging requires every user to modify the configuration
3219  files in the <filename>/etc</filename> directory, there are 2 popular ways to  files in the <filename>/etc</filename> directory, there are two popular ways to
3220  make them not as conffiles to keep <command>dpkg</command> quiet.  arrange for them to not be conffiles, keeping <command>dpkg</command> quiet.
3221  </para>  </para>
3222  <itemizedlist>  <itemizedlist>
3223  <listitem>  <listitem>
3224  <para>  <para>
3225  You make a symlink under the <filename>/etc</filename> directory pointing to a  Create a symlink under the <filename>/etc</filename> directory pointing to a
3226  file under the <filename>/var</filename> directory generated by the  file under the <filename>/var</filename> directory generated by the
3227  <emphasis>maintainer scripts</emphasis>.  maintainer scripts.
3228  </para>  </para>
3229  </listitem>  </listitem>
3230  <listitem>  <listitem>
3231  <para>  <para>
3232  You make a file generated by the <emphasis>maintainer scripts</emphasis> under  Create a file generated by the maintainer scripts under the <filename>/etc</filename> directory.
 the <filename>/etc</filename> directory.  
3233  </para>  </para>
3234  </listitem>  </listitem>
3235  </itemizedlist>  </itemizedlist>
3236  <para>  <para>
3237  For more information on the <emphasis>maintainer scripts</emphasis>, see <xref linkend="maintscripts"/> .  For information on maintainer scripts, see <xref linkend="maintscripts"/>.
3238  </para>  </para>
3239  </section>  </section>
3240  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename> files</title>  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename></title>
3241  <para>  <para>
3242  If your package requires regularly scheduled tasks to operate properly, you can  If your package requires regularly scheduled tasks to operate properly, you can
3243  use this file to set it up.  You can either setup regular tasks that happen  use these files to set that up.  You can set up regular tasks that either happen
3244  hourly, daily, weekly or monthly or alternatively happen any other time that  hourly, daily, weekly, or monthly, or alternatively happen at any other time that
3245  you wish.  The filenames are:  you wish.  The filenames are:
3246  </para>  </para>
3247  <itemizedlist>  <itemizedlist>
3248  <listitem>  <listitem>
3249  <para>  <para>
3250  <filename>cron.hourly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.hourly</filename> - Installed as
3251  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>; run
3252  once an hour every hour.  once an hour.
3253  </para>  </para>
3254  </listitem>  </listitem>
3255  <listitem>  <listitem>
3256  <para>  <para>
3257  <filename>cron.daily</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.daily</filename> - Installed as
3258  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>; run
3259  once a day, usually early morning.  once a day.
3260  </para>  </para>
3261  </listitem>  </listitem>
3262  <listitem>  <listitem>
3263  <para>  <para>
3264  <filename>cron.weekly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.weekly</filename> - Installed as
3265  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>; run
3266  once a week, usually early Sunday morning.  once a week.
3267  </para>  </para>
3268  </listitem>  </listitem>
3269  <listitem>  <listitem>
3270  <para>  <para>
3271  <filename>cron.monthly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.monthly</filename> - Installed as
3272  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run
3273  once a month, usually early morning on the first of the month.  once a month.
3274  </para>  </para>
3275  </listitem>  </listitem>
3276  <listitem>  <listitem>
3277  <para>  <para>
3278  <filename>cron.d</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.d</filename> - Installed as
3279  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any
3280  other time  other time.
3281  </para>  </para>
3282  </listitem>  </listitem>
3283  </itemizedlist>  </itemizedlist>
3284  <para>  <para>
3285  For the named files, the format of them is the shell script.  The different one  Most of these files are shell scripts, with the exception of
3286  is <filename><replaceable>package</replaceable>.cron.d</filename> which follows  <filename><replaceable>package</replaceable>.cron.d</filename> which follows
3287  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>
3288  <manvolnum>5</manvolnum> </citerefentry>.  <manvolnum>5</manvolnum> </citerefentry>.
3289  </para>  </para>
3290  <para>  <para>
3291  Note that this doesn't include log rotation; for that, see <citerefentry>  No explicit <filename>cron.*</filename> file is needed to set up log rotation;
3292  <refentrytitle>dh_installlogrotate</refentrytitle> <manvolnum>1</manvolnum>  for that, see
3293  </citerefentry> and <citerefentry> <refentrytitle>logrotate</refentrytitle>  <citerefentry><refentrytitle>dh_installlogrotate</refentrytitle>
3294  <manvolnum>8</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum></citerefentry> and
3295    <citerefentry><refentrytitle>logrotate</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
3296  </para>  </para>
3297  </section>  </section>
3298  <section id="dirs"><title><filename>dirs</filename> file</title>  <section id="dirs"><title><filename>dirs</filename></title>
3299  <para>  <para>
3300  This file specifies the directories which we need but the normal installation  This file specifies any directories which we need but which are not created by the normal installation
3301  procedure (<literal>make install DESTDIR=...</literal> invoked by  procedure (<literal>make install DESTDIR=...</literal> invoked by
3302  <literal>dh_auto_install</literal>) somehow doesn't create.  This generally  <literal>dh_auto_install</literal>).  This generally
3303  means there is a problem with the <filename>Makefile</filename>.  means there is a problem with the <filename>Makefile</filename>.
3304  </para>  </para>
3305  <para>  <para>
3306  Files listed in the <filename>install</filename> file doesn't need the  Files listed in an <filename>install</filename> file don't need their
3307  directories created first.  See <xref linkend="install"/> .  directories created first.  See <xref linkend="install"/>.
3308  </para>  </para>
3309  <para>  <para>
3310  It is best to 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
3311  run into trouble.  There is no preceding slash on the directory names listed in  run into trouble.  There is no preceding slash on the directory names listed in
3312  the <filename>dirs</filename> file.  the <filename>dirs</filename> file.
3313  </para>  </para>