FreeBSD: Ports Development

I’m slowly starting to get comfortable with creating FreeBSD ports. As of today, I’ve successfully created three ports.

This post serves as a knowledge base of various tips & tricks I’ve learned during my journey. However, keep in mind that one of the strong suits of FreeBSD is the excellent documentation. There is a handbook specifically focusing on ports: The FreeBSD Porter’s Handbook. I’ll only post things here that are either not obvious from reading the handbook or simply not mentioned there at all.

Local upstream files

While developing the devel/qschematic port I had to perform some debugging on the upstream build system. At first, I created a separate branch in the upstream repository and used that branch in the port Makefile. However, I quickly determined that this is not a sustainable workflow so I started looking for better solutions.

My goal was to use a local copy of the upstream source rather than having the port Makefile fetching a modified version each time. As it turns out, this can be achieved easily by using a custom do-extract step in the port Makefile:

	cp -r ./qschematic/* ${WRKSRC}

In the do-extract step we’re first creating the ${WRKSRC} directory and then copy the upstream source from a local directory (in the example above from ./qscheamtic).

This allows modifying upstream code and running builds/tests without having to commit & push changes to a remote repository.

comments powered by Disqus