You can create your own Fink packages by identifying a source archive and creating a . info file in your /sw/fink/dists/local/main/finkinfo directory.
12.4.1 Creating and Publishing the Tarball
The Fink package system needs a tarball that can be downloaded with the curl utility. To illustrate how to create a Fink package, let's use the hellow-1.0 program (see Section 12.1 earlier in this chapter). Before you proceed, you should create a tarball named hellow-1.0.tar.gz with the following contents, and move it to the /Users/Shared/hellow/src directory:
hellow-1.0/ hellow-1.0/hellow.1 hellow-1.0/hellow.c hellow-1.0/Makefile
The curl utility can download this file with the following URL: http://www.jepstone.net/downloads/hellow-1.0.tar.gz. (You could also host your own files on a public web server, FTP server, or a local filesystem by using file : URL.)
12.4.2 Creating the .info File
Next, create a .info file to tell Fink where to download the package from and how to install it. Fink uses this information to download, extract, and compile the source code, and then to generate and install a Debian package ( .deb file). This file must be in /sw/fink/dists/local/main/finkinfo , so you'll need superuser privileges to create it (use the sudo utility to temporarily gain these privileges). Example 12-4 shows /sw/fink/dists/local/main/finkinfo/hellow-1.0.info .
Example 12-4. -The hellow-1.0 info file
Package: hellow Version: 1.0 Revision: 1 Source: http://www.jepstone.net/downloads/%n-%v.tar.gz Source-MD5: 4ca04528f976641d458f65591da7985c CompileScript: make InstallScript: mkdir -p %i/bin cp %n %i/bin mkdir -p %i/share/man/man1 cp %n.1 %i/share/man/man1/%n.1 Description: Hello, World program DescDetail: << Prints a friendly greeting to you and your friends. << License: Public Domain Maintainer: Brian Jepson <email@example.com>
The hellow-1.0.info file includes several entries, described in the following list. See the Fink Packaging Manual at http://fink. sourceforge .net/doc/packaging/ for more details.
12.4.3 Installing the Package
To install hellow , use the command fink install hellow . This command downloads the source to a working directory, and then extracts , compiles, and packages it, generating the file /sw/fink/dists/local/main/binary-darwin-powerpc/hellow_1.0-1_darwin-powerpc.deb .
After Fink creates this file, it installs it using dpkg . After you've installed hellow , you can view its manpage and run the hellow command:
$ man hellow HELLOW(1) System General Commands Manual HELLOW(1) NAME hellow - Greeting generator DESCRIPTION This command prints a friendly greeting. Mac OS April 15, 2002 Mac OS $ hellow Hello, world!
This example shows only a portion of Fink's capabilities. For example, Fink can be used to download and apply patches to a source distribution. For more information, see the Fink Packaging Manual (http://fink.sourceforge.net/doc/packaging/index.php), which contains detailed instructions on how to build and contribute a .deb package to the Fink distribution.