Annotation of wikisrc/pkgsrc/how_to_use_pkg_options_with_pkgsrc.mdwn, revision 1.2

1.2     ! schmonz     1: 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/<category>/<pkgname> directory type
        !             2: 
        !             3:     make show-options
        !             4: 
        !             5: 
        !             6: As an example, we'll use uim, an input method for Japanese.
        !             7: 
        !             8:     cd /usr/pgksrc/inputmethod/uim
        !             9:     make show-options
        !            10: 
        !            11: I see the following
        !            12: <pre><code>
        !            13: Any of the following general options may be selected:
        !            14:        anthy    Use Anthy as Japanese conversion program.
        !            15:        canna    Use Canna as Japanese conversion program.
        !            16:        eb       Enable EB dictionary library support.
        !            17:        gtk      Enable support for GTK.
        !            18:        qt
        !            19: 
        !            20: These options are enabled by default: anthy canna gtk
        !            21: These options are currently enabled: anthy canna gtk
        !            22: </code></pre>
        !            23: 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.
        !            24: 
        !            25: 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 file in their directory. A quick glance at that will show you the name of the variable. (If there is no file, the name of the variable can be found in the Makefile.) In this case the file has the line
        !            26: 
        !            27:     PKG_OPTIONS_VAR=        PKG_OPTIONS.uim
        !            28: 
        !            29: So, I will type
        !            30: 
        !            31:     make PKG_OPTIONS.uim="qt -canna" install clean; make clean-depends. 
        !            32: 
        !            33: This will install gtk, qt and anthy.
        !            34: 
        !            35: 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)
        !            36: 
        !            37: 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
        !            38: 
        !            39: 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.
        !            40: 
        !            41: 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
        !            42: 
        !            43:     PKG_OPTIONS.uim=qt -canna
        !            44: 
        !            45: If I write
        !            46: 
        !            47:     PKG_OPTIONS.uim="qt -canna" 
        !            48: 
        !            49: 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.)
        !            50: 
        !            51: So, to sum up
        !            52: 
        !            53: 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.
        !            54: 
1.1       mspo       55: 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 

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb