| 1 |
<!doctype debiandoc system>
|
| 2 |
|
| 3 |
<debiandoc>
|
| 4 |
|
| 5 |
<book>
|
| 6 |
|
| 7 |
<titlepag>
|
| 8 |
|
| 9 |
<title>Debian New Maintainers Guide</title>
|
| 10 |
|
| 11 |
<author>
|
| 12 |
Josip Rodin <email/jrodin@jagor.srce.hr/
|
| 13 |
</author>
|
| 14 |
|
| 15 |
<version>version 0.7, <date></version>
|
| 16 |
|
| 17 |
<copyright>
|
| 18 |
<copyrightsummary>Copyright © 1998 Josip Rodin.</copyrightsummary>
|
| 19 |
|
| 20 |
<p>This document is licensed under the terms of GNU GPL v2 or higher. The
|
| 21 |
documents that I have merged (and adapted to debhelper) are:
|
| 22 |
|
| 23 |
<p>The New-Maintainer's Debian Packaging Howto, copyright © 1997
|
| 24 |
Will Lowe <email/lowe@debian.org/.
|
| 25 |
<p>Freely redistributable in all electronic or other forms provided that
|
| 26 |
this copyright notice is retained and that and content modifications from
|
| 27 |
my original are clearly marked as such.
|
| 28 |
<p>Contributions were also made to this document by Igor Grobman
|
| 29 |
<email/igor@digicron.com/ and James A. Treacy <email/treacy@debian.org/.
|
| 30 |
|
| 31 |
<p>Debmake manual (Making a Debian Package), copyright © 1997
|
| 32 |
Jaldhar Vyas <email/jaldhar@debian.org/.
|
| 33 |
<p>Included are some tips picked up from the Debian Users and Developers
|
| 34 |
mailing lists or suggested by readers.
|
| 35 |
</copyright>
|
| 36 |
|
| 37 |
</titlepag>
|
| 38 |
|
| 39 |
<toc sect>
|
| 40 |
|
| 41 |
<chapt id="start">Getting started "The Right Way"
|
| 42 |
|
| 43 |
<p>This document will try to describe building of a Debian GNU/Linux package
|
| 44 |
to the common Debian user (and wannabe developer) in common language, and
|
| 45 |
well covered with working examples. There is an old Roman saying, <em>Longum
|
| 46 |
iter est per preaecepta, breve et efficax per exempla!</em> (It's a long way
|
| 47 |
by the rules, but short and efficient with examples!).
|
| 48 |
|
| 49 |
<p>One of the things that makes Debian such a top-notch Linux distribution
|
| 50 |
is its package system. While there is a vast quantity of software already
|
| 51 |
in the Debian format, sometimes you need to install software that isn't.
|
| 52 |
You may be wondering how you can make your own packages and perhaps you
|
| 53 |
think it is a very difficult task. Well, if you are a real novice on Linux,
|
| 54 |
it is hard, but if you were rookie, you wouldn't be reading this doc now. :-)
|
| 55 |
You do need to know a little about Unix programming but you certainly
|
| 56 |
don't need to be a wizard.
|
| 57 |
|
| 58 |
<sect id="needprogs">Programs you need for development
|
| 59 |
|
| 60 |
<p>Before you start anything, you should make sure that you properly install
|
| 61 |
some packages with <manref name="dpkg" section="8"> (ie. `dpkg -i package`).
|
| 62 |
This document has been written while the 2.0 'hamm' distribution was the
|
| 63 |
officially stable release of Debian, and 2.1 'slink' was frozen (to be
|
| 64 |
released), and for safety reasons packages named here are the ones from 2.0.
|
| 65 |
|
| 66 |
<p>Following packages come with standard installation of Debian 2.0, so
|
| 67 |
you probably have them already. Still, you should check it with `dpkg -s
|
| 68 |
package`.
|
| 69 |
|
| 70 |
<list>
|
| 71 |
<item><em>binutils</em> - these programs used to assemble and link
|
| 72 |
object files - the stuff programs are made of. (see `info binutils`)
|
| 73 |
|
| 74 |
<item><em>cpp</em> - the C preprocessor. (see <manref name="cpp" section="1">)
|
| 75 |
|
| 76 |
<item><em>cpio</em> - this is an archiver like tar or zip. (see
|
| 77 |
<manref name="cpio" section="1">)
|
| 78 |
|
| 79 |
<item><em>dpkg-dev</em> - this package contains the tools needed to unpack,
|
| 80 |
build and upload Debian source packages. It also contains the packaging
|
| 81 |
and dpkg-internals manual. (see <manref name="dpkg-source" section="1">)
|
| 82 |
|
| 83 |
<item><em>file</em> - this handy program can determine what type a file is.
|
| 84 |
(see <manref name="file" section="1">)
|
| 85 |
|
| 86 |
<item><em>fileutils</em> - the essential Linux utilities, like ls, chmod,
|
| 87 |
rm and others. (see `info --file /usr/info/fileutils.info.gz`)
|
| 88 |
|
| 89 |
<item><em>gcc</em> - the GNU C compiler. Most Linux programs are written
|
| 90 |
in the C programming language. (see <manref name="gcc" section="1">)
|
| 91 |
|
| 92 |
<item><em>libc6-dev</em> - the C libraries and header files gcc needs to
|
| 93 |
link with to create object files. Although some programs still reccommend
|
| 94 |
and/or use libc5, you are encouraged to use the newer version (libc6).
|
| 95 |
(see `info libc`)
|
| 96 |
|
| 97 |
<item><em>make</em> - usually creation of a program takes several steps.
|
| 98 |
Rather than having to type out the same commands over and over again, you
|
| 99 |
can use the make program to automate the process. (see `info make`)
|
| 100 |
|
| 101 |
<item><em>patch</em> - this very useful utility will take file containing
|
| 102 |
a difference listing (produced by the diff program) and apply it to the
|
| 103 |
original file, producing a patched version. (see <manref name="patch" section="1">)
|
| 104 |
|
| 105 |
<item><em>perl</em> - this is one of the most used interpreted scripting
|
| 106 |
languages on today's un*x systems, often reffered to as "Unix's Swiss Army
|
| 107 |
Chainsaw". (see <manref name="perl" section="1">)
|
| 108 |
</list>
|
| 109 |
|
| 110 |
<p>From the devel section of the distribution you'll probably need
|
| 111 |
to install this yourself:
|
| 112 |
|
| 113 |
<list>
|
| 114 |
<item><em>fakeroot</em> and <em>libtricks</em> - these let you emulate
|
| 115 |
being root which is neccessary for some parts of the build process.
|
| 116 |
Currently under development, but do the work. (see <manref name="fakeroot" section="1">)
|
| 117 |
|
| 118 |
<item><em>lintian</em> - this package can let you know of any common
|
| 119 |
mistakes after you build the package, and explain the errors. Also
|
| 120 |
requires diffstat, small utility that produces histograms from diff output.
|
| 121 |
(see <manref name="lintian" section="1">, <manref name="diffstat" section="1">,
|
| 122 |
/usr/doc/lintian/lintian.html/index.html)
|
| 123 |
</list>
|
| 124 |
|
| 125 |
<p>And from the utils section you'll need these packages:
|
| 126 |
|
| 127 |
<list>
|
| 128 |
<item><em>dh-make</em> and <em>debhelper</em> - dh-make is neccessary to
|
| 129 |
create the skeleton of our example package, and it will use some the
|
| 130 |
debhelper tools for creating packages. They are not essential for creation
|
| 131 |
of packages, but it is <em>highly</em> recommended for new maintainers.
|
| 132 |
It makes the whole process very much easier to start, and control
|
| 133 |
afterwards. (see <manref name="dh_make" section="1">,
|
| 134 |
<manref name="debhelper" section="1">, /usr/doc/debhelper/README)
|
| 135 |
|
| 136 |
<item><em>debmake</em> and <em>devscripts</em> - these packages contain some
|
| 137 |
programs that may be useful, but they are also not neccessary for building
|
| 138 |
packages. debmake functions similar to dh-make, and devscripts is collection
|
| 139 |
of scripts. (see <manref name="deb-make" section="1">, /usr/doc/devscripts/README.debian.gz)
|
| 140 |
</list>
|
| 141 |
|
| 142 |
<p>Finnally, these <em>very important</em> packages are in the doc section
|
| 143 |
of the distribution:
|
| 144 |
|
| 145 |
<list>
|
| 146 |
<item><em>debian-policy</em> - includes the structure and contents of the
|
| 147 |
archive, several OS design issues, Linux Filesystem Structure Standard,
|
| 148 |
and the most important thing (for you) is that it describes requirements
|
| 149 |
that each package must satisfy to be included in the distribution.
|
| 150 |
(see /usr/doc/debian-policy/policy.html/index.html)
|
| 151 |
|
| 152 |
<item><em>developers-reference</em> - for all matters not specifically
|
| 153 |
about the technical details of packaging, like the structure of the
|
| 154 |
archive, how to rename, orphan, pick up packages, how to do NMUs, how to
|
| 155 |
manage bugs, when and where to upload etc.
|
| 156 |
(see /usr/doc/developers-reference/developers-reference.html/index.html)
|
| 157 |
|
| 158 |
<item><em>packaging-manual</em> - describes the technical aspects of
|
| 159 |
creating Debian binary and source packages.
|
| 160 |
(see /usr/doc/packaging-manual/packaging.html/index.html)
|
| 161 |
</list>
|
| 162 |
|
| 163 |
<p>Also you need the encryption package <manref name="pgp" section="1">
|
| 164 |
to digitally <em>sign</em> your package. This is especially important if
|
| 165 |
you want to distribute your package to other people (and you'll be doing
|
| 166 |
that when your package gets included in Debian distribution). However,
|
| 167 |
due to a rather wacky U.S. export law, you cannot simply download this
|
| 168 |
from your nearest Debian ftp site. But, your FTP site will however have
|
| 169 |
a file called README.non-us, which will tell you how to get a copy of
|
| 170 |
pgp (hint: ftp://nonus.debian.org/debian-non-US/).
|
| 171 |
|
| 172 |
<p>The short descriptions that are given above only serve to introduce
|
| 173 |
you to what each package does. Before continuing please thoroughly read
|
| 174 |
how to the documentation of each program, at least the standard usage.
|
| 175 |
It may seem like heavy going now, but later on you'll be <em>very</em>
|
| 176 |
glad you read it.
|
| 177 |
|
| 178 |
<sect id="otherinfo">Other information
|
| 179 |
|
| 180 |
<p>There are two types of packages you can make, source and binary.
|
| 181 |
A source package contains code which you can compile into a program.
|
| 182 |
A binary package contains just the finished program. Don't mix terms
|
| 183 |
like source of the program and the source package of the program!
|
| 184 |
Please read the other manuals if you need more details on terminology.
|
| 185 |
|
| 186 |
<p>Debian uses the term 'maintainer' for person that makes packages,
|
| 187 |
'author' for the person that made the program, and 'upstream maintainer'
|
| 188 |
for the person who currently maintains that program. Usually author and
|
| 189 |
the upstream maintainer are the same person - and sometimes even the
|
| 190 |
maintainer is the same person. If you made a program, and want it to get
|
| 191 |
in Debian, feel free to submit your application to become a maintainer.
|
| 192 |
|
| 193 |
<p>After you build your package (or while doing that), you will have
|
| 194 |
to become an official Debian maintainer if you wish your program to get
|
| 195 |
into the next distribution (if the program is useful, why not?).
|
| 196 |
That process is explained in Developer's Reference. Please read it.
|
| 197 |
|
| 198 |
<chapt id="first">First steps
|
| 199 |
|
| 200 |
<p>While the documentation at the <url name="Developers corner" id="http://www.debian.org/devel/">
|
| 201 |
is not so clear about where and how should new maintainers start their
|
| 202 |
work, this document will explain every little (at first maybe irrelevant)
|
| 203 |
step, and help you create that first package, and to gain some experience
|
| 204 |
in building next releases of that and maybe other packages later on.
|
| 205 |
|
| 206 |
<sect id="choose">Choose your program.
|
| 207 |
|
| 208 |
<p>You have probably chosen the package you want to build, but here are
|
| 209 |
some pointers for you as the uninitiated:
|
| 210 |
|
| 211 |
<list>
|
| 212 |
<item>check if the package is in the distribution already. If you use the
|
| 213 |
'stable' distribution, maybe it's best that you go to the
|
| 214 |
<url name="package search page" id="http://www.debian.org/distrib/packages.html">.
|
| 215 |
If you use <em>current</em> 'unstable' distribution, check it out with
|
| 216 |
these commands:
|
| 217 |
<example>
|
| 218 |
dpkg -s program
|
| 219 |
dpkg -l '*program*'
|
| 220 |
</example>
|
| 221 |
|
| 222 |
<item>consult the <url name="WNPP page" id="http://www.debian.org/doc/prospective-packages.html">
|
| 223 |
to see if anyone else is building that same program. If so, contact the
|
| 224 |
current maintainer if you feel you need to. If not - find another
|
| 225 |
interesting program that nobody maintains.</item>
|
| 226 |
|
| 227 |
<item>program <em>must</em> have a license, if possible free as according
|
| 228 |
to the <url name="Debian Free Software Guidelines" id="http://www.debian.org/social_contract.html#guidelines">.
|
| 229 |
If it doesn't conform to some of these rules, it still can be included in
|
| 230 |
'contrib' or 'non-free' sections of Debian. If you are unsure about where
|
| 231 |
should it go, ask on <email/debian-legal@lists.debian.org/.
|
| 232 |
</item>
|
| 233 |
|
| 234 |
<item>program certainly should <em>not</em> run setuid root, or even
|
| 235 |
better - it shouldn't need to be setuid or setgid anything.</item>
|
| 236 |
|
| 237 |
<item>program should not be a daemon, or something that goes in */sbin
|
| 238 |
directories.</item>
|
| 239 |
|
| 240 |
<item>program should result in binary executable form, don't try
|
| 241 |
libraries yet.</item>
|
| 242 |
|
| 243 |
<item>it should be well documented, or at least understandable
|
| 244 |
(to anyone).</item>
|
| 245 |
|
| 246 |
<item>you should contact program's author(s) to check if they agree
|
| 247 |
with packaging it. It is important to be able to consult with author(s)
|
| 248 |
about the program in case of any program specific problems, so don't
|
| 249 |
try to package unmaintained pieces of software.</item>
|
| 250 |
|
| 251 |
<item>and last but not the least, you must know that it works, and
|
| 252 |
have it tried for some time.</item>
|
| 253 |
</list>
|
| 254 |
|
| 255 |
<p>Of course, these things are just safety measures, and intended to save
|
| 256 |
you from rageous users if you do something wrong in some setuid ftp daemon...
|
| 257 |
When you gain some more experience in packaging, you'll be able to do such
|
| 258 |
packages, but even the most experienced developers consult debian-devel
|
| 259 |
mailing list when they are in doubt. And people there will gladly help.
|
| 260 |
|
| 261 |
<p>For more help about these, check in Developer's Reference.
|
| 262 |
|
| 263 |
<sect id="getsrc">Get the program, and try it out.
|
| 264 |
|
| 265 |
<p>So the first thing to do is to find and download the original package.
|
| 266 |
I presume that you already have the source file that you picked up at
|
| 267 |
the authors homepage. Linux sources usually come in tar/gzip format,
|
| 268 |
with extension .tar.gz or .tgz, and usually contain the subdirectory
|
| 269 |
called program-version and all the sources in it. If your program's
|
| 270 |
source comes as some other sort of archive (for instance, the filename
|
| 271 |
ends in <TT>.Z</TT> or <TT>.zip</TT>), unpack it with appropriate tools,
|
| 272 |
or ask on debian-mentors if you're not sure how to unpack it correctly
|
| 273 |
(hint: issue `file archive.extension`).
|
| 274 |
|
| 275 |
<p>As an example, I'll use program named 'gentoo', an X11 GTK+ file
|
| 276 |
manager.
|
| 277 |
|
| 278 |
<p>Create subdirectory under /usr/local/src named as your program's name
|
| 279 |
(/usr/local/src/gentoo in this case). Place the downloaded archive in it,
|
| 280 |
and uncompress it with `tar -xzf gentoo-0.9.12.tar.gz`. That (a bit
|
| 281 |
lenghty) proccess will make no output (except if there are any errors -
|
| 282 |
then you must download it again or check if it is really a tar/gzip
|
| 283 |
archive), but you will get the sources unpacked in a subdirectory called
|
| 284 |
'gentoo-0.9.12' in /usr/local/src/gentoo.
|
| 285 |
|
| 286 |
<p>Change to that directory and <em>throughly</em> read the documentation.
|
| 287 |
It is usually in files named README*, INSTALL*, *.lsm or *.html. In there
|
| 288 |
you will find instructions on how to correctly compile and install the
|
| 289 |
program (most probably to /usr/local/bin directory).
|
| 290 |
|
| 291 |
<p>The process varies from program to program, but a lot of modern
|
| 292 |
programs come with a `configure' script that configures the source under
|
| 293 |
your system and makes sure that your system is in condition to compile it.
|
| 294 |
After configuring (with `./configure`), programs are usually compiled
|
| 295 |
with `make`, and get installed in destination directories by typing
|
| 296 |
`make install`.
|
| 297 |
|
| 298 |
<p>So, do compile, install and try that program, to make sure it works okay
|
| 299 |
and doesn't break something else while it's installing or running.
|
| 300 |
|
| 301 |
<sect id="naming">Stuff prior to `dh_make'
|
| 302 |
|
| 303 |
<p>For the correct building of the program, you should move the source
|
| 304 |
directory to <packagename>-<version>. As you can see, the
|
| 305 |
example program gentoo doesn't need that, but maybe your program will.
|
| 306 |
So, make the program's original name lowercase, if it already is not.
|
| 307 |
If it consists of more than one word, contract them to one word or make
|
| 308 |
an abbreviation. For example, program "John's little editor for X"
|
| 309 |
package would be named johnledx or jle4x, or whatever you decide, as
|
| 310 |
long as it's under some reasonable limit, like 15 characters.
|
| 311 |
|
| 312 |
<p>Also check for the exact version of the program (not the package!).
|
| 313 |
If that piece of software is not numbered with versions like X.Y.Z, but
|
| 314 |
with release date, feel free to use date (if the date was 19th of
|
| 315 |
December, 1998. use it US-like shortened, 19981219) as the version number.
|
| 316 |
Some won't be numbered at all, in which case you should contact the
|
| 317 |
upstream maintainer to see if they've got some other revision-tracking
|
| 318 |
method.
|
| 319 |
|
| 320 |
<p>Before you proceed to the dh_make proccess, you should set the
|
| 321 |
$EMAIL environment variable to your e-mail address, and you'll do that
|
| 322 |
by issuing this at in your shell (this is for bash):
|
| 323 |
|
| 324 |
<p><example>
|
| 325 |
export EMAIL=your.login@somewhere.net
|
| 326 |
</example>
|
| 327 |
|
| 328 |
<sect id="dh_make">Running `dh_make'
|
| 329 |
|
| 330 |
<p>Make sure you're in the program source directory, and issue this:
|
| 331 |
|
| 332 |
<p><example>
|
| 333 |
dh_make
|
| 334 |
</example>
|
| 335 |
|
| 336 |
<p>Some information will come up. It will ask you what sort of package you
|
| 337 |
want to create. Gentoo is a single binary package - it creates only one
|
| 338 |
binary, and thus one .deb file - so we will select the first option, with
|
| 339 |
the 's' key. As a new maintainer you are discouraged to create multi-binary
|
| 340 |
packages, or the libraries, as explained earlier.
|
| 341 |
|
| 342 |
<chapt id="modify">Modifying the source
|
| 343 |
|
| 344 |
<p>When dh_make is finished, and you adjusted program's own Makefile,
|
| 345 |
you can `cd ..` to see a new directory that has been created, and it is
|
| 346 |
called 'gentoo-0.9.12.orig'. It contains the original source code which
|
| 347 |
will hereafter remain untouched. The 'gentoo-0.9.12' directory still
|
| 348 |
exists, and there you will make changes.
|
| 349 |
|
| 350 |
<p>Normally, programs install themselves in the /usr/local subdirectories.
|
| 351 |
But, Debian packages must not use that directory, since it is reserved for
|
| 352 |
system administrator's (or user's) private use. This means that you have to
|
| 353 |
take a look at gentoo's Makefile. This is the script <manref name="make" section="1">
|
| 354 |
will use to automate building this program. For more details on Makefiles,
|
| 355 |
look in <ref id="rules">.
|
| 356 |
|
| 357 |
<p>Note that there isn't space here to go into <em>all</em> the details
|
| 358 |
of fixing but here are a few problems you often run across.
|
| 359 |
|
| 360 |
<sect id="destdir">The $DESTDIR problem
|
| 361 |
|
| 362 |
<p><example>
|
| 363 |
# Where to put binary on 'make install'?
|
| 364 |
BIN = /usr/local/bin
|
| 365 |
# Where to put icons on 'make install'? Note: if you change this,
|
| 366 |
# gentoo will not find the icons as it starts up. You're going to
|
| 367 |
# have to alter gentoo's icon path (in the config window, "Paths"
|
| 368 |
# tab) to get it work.
|
| 369 |
ICONS = /usr/local/lib/gentoo/
|
| 370 |
</example>
|
| 371 |
|
| 372 |
<p>Before all that, you should insert a new two lines that say:
|
| 373 |
|
| 374 |
<p><example>
|
| 375 |
# Edited for Debian GNU/Linux.
|
| 376 |
DESTDIR =
|
| 377 |
</example>
|
| 378 |
because the build process requires it (will be explained later).
|
| 379 |
|
| 380 |
<p>Then the Makefile mentions the location of the final binary. Just
|
| 381 |
change that to this:
|
| 382 |
<p><example>
|
| 383 |
# Where to put binary on 'make install'?
|
| 384 |
BIN = $(DESTDIR)/usr/X11R6/bin
|
| 385 |
</example>
|
| 386 |
|
| 387 |
<p>But why in that directory, and not some other? Because Debian has
|
| 388 |
defined some rules on where programs are to be installed. That is specified
|
| 389 |
in Linux Filesystem Structure Standard (/usr/doc/debian-policy/fsstnd).
|
| 390 |
So, we should install the binary in /usr/X11R6/bin instead of /usr/local/bin,
|
| 391 |
and the man page (it doesn't exist here, but almost every program has one,
|
| 392 |
so we'll make one later) in /usr/man/man1 instead of /usr/local/man/man1.
|
| 393 |
|
| 394 |
<p>After that we have a bit harder situation. If you change one line to:
|
| 395 |
|
| 396 |
<p><example>
|
| 397 |
ICONS = $(DESTDIR)/usr/share/gentoo/
|
| 398 |
</example>
|
| 399 |
which conforms to the policy, you will have to edit some real C sources.
|
| 400 |
But where and what to search? You can find this out by issuing:
|
| 401 |
<p><example>
|
| 402 |
grep -n usr/local/lib *.[ch]
|
| 403 |
</example>
|
| 404 |
(in every subdirectory that contains .c and .h files). Grep will tell
|
| 405 |
you the name of the file and the line in it, when he finds an occurence.
|
| 406 |
Now edit those files and in those lines replace usr/local/lib with
|
| 407 |
usr/share - and that is it. Just replace usr/local/lib with your location,
|
| 408 |
and be very careful that you don't mess up the rest of the code, if you
|
| 409 |
don't know much about programming in C. :-)
|
| 410 |
|
| 411 |
<p>After that you should find the install target (search for line
|
| 412 |
that starts with 'install:') and rename all references to directories
|
| 413 |
other than ones defined at the top of the Makefile. In this case,
|
| 414 |
it does that and polishes things up a bit. Previously, install target
|
| 415 |
said:
|
| 416 |
|
| 417 |
<p><example>
|
| 418 |
# ----------------------------------------- Installation
|
| 419 |
|
| 420 |
# You're going to have to be root to do this!
|
| 421 |
install: gentoo-target
|
| 422 |
install ./gentoo $(BIN)
|
| 423 |
install icons $(ICONS)
|
| 424 |
install gentoorc-example $(HOME)/.gentoorc
|
| 425 |
</example>
|
| 426 |
|
| 427 |
<p>After our change it says:
|
| 428 |
<example>
|
| 429 |
# ----------------------------------------- Installation
|
| 430 |
|
| 431 |
# You're going to have to be root to do this!
|
| 432 |
install: gentoo-target
|
| 433 |
install -d $(BIN) $(ICONS) $(DESTDIR)/etc
|
| 434 |
install ./gentoo $(BIN)
|
| 435 |
install -m644 icons/* $(ICONS)
|
| 436 |
install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc
|
| 437 |
install -d $(DESTDIR)/usr/doc/gentoo/html
|
| 438 |
cp -a docs/* $(DESTDIR)/usr/doc/gentoo/html
|
| 439 |
</example>
|
| 440 |
|
| 441 |
<p>A careful reader will notice that I changed 'gentoo' to 'gentoo-target'
|
| 442 |
in the 'install:' line. That is called bug fix :-)
|
| 443 |
|
| 444 |
<p>Whenever you make changes that are not specifically related to Debian
|
| 445 |
package, be sure to send them to the upstream maintainer so they can be
|
| 446 |
included in the next program revision.
|
| 447 |
|
| 448 |
<sect id="nolibs">Differring libraries
|
| 449 |
|
| 450 |
<p>There is one other common problem: libraries are often different from
|
| 451 |
platform to platform. For example, Makefile can contain a reference to
|
| 452 |
a library which doesn't exist on Debian. In that case, we need to change
|
| 453 |
it to a library which does exist in Debian, and serves the same purpose.
|
| 454 |
The best way is to comment out (<em>not to delete!</em>) those lines
|
| 455 |
because there may be others that will try to compile on different platforms
|
| 456 |
so that they can have some hints about what could be the problem.
|
| 457 |
|
| 458 |
<p>So, if there is a line in your program's Makefile that says something
|
| 459 |
like this (and your program doesn't compile):
|
| 460 |
|
| 461 |
<p><example>
|
| 462 |
LIBS = -lcurses -lsomething -lsomethingelse
|
| 463 |
</example>
|
| 464 |
|
| 465 |
<p>Change it to this, and it will most probably work:
|
| 466 |
<p><example>
|
| 467 |
LIBS = -lncurses -lsomething -lsomethingelse
|
| 468 |
#LIBS = -lcurses -lsomething -lsomethingelse
|
| 469 |
</example>
|
| 470 |
|
| 471 |
<chapt id="crules">The debian/control and debian/rules file
|
| 472 |
|
| 473 |
<p>There is a new subdirectory in gentoo-0.9.12, it is called 'debian'.
|
| 474 |
There are a number of files in this directory. We will be editing these
|
| 475 |
in order to customize the behavior of the package. The most important of
|
| 476 |
them are 'control' and 'rules'.
|
| 477 |
|
| 478 |
<sect id="control">the `control' file
|
| 479 |
|
| 480 |
<p>This file contains various values which dpkg and dselect will use to
|
| 481 |
manage the package. Here is the control file dh_make creates for us.
|
| 482 |
|
| 483 |
<p><example>1 Source: gentoo
|
| 484 |
2 Section: unknown
|
| 485 |
3 Priority: optional
|
| 486 |
4 Maintainer: Josip Rodin <jrodin@jagor.srce.hr>
|
| 487 |
5 Standards-Version: 2.4.0.0
|
| 488 |
6
|
| 489 |
7 Package: gentoo
|
| 490 |
8 Architecture: any
|
| 491 |
9 Depends: ${shlibs:Depends}
|
| 492 |
10 Description: Missing
|
| 493 |
11 Missing
|
| 494 |
</example>
|
| 495 |
(I've added the line numbers.)
|
| 496 |
|
| 497 |
<p>Lines 1-5 are the control information for the source package. Line 1
|
| 498 |
is the name of the source package.
|
| 499 |
|
| 500 |
<p>Line 2 is the section of the distribution this package goes into. Lets
|
| 501 |
change it to x11.
|
| 502 |
|
| 503 |
<p>Line 3 describes how important it is that the user install this package.
|
| 504 |
As it is a normal priority package, but still pretty unstable, we'll leave
|
| 505 |
it as optional. Section and priority are actually only used by dselect
|
| 506 |
when it sorts packages and selects defaults. See the policy manual for
|
| 507 |
guidance on what to set these fields to.
|
| 508 |
|
| 509 |
<p>Line 4 is the name and email address of the maintainer.
|
| 510 |
|
| 511 |
<p>Line 5 is the version of the Debian policy standards this package follows
|
| 512 |
(two major versions of the installed debian-policy package).
|
| 513 |
|
| 514 |
<p>Lines 7-11 are the control information for the binary package.
|
| 515 |
|
| 516 |
<p>Line 7 is the name of the binary package.
|
| 517 |
|
| 518 |
<p>Line 8 describes the CPU architecture the binary package was compiled
|
| 519 |
for. We can leave this as any as <manref name="dpkg-gencontrol" section="1">
|
| 520 |
will fill in the appropriate value.
|
| 521 |
|
| 522 |
<p>Line 9 shows one of the most powerful features of the Debian packaging
|
| 523 |
system. Packages can relate to each other in various ways. Apart from
|
| 524 |
depends other relationship fields are Recommends:, Suggests:, Pre-depends:,
|
| 525 |
Conflicts:, Provides:, and Replaces: . This is what they mean:
|
| 526 |
|
| 527 |
<p><list>
|
| 528 |
<item>Depends:
|
| 529 |
<p><manref name="dpkg" section="8"> and <manref name="dselect" section="8">
|
| 530 |
will not install your program unless the packages it depends on are
|
| 531 |
installed. Use this if your program absolutely will not run unless a
|
| 532 |
particular package is present.</item>
|
| 533 |
|
| 534 |
<item>Recommends:
|
| 535 |
<p><manref name="dselect" section="8"> will not install your package unless
|
| 536 |
the packages it recommends are installed. <manref name="dpkg" section="8">
|
| 537 |
will let you do it though. Use this for packages that are not strictly
|
| 538 |
neccessary but are typically used with your program.</item>
|
| 539 |
|
| 540 |
<item>Suggests:
|
| 541 |
<p>When a user installs your program <manref name="dselect" section="8">
|
| 542 |
will prompt him to install any package it suggests. <manref name="dpkg" section="8">
|
| 543 |
doesn't care. Use this for packages which will work nicely with your
|
| 544 |
program but are not neccessary.</item>
|
| 545 |
|
| 546 |
<item>Pre-Depends:
|
| 547 |
<p>This is stronger than depends. <manref name="dpkg" section="8"> and
|
| 548 |
<manref name="dselect" section="8"> will not install your package unless
|
| 549 |
the packages it pre-depends on are installed <em>and correctly configured</em>.
|
| 550 |
Use this very sparingly and only after discussing it on the debian-devel
|
| 551 |
mailing list. Read: don't use it at all. :-)</item>
|
| 552 |
|
| 553 |
<item>Conflicts:
|
| 554 |
<p><manref name="dpkg" section="8"> and <manref name="dselect" section="8">
|
| 555 |
will not install your program until all the packages it conflicts with have
|
| 556 |
been removed.</item>
|
| 557 |
|
| 558 |
<item>Provides:
|
| 559 |
<p>For some types of packages where there are multiple alternatives virtual
|
| 560 |
names have been defined. You can get the full list in /usr/doc/debian-policy/virtual-package-names-list.text.gz.
|
| 561 |
Use this if your program provides a virtual package.</item>
|
| 562 |
|
| 563 |
<item>Replaces:
|
| 564 |
<p>Use this when your program replaces another package.
|
| 565 |
<manref name="dpkg" section="8"> and <manref name="dselect" section="8">
|
| 566 |
will remove replaced packages before installing yours.</item>
|
| 567 |
</list>
|
| 568 |
|
| 569 |
<p>All these fields have uniform syntax. They are a list of package names
|
| 570 |
separated by commas. These package names may also be lists of alternative
|
| 571 |
package names, separated by vertical bar symbols <tt>|</tt> (pipe symbols).
|
| 572 |
The fields may restrict their applicability to particular versions of each
|
| 573 |
named package. This is done in parentheses after each individual package
|
| 574 |
name; the parentheses should contain a relation from the list below followed
|
| 575 |
by a version number. The relations allowed are <tt><<</tt>,
|
| 576 |
<tt><=</tt>, <tt>=</tt>, <tt>>=</tt> and <tt>>></tt> for strictly
|
| 577 |
earlier, earlier or equal, exactly equal, later or equal and strictly later,
|
| 578 |
respectively.
|
| 579 |
|
| 580 |
<p>The last feature I want to show you is $(shlibs:Depends). This will be
|
| 581 |
automatically filled in by dh_shlibdeps (see later) with the names of any
|
| 582 |
shared libraries, such as libc6 or xlib6g, your program uses, so you don't
|
| 583 |
have to specify them yourself. Having said all that, we can leave line 9
|
| 584 |
exactly as it is, because gentoo won't depend on any other package.
|
| 585 |
|
| 586 |
<p>Line 10 is where the list of suggestions go. Here it is only the
|
| 587 |
'menu', because gentoo should be in the X11 window managers' menus. This
|
| 588 |
is controlled also by the file debian/menu. See <manref name="menufile"
|
| 589 |
section="5">, <manref name="update-menus" section="1">.
|
| 590 |
|
| 591 |
<p>Line 11 is the short description. Most people screens are 80 columns
|
| 592 |
wide so this shouldn't be longer than about 50 characters. I'll change
|
| 593 |
it to "A fully GUI configurable GTK+ file manager".
|
| 594 |
|
| 595 |
<p>Line 12 is where the long description goes. This should be a paragraph
|
| 596 |
which gives more detail about the package. Column 1 of each line should
|
| 597 |
be empty. There must be no blank lines. Put a . in column 2 to simulate
|
| 598 |
this. Also, there must be no blank lines after the long description.
|
| 599 |
|
| 600 |
<p>Here is the updated control file:
|
| 601 |
|
| 602 |
<p><example>
|
| 603 |
1 Source: gentoo
|
| 604 |
2 Section: x11
|
| 605 |
3 Priority: optional
|
| 606 |
4 Maintainer: Josip Rodin <jrodin@jagor.srce.hr>
|
| 607 |
5 Standards-Version: 2.4.1.2
|
| 608 |
6
|
| 609 |
7 Package: gentoo
|
| 610 |
8 Architecture: any
|
| 611 |
9 Depends: ${shlibs:Depends}
|
| 612 |
10 Suggests: menu (>= 1.5)
|
| 613 |
11 Description: A fully GUI configurable GTK+ file manager
|
| 614 |
12 gentoo is a file manager for Linux written from scratch in pure C. It
|
| 615 |
13 uses the GTK+ toolkit for all of its interface needs. gentoo provides
|
| 616 |
14 100% GUI configurability; no need to edit config files by hand and re-
|
| 617 |
15 start the program. gentoo supports identifying the type of various
|
| 618 |
16 files (using extension, regular expressions, or the 'file' command),
|
| 619 |
17 and can display files of different types with different colors and icons.
|
| 620 |
18 .
|
| 621 |
19 gentoo borrows some of its look and feel from the classic Amiga file
|
| 622 |
20 manager "Directory OPUS" (written by Jonathan Potter).
|
| 623 |
</example>
|
| 624 |
|
| 625 |
<sect id="rules">the `rules' file
|
| 626 |
|
| 627 |
<p>Now we go back to the 'debian' directory to take a look at rules which
|
| 628 |
<manref name="dpkg-buildpackage" section="1"> will use to actually create
|
| 629 |
the package. This file is actually another Makefile, since it is executed
|
| 630 |
with 'make -f', but different than the one in the upstream source.
|
| 631 |
|
| 632 |
<p>Every 'rules' file, as any other Makefile, consists of several rules
|
| 633 |
of how to build the source. Rules consist of targets, filenames or names
|
| 634 |
of actions that should be carried out (for example, 'build:' or 'install:').
|
| 635 |
Rules that you want to execute you should call as the command line arguments
|
| 636 |
(for example, 'rules build' or 'rules install'). After the target name,
|
| 637 |
you can name the dependency, program or file that that rule depends on.
|
| 638 |
After that there can be any number of commands (starting with <tab>!),
|
| 639 |
until an empty line is found. There begins another rule. Comments begin
|
| 640 |
with hashes ('#'), and end with end of the line. You can invoke rules
|
| 641 |
either from other rules or from command line (ie. `debian/rules clean`).
|
| 642 |
|
| 643 |
<p>You are probably confused now, but it will all be clear upon examination
|
| 644 |
of the 'rules' file that dh_make gives us as a default.
|
| 645 |
|
| 646 |
<p><example>
|
| 647 |
1 #!/usr/bin/make -f
|
| 648 |
2 # Made with the aid of dh_make, by Craig Small
|
| 649 |
3 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
|
| 650 |
4 # Some lines taken from debmake, by Cristoph Lameter.
|
| 651 |
5
|
| 652 |
6 # Uncomment this to turn on verbose mode.
|
| 653 |
7 #export DH_VERBOSE=1
|
| 654 |
8
|
| 655 |
9 build: build-stamp
|
| 656 |
10 build-stamp:
|
| 657 |
11 dh_testdir
|
| 658 |
12
|
| 659 |
13
|
| 660 |
14 # Add here commands to compile the package.
|
| 661 |
15 $(MAKE)
|
| 662 |
16
|
| 663 |
17 touch build-stamp
|
| 664 |
17
|
| 665 |
18 clean:
|
| 666 |
19 dh_testdir
|
| 667 |
20 dh_testroot
|
| 668 |
21 rm -f build-stamp install-stamp
|
| 669 |
22
|
| 670 |
23 # Add here commands to clean up after the build process.
|
| 671 |
24 -$(MAKE) clean
|
| 672 |
25
|
| 673 |
26 dh_clean
|
| 674 |
27
|
| 675 |
28 install: install-stamp
|
| 676 |
29 install-stamp: build-stamp
|
| 677 |
30 dh_testdir
|
| 678 |
31 dh_testroot
|
| 679 |
32 dh_clean -k
|
| 680 |
33 dh_installdirs
|
| 681 |
34
|
| 682 |
35 # Add here commands to install the package into debian/tmp.
|
| 683 |
36 $(MAKE) install DESTDIR=`pwd`/debian/tmp
|
| 684 |
37
|
| 685 |
38 touch install-stamp
|
| 686 |
39
|
| 687 |
40 # Build architecture-independent files here.
|
| 688 |
41 binary-indep: build install
|
| 689 |
42 # We have nothing to do by default.
|
| 690 |
43
|
| 691 |
44 # Build architecture-dependent files here.
|
| 692 |
45 binary-arch: build install
|
| 693 |
46 # dh_testversion
|
| 694 |
47 dh_testdir
|
| 695 |
48 dh_testroot
|
| 696 |
49 dh_installdocs
|
| 697 |
50 dh_installexamples
|
| 698 |
51 dh_installmenu
|
| 699 |
52 # dh_installemacsen
|
| 700 |
53 # dh_installinit
|
| 701 |
54 dh_installcron
|
| 702 |
55 dh_installmanpages
|
| 703 |
56 # dh_undocumented
|
| 704 |
57 dh_installchangelogs
|
| 705 |
58 dh_strip
|
| 706 |
59 dh_compress
|
| 707 |
60 dh_fixperms
|
| 708 |
61 dh_suidregister
|
| 709 |
62 dh_installdeb
|
| 710 |
63 dh_shlibdeps
|
| 711 |
64 dh_gencontrol
|
| 712 |
65 # dh_makeshlibs
|
| 713 |
66 dh_md5sums
|
| 714 |
67 dh_builddeb
|
| 715 |
68
|
| 716 |
69 source diff:
|
| 717 |
70 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
| 718 |
71
|
| 719 |
72 binary: binary-indep binary-arch
|
| 720 |
73 .PHONY: build clean binary-indep binary-arch binary
|
| 721 |
</example>
|
| 722 |
|
| 723 |
<p>You are probably familiar with lines like line 1 from shell and perl
|
| 724 |
scripts. It means this file is to be run through make. Empty lines are
|
| 725 |
ignored. Lines beggining with '#' (hash) are treated as comments and also
|
| 726 |
ignored. Line 15 runs the applications own Makefile to compile the program.
|
| 727 |
|
| 728 |
<p>Things rarely work perfectly the first time so lines 18-26 clean up any
|
| 729 |
unneeded junk left over from previous failed attempts.
|
| 730 |
|
| 731 |
<p>The installation process starts with line 28. In line 33, all neccessary
|
| 732 |
directories are created in the 'debian' directory. Line 36 runs the install
|
| 733 |
target from gentoo's Makefile - and installs in the debian/tmp directory -
|
| 734 |
this is why we specified $(DESTDIR) as the root installation directory in
|
| 735 |
gentoo's Makefile.
|
| 736 |
|
| 737 |
<p>As the comments suggest, lines 40-42 are used to build architecture
|
| 738 |
independant files.
|
| 739 |
|
| 740 |
<p>Lines 45-67 run several small utilities from the debhelper package that
|
| 741 |
do things to your package to make it conform to Debian policy.
|
| 742 |
|
| 743 |
<p>The names start with dh_ and after that you can see what every little
|
| 744 |
utility really does:
|
| 745 |
|
| 746 |
<list>
|
| 747 |
<item><manref name="dh_testdir" section="1"> check that you are in the
|
| 748 |
right directory (/usr/local/gentoo/gentoo-0.9.12/),
|
| 749 |
<item><manref name="dh_testroot" section="1"> checks that you have root
|
| 750 |
permissions,
|
| 751 |
<item><manref name="dh_installdirs" section="1"> creates directories
|
| 752 |
mentioned in 'dirs' file [doesn't exist here],
|
| 753 |
<item><manref name="dh_installdocs" section="1"> copies documentation to
|
| 754 |
debian/tmp/usr/doc/gentoo directory,
|
| 755 |
<item><manref name="dh_installmenu" section="1"> copies menu file to
|
| 756 |
debian/tmp/usr/lib/menu/gentoo,
|
| 757 |
<item><manref name="dh_installmanpages" section="1"> copies manpages and
|
| 758 |
links them correctly,
|
| 759 |
<item><manref name="dh_installchangelogs" section="1"> copies changelogs
|
| 760 |
to debian/tmp/usr/doc/gentoo directory,
|
| 761 |
<item><manref name="dh_installinit" section="1"> copies init.d script
|
| 762 |
[doesn't exist here],
|
| 763 |
<item><manref name="dh_installcron" section="1"> copies crontab script to
|
| 764 |
debian/tmp/etc/cron.* [doesn't exist here],
|
| 765 |
<item><manref name="dh_installexamples" section="1"> copies example files
|
| 766 |
to debian/tmp/usr/doc/gentoo/examples [doesn't exist here],
|
| 767 |
<item><manref name="dh_strip" section="1"> strips debugging headers from
|
| 768 |
executable files to make them smaller,
|
| 769 |
<item><manref name="dh_compress" section="1"> gzips man pages and
|
| 770 |
documentation larger than 4 kb,
|
| 771 |
<item><manref name="dh_fixperms" section="1"> checks and fixes invalid
|
| 772 |
permissions in debian/tmp directory,
|
| 773 |
<item><manref name="dh_suidregister" section="1"> sets up files to register
|
| 774 |
setuid executables with <manref name="suidregister" section="8"> [doesn't exist here],
|
| 775 |
<item><manref name="dh_installdeb" section="1"> copies package related
|
| 776 |
files under debian/tmp directory,
|
| 777 |
<item><manref name="dh_shlibdeps" section="1"> calculates dependencies
|
| 778 |
of the executables,
|
| 779 |
<item><manref name="dh_gencontrol" section="1"> generates and installes
|
| 780 |
the control file,
|
| 781 |
<item><manref name="dh_makeshlibs" section="1"> generates shared libs
|
| 782 |
dependencies file [doesn't exist here],
|
| 783 |
<item><manref name="dh_md5sums" section="1"> generates MD5 checksums, and
|
| 784 |
finally,
|
| 785 |
<item><manref name="dh_builddeb" section="1"> finally builds the package.
|
| 786 |
</list>
|
| 787 |
|
| 788 |
<p>Every one of these dh_* scripts has its own man page, for more
|
| 789 |
information please read it. There are other dh_* scripts not mentioned
|
| 790 |
here, and if you might need them, read the debhelper documentation.
|
| 791 |
|
| 792 |
<p>Lines 69-73 are just macros used by the rules file and not important
|
| 793 |
to know about.
|
| 794 |
|
| 795 |
<p>The important part to know about the rules file created by dh_make is
|
| 796 |
that it is just a suggestion. It will work for simple packages but for
|
| 797 |
more complicated ones, don't be afraid to add and subtract from it to fit
|
| 798 |
your needs. This especially applies to the binary-arch sections, where
|
| 799 |
you should comment out lines that call features you don't need, in this
|
| 800 |
case I'll comment out lines 50, 54 and 61 because gentoo doesn't need them.
|
| 801 |
Only thing that you should not change are the names of the rules, because
|
| 802 |
they are needed to be named this way because all the tools use these names.
|
| 803 |
|
| 804 |
<p>Of course, some tuning is required here: on the line 57 I'll add 'FIXES'
|
| 805 |
because that is the name of the changelog file. For any other option,
|
| 806 |
please read the man page of called dh_* program.
|
| 807 |
|
| 808 |
<chapt id="dother">Other files in debian/ dir
|
| 809 |
|
| 810 |
<sect id="copyright">copyright
|
| 811 |
|
| 812 |
<p>This file contains the packages copyright information. this is
|
| 813 |
what the default dh_make creates looks like.
|
| 814 |
|
| 815 |
<p><example>
|
| 816 |
1 This package was debianized by Josip Rodin jrodin@jagor.srce.hr on
|
| 817 |
2 Wed, 11 Nov 1998 21:02:14 +0100.
|
| 818 |
3
|
| 819 |
4 It was downloaded from <fill in ftp site>
|
| 820 |
5
|
| 821 |
6 Upstream Author(s): <put author(s) name and email here>
|
| 822 |
7
|
| 823 |
8 Copyright:
|
| 824 |
9
|
| 825 |
10 <Must follow here>
|
| 826 |
</example>
|
| 827 |
|
| 828 |
<p>The important things to add to this file are the place you got the
|
| 829 |
package from and the actual copyright notice. If the copyright is one
|
| 830 |
of the popular free software licenses such as GNU, BSD or the Artistic
|
| 831 |
license, you should not include the entire text, you can just refer to
|
| 832 |
the appropriate file in /usr/doc/copyright, that exists on every Debian
|
| 833 |
system. Gentoo is licensed under the GNU public license, so we'll change
|
| 834 |
the file to this:
|
| 835 |
|
| 836 |
<p><example>
|
| 837 |
1 This package was debianized by Josip Rodin jrodin@jagor.srce.hr on
|
| 838 |
2 Wed, 11 Nov 1998 21:02:14 +0100.
|
| 839 |
3
|
| 840 |
4 It was downloaded from http://www.obsession.se/gentoo/
|
| 841 |
5
|
| 842 |
6 Upstream Author(s): Emil Brink <emil@obsession.se>
|
| 843 |
7
|
| 844 |
8 Copyright (c) Obsession Development, 1998.
|
| 845 |
9
|
| 846 |
10 gentoo is released under the GNU GPL license as free, open source soft-
|
| 847 |
11 ware. Hopefully it will seem useful to someone. NO WARRANTY.
|
| 848 |
12
|
| 849 |
13 On Debian GNU/Linux systems, the complete text of the GNU General
|
| 850 |
14 Public License can be found in /usr/doc/copyright/GPL'.
|
| 851 |
</example>
|
| 852 |
|
| 853 |
<sect id="readdeb">README.debian
|
| 854 |
|
| 855 |
<p>Any extra details or discrepancies between the original package and
|
| 856 |
your debianized version should be documented here. This is what the
|
| 857 |
default dh_make creates looks like:
|
| 858 |
|
| 859 |
<example>
|
| 860 |
gentoo for DEBIAN
|
| 861 |
----------------------
|
| 862 |
|
| 863 |
Comments regarding the Package
|
| 864 |
|
| 865 |
Josip Rodin <jrodin@jagor.srce.hr>, Wed, 11 Nov 1998 21:02:14 +0100
|
| 866 |
</example>
|
| 867 |
|
| 868 |
<p>We don't particularly have anything to put there so we'll delete it.
|
| 869 |
|
| 870 |
<sect id="changelog">changelog
|
| 871 |
|
| 872 |
<p>As you keep working on a package behavior will change, new features
|
| 873 |
will be added and bugs will be fixed. People downloading your package can
|
| 874 |
look at this file and see what has changed. This is what the default
|
| 875 |
changelog that dh_make creates looks like:
|
| 876 |
|
| 877 |
<p><example>
|
| 878 |
1 gentoo (0.9.12-1) unstable; urgency=low
|
| 879 |
2
|
| 880 |
3 * Initial Release.
|
| 881 |
4
|
| 882 |
5 -- Josip Rodin <jrodin@jagor.srce.hr> Wed, 11 Nov 1998 21:02:14 +0100
|
| 883 |
6
|
| 884 |
7 Local variables:
|
| 885 |
8 mode: debian-changelog
|
| 886 |
9 add-log-mailing-address: "jrodin@jagor.srce.hr"
|
| 887 |
10 End:
|
| 888 |
</example>
|
| 889 |
|
| 890 |
<p>Line 1 is the package name, version, distribution, and urgency.
|
| 891 |
Distribution should be unstable or experimental, and urgency shouldn't
|
| 892 |
be changed to anything higher than 'low'. :-)
|
| 893 |
|
| 894 |
<p>Lines 3-5 are a log entry, where you document changes made in this
|
| 895 |
package revision (not the upstream changes - there is special file for
|
| 896 |
that purpose). New lines must be inserted just before the uppermost line
|
| 897 |
that begins with asterisk ('*'). You can do it with dch, emacs (lines
|
| 898 |
7-10 are mode information for the Emacs editor), or just some text editor.
|
| 899 |
You will end up with something like this:
|
| 900 |
|
| 901 |
<p><example>
|
| 902 |
1 gentoo (0.9.12-1) unstable; urgency=low
|
| 903 |
2
|
| 904 |
3 * Initial Release.
|
| 905 |
4 * This is my first Debian package.
|
| 906 |
5
|
| 907 |
6 -- Josip Rodin <jrodin@jagor.srce.hr> Wed, 11 Nov 1998 21:02:14 +0100
|
| 908 |
7
|
| 909 |
8 Local variables:
|
| 910 |
9 mode: debian-changelog
|
| 911 |
10 add-log-mailing-address: "jrodin@jagor.srce.hr"
|
| 912 |
11 End:
|
| 913 |
</example>
|
| 914 |
|
| 915 |
<p>When you release a new version, you should increment the version number.
|
| 916 |
You can do that with 'dch -n <comments>', emacs or any text editor.
|
| 917 |
Tip: how to easily get the date in this format? Use the
|
| 918 |
<manref name="822-date" section="1"> program.
|
| 919 |
New version information is added at the top of the changelog file. This is
|
| 920 |
what the changelog looks like afterwards:
|
| 921 |
|
| 922 |
<p><example>
|
| 923 |
1 gentoo (0.9.12-2) unstable; urgency=low
|
| 924 |
2
|
| 925 |
3 * Comments about the second revision
|
| 926 |
4
|
| 927 |
5 -- Josip Rodin <jrodin@jagor.srce.hr> Wed, 11 Nov 1998 22:15:39 +0100
|
| 928 |
6
|
| 929 |
7 gentoo (0.9.12-1) unstable; urgency=low
|
| 930 |
8
|
| 931 |
9 * Initial Release.
|
| 932 |
10 * This is my first Debian package.
|
| 933 |
11
|
| 934 |
12 -- Josip Rodin <jrodin@jagor.srce.hr> Wed, 11 Nov 1998 21:02:14 +0100
|
| 935 |
13
|
| 936 |
14 Local variables:
|
| 937 |
15 mode: debian-changelog
|
| 938 |
16 add-log-mailing-address: "jrodin@jagor.srce.hr"
|
| 939 |
17 End:
|
| 940 |
</example>
|
| 941 |
|
| 942 |
<sect id="conffiles">conffiles
|
| 943 |
|
| 944 |
<p>One of the most annoying things about software is when you spend a
|
| 945 |
great deal of time and effort customizing a program only to have an
|
| 946 |
upgrade stomp all over your changes. Debian solves this problem by
|
| 947 |
marking configuration files so that when you upgrade a package you will
|
| 948 |
be prompted whether you want to keep your old configuration or not. You
|
| 949 |
do this by entering the full path to each configuration file (they are
|
| 950 |
usually in /etc,) one per line in a file called conffiles. Gentoo has
|
| 951 |
one conffile, /etc/gentoorc, and we'll enter that in the file.
|
| 952 |
|
| 953 |
<sect id="dirs">dirs
|
| 954 |
|
| 955 |
<p>This file specifies the directories which our package will create.
|
| 956 |
By default, it looks like this:
|
| 957 |
<p><example>
|
| 958 |
1 usr/bin
|
| 959 |
2 usr/sbin
|
| 960 |
</example>
|
| 961 |
|
| 962 |
<p>Note that the preceding slash is not included. We would have normally
|
| 963 |
changed it to look like this:
|
| 964 |
<p><example>
|
| 965 |
1 usr/X11R6/bin
|
| 966 |
2 usr/X11R6/man/man1
|
| 967 |
</example>
|
| 968 |
|
| 969 |
but those directories are already created on every system that has got
|
| 970 |
X11R6 packages installed, so we won't need this.
|
| 971 |
|
| 972 |
<sect id="maintscripts">postinst, preinst, postrm, prerm
|
| 973 |
|
| 974 |
<p>These files are called maintainer scripts, and you should try to avoid
|
| 975 |
maintainer scripts if you possibly can because they are too complex. For
|
| 976 |
more information look in the Packaging Manual.
|
| 977 |
|
| 978 |
<sect id="manpage">manpage.1.ex
|
| 979 |
|
| 980 |
<p>The files ending in *.ex are examples of how to add that kind of
|
| 981 |
support into the package. To use one of them, edit it and remove
|
| 982 |
the .ex extension.
|
| 983 |
|
| 984 |
<p>Your program should have a man page. If it doesn't, this is a skeleton
|
| 985 |
you can fill out. See the man pages for <manref name="man" section="7">
|
| 986 |
for a brief description of how to create a man page. Be sure to rename
|
| 987 |
this file to the name of the program and make the extension the manual
|
| 988 |
section it should go into. Here's a short list:
|
| 989 |
|
| 990 |
<p><example>
|
| 991 |
Section | Description | Notes
|
| 992 |
1 User commands Executable commands or scripts.
|
| 993 |
2 System calls Functions provided by the kernel.
|
| 994 |
3 Library calls Functions within system libraries.
|
| 995 |
4 Special files Usually found in /dev
|
| 996 |
5 File formats E.g. /etc/passwd's format
|
| 997 |
6 Games Or other frivolous programs
|
| 998 |
7 Macro packages Such as man macros.
|
| 999 |
8 System administration Programs typically only run by root.
|
| 1000 |
9 Kernel routines Non-standard calls and internals.
|
| 1001 |
</example>
|
| 1002 |
|
| 1003 |
<p>So gentoo's manpage should be called gentoo.1, or gentoo.1x because it
|
| 1004 |
is an X11 program. There was no gentoo.1 man page in the original source
|
| 1005 |
so I wrote it from the example.
|
| 1006 |
|
| 1007 |
<sect id="menu">menu.ex
|
| 1008 |
|
| 1009 |
<p>X Window users have a window manager with menus that can be customized
|
| 1010 |
to launch programs. If they have installed the Debian menu package,
|
| 1011 |
a set of menus for every program on the system will be created for them.
|
| 1012 |
It isn't required by Debian policy, but users will surely appreciate it.
|
| 1013 |
We can add Gentoo to the menus by editing this file. Here's the default
|
| 1014 |
that dh_make creates:
|
| 1015 |
|
| 1016 |
<p><example>
|
| 1017 |
?package(gentoo):needs=X11|text|vc|wm section=Apps/see-menu-manual\
|
| 1018 |
title="gentoo" command="/usr/bin/gentoo"
|
| 1019 |
</example>
|
| 1020 |
|
| 1021 |
<p>The first field specifies what kind of interface the program needs
|
| 1022 |
(i.e. text or X11.) The next is the menu and submenu the entry should
|
| 1023 |
appear in. The current list of sections is in /usr/doc/menu/html/ch2.html#s2.2
|
| 1024 |
The third is the name of the program. The fourth is the icon for the
|
| 1025 |
program or none if there isn't one. The fifth is the actual text which
|
| 1026 |
will appear in the menu. The sixth is the command that runs the program.
|
| 1027 |
|
| 1028 |
<p>Now we'll change the menu entry to this:
|
| 1029 |
<p><example>
|
| 1030 |
?package(gentoo):needs=X11 section=Apps/Misc\
|
| 1031 |
title="gentoo" command="/usr/X11R6/bin/gentoo"
|
| 1032 |
</example>
|
| 1033 |
|
| 1034 |
<sect id="watch">watch.ex
|
| 1035 |
|
| 1036 |
<p>You can use this file in addition to the <manref name="uscan" section="1">
|
| 1037 |
and <manref name="uupdate" section="1"> programs (in the devscripts package)
|
| 1038 |
to watch the site you got the original source from. See the man pages for
|
| 1039 |
more details. Gentoo can't use this feature so we'll delete the file.
|
| 1040 |
|
| 1041 |
<p>We are now finally ready to build the package...
|
| 1042 |
|
| 1043 |
<chapt id="build">Building the package
|
| 1044 |
|
| 1045 |
<p>Go into Gentoo's main directory (/usr/local/src/gentoo/gentoo-0.9.12/)
|
| 1046 |
and then issue this:
|
| 1047 |
<p><example>
|
| 1048 |
dpkg-buildpackage
|
| 1049 |
</example>
|
| 1050 |
|
| 1051 |
<p>This will do everything for you, you'll just have to enter your
|
| 1052 |
PGP secret key, twice. After it's done, you will see four new files
|
| 1053 |
in /usr/local/gentoo directory:
|
| 1054 |
|
| 1055 |
<p><list>
|
| 1056 |
<item><em>gentoo_0.9.12-1_i386.deb</em>
|
| 1057 |
<p>is the completed binary package. You can use dpkg or dselect to
|
| 1058 |
install and remove this just like any other package.
|
| 1059 |
|
| 1060 |
<item><em>gentoo_0.9.12-1_i386.changes</em>
|
| 1061 |
<p>As you keep working on the package, behavior will change and new
|
| 1062 |
features will be added. People downloading your package can look at
|
| 1063 |
this file and see what has changed. The file is generated from the
|
| 1064 |
gentoo-0.9.12/debian/changelog file, it contains changes to current
|
| 1065 |
revision of the package). It also lists the files in the package. The
|
| 1066 |
long strings of numbers are MD5 sums for the file. Person downloading
|
| 1067 |
your files can test them with <manref name="md5sum" section="1"> and
|
| 1068 |
if the numbers don't match, they'll know the file is corrupt or has
|
| 1069 |
been hacked. This file is PGP signed, so that people can be even more
|
| 1070 |
sure that it's really yours.
|
| 1071 |
|
| 1072 |
<item><em>gentoo_0.9.12.orig.tar.gz</em>
|
| 1073 |
<p>This is the original source code gathered up so that if someone else
|
| 1074 |
wants to recreate your package from scratch they can. Or if they aren't
|
| 1075 |
using Debian packaging system, but need to download the source and compile.
|
| 1076 |
|
| 1077 |
<item><em>gentoo_0.9.12-1.dsc</em>
|
| 1078 |
<p>This is a summary of the contents of the source code. The file is
|
| 1079 |
generated from the gentoo-0.9.12/debian/control file, and is used when
|
| 1080 |
unpacking the source with <manref name="dpkg-source" section="1">. This
|
| 1081 |
file is PGP signed, so that people can be sure that it's really yours.
|
| 1082 |
</list>
|
| 1083 |
|
| 1084 |
<sect id="errcheck">Checking your package for errors
|
| 1085 |
|
| 1086 |
<p>Run <manref name="lintian" section="1"> on your .changes file; this
|
| 1087 |
program will check for many common packaging errors. The command is:
|
| 1088 |
|
| 1089 |
<p><example>
|
| 1090 |
lintian -i gentoo_0.9.12-1_i386.changes
|
| 1091 |
</example>
|
| 1092 |
|
| 1093 |
<p>If it appears that there are some errors (lines beginning with E:),
|
| 1094 |
read the explanation (the N: lines), correct mistakes, and rebuild with
|
| 1095 |
dpkg-buildpackage. If there are lines that begin with W:, those are only
|
| 1096 |
warnings, so you can be pretty much sure that your package is okay (but
|
| 1097 |
it sure needs some fine tuning).
|
| 1098 |
|
| 1099 |
<p>Install the package to test it yourself. Try to install it on machines
|
| 1100 |
other than your own and watch closely for any errors.
|
| 1101 |
|
| 1102 |
<p>When you build a new upstream version, you should do the following:
|
| 1103 |
|
| 1104 |
<list>
|
| 1105 |
<item>upgrade from the previous version (and from the version in last
|
| 1106 |
Debian release),
|
| 1107 |
<item>downgrade back again.
|
| 1108 |
<item>install the package as a new package (i.e., with no previous version
|
| 1109 |
installed),
|
| 1110 |
<item>uninstall it, reinstall it again, and then purge it.
|
| 1111 |
</list>
|
| 1112 |
|
| 1113 |
<sect id="upload">Uploading your package
|
| 1114 |
|
| 1115 |
<p>Now that you have tested your new package throughly, you'll need to
|
| 1116 |
upload these files to master.debian.org, using <manref name="dupload" section="1">.
|
| 1117 |
First you have to set up dupload's config file. Copy the defaults from
|
| 1118 |
/etc to your home directory:
|
| 1119 |
|
| 1120 |
<p><example>
|
| 1121 |
cp /etc/dupload.conf ~/.dupload.conf
|
| 1122 |
</example>
|
| 1123 |
|
| 1124 |
<p>Then edit that file (~/.dupload.conf), find part that begins with
|
| 1125 |
'$cfg{master}' and change these lines (not neccessarilly in this order):
|
| 1126 |
<example>
|
| 1127 |
login => getlogin() || $ENV{USER} || $ENV{LOGNAME},
|
| 1128 |
visibleuser => getlogin() || $ENV{USER} || $ENV{LOGNAME},
|
| 1129 |
visiblename => "",
|
| 1130 |
fullname => "",
|
| 1131 |
</example>
|
| 1132 |
to values equivalent to these (change my settings to yours):
|
| 1133 |
<example>
|
| 1134 |
login => "joy",
|
| 1135 |
visibleuser => "jrodin",
|
| 1136 |
visiblename => "jagor.srce.hr",
|
| 1137 |
fullname => "Josip Rodin",
|
| 1138 |
</example>
|
| 1139 |
|
| 1140 |
<p>Then connect to your internet provider, make sure once again that
|
| 1141 |
you are in /usr/local/src/gentoo directory, and issue this command:
|
| 1142 |
|
| 1143 |
<p><example>
|
| 1144 |
dupload --to master gentoo_0.9.12-1_i386.changes
|
| 1145 |
</example>
|
| 1146 |
|
| 1147 |
<p>Dupload will ask for your password on master.debian.org, upload the
|
| 1148 |
packages, and give a short announcement about your upload on
|
| 1149 |
<email/debian-devel-changes@lists.debian.org/.
|
| 1150 |
<p>If you live in Europe, you can use some other upload queues instead
|
| 1151 |
of master. For details look in <manref name="dupload" section="1">,
|
| 1152 |
<manref name="dupload" section="5"> and the Developer's Reference.
|
| 1153 |
|
| 1154 |
<sect id="whereishelp">Where to ask for help
|
| 1155 |
|
| 1156 |
<p>Before you decide to ask you question in some public place, please
|
| 1157 |
just RTFM. That includes documentation in /usr/doc/dpkg, /usr/doc/debian,
|
| 1158 |
/usr/doc/debhelper and the man/info pages for all the programs mentioned
|
| 1159 |
in this article. When you receive a bug report (yes actual bug reports!)
|
| 1160 |
you will know that it is time that you dig in to
|
| 1161 |
<url name="Debian Bug Tracking System" id="http://www.debian.org/Bugs/">
|
| 1162 |
and read the documentation there.
|
| 1163 |
|
| 1164 |
<p>By joining the Debian Mentors' mailing list at <email/debian-mentors@lists.debian.org/
|
| 1165 |
you can team up with an experienced Debian developer who will help you
|
| 1166 |
with questions you might have. You can subscribe to it by sending e-mail
|
| 1167 |
to <email/debian-mentors-request@lists.debian.org/ with the word
|
| 1168 |
'subscribe' in the message body.
|
| 1169 |
|
| 1170 |
<p>If you still have questions, ask on the Debian Developers' mailing list
|
| 1171 |
at <email/debian-devel@lists.debian.org/. You can subscribe to it by
|
| 1172 |
sending e-mail to <email/debian-devel-request@lists.debian.org/ with the
|
| 1173 |
word 'subscribe' in the message body.
|
| 1174 |
|
| 1175 |
<p>Even if it all worked well, it's time to start praying. Why? Because
|
| 1176 |
in just a few hours (or days) users from all around the world will start
|
| 1177 |
to use your package, and if you made some critical error you'll get
|
| 1178 |
mailbombed by numerous angry Debian users... Just kidding. :-)
|
| 1179 |
|
| 1180 |
<p>Relax and be ready for bug reports, because there is a lot more work
|
| 1181 |
to be done before it will be fully in line with Debian policies (once again,
|
| 1182 |
read the <em>real documentation</em> for details). Good luck!
|
| 1183 |
|
| 1184 |
</book>
|
| 1185 |
|
| 1186 |
</debiandoc>
|