macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Advanced Package Management with Fink
Pages: 1, 2, 3

In the line ConfigureParams, you set some parameters so that all files will be installed in the right directory. The --prefix option says that the /sw directory tree should be used. The --mandir and --datadir options are responsible for the right placement of the manpages and the documentation. In the install phase, we have to copy the list of files after DocFiles to the documentation directory. To install gnuvd, Fink has to execute the make install command.

To find for yourself which steps you have to make in the different phases with a specific program, you have to read the INSTALL file. The gnuvd package is a simple example, but Fink packages can be more difficult to make.

Now save this file as gnuvd.info. The first thing we do is validate it with the fink validate command. This will check whether our info file follows the guidelines for Fink packages:

koan$ fink validate gnuvd.info 
Warning: Length of package description exceeds 45 characters. (gnuvd.info)

It looks rather OK. You shouldn't get an error, just a warning. The description you wrote in the info file will be displayed by the fink list command, so it should be very short and informative, preferably less than 45 characters. Shorten the description to: "Dutch dictionary using the Van Dale website." That should be clear. fink validate doesn't complain anymore, so the package file seems OK.

The next step is trying to build the package. You copy (as root, so with sudo) the gnuvd.info file to /sw/fink/dists/local/main/finkinfo/ to make it available to Fink. Then you download the file with the source code in /sw/src. Go in Terminal.app to /sw/src and type:

zen:/sw/src koan$ sudo wget http://www.djcbsoftware.nl/code/gnuvd/gnuvd-1.0.2.tar.gz
Password:
--14:03:57--  http://www.djcbsoftware.nl/code/gnuvd/gnuvd-1.0.2.tar.gz
           => `gnuvd-1.0.2.tar.gz'
Resolving www.djcbsoftware.nl... 217.22.64.74
Connecting to www.djcbsoftware.nl|217.22.64.74|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 136,078 (133K) [application/x-tar]

100%[====================================>] 136,078      135.17K/s             

14:03:58 (134.79 KB/s) - `gnuvd-1.0.2.tar.gz' saved [136078/136078]

Then:

zen:/sw/src koan$ fink build gnuvd

If all goes fine, you end up with something like this:

figure 1
Figure 1. We have built the gnuvd package.

Now the directory /sw/fink/dists/local/main/binary-darwin-powerpc/ contains our binary package gnuvd_1.0.2-1_darwin-powerpc.deb. Let's inspect the package contents. This can be done with the command dpkg -c:

figure 2
Figure 2. The contents of our gnuvd package

This looks OK too: all files will be installed under /sw, as they should be. For a last check, validate the deb file:

zen:/sw/fink/dists/local/main/binary-darwin-powerpc koan$ fink validate gnuvd_1.0.2-1_darwin-powerpc.deb 
Validating .deb file gnuvd_1.0.2-1_darwin-powerpc.deb...

If you don't get an error, you should be able to install the binary package:

zen:/sw/fink/dists/local/main/binary-darwin-powerpc koan$ fink install gnuvd
Password:
Information about 5135 packages read in 1 seconds.
The following package will be installed or updated:
 gnuvd
/sw/bin/dpkg-lockwait -i /sw/fink/dists/local/main/binary-darwin-powerpc/gnuvd_1.0.2-1_darwin-powerpc.deb
Selecting previously deselected package gnuvd.
(Reading database ... 18964 files and directories currently installed.)
Unpacking gnuvd (from .../gnuvd_1.0.2-1_darwin-powerpc.deb) ...
Setting up gnuvd (1.0.2-1) ...

And now you're able to use the new package:

zen:/sw/fink/dists/local/main/binary-darwin-powerpc koan$ gnuvd inleiding
`in|lei|ding (de ~ (v.))
1 tekst, woorden ter voorbereiding op de eigenlijke tekst of het eigenlijke verhaal => aanloop, introductie, preambule
2 korte voordracht over een bepaald onderwerp

Now you only have to submit the info file to Fink's Package Submission Tracker. A package reviewer will take a look at it and add it to the Fink tree if the package seems usable. Users can install your package then by just typing fink install gnuvd.

This was a very simple package to make. For more difficult cases, I suggest you read the Fink documentation. You can find more complete information on the Fink website, especially the packaging tutorial and the packaging manual.

Final Thoughts

In this article I've discussed more advanced ways to work with packages. You saw how to build binary packages and how to distribute them with a dedicated server. You saw how to detect dependencies and how to create a new source package. In this way, you can help the Fink community to build an even greater repository of Unix software for Mac OS X.

Koen Vervloesem has a master's degree in computer science and has been freelancing as an IT journalist since 2000, primarily for Dutch IT magazines.


Return to the Mac DevCenter