by David Sweet
By now you have probably become familiar with the standard form in which KDE applications and libraries are distributed. The source code is bound in a single directory in a gzipped tar file, and the program is made and installed with the commands ./configure; make; make install. In this chapter, you learn how to create packages like this for your own applications.
The advantages to using this standard packaging method include
An easy and familiar compilation and installation procedure for end users.
A simple way to construct makefiles and manage dependencies (including .moc files).
A convenient way to adapt your source code to the system on which it is being compiled. These advantages occur because of the use of Autoconf and Automake, as well as the hard work of Stephan Kulow (who maintains the KDE packaging software) and other contributors. To use this packaging system, you need Autoconf version 2.13 or better and Automake version 1.4a or better. You will also need to have Perl installed.
You can find out about Autoconf, Automake and Perl at the following URLs:
|
After you've created a working package for your application, you'll want to distribute it and get the word out to potential users. This chapter will show you how.
16.1. The Structure of a PackageA package contains several files in addition to your source code, such as makefiles, scripts, and sources for the makefiles and scripts. A typical layout is shown in Figure 16.1. This layout is taken from the package kexample.tar.gz. In this chapter, you will examine it and develop it into a package for KSimpleApp, the application written in Chapter 2, "A Simple KDE Application." The top-level directory of a package contains some administrative scripts, including the script configure, and a makefile. The script configure runs several tests to learn about the system before the software is compiled. These tests include checking for the appropriate versions of KDE and Qt; checking for the locations of KDE, Qt, and X; checking for the presence of various utility programs; and checking for various system-dependent behaviors of programs and library functions. The file Makefile is used by the make utility to build and install the software, to remove files not needed for distribution, and to regenerate automatically generated files when they are needed. The script configure is generated automatically by the Autoconf from a file called configure.in and Makefile is generated by configure from the file Makefile.in. You will see how to create these files later in the section "Configuring the Top-Level Directory." There are two important subdirectories. One is given the name of your application in all lowercase letters (the subdirectory for KSimpleApp, for example, is ksimpleapp), and the other is called po. The first subdirectory contains all the application's source code, and po holds translations of the string literals that are passed to the i18n() function. |