Prerequisites
Zurück
Weiter

Prerequisites

This guide assumes that the reader has a reasonable knowledge of building and installing software from source on Linux distributions. The guide also uses the Command Line Interface (CLI) throughout, so you should be comfortable using a terminal. Below is a quick overview or review of some of the requisite knowledge.

make

Beschreibung:

GNU Make is a very important software building tool. It is used to transform a complex compilation task into a trivial one. It is important that you know how to use it, because we will store most of the information about the packaging process in a Makefile.

Referenzen:

GNU Make has a well-written man page and extensive info documentation. Documentation is also available at the GNU website.

./configure

Beschreibung:

This script is included in almost all Linux source, especially for software written in compiled languages such as C and C++. It is used to generate a Makefile (file used by make) that is properly configured for your system. Standard Debian packaging tools use it, so it is important that you know what the configure script does. You do not need to know how to create a configure script yourself, as the software author (or autoconf will do that. However, you may have to adjust it at some point to get a Ubuntu package to build correctly.

Schnell Anleitung:

First, get the GNU Hello source. From a terminal:

wget http://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz # get the package
tar -xzf hello-2.1.1.tar.gz # unpack it
cd hello-2.1.1/
			

Now, with ./configure you can run the configure script to generate a Makefile that is customized to your system.

Sie können ./configure auch Kommandozeilen Parameter zuweisen. Zum Beispiel wird das Programm GNU Hello standardmäßig in das /usr/local/ Verzeichnis installiert. Sie könnte es auch stattdessen irhendwo anders installieren (etwa in ein persönliches Binärverzeichnis wie ~/programs/)

./configure --prefix="$HOME/programs/" # Installationsverzeichnis festlegen

Um alle Optionen für ./configure zu sehen, führen Sie ./configure --help aus.

Referenzen:

Nähere Informationen über ./configure finden Sie in der make Dokumentation.

Apt/Dpkg

Beyond the basic use of installing programs, apt and dpkg have many features that are useful for packaging.

  • apt-cache dump - lists every package in the cache. This command is especially helpful in combination with a grep pipe such as apt-cache dump | grep foo to search for packages whose names or dependencies include „foo“.

  • apt-cache policy - lists the repositories (main/restricted/universe/multiverse) in which a package exists.

  • apt-cache show - displays information about a binary package.

  • apt-cache showsrc - Zeigt Informationen über ein Quellpaket an.

  • apt-cache rdepends - shows reverse dependencies for a package (which packages require the queried one.

  • dpkg -S - Listet die Binärpakete auf, zu denen eine bestimmte Datei gehört

  • dpkg -l - Listet alle zurzeit installierten Pakete auf. Ähnlich zu apt-cache dump, aber für installierte Pakete.

  • dpkg -c - lists the contents of a binary package. It is useful for ensuring that files are installed to the right places.

  • dpkg -f - shows the control file for a binary package. It is useful for ensuring that the dependencies are correct.

  • grep-dctrl - searches for specialized information in packages. It is a specific use of the grep package (but not installed by default).

diff und patch

The diff program can be used to compare two files and to make patches. A typical example might be diff -ruN file.old file.new > file.diff. This command will create a diff (recursively if directories are used) that shows the changes, or „delta“, between the two files.

The patch program is used to apply a patch (usually created by diff or another similar program) to a file or directory. To apply the patch created above, we can invoke patch -p0 < file.diff. The -p tells patch how much it should strip from the paths for the file names in the patch. -p0 means to strip nothing, or leave the path intact.

Zurück
Weiter
Zum Anfang