Fink packaging tutorial

About

Fink is a great way to install software on Mac OS X. Basically, it is a port of the Debian Package Manager.

So you want to contribute your own packages?

Since creating Fink package is not that much more effort than compiling the software from source, you can kill to birds with one stone. Below is a Makefile that supports the process:

INFOS = mypackage1.info mypackage2.info

PACKAGES = $(patsubst %.info,%.deb,$(INFOS))

DEBPATH = /sw/fink/dists/local/main/binary-darwin-*
LOCALDIST = /sw/fink/dists/local/main/finkinfo/

all: $(PACKAGES)

clean:
        rm -f $(PACKAGES) *~

distclean:
        make $(patsubst %.info,%.CLEAN,$(INFOS))

%.CLEAN: %.info
         fink remove $(patsubst %.info,%,$<)
         sudo rm -f $(DEBPATH)/$(patsubst %.info,%,$<)*.deb
         sudo rm -f $(LOCALDIST)/$<

%.deb: %.info
       echo "Copying files...:"
       sudo install $< $(LOCALDIST)
       sudo install $(patsubst %.info,%.patch,$<) $(LOCALDIST) || true
       echo "Validating $< ..."
       fink -v validate $<
       echo "Trying to build as user nobody"
       fink -m --build-as-nobody rebuild $(patsubst %.info,%,$<)
       echo "Validating $@ ..."
       fink -v validate $(DEBPATH)/$(patsubst %.info,%,$<)*.deb
       echo "Contents of package:"
       dpkg -c $(DEBPATH)/$(patsubst %.info,%,$<)*.deb
       echo "Installing $@ ..."
       fink install $(patsubst %.info,%,$<)
       ln $(DEBPATH)/$(patsubst %.info,%,$<)*.deb $@

Important Links