oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Advanced Package Management with Fink

by Koen Vervloesem

In my previous article about Fink, I covered how to install Fink and some basic things you can do with this package management system. In this article, I'll tackle some more advanced Fink topics, like building binary packages, running your own binary distribution server, and creating Fink packages for your own software.

Building Packages

Last time I explained how you can install software from source with the fink install command. Let's see what happens when you execute that command. Suppose you want to install the GNU Prolog compiler:

fink install gprolog

It doesn't matter if you use the graphical user interface FinkCommander, because it uses the same fink command.

What's happening now? Fink downloads the source tarball, generally a tar.gz or a tar.bz2 file. Then it decompresses the file and unpacks the tar archive. If the source code comes with a patch in order to get the software working on Mac OS X, the patch gets applied. Then the software gets compiled: the configure script generates a makefile and the command make uses this makefile to execute the right steps to compile the program.

Once the software has been compiled, Fink installs the software in a temporary directory. Then it creates a binary package file with extension deb: that's gprolog_1.2.16-1_darwin-powerpc.deb in our example. This gets installed in the directory /sw/fink/debs. What has happened until now is the build phase: Fink has built the package. The deb package contains the whole directory structure which has to be installed. Now Fink calls the dpkg tool to install the package.

The build and install phases are in fact two separate steps. This means you can build a package without installing it or, even more interesting, you can build a package and install it on another Mac. This computer doesn't need to have Fink or the Developer Tools installed. A deb file contains all needed files, including the binary program. You can distribute it to another Mac and install it there, as long as this computer has the libraries and other programs the program uses. These libraries can also be installed from a deb file.

When you want to build irssi for example without installing it, all you have to type in is this:

fink build irssi

In FinkCommander, we can do the same by selecting the package irssi in the list and choosing the menu item Source -> Build.

One caveat: dependencies, packages needed by the built package, are installed, not just built.

To distribute the deb file to another computer, move it to the directory /sw/fink/debs and execute fink install gprolog. Fink finds the binary package file and installs the GNU Prolog compiler from it.

Running a Binary Distribution Server

In the last article you saw that not all Fink packages are available as a binary package. If you want to distribute a certain set of binary packages to a group of clients, you can place binary packages of all the programs you use in your organization on a central server, the distribution server. The clients can download the packages from the server and install them then. This approach has several advantages:

  • The clients don't have to execute the tedious task of compiling themselves.
  • Programs you need can be available as binary packages, even if the official Fink sites don't have them available.
  • Downloading packages will be much faster if the distribution server is placed in an intranet.

Let's see how we can set up such a configuration. On the distribution server, you have to take the following steps:

  1. Install Fink in the default path /sw.
  2. Build the packages you want to distribute with the fink build command (or FinkCommander's equivalent). You don't have to install these packages on the server.
  3. Run fink scanpackages to update the list of available binary packages.
  4. Make the directory /sw/fink available for download.

The first three steps are straightforward. For the fourth step, you actually have some choices. You can make the directory available through different methods: via HTTP, FTP or SSH. We will show how to do it via HTTP, because it's rather easy.

You have to change the configuration file of the Apache web server, which is included in Mac OS X. You can't do it with TextEdit or another graphical editor, so you have to use the command-line editor vim. Type the following in

sudo vim /etc/httpd/httpd.conf

Give your password when asked. Scroll to the following line:

<IfModule mod_alias.c>

Then type i for going into insert mode and add the following after the IfModule line:

Alias /fink /sw/fink
<Directory /sw/fink>
  Options Indexes FollowSymLinks

You can select and copy it from here. These lines tell the web server to share the contents of the directory /sw/fink on the URL /fink. Afterwards, push the Esc button and type :wq to save the changes and quit vim.

Now start the Apache web server by enabling Personal Web Sharing in the Sharing section of System Preferences. If the web server was already enabled when making the changes to /etc/httpd/httpd.conf, we have to restart the server to read the configuration file again:

sudo /usr/sbin/apachectl graceful

If you don't want to use a web server, you can instead share the Fink directory on an FTP server (included in Mac OS X), or even with SSH (also included in Mac OS X). The details are left out here.

Every time you add new or updated binary packages on the distribution server, you have to run the fink scanpackages command to update the list of available binary packages. Otherwise the clients can't download these new packages.

Pages: 1, 2, 3

Next Pagearrow