Creating local packages

As explained in the local packages post, sometimes it might be necessary to create a local package in order to test or use different build options. For example, Fink’s libgpiv3 package doesn’t have the DEBUG macro enabled and therefore libgpiv3 doesn’t dump messages that are useful when there’s need for debugging. I’ll use this package as an example of how to create a local package.

Copying files to the local tree

The first step is to copy the package description and necessary patches to the folder finkinfo in the local tree, /sw/fink/dists/local/main/finkinfo. In order to find the name and location of the package description file (and patch file if it exists), run the command

fink dumpinfo -finfofile -fpatchfile libgpiv3

It should output something similar to

infofile: /sw/fink/dists/unstable/main/finkinfo/sci/libgpiv3.info

This shows that libgpiv3 has no patch file.

In order to copy the package description to the local tree, run

cd /sw/fink/dists/local/main/finkinfo
sudo cp /sw/fink/dists/unstable/main/finkinfo/sci/libgpiv3.info .

If you’re changing a package that has a patch file, don’t forget to copy it as well.

Editing the package description

Use your favourite text editor to open the local package description – you’ll need administrative rights to do that (e.g. sudo). The first step is to change the revision number so that the local package description appears to Fink as the most recent one. At the time of writing, the current revision number of libgpiv3 is 3, so change it to (say) 4:

Revision: 4

In order to define the DEBUG macro, add its definition to the SetCFLAGS field:

SetCFLAGS: -Os -DSYSTEM_RSC_DIR="\"%p/etc\"" -DDEBUG

Revision, SetCFLAGS and other fields are explained in the Packaging Manual, Fields section.

Save the file and check if it’s ok by running the command

fink -v validate libgpiv3.info

Building and installing the local package

Before building the local package, tell Fink to scan the trees so that it’ll detect the local package in the local tree:

fink index

If you run that previous fink dumpinfo command again you’ll see that Fink now considers the local package as the most recent (and the one it’ll use from now on).

Now build the package:

fink -m --build-as-nobody rebuild libgpiv3

Alternatively, you might want to save the build log (located under /tmp) in order to check if -DDEBUG is actually being used:

fink -lm --build-as-nobody rebuild liggpiv3

If the package builds fine then you should have two .deb files (libgpiv3, libgpiv3-shlibs) under /sw/fink/dists/local/main/binary-darwin-i386 (or whathever is the architecture of the system you’re building on). Now install the package via

fink install libgpiv3

Version updates

Fink always tries to use the most recent version/revision of a package. This means that if Fink’s original package is updated then yours won’t be used in subsequent selfupdates – if a local package has version/revision <= Fink’s version/revision, Fink will use its own instead. See the local packages post.

If the local package has a patch file and you want to update it to a newer version, make sure that the patch file is suitable for that version.

Submitting a package to Fink

If you think that your local package would be useful for other users, consider submitting it to Fink. If the package has a listed maintainer in its description file, contact the maintainer via e-mail. If the maintainer is listed as None, add yourself as the maintainer of your local package (and perhaps the original package too!) and submit it to the Submissions tracker on SourceForge.net. Depending on the changes it might warrant a new package name, e.g. libgpiv3-debug.

2 responses to “Creating local packages

  1. Pingback: Starting anew « Finkers: a blog about Fink

  2. I dont disagree with this article!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s