Some folks don't realize that NetBSD provides an easy way to configure many packages. To see if a particular package has such options, while in the /usr/pkgsrc// directory type

make show-options

As an example, we'll use uim, an input method for Japanese.

cd /usr/pgksrc/inputmethod/uim
make show-options

I see the following


Any of the following general options may be selected:
       anthy    Use Anthy as Japanese conversion program.
       canna    Use Canna as Japanese conversion program.
       eb       Enable EB dictionary library support.
       gtk      Enable support for GTK.
       qt

These options are enabled by default: anthy canna gtk
These options are currently enabled: anthy canna gtk

If one only wants the default options, then a simple make install clean; make clean-depends will install them. However I don't want the defaults. I do want anthy and gtk however, I don't want canna and wish to add qt.

One can either do this at the command line or put the lines in /etc/mk.conf. Usually, the variable will be called PKG_OPTIONS.pkgname where pkgname is, oddly enough, the name of the package. Most packages that have options will have an options.mk file in their directory. A quick glance at that will show you the name of the variable. (If there is no options.mk file, the name of the variable can be found in the Makefile.) In this case the options.mk file has the line

PKG_OPTIONS_VAR=        PKG_OPTIONS.uim

So, I will type

make PKG_OPTIONS.uim="qt -canna" install clean; make clean-depends. 

This will install gtk, qt and anthy.

Most people will put these options in /etc/mk.conf so that they don't have to remember it each time. In this case, it's only a few options, but for something like /usr/pkgsrc/x11/xorg-server there are about 30 options, most of which you won't want. Typing make show-options in x11/xorg-server's directory gives me (shortened for the reader's sake)

These options are enabled by default: xorg-server-apm xorg-server-ark xorg-server-ati xorg-server-chips xorg-server-cirrus xorg-server-cyrix xorg-server-dummy xorg-server-glint xorg-server-i128 xorg-server-i740 xorg-server-i810 xorg-server-imstt xorg-server-mga xorg-server-neomagic xorg-server-newport xorg-server-nsc xorg-server-nv xorg-server-rendition xorg-server-s3 xorg-server-s3virge xorg-server-savage xorg-server-siliconmotion xorg-server-sis xorg-server-tdfx xorg-server-tga xorg-server-trident xorg-server-tseng xorg-server-vesa xorg-server-vga xorg-server-via xorg-server-vmware

I don't want to type make PKG_OPTIONS="-xorg-server-ati -xorg-server-cardb -xorg-server-cardc" and all the rest each time I reinstall it so I would definitely put it in /etc/mk.conf.

When adding PKG_OPTIONS.pkgname options to etc/mk.conf, don 't put quotes around them. In our example of uim, I would add this line to /etc/mk.conf

PKG_OPTIONS.uim=qt -canna

If I write

PKG_OPTIONS.uim="qt -canna" 

in /etc/mk.conf, I will get an error message when I try to build the package. (Or possibly when I try to build any package.)

So, to sum up

If you want default options, don't do anything. If you want available options that aren't enabled by default add them to the PKG_OPTIONS variable, either quoted on the command line, eg PKG_OPTIONS.uim="qt" or in /etc/mk.conf. If you put them in mk.conf don't use quotes.

If you don't want an option enabled by default, use a - in front of it, either quoted on the command line or without quotes in /etc/mk.conf

Add a comment