Packaging Tutorial - 1. How to Start
1.1 Learn the Basics
Please note: In this document we assume that fink
is installed into
/opt/sw
- the default location. If you see a codeblock similar to
finkdev% somecommand
it means that you have to type somecommand
into Terminal.app or
any other terminal on your Mac.
First you should learn a few basic concept about how to build Fink packages. We suggest you:
- Have a look at Using Fink: A Developer's How To (2MB pdf file) - slides from a presentation at the O'Reilly Mac OS X Conference.
- Read and try to understand the example here.
-
Look at other, similar packages in your
/opt/sw/fink/dists/unstable/main/finkinfo/
directory or in the online CVS repository and take one (or several) info file(s) as a starting point. - Search the Package Submission Tracker if somebody else already tried to package the same and the Package Request Tracker if there is a matching request. You might find valuable information there.
- Maybe browse the Packaging Manual if you think you need more detailed information.
1.2 Make your Package
Save your new info file (and patch file - if needed) into your
/opt/sw/fink/dists/local/main/finkinfo/
directory. The file should be named
packagename.info
(and packagename.patch
) where
packagename
is the name of your package. If this directory doesn't
exist you need to create it manually.
Please note:
Make sure you are running an up-to-date fink
tool by running
finkdev% fink selfupdate
Now run
finkdev% fink configure
and set the verbosity level to the highest value and enable the unstable tree.
After that you should check if fink
found your package by typing:
finkdev% fink list packagename
If it doesn't show up in the list you might need to change your fink configuration file to include your local tree.
Maybe you also have to manually re-index your packages by typing:
finkdev% fink index
If you need more information read the Packaging Manual or use one or more of different help sources. You should also subscribe to the fink-devel mailing list.
1.3 Validate your Package
During validation of your package you should set the verbose level of
fink
to the highest possible value. Check the section on the
fink configuration file
about how to change the verbose level.
Check if your package passes validation by running:
finkdev% fink validate /opt/sw/fink/dists/local/main/finkinfo/packagename.info
If the validation passes try to build your package with:
finkdev% fink -m --build-as-nobody rebuild packagename
Watch the output of the build process carefully for errors or warnings.
Especially make sure that everything is installed into the destination directory
(which is located at /opt/sw/src/root-packagename-%v-%r/opt/sw
) from where
fink
builds the binary package. Nothing should be installed directly into
/opt/sw
.
If you use the --keep-build-dir
or -k
option to fink
, it will
keep the build directory. This is where fink
expands the downloaded source and
where the package gets built. This might help if you need to debug the build
process. Type man fink
for details.
You may also want to use the --keep-root-dir
or -K
option, it will keep the destination directory. This is where fink
builds the installation tree for the package. Comparing build and destination directories may help you debugging the installation phase.
If the build succeeds check the content of the binary package with:
finkdev% dpkg -c /opt/sw/fink/dists/local/main/binary-darwin-powerpc/packagename.deb
Check if all files that you think should be in the package are actually
in the .deb file. Again: make sure that nothing is installed directly into
/opt/sw
.
Now you can also validate the binary package by doing:
finkdev% fink validate /opt/sw/fink/dists/local/main/binary-darwin-powerpc/packagename.deb
If all is well install the package with:
finkdev% fink install packagename
and test the functionality of your package.
If any of the above steps fail try to correct the errors and restart at the
top with the fink validate
step.
1.4 Submit your Package
If your package passes all the checks above you now can submit the info (and patch if necessary) file to the Package Submission Tracker.
A package reviewer should now take a look at your package submission and add it to the Fink unstable tree if the package seems ready. If not you will be asked to bring the package into compliance with the policy.
Important:
- If feasible add multiple items one at a time to the same tracker item (e.g. info and patch files).
-
Add a note whether your package is intended for the
10.3
tree,10.4
tree, or both, -
which
section
(graphics, sci, etc.) you feel it belongs in, and -
that you have run the command
fink validate
on your info and deb files. -
Set the
Group
field of the tracker item toUndergoing Validation
when you create the new tracker. Also change it back toUndergoing Validation
whenever you fixed problems package reviewers found in your submission. -
Set the
Category
field of the tracker item to the correct value.