Chapter 6. Creating and Installing PackagesContents:Just because you can build all your applications from source doesn't mean that you should. Linux users are spoiled by the wealth of applications that they can download as Red Hat or Debian packages. FreeBSD users have the best of both worlds (packaged software and building from source) through the vast number of applications in /usr/ports. Mac OS X users can tap into this wealth of applications through the Fink and GNU-Darwin projects. However, if you go through the trouble of building applications from source, you might want to package the resulting binaries for distribution so others can install the package, you can reinstall it at a later time without needing to rebuild it from source, or you can install it on multiple machines. Mac OS X is quite rich in the number of options available for packaging. This chapter covers the Fink and GNU-Darwin distributions, as well as the packaging tools that come with Mac OS X's Developer Tools, and shows you how to package your application for distribution. 6.1. FinkChristoph Pfisterer[7] started the Fink project in December 2000. A number of other people continued the project after Pfisterer left it in 2002.
Fink is essentially a port of the Debian Advanced Package Tool (APT), with some frontends and its own centralized collection site, which stores packaged binaries, source code, and patches needed to build software on Mac OS X. The Fink package manager allows you to install a package, choosing whether to install it from source or a binary package. Consistent with Debian, binary package files are in the dpkg format with a .deb extension and are managed with the ported Debian tools dpkg and apt-get. Fink also provides new tools that create a .deb package from source. A database of installed software is maintained that identifies packages by the combination of name, version, and revision. Moreover, Fink understands dependencies, uses CVS to propagate software updates, supports uninstallation, and makes it easy to see available packages and installed packages. Fink can be used to install XFree86, as well as several hundred other popular Unix packages. If you already have a copy of XFree86 installed, Fink recognizes and supports it. TIP: Although Fink does not manage Mac OS X packages, it does require Mac OS X Developer Tools. Fink installs itself and all of its packages, with the exception of XFree86, in a directory named /sw, thus completely separating it from the main system directory /usr. A more traditional Unix practice is to place locally installed software in /usr/local. Installing software in /sw takes the usual practice one step further and is regarded as a safer policy. If problems occur with Fink-installed packages, you can then delete the entire /sw directory tree without affecting your system. You can install Fink from binary or source. Both methods of installation are simple. The binary installation involves the following steps:
To install Fink from source, perform the following steps.
To begin using Fink, you need to set up your PATH and some environment variables. Fink provides shell scripts to help with this. If you are using tcsh or csh, you can execute this command before using Fink applications (or add it to your .cshrc or .tcshrc file, depending on which one you have): source /sw/bin/init.csh If you are using sh, zsh, ksh, or bash, you can run this command (or add it to your .profile or .bash_profile file): . /sw/bin/init.sh Use the following command to perform additional post-install configuration (you will be prompted for your password): fink scanpackages Fink can later be updated by entering the commands: fink selfupdate fink update-all The first command updates Fink itself, including the list and descriptions of available packages, while the second command updates any installed packages. Once Fink has been installed, you can see what packages are available by entering the command fink list. You can download and install binaries via dselect (shown in Figure 6-1), a console-based frontend to dpkg. To use dselect, you need to have superuser (or administrator) privileges, so you'll need to run sudo dselect in the Terminal. Once dselect has started, you can use the following options to maintain, install, and uninstall packages: Figure 6-1. The dselect program's main menu
Table 6-1. Some apt-get and dpkg commands
TIP: You must run [U]pdate at least once after installing Fink.
The fink command is used from the command line to maintain, install, and uninstall packages. Table 6-2 lists some examples of its usage. Table 6-2. Various fink commands
Using Fink, you can mix binary and source installations. That is, you can install some packages from their precompiled .deb files and others from source. If you do this, you will need to first use apt-get to update the available binaries and subsequently use fink selfupdate, followed by fink update-all, to update packages installed from source. Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|