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

Diff of /manuals/trunk/maint-guide/maint-guide.sgml

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

revision 892 by joy, Fri Nov 12 16:19:02 1999 UTC revision 893 by joy, Fri Dec 24 14:58:14 1999 UTC
# Line 15  Line 15 
15     </author>     </author>
16    -->    -->
17    
18     <version>version 0.97, 27. September 1999.</version>     <version>version 0.98, 24. December 1999.</version>
19    
20     <copyright>     <copyright>
21     <copyrightsummary>Copyright &copy; 1998, 1999 Josip Rodin.</copyrightsummary>     <copyrightsummary>Copyright &copy; 1998, 1999 Josip Rodin.</copyrightsummary>
22    
23     <p>This document may used under the terms of any fully DFSG compliant     <p>This document may used under the terms the GNU General Public License
24     license, preferably GNU General Public License version 2+.     version 2 or higher.
25    
26     <p>With permission of their authors, I have used and modified portions     <p>This document was made using with these two documents as examples:
    of these two documents:  
27    
28     <p>Making a Debian Package (AKA the Debmake Manual), copyright &copy;     <p>Making a Debian Package (AKA the Debmake Manual), copyright &copy;
29     1997 Jaldhar Vyas <email/jaldhar@debian.org/.     1997 Jaldhar Vyas <email/jaldhar@debian.org/.
# Line 56  Line 55 
55    
56    <sect id="needprogs">Programs you need for development    <sect id="needprogs">Programs you need for development
57    
58    <p>Before you start anything, you should make sure that you properly install    <p>Before you start anything, you should make sure that you properly
59    some packages with <manref name="dpkg" section="8"> (ie. `dpkg -i package`,    install some additional packages with <manref name="dpkg" section="8">
60    or through some of the front-ends like dselect or apt).    (ie. `dpkg -i package`, or through some of the front-ends like dselect or
61    This document has been written while the 2.1 'slink' distribution was the    apt). Note that the list doesn't contain any packages marked `essential'
62    officially stable release of Debian, and the 2.2 'potato' was being    or `required' - we expect that you have those installed already.
63    created, thus the packages named here are mostly those from 'potato'.  
64      <p>This document has been written while the 2.1 'slink' distribution
65      was the officially stable release of Debian, and the 2.2 'potato' was
66      being created, thus the packages named here are mostly those from
67      'potato'.
68    
69    <p>Following packages come with standard installation of Debian 2.1, so    <p>Following packages come with standard installation of Debian 2.1, so
70    you probably have them (and additional packages they depend on) already.    you probably have them (and additional packages they depend on) already.
# Line 83  Line 86 
86    <item><em>file</em> - this handy program can determine what type a file is.    <item><em>file</em> - this handy program can determine what type a file is.
87    (see <manref name="file" section="1">)    (see <manref name="file" section="1">)
88    
   <item><em>fileutils</em> - the essential Linux utilities, like ls, chmod,  
   rm and others. (see `info --file /usr/info/fileutils.info.gz`)  
   
89    <item><em>gcc</em> - the GNU C compiler. Most Linux programs are written    <item><em>gcc</em> - the GNU C compiler. Most Linux programs are written
90    in C. However, if your program is written in some other programming    in C. However, if your program is written in some other programming
91    language, like C++, Fortran, Pascal, you should get g++, g77, or gpc,    language, like C++, Fortran, Pascal, you should get g++, g77, or gpc,
# Line 137  Line 137 
137    is necessary for some parts of the build process. (see    is necessary for some parts of the build process. (see
138    <manref name="fakeroot" section="1">)    <manref name="fakeroot" section="1">)
139    
140    <item><em>lintian</em> - this is a package checker, that can let you know    <item><em>lintian</em> - this is the Debian package checker, that can let
141    of any common mistakes after you build the package, and explain the    you know of any common mistakes after you build the package, and explain
142    errors found. (see <manref name="lintian" section="1">,    the errors found. (see <manref name="lintian" section="1">,
143    /usr/share/doc/lintian/lintian.html/index.html)    /usr/share/doc/lintian/lintian.html/index.html)
144    </list>    </list>
145    
# Line 277  Line 277 
277    
278    <p>So the first thing to do is to find and download the original package.    <p>So the first thing to do is to find and download the original package.
279    I presume that you already have the source file that you picked up at    I presume that you already have the source file that you picked up at
280    the author's homepage. Linux sources usually come in tar/gzip format,    the author's homepage. Sources for free Linux programs usually come in
281    with extension .tar.gz or .tgz, and usually contain the subdirectory    tar/gzip format, with extension .tar.gz, and usually contain the
282    called program-version and all the sources in it. If your program's    subdirectory called program-version and all the sources in it. If your
283    source comes as some other sort of archive (for instance, the filename    program's source comes as some other sort of archive (for instance, the
284    ends in <TT>.Z</TT> or <TT>.zip</TT>), unpack it with appropriate tools,    filename ends in <TT>.Z</TT> or <TT>.zip</TT>), unpack it with appropriate
285    or ask on debian-mentors if you're not sure how to unpack it correctly    tools, or ask on debian-mentors if you're not sure how to unpack it
286    (hint: issue `file archive.extension`).    correctly (hint: issue `file archive.extension`).
287    
288    <p>As an example, I'll use program named 'gentoo', an X11 GTK+ file    <p>As an example, I'll use program named 'gentoo', an X11 GTK+ file
289    manager. Note that the program is already packaged, and has changed    manager. Note that the program is already packaged, and has changed
290    substantially from the version while this text was first written.    substantially from the version while this text was first written.
291    
292    <p>Create subdirectory under /usr/local/src named as your program's name    <p>Create subdirectory under your home directory named 'debian' or 'deb'
293    (/usr/local/src/gentoo in this case). Place the downloaded archive in it,    or anything you find appropriate (or the program's name, ~/gentoo would
294    and uncompress it with `tar -xzf gentoo-0.9.12.tar.gz`. That (somewhat    do fine in this case). Place the downloaded archive in it, and uncompress
295    lengthy) process will make no output (except if there are any errors -    it (with `tar xzf gentoo-0.9.12.tar.gz`). Make sure there are no errors
296    then you must download it again or check if it is really a tar/gzip    even some `unimportant' ones, because there will most probably be problems
297    archive), but you will get the sources unpacked in a subdirectory called    unpacking on other people's systems, whose unpacking tools may or may not
298    'gentoo-0.9.12' in /usr/local/src/gentoo.    ignore those errors.
299    
300    <p>Change to that directory and <strong>thoroughly</strong> read the    <p>Now you have another subdirectory, called 'gentoo-0.9.12'. Change to
301    provided documentation. It is usually in files named README*, INSTALL*,    that directory and <strong>thoroughly</strong> read the provided
302    *.lsm or *.html. In there you will find instructions on how to correctly    documentation. Usually there exist files named README*, INSTALL*, *.lsm
303    compile and install the program (most probably to /usr/local/bin directory).    or *.html. You must find instructions on how to correctly compile and
304      install the program (most probably they'll assume you want to install to
305      /usr/local/bin directory; you won't be doing that, but more on that later).
306    
307    <p>The process varies from program to program, but a lot of modern    <p>The process varies from program to program, but a lot of modern
308    programs come with a `configure' script that configures the source under    programs come with a `configure' script that configures the source under
# Line 338  Line 340 
340    <p>Make sure you're in the program source directory, and issue this:    <p>Make sure you're in the program source directory, and issue this:
341    
342    <p><example>    <p><example>
343    dh_make -e your.maintainer@address    dh_make -e your.maintainer@address -f gentoo-0.9.12.tar.gz
344    </example>    </example>
345    
346    <p>Of course, replace the string "your.maintainer@address" with your    <p>Of course, replace the string "your.maintainer@address" with your
347    e-mail address for inclusion in the changelog entry and other files.    e-mail address for inclusion in the changelog entry and other files,
348      and the filename with the name of your original source archive. See
349      <manref name="dh_make" section="1"> for details.
350    
351    <p>Some information will come up. It will ask you what sort of package you    <p>Some information will come up. It will ask you what sort of package you
352    want to create. Gentoo is a single binary package - it creates only one    want to create. Gentoo is a single binary package - it creates only one
353    binary, and thus one .deb file - so we will select the first option, with    binary, and thus one .deb file - so we will select the first option, with
354    the 's' key, check the information on the screen and confirm with pressing    the 's' key, check the information on the screen and confirm with pressing
355    &lt;enter&gt;. As a new maintainer you are discouraged to create    &lt;enter&gt;. As a new maintainer you are discouraged to create
356    multi-binary packages, or the libraries, as explained earlier.    multi-binary packages, or the libraries, as explained earlier. It's not
357      that hard, but it requires a bit more knowledge so we won't describe all
358      of it here.
359    
360    <p>Please note that you should run dh_make <strong>only once</strong>,    <p>Please note that you should run dh_make <strong>only once</strong>,
361    and that it won't behave correctly if you run it again in the same,    and that it won't behave correctly if you run it again in the same,
# Line 359  Line 365 
365    
366    <chapt id="modify">Modifying the source    <chapt id="modify">Modifying the source
367    
368    <p>When dh_make is finished, and you adjusted the program's own Makefile,    <p>Normally, programs install themselves in the /usr/local subdirectories.
   you can `cd ..` to see a new directory that has been created, and it is  
   called 'gentoo-0.9.12.orig'. It contains the original source code which  
   will hereafter remain untouched. The 'gentoo-0.9.12' directory still  
   exists, and there you will make changes.  
   
   <p>Normally, programs install themselves in the /usr/local subdirectories.  
369    But, Debian packages must not use that directory, since it is reserved for    But, Debian packages must not use that directory, since it is reserved for
370    system administrator's (or user's) private use. This means that you have to    system administrator's (or user's) private use. This means that you have
371    take a look at gentoo's Makefile. This is the script <manref name="make" section="1">    to take a look at your program's build system, usually starting with the
372    will use to automate building this program. For more details on Makefiles,    Makefile. This is the script <manref name="make" section="1"> will use to
373    look in <ref id="rules">.    automate building this program. For more details on Makefiles, look in
374      <ref id="rules">.
375    
376    <p>Note that there isn't space here to go into <em>all</em> the details    <p>Note that there isn't space here to go into <em>all</em> the details
377    of fixing but here are a few problems you often run across.    of fixing but here are a few problems you often run across.
# Line 491  Line 492 
492    <sect id="nolibs">Differing libraries    <sect id="nolibs">Differing libraries
493    
494    <p>There is one other common problem: libraries are often different from    <p>There is one other common problem: libraries are often different from
495    platform to platform. For example, Makefile can contain a reference to    platform to platform. For example, Makefile can contain a reference to a
496    a library which doesn't exist on Debian. In that case, we need to change    library which doesn't exist on Debian, or even Linux. In that case, we
497    it to a library which does exist in Debian, and serves the same purpose.    need to change it to a library which does exist in Debian, and serves the
498    The best way is to comment out (<em>not to delete!</em>) those lines    same purpose. The best way is to comment out those lines because there may
499    because there may be others that will try to compile on different platforms    be others that will try to compile on different platforms so that they can
500    so that they can have some hints about what could be the problem.    have some hints about what could be the problem.
501    
502    <p>So, if there is a line in your program's Makefile that says something    <p>So, if there is a line in your program's Makefile that says something
503    like this (and your program doesn't compile):    like this (and your program doesn't compile):
# Line 511  Line 512 
512    #LIBS = -lcurses -lsomething -lsomethingelse    #LIBS = -lcurses -lsomething -lsomethingelse
513    </example>    </example>
514    
515    <chapt id="crules">The debian/control and debian/rules file    <chapt id="crules">Required stuff under debian/
516    
517    <p>There is a new subdirectory in gentoo-0.9.12, it is called 'debian'.    <p>There is a new subdirectory under the program's main directory
518    There are a number of files in this directory. We will be editing these    (`gentoo-0.9.12'), it is called `debian'. There are a number of files
519    in order to customize the behavior of the package. The most important of    in this directory. We will be editing these in order to customize
520    them are 'control' and 'rules'.    the behavior of the package. The most important of them are `control',
521      `changelog', `copyright' and 'rules', which are required for all packages.
522    
523    <sect id="control">the `control' file    <sect id="control">`control' file
524    
525    <p>This file contains various values which dpkg and dselect will use to    <p>This file contains various values which dpkg and dselect will use to
526    manage the package. Here is the control file dh_make creates for us.    manage the package. Here is the control file dh_make creates for us.
527    
528    <p><example>1  Source: gentoo    <p><example>
529      1  Source: gentoo
530    2  Section: unknown    2  Section: unknown
531    3  Priority: optional    3  Priority: optional
532    4  Maintainer: Josip Rodin &lt;jrodin@jagor.srce.hr&gt;    4  Maintainer: Josip Rodin &lt;jrodin@jagor.srce.hr&gt;
# Line 614  Line 617 
617    
618    <item>Conflicts:    <item>Conflicts:
619    <p>The package will not be installed until all the packages it conflicts    <p>The package will not be installed until all the packages it conflicts
620    with have been removed.</item>    with have been removed. Use this if your program absolutely will not run
621      (or will cause severe breakage) if a particular package is present.</item>
622    
623    <item>Provides:    <item>Provides:
624    <p>For some types of packages where there are multiple alternatives    <p>For some types of packages where there are multiple alternatives
# Line 641  Line 645 
645    <tt>&gt;&gt;</tt> for strictly earlier, earlier or equal, exactly equal,    <tt>&gt;&gt;</tt> for strictly earlier, earlier or equal, exactly equal,
646    later or equal and strictly later, respectively.    later or equal and strictly later, respectively.
647    
648    <p>The last feature I want to show you is $(shlibs:Depends). This will be    <p>The last feature you need to know about is $(shlibs:Depends). This will
649    automatically filled in by <manref name="dh_shlibdeps" section="1"> (see    be automatically generated by <manref name="dh_shlibdeps" section="1"> and
650    later) with the names of any shared libraries, such as libc6 or xlib6g,    filled in by <manref name="dh_gencontrol" section="1"> with the names of
651    your program uses, so you don't have to specify them yourself. Having said    any shared libraries your program uses, such as libc6 or xlib6g, so you
652    all that, we can leave line 9 exactly as it is now.    don't have to specify them yourself. Having said all that, we can leave
653      line 9 exactly as it is now.
654    
655    <p>Line 10 is where the list of suggestions go. Here it's only 'file',    <p>Line 10 is where the list of suggestions go. Here it's only 'file',
656    because can use some features provided by that program/package.    because can use some features provided by that program/package.
# Line 686  Line 691 
691    </example>    </example>
692    (I've added the line numbers.)    (I've added the line numbers.)
693    
694    <sect id="rules">the `rules' file    <sect id="copyright">`copyright' file
   
   <p>Now we go back to the 'debian' directory to take a look at rules which  
   <manref name="dpkg-buildpackage" section="1"> will use to actually create  
   the package. This file is actually another Makefile, since it is executed  
   with 'make -f', but different than the one in the upstream source.  
   
   <p>Every 'rules' file, as any other Makefile, consists of several rules  
   of how to build the source. Rules consist of targets, filenames or names  
   of actions that should be carried out (for example, 'build:' or 'install:').  
   Rules that you want to execute you should call as the command line arguments  
   (for example, 'rules build' or 'rules install'). After the target name,  
   you can name the dependency, program or file that that rule depends on.  
   After that there can be any number of commands (starting with &lt;tab&gt;!),  
   until an empty line is found. There begins another rule. Comments begin  
   with hashes ('#'), and end with end of the line. You can invoke rules  
   either from other rules or from command line (ie. `debian/rules clean`).  
   
   <p>You are probably confused now, but it will all be clear upon examination  
   of the 'rules' file that dh_make gives us as a default. You should also  
   read the 'make' entry in info for more information.  
   
   <p><example>  
   1  #!/usr/bin/make -f  
   2  # Made with the aid of dh_make, by Craig Small  
   3  # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.  
   4  # Some lines taken from debmake, by Christoph Lameter.  
   5  
   6  # Uncomment this to turn on verbose mode.  
   7  #export DH_VERBOSE=1  
   8  
   9  build: build-stamp  
   10 build-stamp:  
   11    dh_testdir  
   12  
   13  
   14    # Add here commands to compile the package.  
   15    $(MAKE)  
   16  
   17    touch build-stamp  
   18  
   19 clean:  
   20    dh_testdir  
   21    dh_testroot  
   22    rm -f build-stamp install-stamp  
   23  
   24    # Add here commands to clean up after the build process.  
   25    -$(MAKE) clean  
   26  
   27    dh_clean  
   28  
   29 install: install-stamp  
   30 install-stamp: build-stamp  
   31    dh_testdir  
   32    dh_testroot  
   33    dh_clean -k  
   34    dh_installdirs  
   35  
   36    # Add here commands to install the package into debian/tmp.  
   37    $(MAKE) install DESTDIR=`pwd`/debian/tmp  
   38  
   39    touch install-stamp  
   40  
   41 # Build architecture-independent files here.  
   42 binary-indep: build install  
   43 # We have nothing to do by default.  
   44  
   45 # Build architecture-dependent files here.  
   46 binary-arch: build install  
   47 #  dh_testversion  
   48    dh_testdir  
   49    dh_testroot  
   50    dh_installdocs  
   51    dh_installexamples  
   52    dh_installmenu  
   53 #  dh_installemacsen  
   54 #  dh_installinit  
   55    dh_installcron  
   56    dh_installmanpages  
   57 #  dh_undocumented  
   58    dh_installchangelogs  
   59    dh_strip  
   60    dh_compress  
   61    dh_fixperms  
   62    dh_suidregister  
   63    dh_installdeb  
   64    dh_shlibdeps  
   65    dh_gencontrol  
   66 #  dh_makeshlibs  
   67    dh_md5sums  
   68    dh_builddeb  
   69  
   70 source diff:  
   71    @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false  
   72  
   73 binary: binary-indep binary-arch  
   74 .PHONY: build clean binary-indep binary-arch binary  
   </example>  
   (I've added the line numbers.)  
   
   <p>You are probably familiar with lines like line 1 from shell and perl  
   scripts. It means this file is to be run through make. Empty lines are  
   ignored. Lines beginning with '#' (hash) are treated as comments and also  
   ignored.  
   
   <p>Lines 9 through 17 describe the 'build' (and its child build-stamp)  
   rule which runs the applications own Makefile to compile the program.  
   
   <p>Things rarely work perfectly the first time so the 'clean' rule  
   specified in lines 18-26 clean up any unneeded junk left over from  
   previous failed attempts.  
   
   <p>The installation process, the 'install' rule, starts with line 29.  
   On line 34, all necessary directories are created in the 'debian'  
   directory. Line 37 runs the install target from gentoo's Makefile - and  
   installs in the debian/tmp directory - this is why we specified  
   $(DESTDIR) as the root installation directory in gentoo's Makefile.  
   
   <p>As the comments suggest, 'binary-indep' rule on lines 41-43 is used  
   to build architecture independent packages, but we don't have any.  
   
   <p>Next is 'binary-arch' rule, on lines 46 through 68, in which we run  
   several small utilities from the debhelper package that do various  
   operations on your package to make it conform to Debian policy.  
   
   <p>The names start with dh_ and after that you can see what every little  
   utility really does:  
   
   <list>  
   <item><manref name="dh_testdir" section="1"> check that you are in the  
   right directory (/usr/local/src/gentoo/gentoo-0.9.12/),  
   <item><manref name="dh_testroot" section="1"> checks that you have root  
   permissions,  
   <item><manref name="dh_installdirs" section="1"> creates directories  
   mentioned in 'dirs' file [doesn't exist here],  
   <item><manref name="dh_installdocs" section="1"> copies documentation to  
   debian/tmp/usr/share/doc/gentoo directory,  
   <item><manref name="dh_installmenu" section="1"> copies menu file to  
   debian/tmp/usr/lib/menu/gentoo,  
   <item><manref name="dh_installmanpages" section="1"> copies manpages and  
   links them correctly,  
   <item><manref name="dh_installchangelogs" section="1"> copies changelogs  
   to debian/tmp/usr/share/doc/gentoo directory,  
   <item><manref name="dh_installinit" section="1"> copies init.d script  
   [doesn't exist here],  
   <item><manref name="dh_installcron" section="1"> copies crontab script to  
   debian/tmp/etc/cron.* [doesn't exist here],  
   <item><manref name="dh_installexamples" section="1"> copies example files  
   to debian/tmp/usr/share/doc/gentoo/examples [doesn't exist here],  
   <item><manref name="dh_strip" section="1"> strips debugging headers from  
   executable files to make them smaller,  
   <item><manref name="dh_compress" section="1"> gzips man pages and  
   documentation larger than 4 kb,  
   <item><manref name="dh_fixperms" section="1"> checks and fixes invalid  
   permissions in debian/tmp directory,  
   <item><manref name="dh_suidregister" section="1"> sets up files to register  
   setuid executables with <manref name="suidregister" section="8"> [doesn't exist here],  
   <item><manref name="dh_installdeb" section="1"> copies package related  
   files under debian/tmp directory,  
   <item><manref name="dh_shlibdeps" section="1"> calculates dependencies  
   of the executables,  
   <item><manref name="dh_gencontrol" section="1"> generates and installs  
   the control file,  
   <item><manref name="dh_makeshlibs" section="1"> generates shared libs  
   dependencies file [doesn't exist here],  
   <item><manref name="dh_md5sums" section="1"> generates MD5 checksums, and  
   finally,  
   <item><manref name="dh_builddeb" section="1"> finally builds the package.  
   </list>  
   
   <p>Every one of these dh_* scripts has its own man page, for more  
   information please read it. There are other dh_* scripts not mentioned  
   here, and if you might need them, read the debhelper documentation.  
   
   <p>Lines 70-74 are just some necessities on which you can read in the  
   make manual. For now, they're not important to know about.  
   
   <p>The important part to know about the rules file created by dh_make is  
   that it is just a suggestion. It will work for simple packages but for  
   more complicated ones, don't be afraid to add and subtract from it to fit  
   your needs. This especially applies to the binary-arch sections, where  
   you should comment out lines that call features you don't need, in this  
   case I'll comment out lines 47, 53, 54, 57 and 66 because gentoo doesn't  
   need them. Only thing that you must not change are the names of the rules,  
   because they are needed to be named this way because all the tools use  
   these names, mandated by our Packaging manual.  
   
   <p>Of course, some tuning is required here: on the line 58 I'll add  
   'FIXES' because that is the name of the changelog file. For any other  
   option, please read the man page of dh_* program involved.  
   
   <chapt id="dother">Other files in debian/ dir  
   
   <sect id="copyright">copyright  
695    
696    <p>This file contains the package's copyright information. It's format    <p>This file contains the package's copyright information. It's format
697    is not dictated by the Policy, but the contents is (section 6.5).    is not dictated by the Policy, but the contents is (section 6.5).
# Line 925  Line 737 
737    </example>    </example>
738    (I've added the line numbers.)    (I've added the line numbers.)
739    
740    <sect id="readdeb">README.Debian    <sect id="changelog">`changelog' file
   
   <p>Any extra details or discrepancies between the original package and  
   your debianized version should be documented here. Dh_make created  
   a default one, this is what it looks like:  
   
   <example>  
   gentoo for Debian  
   ----------------------  
   
   &lt;possible notes regarding this package - if none, delete this file&gt;  
   
   Josip Rodin &lt;jrodin@jagor.srce.hr&gt;, Wed, 11 Nov 1998 21:02:14 +0100  
   </example>  
   
   <p>Since we don't have anything to put there - it is allowed to delete  
   the file.  
   
   <sect id="changelog">changelog  
741    
742    <p>This is a required file, which has a special format described in    <p>This is a required file, which has a special format described in
743    the Packaging Manual (section 3.2.3). This format is used by dpkg and    the Packaging Manual (section 3.2.3). This format is used by dpkg and
# Line 1029  Line 823 
823    </example>    </example>
824    (I've added the line numbers.)    (I've added the line numbers.)
825    
826      <sect id="rules">`rules' file
827    
828      <p>Now we need to go back to the 'debian' directory to take a look at rules
829      which <manref name="dpkg-buildpackage" section="1"> will use to actually
830      create the package. This file is actually another Makefile, since it is
831      executed with 'make -f', but different than the one in the upstream source.
832    
833      <p>Every 'rules' file, as any other Makefile, consists of several rules
834      of how to build the source. Rules consist of targets, filenames or names
835      of actions that should be carried out (for example, 'build:' or 'install:').
836      Rules that you want to execute you should call as the command line arguments
837      (for example, 'rules build' or 'rules install'). After the target name,
838      you can name the dependency, program or file that that rule depends on.
839      After that there can be any number of commands (starting with &lt;tab&gt;!),
840      until an empty line is found. There begins another rule. Comments begin
841      with hashes ('#'), and end with end of the line. You can invoke rules
842      either from other rules or from command line (ie. `debian/rules clean`).
843    
844      <p>You are probably confused now, but it will all be clear upon examination
845      of the 'rules' file that dh_make gives us as a default. You should also
846      read the 'make' entry in info for more information.
847    
848      <p>The important part to know about the rules file created by dh_make, is
849      that it is just a suggestion. It will work for simple packages but for
850      more complicated ones, don't be afraid to add and subtract from it to fit
851      your needs. Only thing that you must not change are the names of the
852      rules, because they are needed to be named this way because all the tools
853      use these names, mandated by our Packaging manual.
854    
855      <p><example>
856      1  #!/usr/bin/make -f
857      2  # Made with the aid of dh_make, by Craig Small
858      3  # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
859      4  # Some lines taken from debmake, by Christoph Lameter.
860      5
861      6  # Uncomment this to turn on verbose mode.
862      7  #export DH_VERBOSE=1
863      8
864      9  # This is the debhelper compatability version to use.
865      10 export DH_COMPAT=1
866      11
867      12 build: build-stamp
868      13 build-stamp:
869      14    dh_testdir
870      15
871      16    # Add here commands to compile the package.
872      17    $(MAKE)
873      18
874      19    touch build-stamp
875      20
876      21 clean:
877      22    dh_testdir
878      23    dh_testroot
879      24    rm -f build-stamp
880      25
881      26    # Add here commands to clean up after the build process.
882      27    -$(MAKE) clean
883      28
884      29    dh_clean
885      30
886      31 install: build-stamp
887      32    dh_testdir
888      33    dh_testroot
889      34    dh_clean -k
890      35    dh_installdirs
891      36
892      37    # Add here commands to install the package into debian/tmp.
893      38    $(MAKE) install DESTDIR=`pwd`/debian/tmp
894      39
895      40 # Build architecture-independent files here.
896      41 binary-indep: build install
897      42 # We have nothing to do by default.
898      43
899      44 # Build architecture-dependent files here.
900      45 binary-arch: build install
901      46 #  dh_testversion
902      47    dh_testdir
903      48    dh_testroot
904      49 #  dh_installdebconf
905      50    dh_installdocs
906      51    dh_installexamples
907      52    dh_installmenu
908      53 #  dh_installemacsen
909      54 #  dh_installpam
910      55 #  dh_installinit
911      56    dh_installcron
912      57    dh_installmanpages
913      58    dh_installinfo
914      59 #  dh_undocumented
915      60    dh_installchangelogs
916      61    dh_link
917      62    dh_strip
918      63    dh_compress
919      64    dh_fixperms
920      65    # You may want to make some executables suid here.
921      66    dh_suidregister
922      67 #  dh_makeshlibs
923      68    dh_installdeb
924      69 #  dh_perl
925      70    dh_shlibdeps
926      71    dh_gencontrol
927      72    dh_md5sums
928      73    dh_builddeb
929      74
930      75 binary: binary-indep binary-arch
931      76 .PHONY: build clean binary-indep binary-arch binary install
932      </example>
933      (I've added the line numbers.)
934    
935      <p>You are probably familiar with lines like line 1 from shell and perl
936      scripts. It means this file is to be run through make. Empty lines, and
937      lines beginning with `#' (hash) are ignored.
938    
939      <p>Lines 12 through 19 describe the 'build' (and its child build-stamp)
940      rule, which runs the applications own Makefile to compile the program.
941    
942      <p>The 'clean' rule, as specified in lines 21-29, cleans up any unneeded
943      binary or auto-generated stuff, left over from building the package.
944      This rule must be working at all times (even when the source tree <em/is/
945      cleaned up!), so please use the forcing options (e.g. for rm, that is
946      `-f'), or ignore return values (with a `-' in front of a command name).
947    
948      <p>The installation process, the 'install' rule, starts with line 31.
949      It basically runs the install rule from the program's main Makefile,
950      but installs in `pwd`/debian/tmp directory - this is why we specified
951      $(DESTDIR) as the root installation directory in gentoo's Makefile.
952    
953      <p>As the comments suggest, 'binary-indep' rule, on the line 41, is used
954      to build architecture independent packages. As we don't have any, nothing
955      will be done there.
956    
957      <p>Next is 'binary-arch' rule, on lines 45 through 73, in which we run
958      several small utilities from the debhelper package that do various
959      operations on your package files to make them all conform to the Policy.
960    
961      <p>The names start with dh_, and the rest is the description of what the
962      particular utility really does. It is all quite self-explanatory, but
963      here are some additional explanations:
964    
965      <list>
966      <item><manref name="dh_testdir" section="1"> checks that you are in the
967            right directory (i.e. the top-level source directory),
968      <item><manref name="dh_testroot" section="1"> checks that you have root
969            permissions which is needed for binary* targets, and clean,
970      <item><manref name="dh_installmanpages" section="1"> copies all the
971            manpages it can find in the source tree to package (beware, this is
972            DWIM),
973      <item><manref name="dh_strip" section="1"> strips debugging headers from
974            executable files and libraries, to make them smaller,
975      <item><manref name="dh_compress" section="1"> gzips man pages and
976            documentation larger than 4 kb,
977      <item><manref name="dh_installdeb" section="1"> copies package related
978            files (e.g. the maintainer scripts) under debian/tmp/DEBIAN directory,
979      <item><manref name="dh_shlibdeps" section="1"> calculates shared libraries
980            dependencies of the libraries and executables,
981      <item><manref name="dh_gencontrol" section="1"> adds stuff to, and
982            installs, the control file,
983      <item><manref name="dh_md5sums" section="1"> generates MD5 checksums for
984            all the files in the package.
985      </list>
986    
987      <p>For more complete information on what do all these dh_* scripts do, and
988      what are their other options, please read respective manual pages. There
989      are some other, possibly very useful, dh_* scripts, which were not
990      mentioned here. If you need them, read the debhelper documentation.
991    
992      <p>The binary-arch section is the one where you really should comment out
993      lines that call features you don't need. For gentoo, I'll comment out
994      lines about testversion, emacsen, pam, init, cron, manpages, info,
995      undocumented, suidregister, makeshlibs, and perl, simply because gentoo
996      doesn't need them. Also, on the line 60, I'll need to add ' FIXES', because
997      that is the name of the upstream changelog file.
998    
999      <p>The last two lines (along with any other not explained ones) are just
1000      some more-or-less neccessary things, regarding which you can read in the
1001      make manual, and the packaging manual. For now, they're not important to
1002      know about.
1003    
1004      <chapt id="dother">Other files under debian/
1005    
1006      <p>You will see that there exist several other files in the debian/
1007      subdirectory, most of them with the `.ex' suffix, meaning that they are
1008      examples. If you wish or need to use any of those features, examine them
1009      and the related documentation (hint: the Policy Manual), rename them to
1010      remove the `.ex' suffix, and modify them and the rules file if neccessary.
1011      Some of those files, those commonly used ones, are explained in the
1012      following sections.
1013    
1014      <sect id="readdeb">README.Debian
1015    
1016      <p>Any extra details or discrepancies between the original package and
1017      your debianized version should be documented here. Dh_make created
1018      a default one, this is what it looks like:
1019    
1020      <example>
1021      gentoo for Debian
1022      ----------------------
1023    
1024      &lt;possible notes regarding this package - if none, delete this file&gt;
1025    
1026      Josip Rodin &lt;jrodin@jagor.srce.hr&gt;, Wed, 11 Nov 1998 21:02:14 +0100
1027      </example>
1028    
1029      <p>Since we don't have anything to put there - it is allowed to delete
1030      the file.
1031    
1032    
1033    <sect id="conffiles">conffiles    <sect id="conffiles">conffiles
1034    
1035    <p>One of the most annoying things about software is when you spend a    <p>One of the most annoying things about software is when you spend a
# Line 1154  Line 1155 
1155    
1156    <sect id="build">Building the package    <sect id="build">Building the package
1157    
1158    <p>Enter the program's main directory (/usr/local/src/gentoo/gentoo-0.9.12/)    <p>Enter the program's main directory and then issue this command:
   and then issue this command:  
1159    
1160    <p><example>    <p><example>
1161    dpkg-buildpackage -rfakeroot    dpkg-buildpackage -rfakeroot
# Line 1163  Line 1163 
1163    
1164    <p>This will do everything for you, you'll just have to enter your    <p>This will do everything for you, you'll just have to enter your
1165    PGP secret key, twice. After it's done, you will see four new files    PGP secret key, twice. After it's done, you will see four new files
1166    in /usr/local/src/gentoo directory:    in the directory above (~/debian/):
1167    
1168    <p><list>    <p><list>
1169    <item><em>gentoo_0.9.12-1_i386.deb</em>    <item><em>gentoo_0.9.12-1_i386.deb</em>
# Line 1263  Line 1263 
1263    <manref name="dupload.conf" section="5"> manual page to understand    <manref name="dupload.conf" section="5"> manual page to understand
1264    what does each of these options mean.    what does each of these options mean.
1265    
1266    <p>Then connect to your Internet provider, make sure once again that    <p>Then connect to your Internet provider, and issue this command:
   you are in /usr/local/src/gentoo directory, and issue this command:  
1267    
1268    <p><example>    <p><example>
1269    dupload --to master gentoo_0.9.12-1_i386.changes    dupload --to master gentoo_0.9.12-1_i386.changes

Legend:
Removed from v.892  
changed lines
  Added in v.893

  ViewVC Help
Powered by ViewVC 1.1.5