12.4 Creating Fink Packages

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 <bjepson@oreilly.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.


The name of the package.


The package version.


The package revision number.


The URL of the source distribution. You can use percent expansion in the name. (In this example, %n is the name of the package and %v is the package version.) See the Fink Packaging Manual for more percent expansions.


The MD5 sum for the file, as calculated by the md5sum binary ( /sw/bin/md5sum ) that comes with Fink. You may need to replace the MD5 sum in the hellow-1.0.info file if it's different than what's shown in Example 12-4.


The command (or commands) needed to compile the source package. The command(s) may span multiple lines, but must begin after the colon .


The command (or commands) that install the compiled package. The command(s) may span multiple lines, but must begin after the colon.


A short description of the package.


A longer description of the package, enclosed with << >> .


The license used by the package. See the Fink Packaging Manual for information on available licenses.


The name and email address of the maintainer.

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 .

If /sw/etc/fink.conf has the entry MirrorOrder: MasterFirst (the default), it will try to find the .tar.gz file on the server designated as Mirror-master . Since it is unlikely that hellow-1.0.tar.gz will be hosted on that server, it will fail, and you'll be presented with several options, including "Retry using original source URL," which will download the file from the location specified in hellow-1.0.info . You could avoid this by changing the MirrorOrder to MasterLast , but we do not recommend changing the default behavior of Fink, since it could have unpredictable results down the road.

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.

Mac OS X Panther for Unix Geeks
Mac OS X Panther for Unix Geeks
ISBN: 0596006071
EAN: 2147483647
Year: 2003
Pages: 212

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net