C2.7.1.2 Documentación a presentar en la obra
II: Soporte, Mantenimiento y Garantía
We recommend that you carry out this tutorial inside a virtual machine rather than on real hardware Whether building RPMs or Debian packages, the confi guration consists of editing some text fi les
The actual building of packages takes place from the command line, as does much of the setup The fi nished product, a DEB fi le that can be installed on Debian- derived distros
01
Employ a virtual machineUsing a virtualiser such as VirtualBox or VMware is often the best approach to building packages for other systems. For one thing, it allows you to maintain a relatively clean, reference installation that is comparable to a setup that other people are likely to be running. This also means that you can keep a selection of target environments, using a different distributions. In addition, most virtualisation products allow the emulation of different architectures, and this can even extend to running a 64-bit OS on a 32-bit platform, although performance will suffer.
02
Starting from scratchIf things go wrong, with Ubuntu or Fedora, it is perfectly safe to simply delete the source directory and start again. Note that the Debian tools do alter the source archive, so you’ll have to start with a fresh copy.
Part 1: Debian
03
Install build environmentWe’ll start by installing most of the tools that we need for to make software from source code. Type:
sudo apt-get install build-essential autoconf automake autotools-dev
Now we have to install tools that are used for handling DEB packages. Do this with the following command…
sudo apt-get install dh-make
debhelper devscripts fakeroot xutils lintian pbuilder
04
Create a GPG keyIf you haven’t created a created a public GPG key in the past, you must create one now so you can sign packages. Start by typing
gpg --gen-key. Accept the default settings,
and fi ll in your details. Make a note of these, as we need an exact match later. Following this, type ls ~/.gnupg to make sure the new key exists (it’s fi rstname_lastname.gpg). Create a public key from this with:
gpg -a --output ~/.gnupg/[your key]. gpg --export '[your name]'. Import this with gpg --import ~/.gnupg/[your key].gpg
05
Fetch packageIn this example, we’re going to fetch and build the latest version of the Dillo web browser. Navigate to the Dillo website (www. dillo.org) and download the most recent .tar.bz tarball. Create a directory for source code with
mkdir ~/src and move the archive into it.
06
Unpack the archiveUnpack the archive with tar -xjvf
[archive name].tar.bz2. Note the naming
convention of the directory (package name- version) is crucial, and fortunately Dillo complies with this. It’s also crucial that the source archive is one level above the source directory.
07
Add Debian complianceMove into the directory that we have just unpacked with cd. dh_make is a script that takes care of adding the confi guration fi le and directory structure that we need; it’s part of the debhelper suite that we added earlier.
dh_make -e [your email address] -c licence -f ../[source archive]
In our example, the command line is:
dh_make -c gpl3 -e example@example. com -f ../dillo-3.0.3.tar.bz2
When prompted, select single binary. The helper script should have created a directory called Debian within the source code directory.
08
Open the control fi leOpen the fi le control in the debian subdirectory in a text editor. Fill in the homepage section (Google for complete list of Debian software sections) and description fi elds of this fi le.
09
Discover dependenciesYou can discover the dependencies needed to run the software in the package by moving into the source directory and typing dpkg-depcheck -d ./configure into a terminal. This may produce errors that indicate a package needed in order to build the software is missing. You can discover these packages by typing sudo apt-get build-dep [name of
package], and this should help if there is some
support for this software in the repository of the distribution. If not, you’ll have to repeatedly
run dpkg-depcheck -d ./configure and add
packages manually by typing sudo apt-get
install [name of package].
10
Add dependencies to the control fileWhen the command from the previous step has completed, it should present you with a list under the packages needed heading. Add this list of dependencies to the depends: section of the control fi le. Each item on the list must be separated by a comma and a space.
11
Edit the copyright fi leTry to complete this step as comprehensively as you can, and don’t skip it. Source: is usually the homepage of the project. Within the Files: * section, replace the copyright information with the names of the authors of the project. You can see the required format for this by examining the Files: debian/* section, which should have your details in it. You may have to do a bit of detective work to fi nd the information you need. Look for fi les such as AUTHORS and COPYING within the source directory.
12
Edit the changelog fi leOpen the changelog fi le and make sure that the name and email address match those that you entered when creating your GPG key. Typically, the helper script may have added your username rather than your real name to the fi le. As with the copyright fi le, don’t skip over