Select Page
NOTE: This is a static archive of an old blog, no interactions like search or categories are current.

A while ago I was again frustrated by the limitations in FreeBSD ports. I did a few portupgrade’s on some software only to discover later on that I did not specify the same environment variables as last time I did it, the result was a bunch of badly behaving ports.
After some discussion on IRC we all agreed it would be pretty simply to just store a per-directory environment somewhere. I mentioned this to Neil who pointed me at penv.

penv is a utility which helps manage persistent per-directory environment settings. In other words, it saves you the trouble of setting or specifying the same environment variables over and over again when executing programs in a specific directory. The main reason for the initial development of penv was its use with the FreeBSD Ports Collection , but it may be used for other day-to-day tasks, too.

While this sounds very nice, it has some issues, if you install port a which required port b something has to run penv when building port b else it won’t work. The penv author has a patch to make which works very nice but is a bit drastic to my liking.
Some reading of the portupgrade man page got me to the -M command line option which the man page is something to prepend to the commandline of make. Did not sound right at the beginning but eventually this turned out to be just the ticket.
In my /usr/local/etc/pkgtools.conf file I put the following:

PORTUPGRADE_ARGS = ENV[‘PORTUPGRADE’] || ‘-M penv’

and now for each port that I have specific build requirements I simply do:

# cd /usr/ports/net/centericq/
# penv -c mkdir
# penv -S WITH_MSN=1
# penv -L
WITH_MSN=1

And any further portinstall or portupgrade operations on the centericq port will always build it with MSN support.