Annotation of htdocs/docs/pkgsrc/configuring.html, revision 1.56
1.36 sevan 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1.1 dsieger 2: <html>
3: <head>
4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
1.43 rillig 5: <title>Chapter 6. Configuring pkgsrc</title>
1.19 spz 6: <link rel="stylesheet" type="text/css" href="/global.css">
1.1 dsieger 7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
1.11 rillig 8: <link rel="home" href="index.html" title="The pkgsrc guide">
1.1 dsieger 9: <link rel="up" href="users-guide.html" title="Part I. The pkgsrc user's guide">
1.43 rillig 10: <link rel="prev" href="using.html" title="Chapter 5. Using pkgsrc">
11: <link rel="next" href="binary.html" title="Chapter 7. Creating binary packages">
1.1 dsieger 12: </head>
13: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14: <div class="navheader">
15: <table width="100%" summary="Navigation header">
1.43 rillig 16: <tr><th colspan="3" align="center">Chapter 6. Configuring pkgsrc</th></tr>
1.1 dsieger 17: <tr>
18: <td width="20%" align="left">
19: <a accesskey="p" href="using.html">Prev</a> </td>
20: <th width="60%" align="center">Part I. The pkgsrc user's guide</th>
21: <td width="20%" align="right"> <a accesskey="n" href="binary.html">Next</a>
22: </td>
23: </tr>
24: </table>
25: <hr>
26: </div>
1.21 asau 27: <div class="chapter">
1.1 dsieger 28: <div class="titlepage"><div><div><h2 class="title">
1.43 rillig 29: <a name="configuring"></a>Chapter 6. Configuring pkgsrc</h2></div></div></div>
1.1 dsieger 30: <div class="toc">
31: <p><b>Table of Contents</b></p>
1.30 leot 32: <dl class="toc">
1.43 rillig 33: <dt><span class="sect1"><a href="configuring.html#general-configuration">6.1. General configuration</a></span></dt>
34: <dt><span class="sect1"><a href="configuring.html#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
1.54 rillig 35: <dt><span class="sect1"><a href="configuring.html#native-or-pkgsrc-preference">6.3. Preferences for native or pkgsrc software</a></span></dt>
36: <dt><span class="sect1"><a href="configuring.html#variables-affecting-installation">6.4. Variables affecting the installation process</a></span></dt>
37: <dt><span class="sect1"><a href="configuring.html#conf.compiler">6.5. Selecting and configuring the compiler</a></span></dt>
1.1 dsieger 38: <dd><dl>
1.54 rillig 39: <dt><span class="sect2"><a href="configuring.html#selecting-the-compiler">6.5.1. Selecting the compiler</a></span></dt>
40: <dt><span class="sect2"><a href="configuring.html#conf.cflags">6.5.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
41: <dt><span class="sect2"><a href="configuring.html#conf.ldflags">6.5.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.1 dsieger 42: </dl></dd>
1.54 rillig 43: <dt><span class="sect1"><a href="configuring.html#developer-advanced-settings">6.6. Developer/advanced settings</a></span></dt>
44: <dt><span class="sect1"><a href="configuring.html#selecting-build-options">6.7. Selecting Build Options</a></span></dt>
1.1 dsieger 45: </dl>
46: </div>
1.3 rillig 47: <a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually
1.1 dsieger 48: called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for
49: that file depends on the installation. On NetBSD, when you use
1.56 ! leot 50: <a class="citerefentry" href="//man.NetBSD.org/NetBSD-10.1/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> from the base system, it is in the directory
1.1 dsieger 51: <code class="filename">/etc/</code>. In all other cases the default location is
52: <code class="literal">${PREFIX}/etc/</code>, depending on where you told the
53: bootstrap program to install the binary packages.</p>
54: <p>The format of the configuration file is that of the usual
55: BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration
56: is done by setting variables in this file. Note that you can define all
57: kinds of variables, and no special error checking (for example for
1.33 rillig 58: spelling mistakes) takes place.</p>
1.21 asau 59: <div class="sect1">
1.1 dsieger 60: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.43 rillig 61: <a name="general-configuration"></a>6.1. General configuration</h2></div></div></div>
1.33 rillig 62: <p>The following variables apply to all
1.1 dsieger 63: pkgsrc packages. A complete list of the variables that can be
64: configured by the user is available in
65: <code class="filename">mk/defaults/mk.conf</code>, together with some
66: comments that describe each variable's intent.</p>
1.21 asau 67: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.17 wiz 68: <li class="listitem"><p><code class="varname">LOCALBASE</code>: Where
1.1 dsieger 69: packages will be installed. The default is
70: <code class="filename">/usr/pkg</code>. Do not mix binary packages
71: with different <code class="varname">LOCALBASE</code>s!</p></li>
1.17 wiz 72: <li class="listitem"><p><code class="varname">CROSSBASE</code>: Where
73: <span class="quote">“<span class="quote">cross</span>”</span> category packages will be
1.1 dsieger 74: installed. The default is
75: <code class="filename">${LOCALBASE}/cross</code>.</p></li>
1.17 wiz 76: <li class="listitem"><p><code class="varname">X11BASE</code>: Where
1.1 dsieger 77: X11 is installed on the system. The default is
1.24 wiz 78: <code class="filename">/usr/X11R7</code>.</p></li>
1.17 wiz 79: <li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the
1.1 dsieger 80: downloaded copies of the original source distributions used
81: for building pkgsrc packages. The default is
82: <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li>
1.17 wiz 83: <li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the
1.1 dsieger 84: database about installed packages is stored. The default is
1.35 sevan 85: <code class="filename">/usr/pkg/pkgdb</code>.</p></li>
1.17 wiz 86: <li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>:
1.1 dsieger 87: If set, override the packages'
88: <code class="varname">MASTER_SITES</code> with this value.</p></li>
1.17 wiz 89: <li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>:
1.1 dsieger 90: Backup location(s) for distribution files and patch files
91: if not found locally or in
92: <code class="filename">${MASTER_SITES}</code> or
93: <code class="filename">${PATCH_SITES}</code> respectively.
1.35 sevan 94: The defaults is
95: <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li>
1.17 wiz 96: <li class="listitem"><p><code class="varname">BINPKG_SITES</code>:
1.1 dsieger 97: List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and
98: <em class="replaceable"><code>arch</code></em> are replaced with OS
1.17 wiz 99: release (<span class="quote">“<span class="quote">2.0</span>”</span>, etc.) and architecture
100: (<span class="quote">“<span class="quote">mipsel</span>”</span>, etc.).</p></li>
101: <li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
1.16 jakllsch 102: List of acceptable licenses. License names are case-sensitive.
103: Whenever you try to build a package whose license is not in this
104: list, you will get an error message. If the license condition is
105: simple enough, the error message will include specific
106: instructions on how to change this variable.</p></li>
1.1 dsieger 107: </ul></div>
108: </div>
1.21 asau 109: <div class="sect1">
1.1 dsieger 110: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.43 rillig 111: <a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div>
1.32 rillig 112: <p>
1.1 dsieger 113: </p>
1.21 asau 114: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.17 wiz 115: <li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
1.1 dsieger 116: directory for the binary packages. The default is
117: <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
1.17 wiz 118: <li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
1.1 dsieger 119: The top level directory where, if defined, the separate
120: working directories will get created, and symbolically
121: linked to from <code class="filename">${WRKDIR}</code> (see below).
122: This is useful for building packages on several
123: architectures, then <code class="filename">${PKGSRCDIR}</code>
124: can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
125: is local to every architecture. (It should be noted that
126: <code class="varname">PKGSRCDIR</code> should not be set by the user
1.10 jmcneill 127: — it is an internal definition which refers to the
1.1 dsieger 128: root of the pkgsrc tree. It is possible to have many
129: pkgsrc tree instances.)</p></li>
1.17 wiz 130: <li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
1.1 dsieger 131: Directory for local patches that aren't part of pkgsrc.
1.48 rillig 132: See <a class="xref" href="components.html#components.patches" title="12.3. patches/*">Section 12.3, “<code class="filename">patches/*</code>”</a> for more
1.1 dsieger 133: information.</p></li>
1.17 wiz 134: <li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
1.7 hubertf 135: the <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
1.1 dsieger 136: BSD-style Makefile. If this is not set,
137: <code class="varname">MAKECONF</code> is set to
138: <code class="filename">/dev/null</code> to avoid picking up
139: settings used by builds in <code class="filename">/usr/src</code>.</p></li>
140: </ul></div>
141: </div>
1.21 asau 142: <div class="sect1">
1.1 dsieger 143: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.54 rillig 144: <a name="native-or-pkgsrc-preference"></a>6.3. Preferences for native or pkgsrc software</h2></div></div></div>
145: <p>Whenever a package depends on a package that has a
146: <code class="filename">builtin.mk</code> file, the dependent package can
147: either use the built-in (native) version from the base system or the
148: pkgsrc-provided version. This only affects dependencies, so it is
149: still possible to build the pkgsrc package <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pcre++/index.html" target="_top"><code class="filename">devel/pcre++</code></a> even when other packages depend
150: on the native pcre++ version instead.</p>
151: <p>To force using the pkgsrc-provided version for a particular
152: package, define <span class="quote">“<span class="quote"><code class="varname">PREFER_PKGSRC</code> =
153: <em class="replaceable"><code>package-ID</code></em></span>”</span> in <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a>. To force
154: using the native package, define
155: <span class="quote">“<span class="quote"><code class="varname">PREFER_NATIVE</code> =
156: <em class="replaceable"><code>package-ID</code></em></span>”</span>. In both cases, the
157: <em class="replaceable"><code>package-ID</code></em> is the one from the
158: <code class="filename">buildlink3.mk</code> of the package. In most cases,
159: this ID is the same as the directory name of the package, but for
160: example, <code class="filename">devel/pcre++</code> has the
161: package ID <span class="quote">“<span class="quote">pcrexx</span>”</span>.</p>
162: <p>For the packages that are not listed by their package ID,
163: pkgsrc uses the pkgsrc-provided version if
164: <code class="varname">PREFER_PKGSRC</code> contains the word
165: <span class="quote">“<span class="quote">yes</span>”</span>. Otherwise, if <code class="varname">PREFER_NATIVE</code>
166: contains the word <span class="quote">“<span class="quote">yes</span>”</span>, pkgsrc uses the native
167: version. For example, to require using the pkgsrc-provided versions
168: for all but the most basic bits on a NetBSD system, you can
169: set:</p>
170: <pre class="programlisting">
171: PREFER_PKGSRC= yes
172: PREFER_NATIVE= getopt skey tcp_wrappers
173: </pre>
174: <p>A package <span class="emphasis"><em>must</em></span> have a
175: <code class="filename">builtin.mk</code> file to be listed in
176: <code class="varname">PREFER_NATIVE</code>, otherwise it is simply ignored in
177: that list.</p>
178: <p><code class="varname">PREFER_PKGSRC</code> and
179: <code class="varname">PREFER_NATIVE</code> should be set during bootstrap to
180: ensure that the bootstrap process does not use inapropriate native
181: tools as dependencies for core packages.</p>
182: <pre class="screen">
183: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap --prefer-pkgsrc yes --prefer-native openssl</code></strong>
184: </pre>
185: <p>Switching between settings globally at a later date can
186: introduce complications with dependency resolution. This is caused
187: by packages built with the opposite preference being installed
188: alongside each other. Hence, when changing any of these variables
189: after bootstrap, you need to rebuild all packages depending on those
190: whose preference has been changed. This is not trivial and should
191: be avoided.</p>
192: <p>When using pkgsrc on Linux systems, there is high risk of
193: <span class="quote">“<span class="quote">leakage</span>”</span>, where programs installed by pkgsrc may
194: inadvertently use a command or library not installed by pkgsrc, e.g.
195: those installed by yum or apt. Such foreign dependencies may be
196: installed, removed, or upgraded to a version incompatible with the
197: pkgsrc package at any time, causing pkgsrc packages to subsequently
198: malfunction. Pkgsrc cannot prevent this, as it has no control over
199: other package managers. Another potential problem is that under
200: Redhat Enterprise and related Linux systems, yum packages are only
201: patched and never upgraded, so eventually they may become too
202: outdated for use by pkgsrc. Even intentionally using foreign
203: dependencies, not considered leakage, can lead to these problems, so
204: it is generally discouraged. In order to minimize such problems,
205: PREFER_PKGSRC defaults to <span class="quote">“<span class="quote">yes</span>”</span> on Linux systems. This ensures that
206: pkgsrc is aware of any changes to dependency packages and can
207: rebuild or upgrade the entire dependency tree as needed. This
208: default can be overridden by setting --prefer-pkgsrc to a
209: list of packages and --prefer-native to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
210: </div>
211: <div class="sect1">
212: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
213: <a name="variables-affecting-installation"></a>6.4. Variables affecting the installation process</h2></div></div></div>
1.51 leot 214: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="varname">PKGSRC_KEEP_BIN_PKGS</code>:
1.39 maya 215: By default, binary packages of built packages are
1.41 leot 216: preserved in <code class="filename">${PACKAGES}/All</code>. Setting
1.39 maya 217: this variable to "no" prevents this.</p></li></ul></div>
1.31 jnemeth 218: <p>Packages have to support installation into a
1.3 rillig 219: subdirectory of <code class="varname">WRKDIR</code>. This allows a package
220: to be built, before the actual filesystem is touched. DESTDIR
221: support exists in two variations:</p>
1.21 asau 222: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.17 wiz 223: <li class="listitem"><p>Basic DESTDIR support means that the package
1.18 wiz 224: installation and packaging is still run as root.</p></li>
225: <li class="listitem"><p>Full DESTDIR support can run the complete
226: build, installation and packaging as normal user. Root
227: privileges are only needed to add packages.</p></li>
1.3 rillig 228: </ul></div>
229: <p>With basic DESTDIR support, <strong class="userinput"><code>make
230: clean</code></strong> needs to be run as root.</p>
1.13 imil 231: <p>Considering the <code class="filename">foo/bar</code> package,
232: DESTDIR full support can be tested using the following commands
233:
234: </p>
235: <pre class="programlisting">
236: <code class="prompt">$</code> id
237: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
238: <code class="prompt">$</code> mkdir $HOME/packages
239: <code class="prompt">$</code> cd $PKGSRCDIR/foo/bar
240: </pre>
241: <p>
242:
243: Verify <code class="varname">DESTDIR</code> full support, no root privileges
244: should be needed
245:
246: </p>
247: <pre class="programlisting">
1.22 asau 248: <code class="prompt">$</code> make stage-install
1.13 imil 249: </pre>
250: <p>
251:
252: Create a package without root privileges
253:
254: </p>
255: <pre class="programlisting">
1.22 asau 256: <code class="prompt">$</code> make PACKAGES=$HOME/packages package
1.13 imil 257: </pre>
258: <p>
259:
260: For the following command, you must be able to gain root
1.56 ! leot 261: privileges using <a class="citerefentry" href="//man.NetBSD.org/NetBSD-10.1/su.1"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a>
1.13 imil 262:
263: </p>
264: <pre class="programlisting">
1.22 asau 265: <code class="prompt">$</code> make PACKAGES=$HOME/packages install
1.13 imil 266: </pre>
267: <p>
268:
269: Then, as a simple user
270:
271: </p>
272: <pre class="programlisting">
273: <code class="prompt">$</code> make clean
274: </pre>
275: <p>
276:
277: </p>
1.3 rillig 278: </div>
1.21 asau 279: <div class="sect1">
1.3 rillig 280: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.54 rillig 281: <a name="conf.compiler"></a>6.5. Selecting and configuring the compiler</h2></div></div></div>
1.21 asau 282: <div class="sect2">
1.1 dsieger 283: <div class="titlepage"><div><div><h3 class="title">
1.54 rillig 284: <a name="selecting-the-compiler"></a>6.5.1. Selecting the compiler</h3></div></div></div>
1.1 dsieger 285: <p>By default, pkgsrc will use GCC to build packages. This may be
286: overridden by setting the following variables in /etc/mk.conf:</p>
1.21 asau 287: <div class="variablelist"><dl class="variablelist">
1.1 dsieger 288: <dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt>
289: <dd>
290: <p>This is a list of values specifying the chain of
291: compilers to invoke when building packages. Valid values
292: are:</p>
1.21 asau 293: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.22 asau 294: <li class="listitem"><p><code class="varname">ccc</code>:
295: Compaq C Compilers (Tru64)</p></li>
296: <li class="listitem"><p><code class="varname">ccache</code>:
297: compiler cache (chainable)</p></li>
298: <li class="listitem"><p><code class="varname">clang</code>:
299: Clang C and Objective-C compiler</p></li>
1.17 wiz 300: <li class="listitem"><p><code class="varname">distcc</code>:
1.1 dsieger 301: distributed C/C++ (chainable)</p></li>
1.22 asau 302: <li class="listitem"><p><code class="varname">f2c</code>:
303: Fortran 77 to C compiler (chainable)</p></li>
304: <li class="listitem"><p><code class="varname">icc</code>:
305: Intel C++ Compiler (Linux)</p></li>
306: <li class="listitem"><p><code class="varname">ido</code>:
307: SGI IRIS Development Option cc (IRIX 5)</p></li>
1.17 wiz 308: <li class="listitem"><p><code class="varname">gcc</code>:
1.1 dsieger 309: GNU C/C++ Compiler</p></li>
1.22 asau 310: <li class="listitem"><p><code class="varname">hp</code>:
311: HP-UX C/aC++ compilers</p></li>
1.17 wiz 312: <li class="listitem"><p><code class="varname">mipspro</code>:
1.1 dsieger 313: Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li>
1.22 asau 314: <li class="listitem"><p><code class="varname">mipspro-ucode</code>:
1.1 dsieger 315: Silicon Graphics, Inc. MIPSpro (o32)</p></li>
1.17 wiz 316: <li class="listitem"><p><code class="varname">sunpro</code>:
1.1 dsieger 317: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li>
1.22 asau 318: <li class="listitem"><p><code class="varname">xlc</code>:
1.35 sevan 319: IBM's XL C/C++ compiler suite</p></li>
1.1 dsieger 320: </ul></div>
321: <p>The default is
1.17 wiz 322: <span class="quote">“<span class="quote"><code class="varname">gcc</code></span>”</span>. You can use
1.1 dsieger 323: <code class="varname">ccache</code> and/or
324: <code class="varname">distcc</code> with an appropriate
325: <code class="varname">PKGSRC_COMPILER</code> setting,
1.17 wiz 326: e.g. <span class="quote">“<span class="quote"><code class="varname">ccache gcc</code></span>”</span>. This
1.1 dsieger 327: variable should always be terminated with a value for
328: a real compiler. Note that only one real compiler
1.17 wiz 329: should be listed (e.g. <span class="quote">“<span class="quote"><code class="varname">sunpro gcc</code></span>”</span>
1.1 dsieger 330: is not allowed).</p>
331: </dd>
332: <dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt>
333: <dd><p>This specifies the minimum version of GCC to use
334: when building packages. If the system GCC doesn't
335: satisfy this requirement, then pkgsrc will build and
336: install one of the GCC packages to use instead.</p></dd>
1.42 leot 337: <dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt>
1.34 maya 338: <dd><p>Specifies which version of python to use when several
339: options are available.</p></dd>
340: <dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt>
1.47 gutterid 341: <dd><p>Specifies the Fortran compiler to use.
342: The default is <code class="varname">gfortran</code>.</p></dd>
1.34 maya 343: <dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt>
344: <dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code>
345: <code class="varname">gfortran</code> is used, this option specifies which
346: version to use.</p></dd>
1.1 dsieger 347: </dl></div>
348: </div>
1.21 asau 349: <div class="sect2">
1.1 dsieger 350: <div class="titlepage"><div><div><h3 class="title">
1.54 rillig 351: <a name="conf.cflags"></a>6.5.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div>
1.1 dsieger 352: <p>If you wish to set the <code class="varname">CFLAGS</code> variable,
353: please make sure to use the <code class="literal">+=</code> operator
354: instead of the <code class="literal">=</code> operator:</p>
355: <pre class="programlisting">
356: CFLAGS+= -your -flags
357: </pre>
358: <p>Using <code class="varname">CFLAGS=</code> (i.e. without the
1.17 wiz 359: <span class="quote">“<span class="quote">+</span>”</span>) may lead to problems with packages that
1.12 jnemeth 360: need to add their own flags. You may want to take a look
1.52 leot 361: at the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/index.html" target="_top"><code class="filename">devel/cpuflags</code></a>
1.17 wiz 362: package if you're interested in optimization specifically
363: for the current CPU. </p>
1.1 dsieger 364: </div>
1.21 asau 365: <div class="sect2">
1.1 dsieger 366: <div class="titlepage"><div><div><h3 class="title">
1.54 rillig 367: <a name="conf.ldflags"></a>6.5.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div>
1.1 dsieger 368: <p>If you want to pass flags to the linker, both in the configure
369: step and the build step, you can do this in two ways. Either set
370: <code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>. The difference
371: between the two is that <code class="varname">LIBS</code> will be appended to
372: the command line, while <code class="varname">LDFLAGS</code> come earlier.
373: <code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF
374: machines depending on the setting of <code class="varname">USE_IMAKE</code> or
375: the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>. As with
376: <code class="varname">CFLAGS</code>, if you do not wish to override these
377: settings, use the <code class="literal">+=</code> operator:</p>
378: <pre class="programlisting">
379: LDFLAGS+= -your -linkerflags
380: </pre>
381: </div>
382: </div>
1.21 asau 383: <div class="sect1">
1.1 dsieger 384: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.54 rillig 385: <a name="developer-advanced-settings"></a>6.6. Developer/advanced settings</h2></div></div></div>
1.24 wiz 386: <p>
1.1 dsieger 387: </p>
1.21 asau 388: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.17 wiz 389: <li class="listitem">
1.1 dsieger 390: <p><code class="varname">PKG_DEVELOPER</code>:
1.53 gutterid 391: Run some sanity checks that package developers want:
392: </p>
1.21 asau 393: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
1.17 wiz 394: <li class="listitem"><p>make sure patches apply with zero
1.53 gutterid 395: fuzz</p></li>
1.17 wiz 396: <li class="listitem"><p>run check-shlibs to see that all
1.53 gutterid 397: binaries will find their shared libs.</p></li>
1.1 dsieger 398: </ul></div>
399: </li>
1.53 gutterid 400: <li class="listitem"><p><code class="varname">CHECK_FILES_STRICT</code>:
401: Also check <code class="varname">VARBASE</code> and <code class="varname">PKG_SYSCONFDIR
402: </code> values in PLIST entries.
403: </p></li>
1.17 wiz 404: <li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level
1.53 gutterid 405: of debugging output which is displayed whilst making and
406: installing the package. The default value for this is 0,
407: which will not display the commands as they are executed
408: (normal, default, quiet operation); the value 1 will display
409: all shell commands before their invocation, and the value 2
410: will display both the shell commands before their invocation,
411: as well as their actual execution progress with <span class="command"><strong>set
412: -x</strong></span>.</p></li>
1.1 dsieger 413: </ul></div>
414: <p>
415: </p>
416: </div>
1.21 asau 417: <div class="sect1">
1.1 dsieger 418: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.54 rillig 419: <a name="selecting-build-options"></a>6.7. Selecting Build Options</h2></div></div></div>
1.1 dsieger 420: <p>Some packages have build time options, usually to select
421: between different dependencies, enable optional support for big
422: dependencies or enable experimental features.</p>
423: <p>To see which options, if any, a package supports, and which
1.7 hubertf 424: options are mutually exclusive, run <span class="command"><strong>make
1.1 dsieger 425: show-options</strong></span>, for example:</p>
426: <pre class="programlisting">
427: The following options are supported by this package:
428: ssl Enable SSL support.
429: Exactly one of the following gecko options is required:
430: firefox Use firefox as gecko rendering engine.
431: mozilla Use mozilla as gecko rendering engine.
432: At most one of the following database options may be selected:
433: mysql Enable support for MySQL database.
434: pgsql Enable support for PostgreSQL database.
435:
436: These options are enabled by default: firefox
437: These options are currently enabled: mozilla ssl
438: </pre>
439: <p>The following variables can be defined in
1.7 hubertf 440: <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a> to select which options to
1.1 dsieger 441: enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>,
442: which can be used to select or disable options for all packages
443: that support them, and
444: <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>,
445: which can be used to select or disable options specifically for
446: package <em class="replaceable"><code>pkgbase</code></em>. Options listed in
1.17 wiz 447: these variables are selected, options preceded by <span class="quote">“<span class="quote">-</span>”</span>
1.1 dsieger 448: are disabled. A few examples:</p>
449: <pre class="screen">
1.7 hubertf 450: <code class="prompt">$</code> <span class="command"><strong>grep "PKG.*OPTION" <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a></strong></span>
1.1 dsieger 451: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
452: PKG_OPTIONS.kdebase= debug -sasl
453: PKG_OPTIONS.apache= suexec </pre>
1.8 rillig 454: <p>It is important to note that options that were specifically
1.14 snj 455: suggested by the package maintainer must be explicitly removed if
1.8 rillig 456: you do not wish to include the option. If you are unsure you can view
457: the current state with <span class="command"><strong>make show-options</strong></span>.</p>
1.1 dsieger 458: <p>The following settings are consulted in the order given, and
459: the last setting that selects or disables an option is
460: used:</p>
1.17 wiz 461: <div class="orderedlist"><ol class="orderedlist" type="1">
462: <li class="listitem"><p>the default options as suggested by the package
1.1 dsieger 463: maintainer</p></li>
1.17 wiz 464: <li class="listitem"><p>the options implied by the settings of legacy
1.1 dsieger 465: variables (see below)</p></li>
1.17 wiz 466: <li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li>
467: <li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li>
1.1 dsieger 468: </ol></div>
469: <p>For groups of mutually exclusive options, the last option
470: selected is used, all others are automatically disabled. If an
471: option of the group is explicitly disabled, the previously
472: selected option, if any, is used. It is an error if no option
473: from a required group of options is selected, and building the
474: package will fail.</p>
475: <p>Before the options framework was introduced, build options
476: were selected by setting a variable (often named
477: <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in
1.7 hubertf 478: <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a> for each option. To ease
1.1 dsieger 479: transition to the options framework for the user, these legacy
480: variables are converted to the appropriate options setting
481: (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>)
482: automatically. A warning is issued to prompt the user to update
1.7 hubertf 483: <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework
1.1 dsieger 484: directly. Support for the legacy variables will be removed
485: eventually.</p>
486: </div>
487: </div>
488: <div class="navfooter">
489: <hr>
490: <table width="100%" summary="Navigation footer">
491: <tr>
492: <td width="40%" align="left">
493: <a accesskey="p" href="using.html">Prev</a> </td>
494: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
495: <td width="40%" align="right"> <a accesskey="n" href="binary.html">Next</a>
496: </td>
497: </tr>
498: <tr>
1.43 rillig 499: <td width="40%" align="left" valign="top">Chapter 5. Using pkgsrc </td>
1.1 dsieger 500: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.43 rillig 501: <td width="40%" align="right" valign="top"> Chapter 7. Creating binary packages</td>
1.1 dsieger 502: </tr>
503: </table>
504: </div>
505: </body>
506: </html>
CVSweb <webmaster@jp.NetBSD.org>