弄deb
Debian packages are produced by the dpkg package management utility. Like RPM, dpkg follows a
series of instructions that are given to it via a single text file. In Debian, this file is known as a control file
(the parallel with RPM being the SPEC file), and it contains much the same kind of information as that
you have already seen in the previous RPM example. There’s a control file included in the example
Debian package, which you will learn how to build in this section.
Creating a single Debian package can be fairly straightforward, thanks to the automated Debian helper
scripts. In this case, dh_make can be used from the command line in order to create a new package,
given an existing source code project to work with. For example, you can copy the existing hello-
1.0.tar.gz into a new directory and use it as the basis for a brand-new Debian package.
Copy the hello-1.0.tar.gz code into a working directory and unpack it:
$ tar xvfz hello-1.0.tar.gz
Inside the newly extracted directory, you’ll find the familiar example source code. To create a Debian
package, you can call the dh_make script from within this directory:
$ dh_make -e jcm@jonmasters.org -f ../hello-1.0.tar.gz
Although there are many option flags available for dh_make (see the man page for a lengthy descrip-
tion), you need only two to get started. In the above command, -e informs dh_make that the email
address of the package author is jcm@jonmasters.org, while the -f option specifies the location of the
original unmodified sources for the current source tree.
When you run dh_make, you will be asked what type of package you would like to create:
Type of package: single binary, multiple binary, library, kernel module or cdbs?
[s/m/l/k/b]
Since you are creating a single binary package, you want the s option (the others are more complex and
documented elsewhere). Here is the output from a typical invocation of dh_make:
$ dh_make -e jcm@jonmasters.org -f ../hello-1.0.tar.gz
Type of package: single binary, multiple binary, library, kernel module or cdbs?
[s/m/l/k/b] s
Maintainer name : Jon Masters
Email-Address : jcm@jonmasters.org
Date : Mon, 01 Jan 2007 14:54:00 +0000
Package Name : hello
Version : 1.0
License : blank
Type of Package : Single
Hit to confirm:
Done. Please edit the files in the debian/ subdirectory now. You should also
check that the hello Makefiles install into $DESTDIR and not in / .
没有评论:
发表评论