FreeBSD ports allow you to pass build configuration as environment variables during the make process using a syntax like below:

# make install distclean WITHOUT_X11=NO

You could define WITHOUT_X11=NO in /etc/make.conf but this isn't always a good solution since you'll be putting 100's of options into your make.conf, using portupgrade you can also put per-port options into the /usr/local/etc/pkgtools.conf' MAKE_ARGS section.

Personally neither of these options are appealing as a way to remember per port compile options. I often find myself doing a upgrade on a port I installed months ago wondering what the options were I used. With many new ports this is a moot point since they use the new port config system to store compile options. You can find out if the port you are building supports this by running 'make config', ports that don't support these options return an error.

# make config
===> No options to configure

For these ports a good option is to install penv and configure portinstall to call it during the build time. This way as long as you always use portinstall or portupgrade to manage your ports you wont need to worry about this.

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.

Once you've installed penv using ports configure portupgrade by adding to /usr/local/etc/pkgtools.conf the following:

PORTUPGRADE_ARGS = ENV['PORTUPGRADE'] || '-M penv'

Now to store configuration for a given port execute commands similar to these:

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

Each time you install or upgrade this port WITH_MSN=1 will be defined.

Changelog

28/11/2005

Initial version

FreeBSD/PortupgradePenv (last edited 2005-11-28 19:27:47 by azrael)