| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | <!-- $NetBSD: configuring.xml,v 1.59 2023/01/05 01:42:15 gutteridge Exp $ --> | | 1 | <!-- $NetBSD: configuring.xml,v 1.60 2023/05/20 15:43:53 rillig Exp $ --> |
2 | | | 2 | |
3 | <chapter id="configuring"> | | 3 | <chapter id="configuring"> |
4 | <title>Configuring pkgsrc</title> | | 4 | <title>Configuring pkgsrc</title> |
5 | | | 5 | |
6 | <anchor id="mk.conf" /> | | 6 | <anchor id="mk.conf" /> |
7 | | | 7 | |
8 | <para>The whole pkgsrc system is configured in a single file, usually | | 8 | <para>The whole pkgsrc system is configured in a single file, usually |
9 | called <filename>mk.conf</filename>. In which directory pkgsrc looks for | | 9 | called <filename>mk.conf</filename>. In which directory pkgsrc looks for |
10 | that file depends on the installation. On NetBSD, when you use | | 10 | that file depends on the installation. On NetBSD, when you use |
11 | &man.make.1; from the base system, it is in the directory | | 11 | &man.make.1; from the base system, it is in the directory |
12 | <filename>/etc/</filename>. In all other cases the default location is | | 12 | <filename>/etc/</filename>. In all other cases the default location is |
13 | <literal>${PREFIX}/etc/</literal>, depending on where you told the | | 13 | <literal>${PREFIX}/etc/</literal>, depending on where you told the |
14 | bootstrap program to install the binary packages.</para> | | 14 | bootstrap program to install the binary packages.</para> |
| @@ -109,26 +109,105 @@ spelling mistakes) takes place. | | | @@ -109,26 +109,105 @@ spelling mistakes) takes place. |
109 | <listitem><para><varname>PKGMAKECONF</varname>: Location of | | 109 | <listitem><para><varname>PKGMAKECONF</varname>: Location of |
110 | the &mk.conf; file used by a package's | | 110 | the &mk.conf; file used by a package's |
111 | BSD-style Makefile. If this is not set, | | 111 | BSD-style Makefile. If this is not set, |
112 | <varname>MAKECONF</varname> is set to | | 112 | <varname>MAKECONF</varname> is set to |
113 | <filename>/dev/null</filename> to avoid picking up | | 113 | <filename>/dev/null</filename> to avoid picking up |
114 | settings used by builds in <filename>/usr/src</filename>.</para> | | 114 | settings used by builds in <filename>/usr/src</filename>.</para> |
115 | </listitem> | | 115 | </listitem> |
116 | | | 116 | |
117 | <!-- DISTDIR --> | | 117 | <!-- DISTDIR --> |
118 | <!-- FAILOVER_FETCH --> | | 118 | <!-- FAILOVER_FETCH --> |
119 | </itemizedlist></para> | | 119 | </itemizedlist></para> |
120 | </sect1> | | 120 | </sect1> |
121 | | | 121 | |
| | | 122 | <sect1 id="native-or-pkgsrc-preference"> |
| | | 123 | <title>Preferences for native or pkgsrc software</title> |
| | | 124 | |
| | | 125 | <para>Whenever a package depends on a package that has a |
| | | 126 | <filename>builtin.mk</filename> file, the dependent package can |
| | | 127 | either use the built-in (native) version from the base system or the |
| | | 128 | pkgsrc-provided version. This only affects dependencies, so it is |
| | | 129 | still possible to build the pkgsrc package <filename |
| | | 130 | role="pkg">devel/pcre++</filename> even when other packages depend |
| | | 131 | on the native pcre++ version instead.</para> |
| | | 132 | |
| | | 133 | <para>To force using the pkgsrc-provided version for a particular |
| | | 134 | package, define <quote><varname>PREFER_PKGSRC</varname> = |
| | | 135 | <replaceable>package-ID</replaceable></quote> in &mk.conf;. To force |
| | | 136 | using the native package, define |
| | | 137 | <quote><varname>PREFER_NATIVE</varname> = |
| | | 138 | <replaceable>package-ID</replaceable></quote>. In both cases, the |
| | | 139 | <replaceable>package-ID</replaceable> is the one from the |
| | | 140 | <filename>buildlink3.mk</filename> of the package. In most cases, |
| | | 141 | this ID is the same as the directory name of the package, but for |
| | | 142 | example, <filename role="pkgpath">devel/pcre++</filename> has the |
| | | 143 | package ID <quote>pcrexx</quote>.</para> |
| | | 144 | |
| | | 145 | <para>For the packages that are not listed by their package ID, |
| | | 146 | pkgsrc uses the pkgsrc-provided version if |
| | | 147 | <varname>PREFER_PKGSRC</varname> contains the word |
| | | 148 | <quote>yes</quote>. Otherwise, if <varname>PREFER_NATIVE</varname> |
| | | 149 | contains the word <quote>yes</quote>, pkgsrc uses the native |
| | | 150 | version. For example, to require using the pkgsrc-provided versions |
| | | 151 | for all but the most basic bits on a NetBSD system, you can |
| | | 152 | set:</para> |
| | | 153 | |
| | | 154 | <programlisting> |
| | | 155 | PREFER_PKGSRC= yes |
| | | 156 | PREFER_NATIVE= getopt skey tcp_wrappers |
| | | 157 | </programlisting> |
| | | 158 | |
| | | 159 | <para>A package <emphasis>must</emphasis> have a |
| | | 160 | <filename>builtin.mk</filename> file to be listed in |
| | | 161 | <varname>PREFER_NATIVE</varname>, otherwise it is simply ignored in |
| | | 162 | that list.</para> |
| | | 163 | |
| | | 164 | <para><varname>PREFER_PKGSRC</varname> and |
| | | 165 | <varname>PREFER_NATIVE</varname> should be set during bootstrap to |
| | | 166 | ensure that the bootstrap process does not use inapropriate native |
| | | 167 | tools as dependencies for core packages.</para> |
| | | 168 | |
| | | 169 | <screen> |
| | | 170 | &rprompt; <userinput>./bootstrap --prefer-pkgsrc yes --prefer-native openssl</userinput> |
| | | 171 | </screen> |
| | | 172 | |
| | | 173 | <para>Switching between settings globally at a later date can |
| | | 174 | introduce complications with dependency resolution. This is caused |
| | | 175 | by packages built with the opposite preference being installed |
| | | 176 | alongside each other. Hence, when changing any of these variables |
| | | 177 | after bootstrap, you need to rebuild all packages depending on those |
| | | 178 | whose preference has been changed. This is not trivial and should |
| | | 179 | be avoided.</para> |
| | | 180 | |
| | | 181 | <para>When using pkgsrc on Linux systems, there is high risk of |
| | | 182 | <quote>leakage</quote>, where programs installed by pkgsrc may |
| | | 183 | inadvertently use a command or library not installed by pkgsrc, e.g. |
| | | 184 | those installed by yum or apt. Such foreign dependencies may be |
| | | 185 | installed, removed, or upgraded to a version incompatible with the |
| | | 186 | pkgsrc package at any time, causing pkgsrc packages to subsequently |
| | | 187 | malfunction. Pkgsrc cannot prevent this, as it has no control over |
| | | 188 | other package managers. Another potential problem is that under |
| | | 189 | Redhat Enterprise and related Linux systems, yum packages are only |
| | | 190 | patched and never upgraded, so eventually they may become too |
| | | 191 | outdated for use by pkgsrc. Even intentionally using foreign |
| | | 192 | dependencies, not considered leakage, can lead to these problems, so |
| | | 193 | it is generally discouraged. In order to minimize such problems, |
| | | 194 | PREFER_PKGSRC defaults to <quote>yes</quote> on Linux systems. This ensures that |
| | | 195 | pkgsrc is aware of any changes to dependency packages and can |
| | | 196 | rebuild or upgrade the entire dependency tree as needed. This |
| | | 197 | default can be overridden by setting --prefer-pkgsrc to a |
| | | 198 | list of packages and --prefer-native to <quote>yes</quote>.</para> |
| | | 199 | </sect1> |
| | | 200 | |
122 | <sect1 id="variables-affecting-installation"> | | 201 | <sect1 id="variables-affecting-installation"> |
123 | <title>Variables affecting the installation process</title> | | 202 | <title>Variables affecting the installation process</title> |
124 | | | 203 | |
125 | <itemizedlist> | | 204 | <itemizedlist> |
126 | <listitem><para><varname>PKGSRC_KEEP_BIN_PKGS</varname>: | | 205 | <listitem><para><varname>PKGSRC_KEEP_BIN_PKGS</varname>: |
127 | By default, binary packages of built packages are | | 206 | By default, binary packages of built packages are |
128 | preserved in <filename>${PACKAGES}/All</filename>. Setting | | 207 | preserved in <filename>${PACKAGES}/All</filename>. Setting |
129 | this variable to "no" prevents this.</para> | | 208 | this variable to "no" prevents this.</para> |
130 | </listitem> | | 209 | </listitem> |
131 | </itemizedlist> | | 210 | </itemizedlist> |
132 | | | 211 | |
133 | <para>Packages have to support installation into a | | 212 | <para>Packages have to support installation into a |
134 | subdirectory of <varname>WRKDIR</varname>. This allows a package | | 213 | subdirectory of <varname>WRKDIR</varname>. This allows a package |