Josef “Jeff” Sipek

Building FreeBSD Binary Packages

On my laptop, I use the binary packages provided by FreeBSD ports. Sometimes however, I want to rebuild a package because I want to change an option (for example, recently I wanted to set DEBUG=on for mutt).

While this is very easy, for whatever reason I can never find a doc with a concise set of steps to accomplish it.

So, for the next time I need to do this:

# portsnap fetch
# portsnap update
# cd /usr/ports/some/thing
# make showconfig
# make rmconfig   # to reset config, if needed
# make clean      # as needed
# make package
# pkg install work/pkg/*.txz

That’s all there is to it.

2 Comments »

  1. The method to build on the base system is considered obsolete, since it clutters the system with build tools not needed otherwise, and more importantly, it does not create reproducible build results. This method is ok for very few small ports, especially those which contain only scripts. Some ports are even self-contained in the ports tree, i.e. scripts under /usr/ports/*/*/files/ & do not download external tar(1) balls (.tar.gz/.txz files). Obviously it is perfectly ok to "build" these directly inside the ports tree, since all what happens is copying files & optionally some text substitutions & expansions.

    In general, it is advised to use poudriere(8) or synth(1) instead of building inside the ports tree (like portmaster & other tools from computer Stone Age), since these modern build tools are building inside a clean jail(8).

    Comment by Walter von Entferndt — September 1, 2020 @ 15:07

  2. Good to know! I've been using FreeBSD for only about a year and a half, so I'm certain I'm doing some dumb stuff.

    It has certainly bothered me that this approach uses root and therefore has the potential to screw things up royally.

    In general, I try to not build software (it is a pain, and then I have to remember to update it), but every once in a while the simplest way is to rebuild it. For example, as this post points out I wanted to see if enabling DEBUG for the mutt port was safe.

    I'll have to look into poudriere and synth, but the motivation is pretty low since how infrequently I build packages. :) If/when I look at those, I'll make sure to write down my finding in a new blahg post and add links between this one and the new one.

    Comment by JeffPC — September 15, 2020 @ 13:13

Atom feed for comments on this post.

Leave a comment

Powered by blahgd