Creating a FreeBSD Port Patch

  • Introduction.

  • Sometimes a FreeBSD port is older than the newest avaliable version of the ported application or lacks implementation of a feature.
    Then a skillful FreeBSD user would want to help out and update that port creating new patches.
    In our case we will create a patch for maildrop 1.5.3 to support MySQL.

  • Creating the patch.

  • Firstly I downloaded the maildrop tarball and unpacked it in my home directory.
    Then I made the necessarily changes in the configure file which was the one that needed to be patched.
    Next I copied the original configure file to configure.orig.
    Then I ran diff command in my home dir in the root dir of unpacked source tree of maildrop:
    # pwd
      /usr/home/yazzy/maildrop-1.5.3
    # diff -ruN maildrop/configure.orig maildrop/configure > /usr/ports/mail/maildrop/files/patch-mysql4
    
    The general recipe for running diff on any file is following:
    # diff -ruN foo/bar/configure.orig foo/bar/configure > ../../files/patch-configure
    
    I also changed the Makefile implementing WITH_TRASHQUOTA=yes and WITH_MYSQL=yes options.
    Then I cd to /usr/ports/mail/maildrop and run make command:
    # cd /usr/ports/mail/maildrop ; make WITH_TRASHQUOTA=yes WITH_MAILDIRQUOTA=yes WITH_MYSQL=yes install clean
    
    The patch applied correctly.
    Finally you could create shar file with your changed and patched port:
    # cd /usr/ports/mail 
    # shar `find maildrop/ -print` > /home/yazzy/maildrop-1.5.3.shar
    
    Then send the .shar file to the port maintainer if it's worth it :)