| @@ -1,1981 +1,1985 @@ | | | @@ -1,1981 +1,1985 @@ |
1 | <!-- $NetBSD: fixes.xml,v 1.123 2013/08/24 16:55:21 bsiegert Exp $ --> | | 1 | <!-- $NetBSD: fixes.xml,v 1.124 2014/09/13 07:32:54 wiz Exp $ --> |
2 | | | 2 | |
3 | <chapter id="fixes"> <?dbhtml filename="fixes.html"?> | | 3 | <chapter id="fixes"> <?dbhtml filename="fixes.html"?> |
4 | <title>Making your package work</title> | | 4 | <title>Making your package work</title> |
5 | | | 5 | |
6 | <sect1 id="general-operation"> | | 6 | <sect1 id="general-operation"> |
7 | <title>General operation</title> | | 7 | <title>General operation</title> |
8 | | | 8 | |
9 | <sect2 id="portability-of-packages"> | | 9 | <sect2 id="portability-of-packages"> |
10 | <title>Portability of packages</title> | | 10 | <title>Portability of packages</title> |
11 | | | 11 | |
12 | <para>One appealing feature of pkgsrc is that it runs on many | | 12 | <para>One appealing feature of pkgsrc is that it runs on many |
13 | different platforms. As a result, it is important to ensure, | | 13 | different platforms. As a result, it is important to ensure, |
14 | where possible, that packages in pkgsrc are portable. This | | 14 | where possible, that packages in pkgsrc are portable. This |
15 | chapter mentions some particular details you should pay | | 15 | chapter mentions some particular details you should pay |
16 | attention to while working on pkgsrc.</para> | | 16 | attention to while working on pkgsrc.</para> |
17 | </sect2> | | 17 | </sect2> |
18 | | | 18 | |
19 | <sect2 id="pulling-vars-from-etc-mk.conf"> | | 19 | <sect2 id="pulling-vars-from-etc-mk.conf"> |
20 | <title>How to pull in user-settable variables from &mk.conf;</title> | | 20 | <title>How to pull in user-settable variables from &mk.conf;</title> |
21 | | | 21 | |
22 | <para>The pkgsrc user can configure pkgsrc by overriding several | | 22 | <para>The pkgsrc user can configure pkgsrc by overriding several |
23 | variables in the file pointed to by <varname>MAKECONF</varname>, | | 23 | variables in the file pointed to by <varname>MAKECONF</varname>, |
24 | which is &mk.conf; by default. When you | | 24 | which is &mk.conf; by default. When you |
25 | want to use those variables in the preprocessor directives of | | 25 | want to use those variables in the preprocessor directives of |
26 | &man.make.1; (for example <literal>.if</literal> or | | 26 | &man.make.1; (for example <literal>.if</literal> or |
27 | <literal>.for</literal>), you need to include the file | | 27 | <literal>.for</literal>), you need to include the file |
28 | <filename>../../mk/bsd.prefs.mk</filename> before, which in turn | | 28 | <filename>../../mk/bsd.prefs.mk</filename> before, which in turn |
29 | loads the user preferences.</para> | | 29 | loads the user preferences.</para> |
30 | | | 30 | |
31 | <para>But note that some variables may not be completely defined | | 31 | <para>But note that some variables may not be completely defined |
32 | after <filename>../../mk/bsd.prefs.mk</filename> has been | | 32 | after <filename>../../mk/bsd.prefs.mk</filename> has been |
33 | included, as they may contain references to variables that are | | 33 | included, as they may contain references to variables that are |
34 | not yet defined. In shell commands this is no problem, since | | 34 | not yet defined. In shell commands this is no problem, since |
35 | variables are actually macros, which are only expanded when they | | 35 | variables are actually macros, which are only expanded when they |
36 | are used. But in the preprocessor directives mentioned above and | | 36 | are used. But in the preprocessor directives mentioned above and |
37 | in dependency lines (of the form <literal>target: | | 37 | in dependency lines (of the form <literal>target: |
38 | dependencies</literal>) the variables are expanded at load | | 38 | dependencies</literal>) the variables are expanded at load |
39 | time.</para> | | 39 | time.</para> |
40 | | | 40 | |
41 | <note><para>Currently there is no exhaustive list of all | | 41 | <note><para>Currently there is no exhaustive list of all |
42 | variables that tells you whether they can be used at load time | | 42 | variables that tells you whether they can be used at load time |
43 | or only at run time, but it is in preparation.</para></note> | | 43 | or only at run time, but it is in preparation.</para></note> |
44 | </sect2> | | 44 | </sect2> |
45 | | | 45 | |
46 | <sect2 id="user-interaction"> | | 46 | <sect2 id="user-interaction"> |
47 | <title>User interaction</title> | | 47 | <title>User interaction</title> |
48 | | | 48 | |
49 | <para>Occasionally, packages require interaction from the user, | | 49 | <para>Occasionally, packages require interaction from the user, |
50 | and this can be in a number of ways:</para> | | 50 | and this can be in a number of ways:</para> |
51 | | | 51 | |
52 | <itemizedlist> | | 52 | <itemizedlist> |
53 | | | 53 | |
54 | <listitem> | | 54 | <listitem> |
55 | <para>When fetching the distfiles, some packages require user | | 55 | <para>When fetching the distfiles, some packages require user |
56 | interaction such as entering username/password or accepting a | | 56 | interaction such as entering username/password or accepting a |
57 | license on a web page.</para> | | 57 | license on a web page.</para> |
58 | </listitem> | | 58 | </listitem> |
59 | | | 59 | |
60 | <listitem> | | 60 | <listitem> |
61 | <para>When extracting the distfiles, some packages may ask for | | 61 | <para>When extracting the distfiles, some packages may ask for |
62 | passwords.</para> | | 62 | passwords.</para> |
63 | </listitem> | | 63 | </listitem> |
64 | | | 64 | |
65 | <listitem> | | 65 | <listitem> |
66 | <para>help to configure the package before it is built</para> | | 66 | <para>help to configure the package before it is built</para> |
67 | </listitem> | | 67 | </listitem> |
68 | | | 68 | |
69 | <listitem> | | 69 | <listitem> |
70 | <para>help during the build process</para> | | 70 | <para>help during the build process</para> |
71 | </listitem> | | 71 | </listitem> |
72 | | | 72 | |
73 | <listitem> | | 73 | <listitem> |
74 | <para>help during the installation of a package</para> | | 74 | <para>help during the installation of a package</para> |
75 | </listitem> | | 75 | </listitem> |
76 | </itemizedlist> | | 76 | </itemizedlist> |
77 | | | 77 | |
78 | <para>The <varname>INTERACTIVE_STAGE</varname> definition is | | 78 | <para>The <varname>INTERACTIVE_STAGE</varname> definition is |
79 | provided to notify the pkgsrc mechanism of an interactive stage | | 79 | provided to notify the pkgsrc mechanism of an interactive stage |
80 | which will be needed, and this should be set in the package's | | 80 | which will be needed, and this should be set in the package's |
81 | <filename>Makefile</filename>, e.g.:</para> | | 81 | <filename>Makefile</filename>, e.g.:</para> |
82 | | | 82 | |
83 | <programlisting> | | 83 | <programlisting> |
84 | INTERACTIVE_STAGE= build | | 84 | INTERACTIVE_STAGE= build |
85 | </programlisting> | | 85 | </programlisting> |
86 | | | 86 | |
87 | <para>Multiple interactive stages can be specified:</para> | | 87 | <para>Multiple interactive stages can be specified:</para> |
88 | | | 88 | |
89 | <programlisting> | | 89 | <programlisting> |
90 | INTERACTIVE_STAGE= configure install | | 90 | INTERACTIVE_STAGE= configure install |
91 | </programlisting> | | 91 | </programlisting> |
92 | | | 92 | |
93 | <para>The user can then decide to skip this package by setting the | | 93 | <para>The user can then decide to skip this package by setting the |
94 | <varname>BATCH</varname> variable.</para> | | 94 | <varname>BATCH</varname> variable.</para> |
95 | </sect2> | | 95 | </sect2> |
96 | | | 96 | |
97 | <sect2 id="handling-licenses"> | | 97 | <sect2 id="handling-licenses"> |
98 | <title>Handling licenses</title> | | 98 | <title>Handling licenses</title> |
99 | | | 99 | |
100 | <para>Authors of software can choose the licence under which | | 100 | <para>Authors of software can choose the licence under which |
101 | software can be copied. This is due to copyright law, and reasons | | 101 | software can be copied. This is due to copyright law, and reasons |
102 | for license choices are outside the scope of pkgsrc. The pkgsrc | | 102 | for license choices are outside the scope of pkgsrc. The pkgsrc |
103 | system recognizes that there are a number of licenses which some | | 103 | system recognizes that there are a number of licenses which some |
104 | users may find objectionable or difficult or impossible to comply | | 104 | users may find objectionable or difficult or impossible to comply |
105 | with. The Free Software Foundation has declared some licenses | | 105 | with. The Free Software Foundation has declared some licenses |
106 | "Free", and the Open Source Initiative has a definition of "Open | | 106 | "Free", and the Open Source Initiative has a definition of "Open |
107 | Source". The pkgsrc system, as a policy choice, does not label | | 107 | Source". The pkgsrc system, as a policy choice, does not label |
108 | packages which have licenses that are Free or Open Source. | | 108 | packages which have licenses that are Free or Open Source. |
109 | However, packages without a license meeting either of those tests | | 109 | However, packages without a license meeting either of those tests |
110 | are labeled with a license tag denoting the license. Note that a | | 110 | are labeled with a license tag denoting the license. Note that a |
111 | package with no license to copy trivially does not meet either the | | 111 | package with no license to copy trivially does not meet either the |
112 | Free or Open Source test.</para> | | 112 | Free or Open Source test.</para> |
113 | | | 113 | |
114 | <para>For packages which are not Free or Open Source, pkgsrc will | | 114 | <para>For packages which are not Free or Open Source, pkgsrc will |
115 | not build the package unless the user has indicated to pkgsrc that | | 115 | not build the package unless the user has indicated to pkgsrc that |
116 | packages with that particular license may be built. Note that | | 116 | packages with that particular license may be built. Note that |
117 | this documentation avoids the term "accepted the license". The | | 117 | this documentation avoids the term "accepted the license". The |
118 | pkgsrc system is merely providing a mechanism to avoid | | 118 | pkgsrc system is merely providing a mechanism to avoid |
119 | accidentally building a package with a non-free license; | | 119 | accidentally building a package with a non-free license; |
120 | judgement and responsibility remain with the user. (Installation | | 120 | judgement and responsibility remain with the user. (Installation |
121 | of binary packages are not currently subject to this mechanism; | | 121 | of binary packages are not currently subject to this mechanism; |
122 | this is a bug.)</para> | | 122 | this is a bug.)</para> |
123 | | | 123 | |
124 | <para>One might want to only install packages with a BSD license, | | 124 | <para>One might want to only install packages with a BSD license, |
125 | or the GPL, and not the other. The free licenses are added to the | | 125 | or the GPL, and not the other. The free licenses are added to the |
126 | default <varname>ACCEPTABLE_LICENSES</varname> variable. The | | 126 | default <varname>ACCEPTABLE_LICENSES</varname> variable. The |
127 | user can override the default by setting the | | 127 | user can override the default by setting the |
128 | <varname>ACCEPTABLE_LICENSES</varname> variable with "=" instead | | 128 | <varname>ACCEPTABLE_LICENSES</varname> variable with "=" instead |
129 | of "+=". The licenses accepted by default are: | | 129 | of "+=". The licenses accepted by default are: |
130 | <programlisting> | | 130 | <programlisting> |
131 | apache-1.1 apache-2.0 | | 131 | apache-1.1 apache-2.0 |
132 | arphic-public | | 132 | arphic-public |
133 | artistic artistic-2.0 | | 133 | artistic artistic-2.0 |
134 | boost-license | | 134 | boost-license |
135 | cc-by-sa-v3.0 | | 135 | cc-by-sa-v3.0 |
136 | cc0-1.0-universal | | 136 | cc0-1.0-universal |
137 | cddl-1.0 | | 137 | cddl-1.0 |
138 | cpl-1.0 | | 138 | cpl-1.0 |
139 | epl-v1.0 | | 139 | epl-v1.0 |
140 | gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3 | | 140 | gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3 |
141 | gnu-gpl-v1 | | 141 | gnu-gpl-v1 |
142 | gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 | | 142 | gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 |
143 | gnu-gpl-v3 gnu-lgpl-v3 | | 143 | gnu-gpl-v3 gnu-lgpl-v3 |
144 | ibm-public-license-1.0 | | 144 | ibm-public-license-1.0 |
145 | ipafont | | 145 | ipafont |
146 | isc | | 146 | isc |
147 | lppl-1.3c | | 147 | lppl-1.3c |
148 | lucent | | 148 | lucent |
149 | miros | | 149 | miros |
150 | mit | | 150 | mit |
151 | mpl-1.0 mpl-1.1 mpl-2.0 | | 151 | mpl-1.0 mpl-1.1 mpl-2.0 |
152 | mplusfont | | 152 | mplusfont |
153 | ofl-v1.0 ofl-v1.1 | | 153 | ofl-v1.0 ofl-v1.1 |
154 | original-bsd modified-bsd 2-clause-bsd | | 154 | original-bsd modified-bsd 2-clause-bsd |
155 | php | | 155 | php |
156 | png-license | | 156 | png-license |
157 | postgresql-license | | 157 | postgresql-license |
158 | public-domain | | 158 | public-domain |
159 | python-software-foundation | | 159 | python-software-foundation |
160 | qpl-v1.0 | | 160 | qpl-v1.0 |
161 | sgi-free-software-b-v2.0 | | 161 | sgi-free-software-b-v2.0 |
162 | sleepycat-public | | 162 | sleepycat-public |
163 | unlicense | | 163 | unlicense |
164 | x11 | | 164 | x11 |
165 | zlib | | 165 | zlib |
166 | zpl | | 166 | zpl |
167 | </programlisting> | | 167 | </programlisting> |
168 | </para> | | 168 | </para> |
169 | | | 169 | |
170 | <para>The license tag mechanism is intended to address | | 170 | <para>The license tag mechanism is intended to address |
171 | copyright-related issues surrounding building, installing and | | 171 | copyright-related issues surrounding building, installing and |
172 | using a package, and not to address redistribution issues (see | | 172 | using a package, and not to address redistribution issues (see |
173 | <varname>RESTRICTED</varname> and | | 173 | <varname>RESTRICTED</varname> and |
174 | <varname>NO_SRC_ON_FTP</varname>, etc.). | | 174 | <varname>NO_SRC_ON_FTP</varname>, etc.). |
175 | Packages with redistribution restrictions should set these | | 175 | Packages with redistribution restrictions should set these |
176 | tags.</para> | | 176 | tags.</para> |
177 | | | 177 | |
178 | <para>Denoting that a package may be copied according to a | | 178 | <para>Denoting that a package may be copied according to a |
179 | particular license is done by placing the license in | | 179 | particular license is done by placing the license in |
180 | <filename>pkgsrc/licenses</filename> and setting the | | 180 | <filename>pkgsrc/licenses</filename> and setting the |
181 | <varname>LICENSE</varname> variable to a string identifying the | | 181 | <varname>LICENSE</varname> variable to a string identifying the |
182 | license, e.g. in <filename | | 182 | license, e.g. in <filename |
183 | role="pkg">graphics/xv</filename>:</para> | | 183 | role="pkg">graphics/xv</filename>:</para> |
184 | | | 184 | |
185 | <programlisting> | | 185 | <programlisting> |
186 | LICENSE= xv-license | | 186 | LICENSE= xv-license |
187 | </programlisting> | | 187 | </programlisting> |
188 | | | 188 | |
189 | <para>When trying to build, the user will get a notice that the | | 189 | <para>When trying to build, the user will get a notice that the |
190 | package is covered by a license which has not been placed in the | | 190 | package is covered by a license which has not been placed in the |
191 | <varname>ACCEPTABLE_LICENSES</varname> variable:</para> | | 191 | <varname>ACCEPTABLE_LICENSES</varname> variable:</para> |
192 | | | 192 | |
193 | <programlisting> | | 193 | <programlisting> |
194 | &cprompt; <userinput>make</userinput> | | 194 | &cprompt; <userinput>make</userinput> |
195 | ===> xv-3.10anb9 has an unacceptable license: xv-license. | | 195 | ===> xv-3.10anb9 has an unacceptable license: xv-license. |
196 | ===> To view the license, enter "/usr/bin/make show-license". | | 196 | ===> To view the license, enter "/usr/bin/make show-license". |
197 | ===> To indicate acceptance, add this line to your /etc/mk.conf: | | 197 | ===> To indicate acceptance, add this line to your /etc/mk.conf: |
198 | ===> ACCEPTABLE_LICENSES+=xv-license | | 198 | ===> ACCEPTABLE_LICENSES+=xv-license |
199 | *** Error code 1 | | 199 | *** Error code 1 |
200 | </programlisting> | | 200 | </programlisting> |
201 | | | 201 | |
202 | <para>The license can be viewed with <command>make | | 202 | <para>The license can be viewed with <command>make |
203 | show-license</command>, and if the user so chooses, the line | | 203 | show-license</command>, and if the user so chooses, the line |
204 | printed above can be added to &mk.conf; to | | 204 | printed above can be added to &mk.conf; to |
205 | convey to pkgsrc that it should not in the future fail because of | | 205 | convey to pkgsrc that it should not in the future fail because of |
206 | that license:</para> | | 206 | that license:</para> |
207 | | | 207 | |
208 | <programlisting> | | 208 | <programlisting> |
209 | ACCEPTABLE_LICENSES+=xv-license | | 209 | ACCEPTABLE_LICENSES+=xv-license |
210 | </programlisting> | | 210 | </programlisting> |
211 | | | 211 | |
212 | <para>When adding a package with a new license, the following steps | | 212 | <para>When adding a package with a new license, the following steps |
213 | are required:</para> | | 213 | are required:</para> |
214 | <orderedlist> | | 214 | <orderedlist> |
215 | <listitem><para>Check if the file can avoid the -license filename tag as described above by referencing <ulink url="http://www.gnu.org/licenses/license-list.html">Various Licenses and Comments about Them</ulink> and <ulink url="http://opensource.org/licenses/alphabetical">Licenses by Name | Open Source Initiative</ulink>. If this is the case, additionally add the license filename to:</para> | | 215 | <listitem><para>Check if the file can avoid the -license filename tag as described above by referencing <ulink url="http://www.gnu.org/licenses/license-list.html">Various Licenses and Comments about Them</ulink> and <ulink url="http://opensource.org/licenses/alphabetical">Licenses by Name | Open Source Initiative</ulink>. If this is the case, additionally add the license filename to:</para> |
216 | <itemizedlist> | | 216 | <itemizedlist> |
217 | <listitem><para>DEFAULT_ACCEPTABLE_LICENSES in <filename>pkgsrc/mk/license.mk</filename></para></listitem> | | 217 | <listitem><para>DEFAULT_ACCEPTABLE_LICENSES in <filename>pkgsrc/mk/license.mk</filename></para></listitem> |
218 | <listitem><para>default_acceptable_licenses in <filename>pkgsrc/pkgtools/pkg_install/files/lib/license.c</filename></para></listitem> | | 218 | <listitem><para>default_acceptable_licenses in <filename>pkgsrc/pkgtools/pkg_install/files/lib/license.c</filename></para></listitem> |
219 | <listitem><para>the ACCEPTABLE_LICENSES list in <filename>pkgsrc/doc/guide/files/fixes.xml</filename></para></listitem> | | 219 | <listitem><para>the ACCEPTABLE_LICENSES list in <filename>pkgsrc/doc/guide/files/fixes.xml</filename></para></listitem> |
220 | </itemizedlist> | | 220 | </itemizedlist> |
221 | <para>with the proper syntax as demonstrated in those files, respectively.</para></listitem> | | 221 | <para>with the proper syntax as demonstrated in those files, respectively.</para></listitem> |
222 | <listitem><para>The license text should be added to <filename>pkgsrc/licenses</filename> for displaying. A list of known licenses can be seen in this directory.</para></listitem> | | 222 | <listitem><para>The license text should be added to <filename>pkgsrc/licenses</filename> for displaying. A list of known licenses can be seen in this directory.</para></listitem> |
223 | </orderedlist> | | 223 | </orderedlist> |
224 | <para>When the license changes (in a way other than formatting), | | 224 | <para>When the license changes (in a way other than formatting), |
225 | please make sure that the new license has a different name (e.g., | | 225 | please make sure that the new license has a different name (e.g., |
226 | append the version number if it exists, or the date). Just | | 226 | append the version number if it exists, or the date). Just |
227 | because a user told pkgsrc to build programs under a previous | | 227 | because a user told pkgsrc to build programs under a previous |
228 | version of a license does not mean that pkgsrc should build | | 228 | version of a license does not mean that pkgsrc should build |
229 | programs under the new licenses. The higher-level point is that | | 229 | programs under the new licenses. The higher-level point is that |
230 | pkgsrc does not evaluate licenses for reasonableness; the only | | 230 | pkgsrc does not evaluate licenses for reasonableness; the only |
231 | test is a mechanistic test of whether a particular text has been | | 231 | test is a mechanistic test of whether a particular text has been |
232 | approved by either of two bodies.</para> | | 232 | approved by either of two bodies.</para> |
233 | | | 233 | |
234 | <para>The use of <varname>LICENSE=shareware</varname>, | | 234 | <para>The use of <varname>LICENSE=shareware</varname>, |
235 | <varname>LICENSE=no-commercial-use</varname>, and similar language | | 235 | <varname>LICENSE=no-commercial-use</varname>, and similar language |
236 | is deprecated because it does not crisply refer to a particular | | 236 | is deprecated because it does not crisply refer to a particular |
237 | license text. Another problem with such usage is that it does not | | 237 | license text. Another problem with such usage is that it does not |
238 | enable a user to tell pkgsrc to proceed for a single package | | 238 | enable a user to tell pkgsrc to proceed for a single package |
239 | without also telling pkgsrc to proceed for all packages with that | | 239 | without also telling pkgsrc to proceed for all packages with that |
240 | tag.</para> </sect2> | | 240 | tag.</para> </sect2> |
241 | | | 241 | |
242 | <sect2 id="restricted-packages"> | | 242 | <sect2 id="restricted-packages"> |
243 | <title>Restricted packages</title> | | 243 | <title>Restricted packages</title> |
244 | | | 244 | |
245 | <para>Some licenses restrict how software may be re-distributed. | | 245 | <para>Some licenses restrict how software may be re-distributed. |
246 | Because a license tag is required unless the package is Free or | | 246 | Because a license tag is required unless the package is Free or |
247 | Open Source, all packages with restrictions should have license | | 247 | Open Source, all packages with restrictions should have license |
248 | tags. By declaring the restrictions, package tools can | | 248 | tags. By declaring the restrictions, package tools can |
249 | automatically refrain from e.g. placing binary packages on FTP | | 249 | automatically refrain from e.g. placing binary packages on FTP |
250 | sites.</para> | | 250 | sites.</para> |
251 | | | 251 | |
252 | <para>There are four restrictions that may be encoded, which are | | 252 | <para>There are four restrictions that may be encoded, which are |
253 | the cross product of sources (distfiles) and binaries not being | | 253 | the cross product of sources (distfiles) and binaries not being |
254 | placed on FTP sites and CD-ROMs. Because this is rarely the exact | | 254 | placed on FTP sites and CD-ROMs. Because this is rarely the exact |
255 | language in any license, and because non-Free licenses tend to be | | 255 | language in any license, and because non-Free licenses tend to be |
256 | different from each other, pkgsrc adopts a definition of FTP and | | 256 | different from each other, pkgsrc adopts a definition of FTP and |
257 | CD-ROM. Pkgsrc uses "FTP" to mean that the source or binary file | | 257 | CD-ROM. Pkgsrc uses "FTP" to mean that the source or binary file |
258 | should not be made available over the Internet at no charge. | | 258 | should not be made available over the Internet at no charge. |
259 | Pkgsrc uses "CD-ROM" to mean that the source or binary may not be | | 259 | Pkgsrc uses "CD-ROM" to mean that the source or binary may not be |
260 | made available on some kind of media, together with other source | | 260 | made available on some kind of media, together with other source |
261 | and binary packages, and which is sold for a distribution charge. | | 261 | and binary packages, and which is sold for a distribution charge. |
262 | </para> | | 262 | </para> |
263 | | | 263 | |
264 | <para>In order to encode these restrictions, the package system | | 264 | <para>In order to encode these restrictions, the package system |
265 | defines five make variables that can be set to note these | | 265 | defines five make variables that can be set to note these |
266 | restrictions:</para> | | 266 | restrictions:</para> |
267 | | | 267 | |
268 | <itemizedlist> | | 268 | <itemizedlist> |
269 | <listitem> | | 269 | <listitem> |
270 | <para><varname>RESTRICTED</varname></para> | | 270 | <para><varname>RESTRICTED</varname></para> |
271 | | | 271 | |
272 | <para>This variable should be set whenever a restriction | | 272 | <para>This variable should be set whenever a restriction |
273 | exists (regardless of its kind). Set this variable to a | | 273 | exists (regardless of its kind). Set this variable to a |
274 | string containing the reason for the restriction. It should | | 274 | string containing the reason for the restriction. It should |
275 | be understood that those wanting to understand the restriction | | 275 | be understood that those wanting to understand the restriction |
276 | will have to read the license, and perhaps seek advice of | | 276 | will have to read the license, and perhaps seek advice of |
277 | counsel.</para> | | 277 | counsel.</para> |
278 | </listitem> | | 278 | </listitem> |
279 | | | 279 | |
280 | <listitem> | | 280 | <listitem> |
281 | <para><varname>NO_BIN_ON_CDROM</varname></para> | | 281 | <para><varname>NO_BIN_ON_CDROM</varname></para> |
282 | | | 282 | |
283 | <para>Binaries may not be placed on CD-ROM containing other | | 283 | <para>Binaries may not be placed on CD-ROM containing other |
284 | binary packages, for which a distribution charge may be made. | | 284 | binary packages, for which a distribution charge may be made. |
285 | In this case, set this variable to | | 285 | In this case, set this variable to |
286 | <varname>${RESTRICTED}</varname>.</para> | | 286 | <varname>${RESTRICTED}</varname>.</para> |
287 | </listitem> | | 287 | </listitem> |
288 | | | 288 | |
289 | <listitem> | | 289 | <listitem> |
290 | <para><varname>NO_BIN_ON_FTP</varname></para> | | 290 | <para><varname>NO_BIN_ON_FTP</varname></para> |
291 | | | 291 | |
292 | <para>Binaries may not made available on the Internet without | | 292 | <para>Binaries may not made available on the Internet without |
293 | charge. In this case, set this variable to | | 293 | charge. In this case, set this variable to |
294 | <varname>${RESTRICTED}</varname>. If this variable is set, | | 294 | <varname>${RESTRICTED}</varname>. If this variable is set, |
295 | binary packages will not be included on ftp.NetBSD.org.</para> | | 295 | binary packages will not be included on ftp.NetBSD.org.</para> |
296 | </listitem> | | 296 | </listitem> |
297 | | | 297 | |
298 | <listitem> | | 298 | <listitem> |
299 | <para><varname>NO_SRC_ON_CDROM</varname></para> | | 299 | <para><varname>NO_SRC_ON_CDROM</varname></para> |
300 | | | 300 | |
301 | <para>Distfiles may not be placed on CD-ROM, together with | | 301 | <para>Distfiles may not be placed on CD-ROM, together with |
302 | other distfiles, for which a fee may be charged. In this | | 302 | other distfiles, for which a fee may be charged. In this |
303 | case, set this variable to <varname>${RESTRICTED}</varname>. | | 303 | case, set this variable to <varname>${RESTRICTED}</varname>. |
304 | </para> | | 304 | </para> |
305 | </listitem> | | 305 | </listitem> |
306 | | | 306 | |
307 | <listitem> | | 307 | <listitem> |
308 | <para><varname>NO_SRC_ON_FTP</varname></para> | | 308 | <para><varname>NO_SRC_ON_FTP</varname></para> |
309 | | | 309 | |
310 | <para>Distfiles may not made available via FTP at no charge. | | 310 | <para>Distfiles may not made available via FTP at no charge. |
311 | In this case, set this variable to | | 311 | In this case, set this variable to |
312 | <varname>${RESTRICTED}</varname>. If this variable is set, | | 312 | <varname>${RESTRICTED}</varname>. If this variable is set, |
313 | the distfile(s) will not be mirrored on ftp.NetBSD.org.</para> | | 313 | the distfile(s) will not be mirrored on ftp.NetBSD.org.</para> |
314 | </listitem> | | 314 | </listitem> |
315 | </itemizedlist> | | 315 | </itemizedlist> |
316 | | | 316 | |
317 | <para>Please note that packages will to be removed from pkgsrc | | 317 | <para>Please note that packages will to be removed from pkgsrc |
318 | when the distfiles are not distributable and cannot be obtained | | 318 | when the distfiles are not distributable and cannot be obtained |
319 | for a period of one full quarter branch. Packages with manual / | | 319 | for a period of one full quarter branch. Packages with manual / |
320 | interactive fetch must have a maintainer and it is his/her | | 320 | interactive fetch must have a maintainer and it is his/her |
321 | responsibility to ensure this.</para> | | 321 | responsibility to ensure this.</para> |
322 | </sect2> | | 322 | </sect2> |
323 | | | 323 | |
324 | | | 324 | |
325 | <sect2 id="dependencies"> | | 325 | <sect2 id="dependencies"> |
326 | <title>Handling dependencies</title> | | 326 | <title>Handling dependencies</title> |
327 | | | 327 | |
328 | <para>Your package may depend on some other package being present | | 328 | <para>Your package may depend on some other package being present |
329 | - and there are various ways of expressing this dependency. | | 329 | - and there are various ways of expressing this dependency. |
330 | pkgsrc supports the <varname>BUILD_DEPENDS</varname> and | | 330 | pkgsrc supports the <varname>BUILD_DEPENDS</varname> and |
331 | <varname>DEPENDS</varname> definitions, the | | 331 | <varname>DEPENDS</varname> definitions, the |
332 | <varname>USE_TOOLS</varname> definition, as well as dependencies | | 332 | <varname>USE_TOOLS</varname> definition, as well as dependencies |
333 | via <filename>buildlink3.mk</filename>, which is the preferred way | | 333 | via <filename>buildlink3.mk</filename>, which is the preferred way |
334 | to handle dependencies, and which uses the variables named above. | | 334 | to handle dependencies, and which uses the variables named above. |
335 | See <xref linkend="buildlink"/> for more information.</para> | | 335 | See <xref linkend="buildlink"/> for more information.</para> |
336 | | | 336 | |
337 | <para>The basic difference between the two variables is as | | 337 | <para>The basic difference between the two variables is as |
338 | follows: The <varname>DEPENDS</varname> definition registers | | 338 | follows: The <varname>DEPENDS</varname> definition registers |
339 | that pre-requisite in the binary package so it will be pulled in | | 339 | that pre-requisite in the binary package so it will be pulled in |
340 | when the binary package is later installed, whilst the | | 340 | when the binary package is later installed, whilst the |
341 | <varname>BUILD_DEPENDS</varname> definition does not, marking a | | 341 | <varname>BUILD_DEPENDS</varname> definition does not, marking a |
342 | dependency that is only needed for building the package.</para> | | 342 | dependency that is only needed for building the package.</para> |
343 | | | 343 | |
344 | <para>This means that if you only need a package present whilst | | 344 | <para>This means that if you only need a package present whilst |
345 | you are building, it should be noted as a | | 345 | you are building, it should be noted as a |
346 | <varname>BUILD_DEPENDS</varname>.</para> | | 346 | <varname>BUILD_DEPENDS</varname>.</para> |
347 | | | 347 | |
348 | <para>The format for a <varname>BUILD_DEPENDS</varname> and a | | 348 | <para>The format for a <varname>BUILD_DEPENDS</varname> and a |
349 | <varname>DEPENDS</varname> definition is:</para> | | 349 | <varname>DEPENDS</varname> definition is:</para> |
350 | | | 350 | |
351 | <programlisting> | | 351 | <programlisting> |
352 | <pre-req-package-name>:../../<category>/<pre-req-package> | | 352 | <pre-req-package-name>:../../<category>/<pre-req-package> |
353 | </programlisting> | | 353 | </programlisting> |
354 | | | 354 | |
355 | <para>Please note that the <quote>pre-req-package-name</quote> | | 355 | <para>Please note that the <quote>pre-req-package-name</quote> |
356 | may include any of the wildcard version numbers recognized by | | 356 | may include any of the wildcard version numbers recognized by |
357 | &man.pkg.info.1;.</para> | | 357 | &man.pkg.info.1;.</para> |
358 | | | 358 | |
359 | <orderedlist> | | 359 | <orderedlist> |
360 | <listitem> | | 360 | <listitem> |
361 | <para>If your package needs another package's binaries or | | 361 | <para>If your package needs another package's binaries or |
362 | libraries to build and run, and if that package has a | | 362 | libraries to build and run, and if that package has a |
363 | <filename>buildlink3.mk</filename> file available, use it:</para> | | 363 | <filename>buildlink3.mk</filename> file available, use it:</para> |
364 | | | 364 | |
365 | <programlisting> | | 365 | <programlisting> |
366 | .include "../../graphics/jpeg/buildlink3.mk" | | 366 | .include "../../graphics/jpeg/buildlink3.mk" |
367 | </programlisting> | | 367 | </programlisting> |
368 | </listitem> | | 368 | </listitem> |
369 | | | 369 | |
370 | <listitem> | | 370 | <listitem> |
371 | <para>If your package needs another package's binaries or | | 371 | <para>If your package needs another package's binaries or |
372 | libraries only for building, and if that package has a | | 372 | libraries only for building, and if that package has a |
373 | <filename>buildlink3.mk</filename> file available, use it:</para> | | 373 | <filename>buildlink3.mk</filename> file available, use it:</para> |
374 | | | 374 | |
375 | <programlisting> | | 375 | <programlisting> |
376 | .include "../../graphics/jpeg/buildlink3.mk" | | 376 | .include "../../graphics/jpeg/buildlink3.mk" |
377 | </programlisting> | | 377 | </programlisting> |
378 | <para>but set | | 378 | <para>but set |
379 | <varname>BUILDLINK_DEPMETHOD.<replaceable>jpeg</replaceable>?=build</varname> | | 379 | <varname>BUILDLINK_DEPMETHOD.<replaceable>jpeg</replaceable>?=build</varname> |
380 | to make it a build dependency only. This case is rather | | 380 | to make it a build dependency only. This case is rather |
381 | rare.</para> | | 381 | rare.</para> |
382 | </listitem> | | 382 | </listitem> |
383 | | | 383 | |
384 | <listitem> | | 384 | <listitem> |
385 | <para>If your package needs binaries from another package to build, | | 385 | <para>If your package needs binaries from another package to build, |
386 | use the <varname>BUILD_DEPENDS</varname> definition:</para> | | 386 | use the <varname>BUILD_DEPENDS</varname> definition:</para> |
387 | | | 387 | |
388 | <programlisting> | | 388 | <programlisting> |
389 | BUILD_DEPENDS+= scons-[0-9]*:../../devel/scons | | 389 | BUILD_DEPENDS+= scons-[0-9]*:../../devel/scons |
390 | </programlisting> | | 390 | </programlisting> |
391 | </listitem> | | 391 | </listitem> |
392 | | | 392 | |
393 | <listitem> | | 393 | <listitem> |
394 | <para>If your package needs a library with which to link and | | 394 | <para>If your package needs a library with which to link and |
395 | there is no <filename>buildlink3.mk</filename> file | | 395 | there is no <filename>buildlink3.mk</filename> file |
396 | available, create one. Using | | 396 | available, create one. Using |
397 | <varname>DEPENDS</varname> won't be sufficient because the | | 397 | <varname>DEPENDS</varname> won't be sufficient because the |
398 | include files and libraries will be hidden from the compiler.</para> | | 398 | include files and libraries will be hidden from the compiler.</para> |
399 | </listitem> | | 399 | </listitem> |
400 | | | 400 | |
401 | <listitem> | | 401 | <listitem> |
402 | <para>If your package needs some executable to be able to run | | 402 | <para>If your package needs some executable to be able to run |
403 | correctly and if there's no | | 403 | correctly and if there's no |
404 | <filename>buildlink3.mk</filename> file, this is specified | | 404 | <filename>buildlink3.mk</filename> file, this is specified |
405 | using the <varname>DEPENDS</varname> variable. The | | 405 | using the <varname>DEPENDS</varname> variable. The |
406 | <filename role="pkg">print/lyx</filename> package needs to | | 406 | <filename role="pkg">print/lyx</filename> package needs to |
407 | be able to execute the latex binary from the teTeX package | | 407 | be able to execute the latex binary from the teTeX package |
408 | when it runs, and that is specified:</para> | | 408 | when it runs, and that is specified:</para> |
409 | | | 409 | |
410 | <programlisting> | | 410 | <programlisting> |
411 | DEPENDS+= teTeX-[0-9]*:../../print/teTeX | | 411 | DEPENDS+= teTeX-[0-9]*:../../print/teTeX |
412 | </programlisting> | | 412 | </programlisting> |
413 | </listitem> | | 413 | </listitem> |
414 | <listitem> | | 414 | <listitem> |
415 | <para>You can use wildcards in package dependencies. Note that | | 415 | <para>You can use wildcards in package dependencies. Note that |
416 | such wildcard dependencies are retained when creating binary | | 416 | such wildcard dependencies are retained when creating binary |
417 | packages. The dependency is checked when installing the binary | | 417 | packages. The dependency is checked when installing the binary |
418 | package and any package which matches the pattern will be | | 418 | package and any package which matches the pattern will be |
419 | used. Wildcard dependencies should be used with care.</para> | | 419 | used. Wildcard dependencies should be used with care.</para> |
420 | | | 420 | |
421 | <para>The <quote>-[0-9]*</quote> should be used instead of | | 421 | <para>The <quote>-[0-9]*</quote> should be used instead of |
422 | <quote>-*</quote> to avoid potentially ambiguous matches | | 422 | <quote>-*</quote> to avoid potentially ambiguous matches |
423 | such as <quote>tk-postgresql</quote> matching a | | 423 | such as <quote>tk-postgresql</quote> matching a |
424 | <quote>tk-*</quote> <varname>DEPENDS</varname>.</para> | | 424 | <quote>tk-*</quote> <varname>DEPENDS</varname>.</para> |
425 | | | 425 | |
426 | <para>Wildcards can also be used to specify that a package | | 426 | <para>Wildcards can also be used to specify that a package |
427 | will only build against a certain minimum version of a | | 427 | will only build against a certain minimum version of a |
428 | pre-requisite:</para> | | 428 | pre-requisite:</para> |
429 | | | 429 | |
430 | <programlisting> | | 430 | <programlisting> |
431 | DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick | | 431 | DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick |
432 | </programlisting> | | 432 | </programlisting> |
433 | | | 433 | |
434 | <para>This means that the package will build using version 6.0 | | 434 | <para>This means that the package will build using version 6.0 |
435 | of ImageMagick or newer. Such a dependency may be warranted | | 435 | of ImageMagick or newer. Such a dependency may be warranted |
436 | if, for example, the command line options of an executable | | 436 | if, for example, the command line options of an executable |
437 | have changed.</para> | | 437 | have changed.</para> |
438 | | | 438 | |
439 | <para>If you need to depend on minimum versions of libraries, | | 439 | <para>If you need to depend on minimum versions of libraries, |
440 | see the buildlink section of the pkgsrc guide.</para> | | 440 | see the buildlink section of the pkgsrc guide.</para> |
441 | | | 441 | |
442 | <para>For security fixes, please update the package | | 442 | <para>For security fixes, please update the package |
443 | vulnerabilities file. See <xref | | 443 | vulnerabilities file. See <xref |
444 | linkend="security-handling"/> for more | | 444 | linkend="security-handling"/> for more |
445 | information.</para> | | 445 | information.</para> |
446 | </listitem> | | 446 | </listitem> |
447 | <listitem> | | 447 | <listitem> |
448 | <para>If the package depends on either one of two (or more) | | 448 | <para>If the package depends on either one of two (or more) |
449 | packages, specify the <quote>pre-req-package-name</quote> as a | | 449 | packages, specify the <quote>pre-req-package-name</quote> as a |
450 | comma-separated list between curly braces.</para> | | 450 | comma-separated list between curly braces.</para> |
451 | | | 451 | |
452 | <para>As an example, take a package that depends on the Perl | | 452 | <para>As an example, take a package that depends on the Perl |
453 | <quote>version</quote> module, which has been part of Perl | | 453 | <quote>version</quote> module, which has been part of Perl |
454 | itself since version 5.10.0. This either/or dependency is | | 454 | itself since version 5.10.0. This either/or dependency is |
455 | expressed as:</para> | | 455 | expressed as:</para> |
456 | | | 456 | |
457 | <programlisting> | | 457 | <programlisting> |
458 | DEPENDS+= {perl>=5.10.0,p5-version-[0-9]*}:../../devel/p5-version | | 458 | DEPENDS+= {perl>=5.10.0,p5-version-[0-9]*}:../../devel/p5-version |
459 | </programlisting> | | 459 | </programlisting> |
460 | </listitem> | | 460 | </listitem> |
461 | </orderedlist> | | 461 | </orderedlist> |
462 | | | 462 | |
463 | <para>If your package needs files from another package to build, | | 463 | <para>If your package needs files from another package to build, |
464 | add the relevant distribution files to | | 464 | add the relevant distribution files to |
465 | <varname>DISTFILES</varname>, so they will be extracted | | 465 | <varname>DISTFILES</varname>, so they will be extracted |
466 | automatically. See the <filename | | 466 | automatically. See the <filename |
467 | role="pkg">print/ghostscript</filename> package for an example. | | 467 | role="pkg">print/ghostscript</filename> package for an example. |
468 | (It relies on the jpeg sources being present in source form | | 468 | (It relies on the jpeg sources being present in source form |
469 | during the build.)</para> | | 469 | during the build.)</para> |
470 | </sect2> | | 470 | </sect2> |
471 | | | 471 | |
472 | | | 472 | |
473 | <sect2 id="conflicts"> | | 473 | <sect2 id="conflicts"> |
474 | <title>Handling conflicts with other packages</title> | | 474 | <title>Handling conflicts with other packages</title> |
475 | | | 475 | |
476 | <para>Your package may conflict with other packages a user might | | 476 | <para>Your package may conflict with other packages a user might |
477 | already have installed on his system, e.g. if your package | | 477 | already have installed on his system, e.g. if your package |
478 | installs the same set of files as another package in the pkgsrc | | 478 | installs the same set of files as another package in the pkgsrc |
479 | tree.</para> | | 479 | tree.</para> |
480 | | | 480 | |
481 | <para>In this case you can set <varname>CONFLICTS</varname> to a | | 481 | <para>In this case you can set <varname>CONFLICTS</varname> to a |
482 | space-separated list of packages (including version string) your | | 482 | space-separated list of packages (including version string) your |
483 | package conflicts with.</para> | | 483 | package conflicts with.</para> |
484 | | | 484 | |
485 | <para>For example, <filename role="pkg">x11/Xaw3d</filename> | | 485 | <para>For example, <filename role="pkg">x11/Xaw3d</filename> |
486 | and <filename role="pkg">x11/Xaw-Xpm</filename> | | 486 | and <filename role="pkg">x11/Xaw-Xpm</filename> |
487 | install the same shared library, thus you set in | | 487 | install the same shared library, thus you set in |
488 | <filename>pkgsrc/x11/Xaw3d/Makefile</filename>:</para> | | 488 | <filename>pkgsrc/x11/Xaw3d/Makefile</filename>:</para> |
489 | | | 489 | |
490 | <programlisting> | | 490 | <programlisting> |
491 | CONFLICTS= Xaw-Xpm-[0-9]* | | 491 | CONFLICTS= Xaw-Xpm-[0-9]* |
492 | </programlisting> | | 492 | </programlisting> |
493 | | | 493 | |
494 | <para>and in <filename>pkgsrc/x11/Xaw-Xpm/Makefile</filename>:</para> | | 494 | <para>and in <filename>pkgsrc/x11/Xaw-Xpm/Makefile</filename>:</para> |
495 | | | 495 | |
496 | <programlisting> | | 496 | <programlisting> |
497 | CONFLICTS= Xaw3d-[0-9]* | | 497 | CONFLICTS= Xaw3d-[0-9]* |
498 | </programlisting> | | 498 | </programlisting> |
499 | | | 499 | |
500 | <para>Packages will automatically conflict with other packages | | 500 | <para>Packages will automatically conflict with other packages |
501 | with the name prefix and a different version | | 501 | with the name prefix and a different version |
502 | string. <quote>Xaw3d-1.5</quote> e.g. will automatically | | 502 | string. <quote>Xaw3d-1.5</quote> e.g. will automatically |
503 | conflict with the older version <quote>Xaw3d-1.3</quote>.</para> | | 503 | conflict with the older version <quote>Xaw3d-1.3</quote>.</para> |
504 | </sect2> | | 504 | </sect2> |
505 | | | 505 | |
506 | | | 506 | |
507 | <sect2 id="not-building-packages"> | | 507 | <sect2 id="not-building-packages"> |
508 | <title>Packages that cannot or should not be built</title> | | 508 | <title>Packages that cannot or should not be built</title> |
509 | | | 509 | |
510 | <para>There are several reasons why a package might be | | 510 | <para>There are several reasons why a package might be |
511 | instructed to not build under certain circumstances. If the | | 511 | instructed to not build under certain circumstances. If the |
512 | package builds and runs on most platforms, the exceptions | | 512 | package builds and runs on most platforms, the exceptions |
513 | should be noted with <varname>NOT_FOR_PLATFORM</varname>. If | | 513 | should be noted with <varname>NOT_FOR_PLATFORM</varname>. If |
514 | the package builds and runs on a small handful of platforms, | | 514 | the package builds and runs on a small handful of platforms, |
515 | set <varname>ONLY_FOR_PLATFORM</varname> instead. | | 515 | set <varname>ONLY_FOR_PLATFORM</varname> instead. |
516 | Both <varname>ONLY_FOR_PLATFORM</varname> and | | 516 | Both <varname>ONLY_FOR_PLATFORM</varname> and |
517 | <varname>NOT_FOR_PLATFORM</varname> are OS triples | | 517 | <varname>NOT_FOR_PLATFORM</varname> are OS triples |
518 | (OS-version-platform) that can use glob-style | | 518 | (OS-version-platform) that can use glob-style |
519 | wildcards.</para> | | 519 | wildcards.</para> |
520 | <para>Some packages are tightly bound to a specific version of an | | 520 | <para>Some packages are tightly bound to a specific version of an |
521 | operating system, e.g. LKMs or <filename | | 521 | operating system, e.g. LKMs or <filename |
522 | role="pkg">sysutils/lsof</filename>. Such binary packages are not | | 522 | role="pkg">sysutils/lsof</filename>. Such binary packages are not |
523 | backwards compatible with other versions of the OS, and should be | | 523 | backwards compatible with other versions of the OS, and should be |
524 | uploaded to a version specific directory on the FTP server. Mark | | 524 | uploaded to a version specific directory on the FTP server. Mark |
525 | these packages by setting <varname>OSVERSION_SPECIFIC</varname> to | | 525 | these packages by setting <varname>OSVERSION_SPECIFIC</varname> to |
526 | <quote>yes</quote>. This variable is not currently used by any of | | 526 | <quote>yes</quote>. This variable is not currently used by any of |
527 | the package system internals, but may be used in the | | 527 | the package system internals, but may be used in the |
528 | future.</para> | | 528 | future.</para> |
529 | <para>If the package should be skipped (for example, because it | | 529 | <para>If the package should be skipped (for example, because it |
530 | provides functionality already provided by the system), set | | 530 | provides functionality already provided by the system), set |
531 | <varname>PKG_SKIP_REASON</varname> to a descriptive message. If | | 531 | <varname>PKG_SKIP_REASON</varname> to a descriptive message. If |
532 | the package should fail because some preconditions are not met, | | 532 | the package should fail because some preconditions are not met, |
533 | set <varname>PKG_FAIL_REASON</varname> to a descriptive | | 533 | set <varname>PKG_FAIL_REASON</varname> to a descriptive |
534 | message.</para> | | 534 | message.</para> |
535 | </sect2> | | 535 | </sect2> |
536 | | | 536 | |
537 | | | 537 | |
538 | <sect2 id="undeletable-packages"> | | 538 | <sect2 id="undeletable-packages"> |
539 | <title>Packages which should not be deleted, once installed</title> | | 539 | <title>Packages which should not be deleted, once installed</title> |
540 | | | 540 | |
541 | <para>To ensure that a package may not be deleted, once it has been | | 541 | <para>To ensure that a package may not be deleted, once it has been |
542 | installed, the <varname>PKG_PRESERVE</varname> definition should | | 542 | installed, the <varname>PKG_PRESERVE</varname> definition should |
543 | be set in the package Makefile. This will be carried into any | | 543 | be set in the package Makefile. This will be carried into any |
544 | binary package that is made from this pkgsrc entry. A | | 544 | binary package that is made from this pkgsrc entry. A |
545 | <quote>preserved</quote> package will | | 545 | <quote>preserved</quote> package will |
546 | not be deleted using &man.pkg.delete.1; unless the | | 546 | not be deleted using &man.pkg.delete.1; unless the |
547 | <quote>-f</quote> option is used.</para> | | 547 | <quote>-f</quote> option is used.</para> |
548 | </sect2> | | 548 | </sect2> |
549 | | | 549 | |
550 | | | 550 | |
551 | <sect2 id="security-handling"> | | 551 | <sect2 id="security-handling"> |
552 | <title>Handling packages with security problems</title> | | 552 | <title>Handling packages with security problems</title> |
553 | | | 553 | |
554 | <para>When a vulnerability is found, this should be noted in | | 554 | <para>When a vulnerability is found, this should be noted in |
555 | <filename>localsrc/security/advisories/pkg-vulnerabilities</filename>, | | 555 | <filename>localsrc/security/advisories/pkg-vulnerabilities</filename>, |
556 | and after committing that file, ask pkgsrc-security@NetBSD.org to | | 556 | and after committing that file, ask pkgsrc-security@NetBSD.org to |
557 | update the file on ftp.NetBSD.org.</para> | | 557 | update the file on ftp.NetBSD.org.</para> |
558 | | | 558 | |
559 | <para>After fixing the vulnerability by a patch, its | | 559 | <para>After fixing the vulnerability by a patch, its |
560 | <varname>PKGREVISION</varname> should be increased (this is of | | 560 | <varname>PKGREVISION</varname> should be increased (this is of |
561 | course not necessary if the problem is fixed by using a newer | | 561 | course not necessary if the problem is fixed by using a newer |
562 | release of the software), and the pattern in the | | 562 | release of the software), and the pattern in the |
563 | pkg-vulnerabilities file must be updated.</para> | | 563 | pkg-vulnerabilities file must be updated.</para> |
564 | | | 564 | |
565 | <para>Also, if the fix should be applied to the stable pkgsrc | | 565 | <para>Also, if the fix should be applied to the stable pkgsrc |
566 | branch, be sure to submit a pullup request!</para> | | 566 | branch, be sure to submit a pullup request!</para> |
567 | | | 567 | |
568 | <para>Binary packages already on ftp.NetBSD.org will be handled | | 568 | <para>Binary packages already on ftp.NetBSD.org will be handled |
569 | semi-automatically by a weekly cron job.</para> | | 569 | semi-automatically by a weekly cron job.</para> |
570 | </sect2> | | 570 | </sect2> |
571 | | | 571 | |
572 | | | 572 | |
573 | <sect2 id="bumping-pkgrevision"> | | 573 | <sect2 id="bumping-pkgrevision"> |
574 | <title>How to handle incrementing versions when fixing an existing package</title> | | 574 | <title>How to handle incrementing versions when fixing an existing package</title> |
575 | | | 575 | |
576 | <para>When making fixes to an existing package it can be useful | | 576 | <para>When making fixes to an existing package it can be useful |
577 | to change the version number in <varname>PKGNAME</varname>. To | | 577 | to change the version number in <varname>PKGNAME</varname>. To |
578 | avoid conflicting with future versions by the original author, a | | 578 | avoid conflicting with future versions by the original author, a |
579 | <quote>nb1</quote>, <quote>nb2</quote>, ... suffix can be used | | 579 | <quote>nb1</quote>, <quote>nb2</quote>, ... suffix can be used |
580 | on package versions by setting <varname>PKGREVISION=1</varname> | | 580 | on package versions by setting <varname>PKGREVISION=1</varname> |
581 | (2, ...). The <quote>nb</quote> is treated like a | | 581 | (2, ...). The <quote>nb</quote> is treated like a |
582 | <quote>.</quote> by the package tools. e.g.</para> | | 582 | <quote>.</quote> by the package tools. e.g.</para> |
583 | | | 583 | |
584 | <programlisting> | | 584 | <programlisting> |
585 | DISTNAME= foo-17.42 | | 585 | DISTNAME= foo-17.42 |
586 | PKGREVISION= 9 | | 586 | PKGREVISION= 9 |
587 | </programlisting> | | 587 | </programlisting> |
588 | | | 588 | |
589 | <para>will result in a <varname>PKGNAME</varname> of | | 589 | <para>will result in a <varname>PKGNAME</varname> of |
590 | <quote>foo-17.42nb9</quote>. If you want to use the original | | 590 | <quote>foo-17.42nb9</quote>. If you want to use the original |
591 | value of <varname>PKGNAME</varname> without the <quote>nbX</quote> | | 591 | value of <varname>PKGNAME</varname> without the <quote>nbX</quote> |
592 | suffix, e.g. for setting <varname>DIST_SUBDIR</varname>, use | | 592 | suffix, e.g. for setting <varname>DIST_SUBDIR</varname>, use |
593 | <varname>PKGNAME_NOREV</varname>.</para> | | 593 | <varname>PKGNAME_NOREV</varname>.</para> |
594 | | | 594 | |
595 | <para>When a new release of the package is released, the | | 595 | <para>When a new release of the package is released, the |
596 | <varname>PKGREVISION</varname> should be removed, e.g. on a new | | 596 | <varname>PKGREVISION</varname> should be removed, e.g. on a new |
597 | minor release of the above package, things should be like:</para> | | 597 | minor release of the above package, things should be like:</para> |
598 | | | 598 | |
599 | <programlisting> | | 599 | <programlisting> |
600 | DISTNAME= foo-17.43 | | 600 | DISTNAME= foo-17.43 |
601 | </programlisting> | | 601 | </programlisting> |
602 | | | 602 | |
603 | <para><varname>PKGREVISION</varname> should be incremented for any | | 603 | <para><varname>PKGREVISION</varname> should be incremented for any |
604 | non-trivial change in the resulting binary package. Without a | | 604 | non-trivial change in the resulting binary package. Without a |
605 | <varname>PKGREVISION</varname> bump, someone with the previous | | 605 | <varname>PKGREVISION</varname> bump, someone with the previous |
606 | version installed has no way of knowing that their package is out | | 606 | version installed has no way of knowing that their package is out |
607 | of date. Thus, changes without increasing | | 607 | of date. Thus, changes without increasing |
608 | <varname>PKGREVISION</varname> are essentially labeled "this is so | | 608 | <varname>PKGREVISION</varname> are essentially labeled "this is so |
609 | trivial that no reasonable person would want to upgrade", and this | | 609 | trivial that no reasonable person would want to upgrade", and this |
610 | is the rough test for when increasing | | 610 | is the rough test for when increasing |
611 | <varname>PKGREVISION</varname> is appropriate. Examples of | | 611 | <varname>PKGREVISION</varname> is appropriate. Examples of |
612 | changes that do not merit increasing | | 612 | changes that do not merit increasing |
613 | <varname>PKGREVISION</varname> are:</para> | | 613 | <varname>PKGREVISION</varname> are:</para> |
614 | | | 614 | |
615 | <itemizedlist><listitem> | | 615 | <itemizedlist><listitem> |
616 | <para>Changing <varname>HOMEPAGE</varname>, | | 616 | <para>Changing <varname>HOMEPAGE</varname>, |
617 | <varname>MAINTAINER</varname>, <varname>OWNER</varname>, | | 617 | <varname>MAINTAINER</varname>, <varname>OWNER</varname>, |
618 | or comments in Makefile.</para></listitem><listitem><para> | | 618 | or comments in Makefile.</para></listitem><listitem><para> |
619 | Changing build variables if the resulting binary package is the same.</para></listitem><listitem><para> | | 619 | Changing build variables if the resulting binary package is the same.</para></listitem><listitem><para> |
620 | Changing <filename>DESCR</filename>.</para></listitem><listitem><para> | | 620 | Changing <filename>DESCR</filename>.</para></listitem><listitem><para> |
621 | Adding <varname>PKG_OPTIONS</varname> if the default options don't change.</para></listitem> | | 621 | Adding <varname>PKG_OPTIONS</varname> if the default options don't change.</para></listitem> |
622 | </itemizedlist> | | 622 | </itemizedlist> |
623 | | | 623 | |
624 | <para>Examples of changes that do merit an increase to | | 624 | <para>Examples of changes that do merit an increase to |
625 | <varname>PKGREVISION</varname> include:</para> | | 625 | <varname>PKGREVISION</varname> include:</para> |
626 | <itemizedlist><listitem><para> | | 626 | <itemizedlist><listitem><para> |
627 | Security fixes</para></listitem><listitem><para> | | 627 | Security fixes</para></listitem><listitem><para> |
628 | Changes or additions to a patch file</para></listitem><listitem><para> | | 628 | Changes or additions to a patch file</para></listitem><listitem><para> |
629 | Changes to the <filename>PLIST</filename></para></listitem> | | 629 | Changes to the <filename>PLIST</filename></para></listitem> |
630 | <listitem><para>A dependency is changed or renamed.</para></listitem> | | 630 | <listitem><para>A dependency is changed or renamed.</para></listitem> |
631 | </itemizedlist> | | 631 | </itemizedlist> |
632 | | | 632 | |
633 | <para>PKGREVISION must also be incremented when dependencies have ABI | | 633 | <para>PKGREVISION must also be incremented when dependencies have ABI |
634 | changes.</para> | | 634 | changes.</para> |
635 | </sect2> | | 635 | </sect2> |
636 | | | 636 | |
637 | <sect2 id="fixes.subst"> | | 637 | <sect2 id="fixes.subst"> |
638 | <title>Substituting variable text in the package files (the SUBST framework)</title> | | 638 | <title>Substituting variable text in the package files (the SUBST framework)</title> |
639 | | | 639 | |
640 | <para>When you want to replace the same text in multiple files | | 640 | <para>When you want to replace the same text in multiple files |
641 | or when the replacement text varies, patches alone cannot help. | | 641 | or when the replacement text varies, patches alone cannot help. |
642 | This is where the SUBST framework comes in. It provides an | | 642 | This is where the SUBST framework comes in. It provides an |
643 | easy-to-use interface for replacing text in files. | | 643 | easy-to-use interface for replacing text in files. |
644 | Example:</para> | | 644 | Example:</para> |
645 | | | 645 | |
646 | <programlisting> | | 646 | <programlisting> |
647 | SUBST_CLASSES+= fix-paths | | 647 | SUBST_CLASSES+= fix-paths |
648 | SUBST_STAGE.fix-paths= pre-configure | | 648 | SUBST_STAGE.fix-paths= pre-configure |
649 | SUBST_MESSAGE.fix-paths= Fixing absolute paths. | | 649 | SUBST_MESSAGE.fix-paths= Fixing absolute paths. |
650 | SUBST_FILES.fix-paths= src/*.c | | 650 | SUBST_FILES.fix-paths= src/*.c |
651 | SUBST_FILES.fix-paths+= scripts/*.sh | | 651 | SUBST_FILES.fix-paths+= scripts/*.sh |
652 | SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' | | 652 | SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' |
653 | SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' | | 653 | SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' |
654 | </programlisting> | | 654 | </programlisting> |
655 | | | 655 | |
656 | <para><varname>SUBST_CLASSES</varname> is a list of identifiers | | 656 | <para><varname>SUBST_CLASSES</varname> is a list of identifiers |
657 | that are used to identify the different SUBST blocks that are | | 657 | that are used to identify the different SUBST blocks that are |
658 | defined. The SUBST framework is heavily used by pkgsrc, so it is | | 658 | defined. The SUBST framework is heavily used by pkgsrc, so it is |
659 | important to always use the <literal>+=</literal> operator with | | 659 | important to always use the <literal>+=</literal> operator with |
660 | this variable. Otherwise some substitutions may be | | 660 | this variable. Otherwise some substitutions may be |
661 | skipped.</para> | | 661 | skipped.</para> |
662 | | | 662 | |
663 | <para>The remaining variables of each SUBST block are | | 663 | <para>The remaining variables of each SUBST block are |
664 | parameterized with the identifier from the first line | | 664 | parameterized with the identifier from the first line |
665 | (<literal>fix-paths</literal> in this case.) They can be seen as | | 665 | (<literal>fix-paths</literal> in this case.) They can be seen as |
666 | parameters to a function call.</para> | | 666 | parameters to a function call.</para> |
667 | | | 667 | |
668 | <para><varname>SUBST_STAGE.*</varname> specifies the stage at | | 668 | <para><varname>SUBST_STAGE.*</varname> specifies the stage at |
669 | which the replacement will take place. All combinations of | | 669 | which the replacement will take place. All combinations of |
670 | <literal>pre-</literal>, <literal>do-</literal> and | | 670 | <literal>pre-</literal>, <literal>do-</literal> and |
671 | <literal>post-</literal> together with a phase name are | | 671 | <literal>post-</literal> together with a phase name are |
672 | possible, though only few are actually used. Most commonly used | | 672 | possible, though only few are actually used. Most commonly used |
673 | are <literal>post-patch</literal> and | | 673 | are <literal>post-patch</literal> and |
674 | <literal>pre-configure</literal>. Of these two, | | 674 | <literal>pre-configure</literal>. Of these two, |
675 | <literal>pre-configure</literal> should be preferred because | | 675 | <literal>pre-configure</literal> should be preferred because |
676 | then it is possible to run <command>bmake patch</command> and | | 676 | then it is possible to run <command>bmake patch</command> and |
677 | have the state after applying the patches but before making any | | 677 | have the state after applying the patches but before making any |
678 | other changes. This is especially useful when you are debugging | | 678 | other changes. This is especially useful when you are debugging |
679 | a package in order to create new patches for it. Similarly, | | 679 | a package in order to create new patches for it. Similarly, |
680 | <literal>post-build</literal> is preferred over | | 680 | <literal>post-build</literal> is preferred over |
681 | <literal>pre-install</literal>, because the install phase should | | 681 | <literal>pre-install</literal>, because the install phase should |
682 | generally be kept as simple as possible. When you use | | 682 | generally be kept as simple as possible. When you use |
683 | <literal>post-build</literal>, you have the same files in the | | 683 | <literal>post-build</literal>, you have the same files in the |
684 | working directory that will be installed later, so you can check | | 684 | working directory that will be installed later, so you can check |
685 | if the substitution has succeeded.</para> | | 685 | if the substitution has succeeded.</para> |
686 | | | 686 | |
687 | <para><varname>SUBST_MESSAGE.*</varname> is an optional text | | 687 | <para><varname>SUBST_MESSAGE.*</varname> is an optional text |
688 | that is printed just before the substitution is done.</para> | | 688 | that is printed just before the substitution is done.</para> |
689 | | | 689 | |
690 | <para><varname>SUBST_FILES.*</varname> is the list of shell | | 690 | <para><varname>SUBST_FILES.*</varname> is the list of shell |
691 | globbing patterns that specifies the files in which the | | 691 | globbing patterns that specifies the files in which the |
692 | substitution will take place. The patterns are interpreted | | 692 | substitution will take place. The patterns are interpreted |
693 | relatively to the <varname>WRKSRC</varname> directory.</para> | | 693 | relatively to the <varname>WRKSRC</varname> directory.</para> |
694 | | | 694 | |
695 | <para><varname>SUBST_SED.*</varname> is a list of arguments to | | 695 | <para><varname>SUBST_SED.*</varname> is a list of arguments to |
696 | &man.sed.1; that specify the actual substitution. Every sed | | 696 | &man.sed.1; that specify the actual substitution. Every sed |
697 | command should be prefixed with <literal>-e</literal>, so that | | 697 | command should be prefixed with <literal>-e</literal>, so that |
698 | all SUBST blocks look uniform.</para> | | 698 | all SUBST blocks look uniform.</para> |
699 | | | 699 | |
700 | <para>There are some more variables, but they are so seldomly | | 700 | <para>There are some more variables, but they are so seldomly |
701 | used that they are only documented in the | | 701 | used that they are only documented in the |
702 | <filename>mk/subst.mk</filename> file.</para> | | 702 | <filename>mk/subst.mk</filename> file.</para> |
703 | | | 703 | |
704 | </sect2> | | 704 | </sect2> |
705 | </sect1> | | 705 | </sect1> |
706 | <sect1 id="fixes.fetch"> | | 706 | <sect1 id="fixes.fetch"> |
707 | <title>Fixing problems in the <emphasis>fetch</emphasis> phase</title> | | 707 | <title>Fixing problems in the <emphasis>fetch</emphasis> phase</title> |
708 | | | 708 | |
709 | <sect2 id="no-plain-download"> | | 709 | <sect2 id="no-plain-download"> |
710 | <title>Packages whose distfiles aren't available for plain downloading</title> | | 710 | <title>Packages whose distfiles aren't available for plain downloading</title> |
711 | | | 711 | |
712 | <para>If you need to download from a dynamic URL you can set | | 712 | <para>If you need to download from a dynamic URL you can set |
713 | <varname>DYNAMIC_MASTER_SITES</varname> and a <command>make | | 713 | <varname>DYNAMIC_MASTER_SITES</varname> and a <command>make |
714 | fetch</command> will call <filename>files/getsite.sh</filename> | | 714 | fetch</command> will call <filename>files/getsite.sh</filename> |
715 | with the name of each file to download as an argument, expecting | | 715 | with the name of each file to download as an argument, expecting |
716 | it to output the URL of the directory from which to download | | 716 | it to output the URL of the directory from which to download |
717 | it. <filename role="pkg">graphics/ns-cult3d</filename> is an | | 717 | it. <filename role="pkg">graphics/ns-cult3d</filename> is an |
718 | example of this usage.</para> | | 718 | example of this usage.</para> |
719 | | | 719 | |
720 | <para>If the download can't be automated, because the user must | | 720 | <para>If the download can't be automated, because the user must |
721 | submit personal information to apply for a password, or must pay | | 721 | submit personal information to apply for a password, or must pay |
722 | for the source, or whatever, you can set | | 722 | for the source, or whatever, you can set |
723 | <varname>FETCH_MESSAGE</varname> to a list of lines that are | | 723 | <varname>FETCH_MESSAGE</varname> to a list of lines that are |
724 | displayed to the user before aborting the build. Example:</para> | | 724 | displayed to the user before aborting the build. Example:</para> |
725 | | | 725 | |
726 | <programlisting> | | 726 | <programlisting> |
727 | FETCH_MESSAGE= "Please download the files" | | 727 | FETCH_MESSAGE= "Please download the files" |
728 | FETCH_MESSAGE+= " "${DISTFILES:Q} | | 728 | FETCH_MESSAGE+= " "${DISTFILES:Q} |
729 | FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." | | 729 | FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." |
730 | </programlisting> | | 730 | </programlisting> |
731 | | | 731 | |
732 | </sect2> | | 732 | </sect2> |
733 | | | 733 | |
734 | | | 734 | |
735 | <sect2 id="modified-distfiles-same-name"> | | 735 | <sect2 id="modified-distfiles-same-name"> |
736 | <title>How to handle modified distfiles with the 'old' name</title> | | 736 | <title>How to handle modified distfiles with the 'old' name</title> |
737 | | | 737 | |
738 | <para>Sometimes authors of a software package make some | | 738 | <para>Sometimes authors of a software package make some |
739 | modifications after the software was released, and they put up a | | 739 | modifications after the software was released, and they put up a |
740 | new distfile without changing the package's version number. If a | | 740 | new distfile without changing the package's version number. If a |
741 | package is already in pkgsrc at that time, the checksum will | | 741 | package is already in pkgsrc at that time, the checksum will |
742 | no longer match. The contents of the new distfile should be | | 742 | no longer match. The contents of the new distfile should be |
743 | compared against the old one before changing anything, to make | | 743 | compared against the old one before changing anything, to make |
744 | sure the distfile was really updated on purpose, and that | | 744 | sure the distfile was really updated on purpose, and that |
745 | no trojan horse or so crept in. | | 745 | no trojan horse or so crept in. |
746 | Please mention that the distfiles were compared and what was found | | 746 | Please mention that the distfiles were compared and what was found |
747 | in your commit message.</para> | | 747 | in your commit message.</para> |
748 | <para>Then, the correct way to work around this is to | | 748 | <para>Then, the correct way to work around this is to |
749 | set <varname>DIST_SUBDIR</varname> to a unique directory name, | | 749 | set <varname>DIST_SUBDIR</varname> to a unique directory name, |
750 | usually based on <varname>PKGNAME_NOREV</varname>. All | | 750 | usually based on <varname>PKGNAME_NOREV</varname>. All |
751 | <varname>DISTFILES</varname> and | | 751 | <varname>DISTFILES</varname> and |
752 | <varname>PATCHFILES</varname> for this package will be put in that | | 752 | <varname>PATCHFILES</varname> for this package will be put in that |
753 | subdirectory of the local distfiles directory. | | 753 | subdirectory of the local distfiles directory. |
754 | (See <xref linkend="bumping-pkgrevision"/> for more details.) | | 754 | (See <xref linkend="bumping-pkgrevision"/> for more details.) |
755 | In case this | | 755 | In case this |
756 | happens more often, <varname>PKGNAME</varname> can be used (thus | | 756 | happens more often, <varname>PKGNAME</varname> can be used (thus |
757 | including the <filename>nbX</filename> suffix) or a date stamp | | 757 | including the <filename>nbX</filename> suffix) or a date stamp |
758 | can be appended, like <varname>${PKGNAME_NOREV}-YYYYMMDD</varname>.</para> | | 758 | can be appended, like <varname>${PKGNAME_NOREV}-YYYYMMDD</varname>.</para> |
759 | <para><varname>DIST_SUBDIR</varname> is also used when a distfile's name does not contain a version and the distfile is apt to change. In cases where the likelihood of this is very small, <varname>DIST_SUBDIR</varname> might not be required. Additionally, <varname>DIST_SUBDIR</varname> must not be removed unless the distfile name changes, even if a package is being moved or renamed.</para> | | 759 | <para><varname>DIST_SUBDIR</varname> is also used when a distfile's name does not contain a version and the distfile is apt to change. In cases where the likelihood of this is very small, <varname>DIST_SUBDIR</varname> might not be required. Additionally, <varname>DIST_SUBDIR</varname> must not be removed unless the distfile name changes, even if a package is being moved or renamed.</para> |
760 | <para>Do not forget regenerating the <filename>distinfo</filename> file | | 760 | <para>Do not forget regenerating the <filename>distinfo</filename> file |
761 | after that, since it contains the <varname>DIST_SUBDIR</varname> | | 761 | after that, since it contains the <varname>DIST_SUBDIR</varname> |
762 | path in the filenames. | | 762 | path in the filenames. |
763 | Also, increase the PKGREVISION if the installed package is different. | | 763 | Also, increase the PKGREVISION if the installed package is different. |
764 | Furthermore, a mail to the package's authors seems appropriate | | 764 | Furthermore, a mail to the package's authors seems appropriate |
765 | telling them that changing distfiles after releases without | | 765 | telling them that changing distfiles after releases without |
766 | changing the file names is not good practice.</para> | | 766 | changing the file names is not good practice.</para> |
767 | </sect2> | | 767 | </sect2> |
768 | </sect1> | | 768 | </sect1> |
769 | | | 769 | |
770 | | | 770 | |
771 | <sect1 id="fixes.configure"> | | 771 | <sect1 id="fixes.configure"> |
772 | <title>Fixing problems in the <emphasis>configure</emphasis> phase</title> | | 772 | <title>Fixing problems in the <emphasis>configure</emphasis> phase</title> |
773 | | | 773 | |
774 | <sect2 id="fixes.libtool"> | | 774 | <sect2 id="fixes.libtool"> |
775 | <title>Shared libraries - libtool</title> | | 775 | <title>Shared libraries - libtool</title> |
776 | | | 776 | |
777 | <para>pkgsrc supports many different machines, with different | | 777 | <para>pkgsrc supports many different machines, with different |
778 | object formats like a.out and ELF, and varying abilities to do | | 778 | object formats like a.out and ELF, and varying abilities to do |
779 | shared library and dynamic loading at all. To accompany this, | | 779 | shared library and dynamic loading at all. To accompany this, |
780 | varying commands and options have to be passed to the | | 780 | varying commands and options have to be passed to the |
781 | compiler, linker, etc. to get the Right Thing, which can be | | 781 | compiler, linker, etc. to get the Right Thing, which can be |
782 | pretty annoying especially if you don't have all the machines | | 782 | pretty annoying especially if you don't have all the machines |
783 | at your hand to test things. The | | 783 | at your hand to test things. The |
784 | <filename role="pkg">devel/libtool</filename> pkg | | 784 | <filename role="pkg">devel/libtool</filename> pkg |
785 | can help here, as it just <quote>knows</quote> how to build | | 785 | can help here, as it just <quote>knows</quote> how to build |
786 | both static and dynamic libraries from a set of source files, | | 786 | both static and dynamic libraries from a set of source files, |
787 | thus being platform-independent.</para> | | 787 | thus being platform-independent.</para> |
788 | | | 788 | |
789 | <para>Here's how to use libtool in a package in seven simple | | 789 | <para>Here's how to use libtool in a package in seven simple |
790 | steps:</para> | | 790 | steps:</para> |
791 | | | 791 | |
792 | <orderedlist> | | 792 | <orderedlist> |
793 | <listitem> | | 793 | <listitem> |
794 | <para>Add <varname>USE_LIBTOOL=yes</varname> to the package | | 794 | <para>Add <varname>USE_LIBTOOL=yes</varname> to the package |
795 | Makefile.</para> | | 795 | Makefile.</para> |
796 | </listitem> | | 796 | </listitem> |
797 | | | 797 | |
798 | <listitem> | | 798 | <listitem> |
799 | <para>For library objects, use <quote>${LIBTOOL} --mode=compile | | 799 | <para>For library objects, use <quote>${LIBTOOL} --mode=compile |
800 | ${CC}</quote> in place of <quote>${CC}</quote>. You could even | | 800 | ${CC}</quote> in place of <quote>${CC}</quote>. You could even |
801 | add it to the definition of <varname>CC</varname>, if only | | 801 | add it to the definition of <varname>CC</varname>, if only |
802 | libraries are being built in a given Makefile. This one command | | 802 | libraries are being built in a given Makefile. This one command |
803 | will build both PIC and non-PIC library objects, so you need not | | 803 | will build both PIC and non-PIC library objects, so you need not |
804 | have separate shared and non-shared library rules.</para> | | 804 | have separate shared and non-shared library rules.</para> |
805 | </listitem> | | 805 | </listitem> |
806 | | | 806 | |
807 | <listitem> | | 807 | <listitem> |
808 | <para>For the linking of the library, remove any | | 808 | <para>For the linking of the library, remove any |
809 | <quote>ar</quote>, <quote>ranlib</quote>, and <quote>ld | | 809 | <quote>ar</quote>, <quote>ranlib</quote>, and <quote>ld |
810 | -Bshareable</quote> commands, and instead use:</para> | | 810 | -Bshareable</quote> commands, and instead use:</para> |
811 | | | 811 | |
812 | <programlisting> | | 812 | <programlisting> |
813 | ${LIBTOOL} --mode=link \ | | 813 | ${LIBTOOL} --mode=link \ |
814 | ${CC} -o ${.TARGET:.a=.la} \ | | 814 | ${CC} -o ${.TARGET:.a=.la} \ |
815 | ${OBJS:.o=.lo} \ | | 815 | ${OBJS:.o=.lo} \ |
816 | -rpath ${PREFIX}/lib \ | | 816 | -rpath ${PREFIX}/lib \ |
817 | -version-info major:minor | | 817 | -version-info major:minor |
818 | </programlisting> | | 818 | </programlisting> |
819 | | | 819 | |
820 | <para>Note that the library is changed to have a | | 820 | <para>Note that the library is changed to have a |
821 | <filename>.la</filename> extension, and the objects are | | 821 | <filename>.la</filename> extension, and the objects are |
822 | changed to have a <filename>.lo</filename> | | 822 | changed to have a <filename>.lo</filename> |
823 | extension. Change <varname>OBJS</varname> as | | 823 | extension. Change <varname>OBJS</varname> as |
824 | necessary. This automatically creates all of the | | 824 | necessary. This automatically creates all of the |
825 | <filename>.a</filename>, | | 825 | <filename>.a</filename>, |
826 | <filename>.so.major.minor</filename>, and ELF symlinks (if | | 826 | <filename>.so.major.minor</filename>, and ELF symlinks (if |
827 | necessary) in the build directory. Be sure to include | | 827 | necessary) in the build directory. Be sure to include |
828 | <quote>-version-info</quote>, especially when major and | | 828 | <quote>-version-info</quote>, especially when major and |
829 | minor are zero, as libtool will otherwise strip off the | | 829 | minor are zero, as libtool will otherwise strip off the |
830 | shared library version.</para> | | 830 | shared library version.</para> |
831 | | | 831 | |
832 | <para>From the libtool manual:</para> | | 832 | <para>From the libtool manual:</para> |
833 | | | 833 | |
834 | <programlisting> | | 834 | <programlisting> |
835 | So, libtool library versions are described by three integers: | | 835 | So, libtool library versions are described by three integers: |
836 | | | 836 | |
837 | CURRENT | | 837 | CURRENT |
838 | The most recent interface number that this library implements. | | 838 | The most recent interface number that this library implements. |
839 | | | 839 | |
840 | REVISION | | 840 | REVISION |
841 | The implementation number of the CURRENT interface. | | 841 | The implementation number of the CURRENT interface. |
842 | | | 842 | |
843 | AGE | | 843 | AGE |
844 | The difference between the newest and oldest interfaces that | | 844 | The difference between the newest and oldest interfaces that |
845 | this library implements. In other words, the library implements | | 845 | this library implements. In other words, the library implements |
846 | all the interface numbers in the range from number `CURRENT - | | 846 | all the interface numbers in the range from number `CURRENT - |
847 | AGE' to `CURRENT'. | | 847 | AGE' to `CURRENT'. |
848 | | | 848 | |
849 | If two libraries have identical CURRENT and AGE numbers, then the | | 849 | If two libraries have identical CURRENT and AGE numbers, then the |
850 | dynamic linker chooses the library with the greater REVISION number. | | 850 | dynamic linker chooses the library with the greater REVISION number. |
851 | </programlisting> | | 851 | </programlisting> |
852 | | | 852 | |
853 | <para>The <quote>-release</quote> option will produce | | 853 | <para>The <quote>-release</quote> option will produce |
854 | different results for a.out and ELF (excluding symlinks) | | 854 | different results for a.out and ELF (excluding symlinks) |
855 | in only one case. An ELF library of the form | | 855 | in only one case. An ELF library of the form |
856 | <quote>libfoo-release.so.<emphasis>x</emphasis>.<emphasis>y</emphasis></quote> | | 856 | <quote>libfoo-release.so.<emphasis>x</emphasis>.<emphasis>y</emphasis></quote> |
857 | will have a symlink of | | 857 | will have a symlink of |
858 | <quote>libfoo.so.<emphasis>x</emphasis>.<emphasis>y</emphasis></quote> | | 858 | <quote>libfoo.so.<emphasis>x</emphasis>.<emphasis>y</emphasis></quote> |
859 | on an a.out platform. This is handled | | 859 | on an a.out platform. This is handled |
860 | automatically.</para> | | 860 | automatically.</para> |
861 | | | 861 | |
862 | <para>The <quote>-rpath argument</quote> is the install | | 862 | <para>The <quote>-rpath argument</quote> is the install |
863 | directory of the library being built.</para> | | 863 | directory of the library being built.</para> |
864 | | | 864 | |
865 | <para>In the <filename>PLIST</filename>, include only the | | 865 | <para>In the <filename>PLIST</filename>, include only the |
866 | <filename>.la</filename> file, the other files will be | | 866 | <filename>.la</filename> file, the other files will be |
867 | added automatically.</para> | | 867 | added automatically.</para> |
868 | </listitem> | | 868 | </listitem> |
869 | | | 869 | |
870 | <listitem> | | 870 | <listitem> |
871 | <para>When linking shared object (<filename>.so</filename>) | | 871 | <para>When linking shared object (<filename>.so</filename>) |
872 | files, i.e. files that are loaded via &man.dlopen.3;, NOT | | 872 | files, i.e. files that are loaded via &man.dlopen.3;, NOT |
873 | shared libraries, use <quote>-module | | 873 | shared libraries, use <quote>-module |
874 | -avoid-version</quote> to prevent them getting version | | 874 | -avoid-version</quote> to prevent them getting version |
875 | tacked on.</para> | | 875 | tacked on.</para> |
876 | | | 876 | |
877 | <para>The <filename>PLIST</filename> file gets the | | 877 | <para>The <filename>PLIST</filename> file gets the |
878 | <filename>foo.so</filename> entry.</para> | | 878 | <filename>foo.so</filename> entry.</para> |
879 | </listitem> | | 879 | </listitem> |
880 | | | 880 | |
881 | <listitem> | | 881 | <listitem> |
882 | <para>When linking programs that depend on these libraries | | 882 | <para>When linking programs that depend on these libraries |
883 | <emphasis>before</emphasis> they are installed, preface | | 883 | <emphasis>before</emphasis> they are installed, preface |
884 | the &man.cc.1; or &man.ld.1; line with <quote>${LIBTOOL} | | 884 | the &man.cc.1; or &man.ld.1; line with <quote>${LIBTOOL} |
885 | --mode=link</quote>, and it will find the correct | | 885 | --mode=link</quote>, and it will find the correct |
886 | libraries (static or shared), but please be aware that | | 886 | libraries (static or shared), but please be aware that |
887 | libtool will not allow you to specify a relative path in | | 887 | libtool will not allow you to specify a relative path in |
888 | -L (such as <quote>-L../somelib</quote>), because it | | 888 | -L (such as <quote>-L../somelib</quote>), because it |
889 | expects you to change that argument to be the | | 889 | expects you to change that argument to be the |
890 | <filename>.la</filename> file. e.g.</para> | | 890 | <filename>.la</filename> file. e.g.</para> |
891 | | | 891 | |
892 | <programlisting> | | 892 | <programlisting> |
893 | ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib | | 893 | ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib |
894 | </programlisting> | | 894 | </programlisting> |
895 | | | 895 | |
896 | <para>should be changed to:</para> | | 896 | <para>should be changed to:</para> |
897 | | | 897 | |
898 | <programlisting> | | 898 | <programlisting> |
899 | ${LIBTOOL} --mode=link ${CC} -o <replaceable>someprog</replaceable> <replaceable>../somelib/somelib.la</replaceable> | | 899 | ${LIBTOOL} --mode=link ${CC} -o <replaceable>someprog</replaceable> <replaceable>../somelib/somelib.la</replaceable> |
900 | </programlisting> | | 900 | </programlisting> |
901 | | | 901 | |
902 | <para>and it will do the right thing with the libraries.</para> | | 902 | <para>and it will do the right thing with the libraries.</para> |
903 | </listitem> | | 903 | </listitem> |
904 | | | 904 | |
905 | <listitem> | | 905 | <listitem> |
906 | <para>When installing libraries, preface the &man.install.1; | | 906 | <para>When installing libraries, preface the &man.install.1; |
907 | or &man.cp.1; command with <quote>${LIBTOOL} | | 907 | or &man.cp.1; command with <quote>${LIBTOOL} |
908 | --mode=install</quote>, and change the library name to | | 908 | --mode=install</quote>, and change the library name to |
909 | <filename>.la</filename>. e.g.</para> | | 909 | <filename>.la</filename>. e.g.</para> |
910 | | | 910 | |
911 | <programlisting> | | 911 | <programlisting> |
912 | ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib | | 912 | ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib |
913 | </programlisting> | | 913 | </programlisting> |
914 | | | 914 | |
915 | <para>This will install the static <filename>.a</filename>, | | 915 | <para>This will install the static <filename>.a</filename>, |
916 | shared library, any needed symlinks, and run | | 916 | shared library, any needed symlinks, and run |
917 | &man.ldconfig.8;.</para> | | 917 | &man.ldconfig.8;.</para> |
918 | </listitem> | | 918 | </listitem> |
919 | | | 919 | |
920 | <listitem> | | 920 | <listitem> |
921 | <para>In your <filename>PLIST</filename>, include only | | 921 | <para>In your <filename>PLIST</filename>, include only |
922 | the <filename>.la</filename> | | 922 | the <filename>.la</filename> |
923 | file (this is a change from previous behaviour).</para> | | 923 | file (this is a change from previous behaviour).</para> |
924 | </listitem> | | 924 | </listitem> |
925 | </orderedlist> | | 925 | </orderedlist> |
926 | </sect2> | | 926 | </sect2> |
927 | | | 927 | |
928 | | | 928 | |
929 | <sect2 id="using-libtool"> | | 929 | <sect2 id="using-libtool"> |
930 | <title>Using libtool on GNU packages that already support libtool</title> | | 930 | <title>Using libtool on GNU packages that already support libtool</title> |
931 | | | 931 | |
932 | <para>Add <varname>USE_LIBTOOL=yes</varname> to the | | 932 | <para>Add <varname>USE_LIBTOOL=yes</varname> to the |
933 | package Makefile. This will override the package's own libtool | | 933 | package Makefile. This will override the package's own libtool |
934 | in most cases. For older libtool using packages, libtool is | | 934 | in most cases. For older libtool using packages, libtool is |
935 | made by ltconfig script during the do-configure step; you can | | 935 | made by ltconfig script during the do-configure step; you can |
936 | check the libtool script location by doing <command>make | | 936 | check the libtool script location by doing <command>make |
937 | configure; find work*/ -name libtool</command>.</para> | | 937 | configure; find work*/ -name libtool</command>.</para> |
938 | | | 938 | |
939 | <para><varname>LIBTOOL_OVERRIDE</varname> specifies which libtool | | 939 | <para><varname>LIBTOOL_OVERRIDE</varname> specifies which libtool |
940 | scripts, relative to <varname>WRKSRC</varname>, to override. By | | 940 | scripts, relative to <varname>WRKSRC</varname>, to override. By |
941 | default, it is set to <quote>libtool */libtool | | 941 | default, it is set to <quote>libtool */libtool |
942 | */*/libtool</quote>. If this does not match the location of the | | 942 | */*/libtool</quote>. If this does not match the location of the |
943 | package's libtool script(s), set it as appropriate.</para> | | 943 | package's libtool script(s), set it as appropriate.</para> |
944 | | | 944 | |
945 | <para>If you do not need <filename>*.a</filename> static | | 945 | <para>If you do not need <filename>*.a</filename> static |
946 | libraries built and installed, then use | | 946 | libraries built and installed, then use |
947 | <varname>SHLIBTOOL_OVERRIDE</varname> instead.</para> | | 947 | <varname>SHLIBTOOL_OVERRIDE</varname> instead.</para> |
948 | | | 948 | |
949 | <para>If your package makes use of the platform-independent library | | 949 | <para>If your package makes use of the platform-independent library |
950 | for loading dynamic shared objects, that comes with libtool | | 950 | for loading dynamic shared objects, that comes with libtool |
951 | (libltdl), you should include devel/libltdl/buildlink3.mk.</para> | | 951 | (libltdl), you should include devel/libltdl/buildlink3.mk.</para> |
952 | | | 952 | |
953 | <para>Some packages use libtool incorrectly so that the package | | 953 | <para>Some packages use libtool incorrectly so that the package |
954 | may not work or build in some circumstances. Some of the more | | 954 | may not work or build in some circumstances. Some of the more |
955 | common errors are:</para> | | 955 | common errors are:</para> |
956 | | | 956 | |
957 | <itemizedlist> | | 957 | <itemizedlist> |
958 | <listitem> | | 958 | <listitem> |
959 | <para>The inclusion of a shared object (-module) as a dependent library in an | | 959 | <para>The inclusion of a shared object (-module) as a dependent library in an |
960 | executable or library. This in itself isn't a problem if one of two things | | 960 | executable or library. This in itself isn't a problem if one of two things |
961 | has been done:</para> | | 961 | has been done:</para> |
962 | | | 962 | |
963 | <orderedlist> | | 963 | <orderedlist> |
964 | <listitem> | | 964 | <listitem> |
965 | <para>The shared object is named correctly, i.e. | | 965 | <para>The shared object is named correctly, i.e. |
966 | <filename>libfoo.la</filename>, not | | 966 | <filename>libfoo.la</filename>, not |
967 | <filename>foo.la</filename></para> | | 967 | <filename>foo.la</filename></para> |
968 | </listitem> | | 968 | </listitem> |
969 | | | 969 | |
970 | <listitem> | | 970 | <listitem> |
971 | <para>The -dlopen option is used when linking an executable.</para> | | 971 | <para>The -dlopen option is used when linking an executable.</para> |
972 | </listitem> | | 972 | </listitem> |
973 | </orderedlist> | | 973 | </orderedlist> |
974 | </listitem> | | 974 | </listitem> |
975 | | | 975 | |
976 | <listitem> | | 976 | <listitem> |
977 | <para>The use of libltdl without the correct calls to initialisation routines. | | 977 | <para>The use of libltdl without the correct calls to initialisation routines. |
978 | The function lt_dlinit() should be called and the macro | | 978 | The function lt_dlinit() should be called and the macro |
979 | <varname>LTDL_SET_PRELOADED_SYMBOLS</varname> included in | | 979 | <varname>LTDL_SET_PRELOADED_SYMBOLS</varname> included in |
980 | executables.</para> | | 980 | executables.</para> |
981 | </listitem> | | 981 | </listitem> |
982 | </itemizedlist> | | 982 | </itemizedlist> |
983 | </sect2> | | 983 | </sect2> |
984 | | | 984 | |
985 | | | 985 | |
986 | <sect2 id="autoconf-automake"> | | 986 | <sect2 id="autoconf-automake"> |
987 | <title>GNU Autoconf/Automake</title> | | 987 | <title>GNU Autoconf/Automake</title> |
988 | | | 988 | |
989 | <para>If a package needs GNU autoconf or automake to be executed | | 989 | <para>If a package needs GNU autoconf or automake to be executed |
990 | to regenerate the configure script and Makefile.in makefile | | 990 | to regenerate the configure script and Makefile.in makefile |
991 | templates, then they should be executed in a pre-configure | | 991 | templates, then they should be executed in a pre-configure |
992 | target.</para> | | 992 | target.</para> |
993 | | | 993 | |
994 | <para>For packages that need only autoconf:</para> | | 994 | <para>For packages that need only autoconf:</para> |
995 | | | 995 | |
996 | <programlisting> | | 996 | <programlisting> |
997 | AUTOCONF_REQD= 2.50 # if default version is not good enough | | 997 | AUTOCONF_REQD= 2.50 # if default version is not good enough |
998 | USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 | | 998 | USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 |
999 | ... | | 999 | ... |
1000 | | | 1000 | |
1001 | pre-configure: | | 1001 | pre-configure: |
1002 | cd ${WRKSRC} && autoconf | | 1002 | cd ${WRKSRC} && autoconf |
1003 | | | 1003 | |
1004 | ... | | 1004 | ... |
1005 | </programlisting> | | 1005 | </programlisting> |
1006 | | | 1006 | |
1007 | <para>and for packages that need automake and autoconf:</para> | | 1007 | <para>and for packages that need automake and autoconf:</para> |
1008 | | | 1008 | |
1009 | <programlisting> | | 1009 | <programlisting> |
1010 | AUTOMAKE_REQD= 1.7.1 # if default version is not good enough | | 1010 | AUTOMAKE_REQD= 1.7.1 # if default version is not good enough |
1011 | USE_TOOLS+= automake # use "automake14" for automake-1.4 | | 1011 | USE_TOOLS+= automake # use "automake14" for automake-1.4 |
1012 | ... | | 1012 | ... |
1013 | | | 1013 | |
1014 | pre-configure: | | 1014 | pre-configure: |
1015 | set -e; cd ${WRKSRC}; \ | | 1015 | set -e; cd ${WRKSRC}; \ |
1016 | aclocal; autoheader; automake -a --foreign -i; autoconf | | 1016 | aclocal; autoheader; automake -a --foreign -i; autoconf |
1017 | | | 1017 | |
1018 | ... | | 1018 | ... |
1019 | </programlisting> | | 1019 | </programlisting> |
1020 | | | 1020 | |
1021 | <para>Packages which use GNU Automake will almost certainly | | 1021 | <para>Packages which use GNU Automake will almost certainly |
1022 | require GNU Make.</para> | | 1022 | require GNU Make.</para> |
1023 | | | 1023 | |
1024 | <para>There are times when the configure process makes | | 1024 | <para>There are times when the configure process makes |
1025 | additional changes to the generated files, which then causes | | 1025 | additional changes to the generated files, which then causes |
1026 | the build process to try to re-execute the automake sequence. | | 1026 | the build process to try to re-execute the automake sequence. |
1027 | This is prevented by touching various files in the configure | | 1027 | This is prevented by touching various files in the configure |
1028 | stage. If this causes problems with your package you can set | | 1028 | stage. If this causes problems with your package you can set |
1029 | <varname>AUTOMAKE_OVERRIDE=NO</varname> in the package | | 1029 | <varname>AUTOMAKE_OVERRIDE=NO</varname> in the package |
1030 | Makefile.</para> | | 1030 | Makefile.</para> |
1031 | </sect2> | | 1031 | </sect2> |
1032 | </sect1> | | 1032 | </sect1> |
1033 | | | 1033 | |
1034 | <sect1 id="programming-languages"> | | 1034 | <sect1 id="programming-languages"> |
1035 | <title>Programming languages</title> | | 1035 | <title>Programming languages</title> |
1036 | | | 1036 | |
1037 | <sect2 id="basic-programming-languages"> | | 1037 | <sect2 id="basic-programming-languages"> |
1038 | <title>C, C++, and Fortran</title> | | 1038 | <title>C, C++, and Fortran</title> |
1039 | | | 1039 | |
1040 | <para>Compilers for the C, C++, and Fortran languages comes with | | 1040 | <para>Compilers for the C, C++, and Fortran languages comes with |
1041 | the NetBSD base system. By default, pkgsrc assumes that a package | | 1041 | the NetBSD base system. By default, pkgsrc assumes that a package |
1042 | is written in C and will hide all other compilers (via the wrapper | | 1042 | is written in C and will hide all other compilers (via the wrapper |
1043 | framework, see <xref linkend="buildlink" />).</para> | | 1043 | framework, see <xref linkend="buildlink" />).</para> |
1044 | | | 1044 | |
1045 | <para>To declare which language's compiler a package needs, set | | 1045 | <para>To declare which language's compiler a package needs, set |
1046 | the <varname>USE_LANGUAGES</varname> variable. Allowed values | | 1046 | the <varname>USE_LANGUAGES</varname> variable. Allowed values |
1047 | currently are <quote>c</quote>, <quote>c++</quote>, and | | 1047 | currently are <quote>c</quote>, <quote>c++</quote>, and |
1048 | <quote>fortran</quote> (and any combination). The default is | | 1048 | <quote>fortran</quote> (and any combination). The default is |
1049 | <quote>c</quote>. Packages using GNU configure scripts, even if | | 1049 | <quote>c</quote>. Packages using GNU configure scripts, even if |
1050 | written in C++, usually need a C compiler for the configure | | 1050 | written in C++, usually need a C compiler for the configure |
1051 | phase.</para> | | 1051 | phase.</para> |
1052 | </sect2> | | 1052 | </sect2> |
1053 | | | 1053 | |
1054 | <sect2 id="java-programming-language"> | | 1054 | <sect2 id="java-programming-language"> |
1055 | <title>Java</title> | | 1055 | <title>Java</title> |
1056 | | | 1056 | |
1057 | <para>If a program is written in Java, use the Java framework in | | 1057 | <para>If a program is written in Java, use the Java framework in |
1058 | pkgsrc. The package must include | | 1058 | pkgsrc. The package must include |
1059 | <filename>../../mk/java-vm.mk</filename>. This Makefile fragment | | 1059 | <filename>../../mk/java-vm.mk</filename>. This Makefile fragment |
1060 | provides the following variables:</para> | | 1060 | provides the following variables:</para> |
1061 | | | 1061 | |
1062 | <itemizedlist> | | 1062 | <itemizedlist> |
1063 | <listitem><para><varname>USE_JAVA</varname> defines if a build | | 1063 | <listitem><para><varname>USE_JAVA</varname> defines if a build |
1064 | dependency on the JDK is added. If | | 1064 | dependency on the JDK is added. If |
1065 | <varname>USE_JAVA</varname> is set to <quote>run</quote>, then | | 1065 | <varname>USE_JAVA</varname> is set to <quote>run</quote>, then |
1066 | there is only a runtime dependency on the JDK. The default is | | 1066 | there is only a runtime dependency on the JDK. The default is |
1067 | <quote>yes</quote>, which also adds a build dependency on the | | 1067 | <quote>yes</quote>, which also adds a build dependency on the |
1068 | JDK.</para></listitem> | | 1068 | JDK.</para></listitem> |
1069 | | | 1069 | |
1070 | <listitem><para>Set <varname>USE_JAVA2</varname> to declare that | | 1070 | <listitem><para>Set <varname>USE_JAVA2</varname> to declare that |
1071 | a package needs a Java2 implementation. The supported values | | 1071 | a package needs a Java2 implementation. The supported values |
1072 | are <quote>yes</quote>, <quote>1.4</quote>, and | | 1072 | are <quote>yes</quote>, <quote>1.4</quote>, and |
1073 | <quote>1.5</quote>. <quote>yes</quote> accepts any Java2 | | 1073 | <quote>1.5</quote>. <quote>yes</quote> accepts any Java2 |
1074 | implementation, <quote>1.4</quote> insists on versions 1.4 or | | 1074 | implementation, <quote>1.4</quote> insists on versions 1.4 or |
1075 | above, and <quote>1.5</quote> only accepts versions 1.5 or | | 1075 | above, and <quote>1.5</quote> only accepts versions 1.5 or |
1076 | above. This variable is not set by default.</para></listitem> | | 1076 | above. This variable is not set by default.</para></listitem> |
1077 | | | 1077 | |
1078 | <listitem><para><varname>PKG_JAVA_HOME</varname> is | | 1078 | <listitem><para><varname>PKG_JAVA_HOME</varname> is |
1079 | automatically set to the runtime location of the used Java | | 1079 | automatically set to the runtime location of the used Java |
1080 | implementation dependency. It may be used to set | | 1080 | implementation dependency. It may be used to set |
1081 | <varname>JAVA_HOME</varname> to a good value if the program | | 1081 | <varname>JAVA_HOME</varname> to a good value if the program |
1082 | needs this variable to be defined. | | 1082 | needs this variable to be defined. |
1083 | </para></listitem> | | 1083 | </para></listitem> |
1084 | <!-- XXX: describe PKG_JVM_DEFAULT and PKG_JVMS_ACCEPTED, but | | 1084 | <!-- XXX: describe PKG_JVM_DEFAULT and PKG_JVMS_ACCEPTED, but |
1085 | not here --> | | 1085 | not here --> |
1086 | </itemizedlist> | | 1086 | </itemizedlist> |
1087 | </sect2> | | 1087 | </sect2> |
1088 | | | 1088 | |
1089 | <sect2 id="perl-scripts"> | | 1089 | <sect2 id="perl-scripts"> |
1090 | <title>Packages containing perl scripts</title> | | 1090 | <title>Packages containing perl scripts</title> |
1091 | | | 1091 | |
1092 | <para>If your package contains interpreted perl scripts, add | | 1092 | <para>If your package contains interpreted perl scripts, add |
1093 | <quote>perl</quote> to the <varname>USE_TOOLS</varname> variable | | 1093 | <quote>perl</quote> to the <varname>USE_TOOLS</varname> variable |
1094 | and set <varname>REPLACE_PERL</varname> to ensure that the proper | | 1094 | and set <varname>REPLACE_PERL</varname> to ensure that the proper |
1095 | interpreter path is set. <varname>REPLACE_PERL</varname> should | | 1095 | interpreter path is set. <varname>REPLACE_PERL</varname> should |
1096 | contain a list of scripts, relative to <varname>WRKSRC</varname>, | | 1096 | contain a list of scripts, relative to <varname>WRKSRC</varname>, |
1097 | that you want adjusted. Every occurrence of | | 1097 | that you want adjusted. Every occurrence of |
1098 | <filename>*/bin/perl</filename> will be replaced with the full | | 1098 | <filename>*/bin/perl</filename> in a she-bang line will be |
1099 | path to the perl executable.</para> | | 1099 | replaced with the full path to the perl executable.</para> |
1100 | | | 1100 | |
1101 | <para>If a particular version of perl is needed, set the | | 1101 | <para>If a particular version of perl is needed, set the |
1102 | <varname>PERL5_REQD</varname> variable to the version number. The | | 1102 | <varname>PERL5_REQD</varname> variable to the version number. The |
1103 | default is <quote>5.0</quote>.</para> | | 1103 | default is <quote>5.0</quote>.</para> |
1104 | | | 1104 | |
1105 | <para>See <xref linkend="perl-modules" /> for information | | 1105 | <para>See <xref linkend="perl-modules" /> for information |
1106 | about handling perl modules.</para> | | 1106 | about handling perl modules.</para> |
1107 | </sect2> | | 1107 | </sect2> |
1108 | | | 1108 | |
1109 | <sect2 id="shell-scripts"> | | 1109 | <sect2 id="shell-scripts"> |
1110 | <title>Packages containing shell scripts</title> | | 1110 | <title>Packages containing shell scripts</title> |
1111 | | | 1111 | |
1112 | <para><varname>REPLACE_SH</varname>, | | 1112 | <para><varname>REPLACE_SH</varname>, |
1113 | <varname>REPLACE_BASH</varname>, <varname>REPLACE_CSH</varname>, | | 1113 | <varname>REPLACE_BASH</varname>, <varname>REPLACE_CSH</varname>, |
1114 | and <varname>REPLACE_KSH</varname> can be used to replace shell | | 1114 | and <varname>REPLACE_KSH</varname> can be used to replace shell |
1115 | hash bangs in files. Please use the appropriate one, prefering | | 1115 | hash bangs in files. Please use the appropriate one, prefering |
1116 | <varname>REPLACE_SH</varname> in case this shell is sufficient. | | 1116 | <varname>REPLACE_SH</varname> in case this shell is sufficient. |
| | | 1117 | Each should contain a list of scripts, relative to |
| | | 1118 | <varname>WRKSRC</varname>, that you want adjusted. Every |
| | | 1119 | occurrence of the matching shell in a she-bang line will be |
| | | 1120 | replaced with the full path to the shell executable. |
1117 | When using <varname>REPLACE_BASH</varname>, don't forget to add | | 1121 | When using <varname>REPLACE_BASH</varname>, don't forget to add |
1118 | <filename>bash</filename> to <varname>USE_TOOLS</varname>.</para> | | 1122 | <filename>bash</filename> to <varname>USE_TOOLS</varname>.</para> |
1119 | </sect2> | | 1123 | </sect2> |
1120 | | | 1124 | |
1121 | <sect2 id="other-programming-languages"> | | 1125 | <sect2 id="other-programming-languages"> |
1122 | <title>Other programming languages</title> | | 1126 | <title>Other programming languages</title> |
1123 | | | 1127 | |
1124 | <para>Currently, there is no special handling for other languages | | 1128 | <para>Currently, there is no special handling for other languages |
1125 | in pkgsrc. If a compiler package provides a | | 1129 | in pkgsrc. If a compiler package provides a |
1126 | <filename>buildlink3.mk</filename> file, include that, otherwise | | 1130 | <filename>buildlink3.mk</filename> file, include that, otherwise |
1127 | just add a (build) dependency on the appropriate compiler | | 1131 | just add a (build) dependency on the appropriate compiler |
1128 | package.</para> | | 1132 | package.</para> |
1129 | </sect2> | | 1133 | </sect2> |
1130 | </sect1> | | 1134 | </sect1> |
1131 | | | 1135 | |
1132 | <sect1 id="fixes.build"> | | 1136 | <sect1 id="fixes.build"> |
1133 | <title>Fixing problems in the <emphasis>build</emphasis> phase</title> | | 1137 | <title>Fixing problems in the <emphasis>build</emphasis> phase</title> |
1134 | | | 1138 | |
1135 | <para>The most common failures when building a package are that | | 1139 | <para>The most common failures when building a package are that |
1136 | some platforms do not provide certain header files, functions or | | 1140 | some platforms do not provide certain header files, functions or |
1137 | libraries, or they provide the functions in a library that the | | 1141 | libraries, or they provide the functions in a library that the |
1138 | original package author didn't know. To work around this, you | | 1142 | original package author didn't know. To work around this, you |
1139 | can rewrite the source code in most cases so that it does not | | 1143 | can rewrite the source code in most cases so that it does not |
1140 | use the missing functions or provides a replacement function.</para> | | 1144 | use the missing functions or provides a replacement function.</para> |
1141 | | | 1145 | |
1142 | <sect2 id="fixes.build.cpp"> | | 1146 | <sect2 id="fixes.build.cpp"> |
1143 | <title>Compiling C and C++ code conditionally</title> | | 1147 | <title>Compiling C and C++ code conditionally</title> |
1144 | | | 1148 | |
1145 | <para>If a package already comes with a GNU configure script, the | | 1149 | <para>If a package already comes with a GNU configure script, the |
1146 | preferred way to fix the build failure is to change the | | 1150 | preferred way to fix the build failure is to change the |
1147 | configure script, not the code. In the other cases, you can | | 1151 | configure script, not the code. In the other cases, you can |
1148 | utilize the C preprocessor, which defines certain macros | | 1152 | utilize the C preprocessor, which defines certain macros |
1149 | depending on the operating system and hardware architecture it | | 1153 | depending on the operating system and hardware architecture it |
1150 | compiles for. These macros can be queried using for example | | 1154 | compiles for. These macros can be queried using for example |
1151 | <varname>#if defined(__i386)</varname>. Almost every operating | | 1155 | <varname>#if defined(__i386)</varname>. Almost every operating |
1152 | system, hardware architecture and compiler has its own macro. | | 1156 | system, hardware architecture and compiler has its own macro. |
1153 | For example, if the macros <varname>__GNUC__</varname>, | | 1157 | For example, if the macros <varname>__GNUC__</varname>, |
1154 | <varname>__i386__</varname> and <varname>__NetBSD__</varname> | | 1158 | <varname>__i386__</varname> and <varname>__NetBSD__</varname> |
1155 | are all defined, you know that you are using NetBSD on an i386 | | 1159 | are all defined, you know that you are using NetBSD on an i386 |
1156 | compatible CPU, and your compiler is GCC.</para> | | 1160 | compatible CPU, and your compiler is GCC.</para> |
1157 | | | 1161 | |
1158 | <para>The list of the following macros for hardware and | | 1162 | <para>The list of the following macros for hardware and |
1159 | operating system depends on the compiler that is used. For | | 1163 | operating system depends on the compiler that is used. For |
1160 | example, if you want to conditionally compile code on Solaris, | | 1164 | example, if you want to conditionally compile code on Solaris, |
1161 | don't use <varname>__sun__</varname>, as the SunPro compiler | | 1165 | don't use <varname>__sun__</varname>, as the SunPro compiler |
1162 | does not define it. Use <varname>__sun</varname> instead.</para> | | 1166 | does not define it. Use <varname>__sun</varname> instead.</para> |
1163 | | | 1167 | |
1164 | <sect3 id="fixes.build.cpp.os"> | | 1168 | <sect3 id="fixes.build.cpp.os"> |
1165 | <title>C preprocessor macros to identify the operating system</title> | | 1169 | <title>C preprocessor macros to identify the operating system</title> |
1166 | | | 1170 | |
1167 | <para>To distinguish between 4.4 BSD-derived systems and the | | 1171 | <para>To distinguish between 4.4 BSD-derived systems and the |
1168 | rest of the world, you should use the following code.</para> | | 1172 | rest of the world, you should use the following code.</para> |
1169 | | | 1173 | |
1170 | <programlisting> | | 1174 | <programlisting> |
1171 | #include <sys/param.h> | | 1175 | #include <sys/param.h> |
1172 | #if (defined(BSD) && BSD >= 199306) | | 1176 | #if (defined(BSD) && BSD >= 199306) |
1173 | /* BSD-specific code goes here */ | | 1177 | /* BSD-specific code goes here */ |
1174 | #else | | 1178 | #else |
1175 | /* non-BSD-specific code goes here */ | | 1179 | /* non-BSD-specific code goes here */ |
1176 | #endif | | 1180 | #endif |
1177 | </programlisting> | | 1181 | </programlisting> |
1178 | | | 1182 | |
1179 | <para>If this distinction is not fine enough, you can also test | | 1183 | <para>If this distinction is not fine enough, you can also test |
1180 | for the following macros.</para> | | 1184 | for the following macros.</para> |
1181 | | | 1185 | |
1182 | <programlisting> | | 1186 | <programlisting> |
1183 | Cygwin __CYGWIN__ | | 1187 | Cygwin __CYGWIN__ |
1184 | DragonFly __DragonFly__ | | 1188 | DragonFly __DragonFly__ |
1185 | FreeBSD __FreeBSD__ | | 1189 | FreeBSD __FreeBSD__ |
1186 | Haiku __HAIKU__ | | 1190 | Haiku __HAIKU__ |
1187 | Interix __INTERIX | | 1191 | Interix __INTERIX |
1188 | IRIX __sgi (TODO: get a definite source for this) | | 1192 | IRIX __sgi (TODO: get a definite source for this) |
1189 | Linux linux, __linux, __linux__ | | 1193 | Linux linux, __linux, __linux__ |
1190 | MirBSD __MirBSD__ (__OpenBSD__ is also defined) | | 1194 | MirBSD __MirBSD__ (__OpenBSD__ is also defined) |
1191 | Minix3 __minix | | 1195 | Minix3 __minix |
1192 | NetBSD __NetBSD__ | | 1196 | NetBSD __NetBSD__ |
1193 | OpenBSD __OpenBSD__ | | 1197 | OpenBSD __OpenBSD__ |
1194 | Solaris sun, __sun | | 1198 | Solaris sun, __sun |
1195 | </programlisting> | | 1199 | </programlisting> |
1196 | | | 1200 | |
1197 | </sect3> | | 1201 | </sect3> |
1198 | <sect3 id="fixes.build.cpp.arch"> | | 1202 | <sect3 id="fixes.build.cpp.arch"> |
1199 | <title>C preprocessor macros to identify the hardware architecture</title> | | 1203 | <title>C preprocessor macros to identify the hardware architecture</title> |
1200 | | | 1204 | |
1201 | <programlisting> | | 1205 | <programlisting> |
1202 | i386 i386, __i386, __i386__ | | 1206 | i386 i386, __i386, __i386__ |
1203 | MIPS __mips | | 1207 | MIPS __mips |
1204 | SPARC sparc, __sparc | | 1208 | SPARC sparc, __sparc |
1205 | </programlisting> | | 1209 | </programlisting> |
1206 | | | 1210 | |
1207 | </sect3> | | 1211 | </sect3> |
1208 | <sect3 id="fixes.build.cpp.compiler"> | | 1212 | <sect3 id="fixes.build.cpp.compiler"> |
1209 | <title>C preprocessor macros to identify the compiler</title> | | 1213 | <title>C preprocessor macros to identify the compiler</title> |
1210 | | | 1214 | |
1211 | <programlisting> | | 1215 | <programlisting> |
1212 | GCC __GNUC__ (major version), __GNUC_MINOR__ | | 1216 | GCC __GNUC__ (major version), __GNUC_MINOR__ |
1213 | MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) | | 1217 | MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) |
1214 | SunPro __SUNPRO_C (0x570 for Sun C 5.7) | | 1218 | SunPro __SUNPRO_C (0x570 for Sun C 5.7) |
1215 | SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) | | 1219 | SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) |
1216 | </programlisting> | | 1220 | </programlisting> |
1217 | | | 1221 | |
1218 | </sect3> | | 1222 | </sect3> |
1219 | </sect2> | | 1223 | </sect2> |
1220 | <sect2 id="compiler-bugs"> | | 1224 | <sect2 id="compiler-bugs"> |
1221 | <title>How to handle compiler bugs</title> | | 1225 | <title>How to handle compiler bugs</title> |
1222 | | | 1226 | |
1223 | <para>Some source files trigger bugs in the compiler, based on | | 1227 | <para>Some source files trigger bugs in the compiler, based on |
1224 | combinations of compiler version and architecture and almost | | 1228 | combinations of compiler version and architecture and almost |
1225 | always relation to optimisation being enabled. Common symptoms | | 1229 | always relation to optimisation being enabled. Common symptoms |
1226 | are gcc internal errors or never finishing compiling a | | 1230 | are gcc internal errors or never finishing compiling a |
1227 | file.</para> | | 1231 | file.</para> |
1228 | | | 1232 | |
1229 | <para>Typically, a workaround involves testing the | | 1233 | <para>Typically, a workaround involves testing the |
1230 | <varname>MACHINE_ARCH</varname> and compiler version, disabling | | 1234 | <varname>MACHINE_ARCH</varname> and compiler version, disabling |
1231 | optimisation for that combination of file, | | 1235 | optimisation for that combination of file, |
1232 | <varname>MACHINE_ARCH</varname> and compiler, and documenting it | | 1236 | <varname>MACHINE_ARCH</varname> and compiler, and documenting it |
1233 | in <filename>pkgsrc/doc/HACKS</filename>. See that file for a | | 1237 | in <filename>pkgsrc/doc/HACKS</filename>. See that file for a |
1234 | number of examples.</para> | | 1238 | number of examples.</para> |
1235 | | | 1239 | |
1236 | </sect2> | | 1240 | </sect2> |
1237 | | | 1241 | |
1238 | <sect2 id="undefined-reference"> | | 1242 | <sect2 id="undefined-reference"> |
1239 | <title>Undefined reference to <quote>...</quote></title> | | 1243 | <title>Undefined reference to <quote>...</quote></title> |
1240 | | | 1244 | |
1241 | <para>This error message often means that a package did not | | 1245 | <para>This error message often means that a package did not |
1242 | link to a shared library it needs. The following functions are | | 1246 | link to a shared library it needs. The following functions are |
1243 | known to cause this error message over and over.</para> | | 1247 | known to cause this error message over and over.</para> |
1244 | | | 1248 | |
1245 | <informaltable id="undefined-reference-functions"> | | 1249 | <informaltable id="undefined-reference-functions"> |
1246 | <tgroup cols="3"> | | 1250 | <tgroup cols="3"> |
1247 | <thead><row><entry>Function</entry><entry>Library</entry><entry>Affected platforms</entry></row></thead> | | 1251 | <thead><row><entry>Function</entry><entry>Library</entry><entry>Affected platforms</entry></row></thead> |
1248 | <tbody> | | 1252 | <tbody> |
1249 | <row><entry>accept, bind, connect</entry><entry>-lsocket</entry><entry>Solaris</entry></row> | | 1253 | <row><entry>accept, bind, connect</entry><entry>-lsocket</entry><entry>Solaris</entry></row> |
1250 | <row><entry>crypt</entry><entry>-lcrypt</entry><entry>DragonFly, NetBSD</entry></row> | | 1254 | <row><entry>crypt</entry><entry>-lcrypt</entry><entry>DragonFly, NetBSD</entry></row> |
1251 | <row><entry>dlopen, dlsym</entry><entry>-ldl</entry><entry>Linux</entry></row> | | 1255 | <row><entry>dlopen, dlsym</entry><entry>-ldl</entry><entry>Linux</entry></row> |
1252 | <row><entry>gethost*</entry><entry>-lnsl</entry><entry>Solaris</entry></row> | | 1256 | <row><entry>gethost*</entry><entry>-lnsl</entry><entry>Solaris</entry></row> |
1253 | <row><entry>inet_aton</entry><entry>-lresolv</entry><entry>Solaris</entry></row> | | 1257 | <row><entry>inet_aton</entry><entry>-lresolv</entry><entry>Solaris</entry></row> |
1254 | <row><entry>nanosleep, sem_*, timer_*</entry><entry>-lrt</entry><entry>Solaris</entry></row> | | 1258 | <row><entry>nanosleep, sem_*, timer_*</entry><entry>-lrt</entry><entry>Solaris</entry></row> |
1255 | <row><entry>openpty</entry><entry>-lutil</entry><entry>Linux</entry></row> | | 1259 | <row><entry>openpty</entry><entry>-lutil</entry><entry>Linux</entry></row> |
1256 | </tbody> | | 1260 | </tbody> |
1257 | </tgroup> | | 1261 | </tgroup> |
1258 | </informaltable> | | 1262 | </informaltable> |
1259 | | | 1263 | |
1260 | <para>To fix these linker errors, it is often sufficient to say | | 1264 | <para>To fix these linker errors, it is often sufficient to say |
1261 | <literal>LIBS.<replaceable>OperatingSystem</replaceable>+= | | 1265 | <literal>LIBS.<replaceable>OperatingSystem</replaceable>+= |
1262 | -l<replaceable>foo</replaceable></literal> to the package | | 1266 | -l<replaceable>foo</replaceable></literal> to the package |
1263 | <filename>Makefile</filename> and then say <command>bmake clean; | | 1267 | <filename>Makefile</filename> and then say <command>bmake clean; |
1264 | bmake</command>.</para> | | 1268 | bmake</command>.</para> |
1265 | | | 1269 | |
1266 | <sect3 id="undefined-reference-sunpro"> | | 1270 | <sect3 id="undefined-reference-sunpro"> |
1267 | <title>Special issue: The SunPro compiler</title> | | 1271 | <title>Special issue: The SunPro compiler</title> |
1268 | | | 1272 | |
1269 | <para>When you are using the SunPro compiler, there is another | | 1273 | <para>When you are using the SunPro compiler, there is another |
1270 | possibility. That compiler cannot handle the following code:</para> | | 1274 | possibility. That compiler cannot handle the following code:</para> |
1271 | | | 1275 | |
1272 | <programlisting> | | 1276 | <programlisting> |
1273 | extern int extern_func(int); | | 1277 | extern int extern_func(int); |
1274 | | | 1278 | |
1275 | static inline int | | 1279 | static inline int |
1276 | inline_func(int x) | | 1280 | inline_func(int x) |
1277 | { | | 1281 | { |
1278 | return extern_func(x); | | 1282 | return extern_func(x); |
1279 | } | | 1283 | } |
1280 | | | 1284 | |
1281 | int main(void) | | 1285 | int main(void) |
1282 | { | | 1286 | { |
1283 | return 0; | | 1287 | return 0; |
1284 | } | | 1288 | } |
1285 | </programlisting> | | 1289 | </programlisting> |
1286 | | | 1290 | |
1287 | <para>It generates the code for <function>inline_func</function> even if | | 1291 | <para>It generates the code for <function>inline_func</function> even if |
1288 | that function is never used. This code then refers to | | 1292 | that function is never used. This code then refers to |
1289 | <function>extern_func</function>, which can usually not be resolved. To | | 1293 | <function>extern_func</function>, which can usually not be resolved. To |
1290 | solve this problem you can try to tell the package to disable inlining | | 1294 | solve this problem you can try to tell the package to disable inlining |
1291 | of functions.</para> | | 1295 | of functions.</para> |
1292 | | | 1296 | |
1293 | </sect3> | | 1297 | </sect3> |
1294 | | | 1298 | |
1295 | </sect2> | | 1299 | </sect2> |
1296 | | | 1300 | |
1297 | <sect2 id="out-of-memory"> | | 1301 | <sect2 id="out-of-memory"> |
1298 | <title>Running out of memory</title> | | 1302 | <title>Running out of memory</title> |
1299 | | | 1303 | |
1300 | <para>Sometimes packages fail to build because the compiler runs | | 1304 | <para>Sometimes packages fail to build because the compiler runs |
1301 | into an operating system specific soft limit. With the | | 1305 | into an operating system specific soft limit. With the |
1302 | <varname>UNLIMIT_RESOURCES</varname> variable pkgsrc can be told | | 1306 | <varname>UNLIMIT_RESOURCES</varname> variable pkgsrc can be told |
1303 | to unlimit the resources. Currently, the allowed values are | | 1307 | to unlimit the resources. Currently, the allowed values are |
1304 | <quote>datasize</quote> and <quote>stacksize</quote> (or both). | | 1308 | <quote>datasize</quote> and <quote>stacksize</quote> (or both). |
1305 | Setting this variable is similar to running the shell builtin | | 1309 | Setting this variable is similar to running the shell builtin |
1306 | <command>ulimit</command> command to raise the maximum data | | 1310 | <command>ulimit</command> command to raise the maximum data |
1307 | segment size or maximum stack size of a process, respectively, to | | 1311 | segment size or maximum stack size of a process, respectively, to |
1308 | their hard limits.</para> | | 1312 | their hard limits.</para> |
1309 | </sect2> | | 1313 | </sect2> |
1310 | </sect1> | | 1314 | </sect1> |
1311 | | | 1315 | |
1312 | <sect1 id="fixes.install"> | | 1316 | <sect1 id="fixes.install"> |
1313 | <title>Fixing problems in the <emphasis>install</emphasis> phase</title> | | 1317 | <title>Fixing problems in the <emphasis>install</emphasis> phase</title> |
1314 | | | 1318 | |
1315 | <sect2 id="install-scripts"> | | 1319 | <sect2 id="install-scripts"> |
1316 | <title>Creating needed directories</title> | | 1320 | <title>Creating needed directories</title> |
1317 | | | 1321 | |
1318 | <para>The BSD-compatible <command>install</command> supplied | | 1322 | <para>The BSD-compatible <command>install</command> supplied |
1319 | with some operating systems cannot create more than one | | 1323 | with some operating systems cannot create more than one |
1320 | directory at a time. As such, you should call | | 1324 | directory at a time. As such, you should call |
1321 | <literal>${INSTALL_*_DIR}</literal> like this:</para> | | 1325 | <literal>${INSTALL_*_DIR}</literal> like this:</para> |
1322 | | | 1326 | |
1323 | <programlisting> | | 1327 | <programlisting> |
1324 | ${INSTALL_DATA_DIR} ${PREFIX}/dir1 | | 1328 | ${INSTALL_DATA_DIR} ${PREFIX}/dir1 |
1325 | ${INSTALL_DATA_DIR} ${PREFIX}/dir2 | | 1329 | ${INSTALL_DATA_DIR} ${PREFIX}/dir2 |
1326 | </programlisting> | | 1330 | </programlisting> |
1327 | | | 1331 | |
1328 | <para>You can also just append <quote><literal>dir1 | | 1332 | <para>You can also just append <quote><literal>dir1 |
1329 | dir2</literal></quote> to the | | 1333 | dir2</literal></quote> to the |
1330 | <varname>INSTALLATION_DIRS</varname> variable, which will | | 1334 | <varname>INSTALLATION_DIRS</varname> variable, which will |
1331 | automatically do the right thing.</para> | | 1335 | automatically do the right thing.</para> |
1332 | | | 1336 | |
1333 | </sect2> | | 1337 | </sect2> |
1334 | <sect2 id="where-to-install-documentation"> | | 1338 | <sect2 id="where-to-install-documentation"> |
1335 | <title>Where to install documentation</title> | | 1339 | <title>Where to install documentation</title> |
1336 | | | 1340 | |
1337 | <para>In general, documentation should be installed into | | 1341 | <para>In general, documentation should be installed into |
1338 | <filename>${PREFIX}/share/doc/${PKGBASE}</filename> or | | 1342 | <filename>${PREFIX}/share/doc/${PKGBASE}</filename> or |
1339 | <filename>${PREFIX}/share/doc/${PKGNAME}</filename> (the latter | | 1343 | <filename>${PREFIX}/share/doc/${PKGNAME}</filename> (the latter |
1340 | includes the version number of the package).</para> | | 1344 | includes the version number of the package).</para> |
1341 | | | 1345 | |
1342 | <para>Many modern packages using GNU autoconf allow to set the | | 1346 | <para>Many modern packages using GNU autoconf allow to set the |
1343 | directory where HTML documentation is installed with the | | 1347 | directory where HTML documentation is installed with the |
1344 | <quote>--with-html-dir</quote> option. Sometimes using this flag | | 1348 | <quote>--with-html-dir</quote> option. Sometimes using this flag |
1345 | is needed because otherwise the documentation ends up in | | 1349 | is needed because otherwise the documentation ends up in |
1346 | <filename>${PREFIX}/share/doc/html</filename> or other | | 1350 | <filename>${PREFIX}/share/doc/html</filename> or other |
1347 | places.</para> | | 1351 | places.</para> |
1348 | | | 1352 | |
1349 | <para>An exception to the above is that library API documentation | | 1353 | <para>An exception to the above is that library API documentation |
1350 | generated with the <filename | | 1354 | generated with the <filename |
1351 | role="pkg">textproc/gtk-doc</filename> tools, for use by special | | 1355 | role="pkg">textproc/gtk-doc</filename> tools, for use by special |
1352 | browsers (devhelp) should be left at their default location, which | | 1356 | browsers (devhelp) should be left at their default location, which |
1353 | is <filename>${PREFIX}/share/gtk-doc</filename>. Such | | 1357 | is <filename>${PREFIX}/share/gtk-doc</filename>. Such |
1354 | documentation can be recognized from files ending in | | 1358 | documentation can be recognized from files ending in |
1355 | <filename>.devhelp</filename> or <filename>.devhelp2</filename>. | | 1359 | <filename>.devhelp</filename> or <filename>.devhelp2</filename>. |
1356 | (It is also acceptable to install such files in | | 1360 | (It is also acceptable to install such files in |
1357 | <filename>${PREFIX}/share/doc/${PKGBASE}</filename> or | | 1361 | <filename>${PREFIX}/share/doc/${PKGBASE}</filename> or |
1358 | <filename>${PREFIX}/share/doc/${PKGNAME}</filename>; the | | 1362 | <filename>${PREFIX}/share/doc/${PKGNAME}</filename>; the |
1359 | <filename>.devhelp*</filename> file must be directly in that | | 1363 | <filename>.devhelp*</filename> file must be directly in that |
1360 | directory then, no additional subdirectory level is allowed in | | 1364 | directory then, no additional subdirectory level is allowed in |
1361 | this case. This is usually achieved by using | | 1365 | this case. This is usually achieved by using |
1362 | <quote>--with-html-dir=${PREFIX}/share/doc</quote>. | | 1366 | <quote>--with-html-dir=${PREFIX}/share/doc</quote>. |
1363 | <filename>${PREFIX}/share/gtk-doc</filename> is preferred | | 1367 | <filename>${PREFIX}/share/gtk-doc</filename> is preferred |
1364 | though.)</para> | | 1368 | though.)</para> |
1365 | | | 1369 | |
1366 | </sect2> | | 1370 | </sect2> |
1367 | | | 1371 | |
1368 | <sect2 id="installing-score-files"> | | 1372 | <sect2 id="installing-score-files"> |
1369 | <title>Installing highscore files</title> | | 1373 | <title>Installing highscore files</title> |
1370 | | | 1374 | |
1371 | <para>Certain packages, most of them in the games category, install | | 1375 | <para>Certain packages, most of them in the games category, install |
1372 | a score file that allows all users on the system to record their | | 1376 | a score file that allows all users on the system to record their |
1373 | highscores. In order for this to work, the binaries need to be | | 1377 | highscores. In order for this to work, the binaries need to be |
1374 | installed setgid and the score files owned by the appropriate | | 1378 | installed setgid and the score files owned by the appropriate |
1375 | group and/or owner (traditionally the "games" user/group). Set | | 1379 | group and/or owner (traditionally the "games" user/group). Set |
1376 | <varname>USE_GAMESGROUP</varname> to yes to support this. The | | 1380 | <varname>USE_GAMESGROUP</varname> to yes to support this. The |
1377 | following variables, documented in more detail in | | 1381 | following variables, documented in more detail in |
1378 | <filename>mk/defaults/mk.conf</filename>, control this | | 1382 | <filename>mk/defaults/mk.conf</filename>, control this |
1379 | behaviour: <varname>GAMEDATAMODE</varname>, | | 1383 | behaviour: <varname>GAMEDATAMODE</varname>, |
1380 | <varname>GAMEDIRMODE</varname>, <varname>GAMES_GROUP</varname>, | | 1384 | <varname>GAMEDIRMODE</varname>, <varname>GAMES_GROUP</varname>, |
1381 | <varname>GAMEMODE</varname>, <varname>GAME_USER</varname>.</para> | | 1385 | <varname>GAMEMODE</varname>, <varname>GAME_USER</varname>.</para> |
1382 | | | 1386 | |
1383 | <para>A package should therefore never hard code file ownership or | | 1387 | <para>A package should therefore never hard code file ownership or |
1384 | access permissions but rely on <varname>INSTALL_GAME</varname> and | | 1388 | access permissions but rely on <varname>INSTALL_GAME</varname> and |
1385 | <varname>INSTALL_GAME_DATA</varname> to set these | | 1389 | <varname>INSTALL_GAME_DATA</varname> to set these |
1386 | correctly.</para> | | 1390 | correctly.</para> |
1387 | </sect2> | | 1391 | </sect2> |
1388 | | | 1392 | |
1389 | <sect2 id="destdir-support"> | | 1393 | <sect2 id="destdir-support"> |
1390 | <title>Adding DESTDIR support to packages</title> | | 1394 | <title>Adding DESTDIR support to packages</title> |
1391 | | | 1395 | |
1392 | <para><varname>DESTDIR</varname> support means that a package | | 1396 | <para><varname>DESTDIR</varname> support means that a package |
1393 | installs into a staging directory, not the final location of the | | 1397 | installs into a staging directory, not the final location of the |
1394 | files. Then a binary package is created which can be used for | | 1398 | files. Then a binary package is created which can be used for |
1395 | installation as usual. There are two ways: Either the package must | | 1399 | installation as usual. There are two ways: Either the package must |
1396 | install as root (<quote>destdir</quote>) or the package can | | 1400 | install as root (<quote>destdir</quote>) or the package can |
1397 | install as non-root user (<quote>user-destdir</quote>).</para> | | 1401 | install as non-root user (<quote>user-destdir</quote>).</para> |
1398 | | | 1402 | |
1399 | <itemizedlist> | | 1403 | <itemizedlist> |
1400 | <listitem><para><varname>PKG_DESTDIR_SUPPORT</varname> has to be | | 1404 | <listitem><para><varname>PKG_DESTDIR_SUPPORT</varname> has to be |
1401 | set to <quote>none</quote>, <quote>destdir</quote>, or | | 1405 | set to <quote>none</quote>, <quote>destdir</quote>, or |
1402 | <quote>user-destdir</quote>. By default <varname>PKG_DESTDIR_SUPPORT</varname> | | 1406 | <quote>user-destdir</quote>. By default <varname>PKG_DESTDIR_SUPPORT</varname> |
1403 | is set to <quote>user-destdir</quote> to help catching more | | 1407 | is set to <quote>user-destdir</quote> to help catching more |
1404 | potential packaging problems. If bsd.prefs.mk is included in the Makefile, | | 1408 | potential packaging problems. If bsd.prefs.mk is included in the Makefile, |
1405 | <varname>PKG_DESTDIR_SUPPORT</varname> needs to be set before | | 1409 | <varname>PKG_DESTDIR_SUPPORT</varname> needs to be set before |
1406 | the inclusion.</para></listitem> | | 1410 | the inclusion.</para></listitem> |
1407 | | | 1411 | |
1408 | <listitem><para>All installation operations have to be prefixed with | | 1412 | <listitem><para>All installation operations have to be prefixed with |
1409 | <filename>${DESTDIR}</filename>.</para></listitem> | | 1413 | <filename>${DESTDIR}</filename>.</para></listitem> |
1410 | | | 1414 | |
1411 | <listitem><para>automake gets this DESTDIR mostly right | | 1415 | <listitem><para>automake gets this DESTDIR mostly right |
1412 | automatically. Many manual rules and pre/post-install often are | | 1416 | automatically. Many manual rules and pre/post-install often are |
1413 | incorrect; fix them.</para></listitem> | | 1417 | incorrect; fix them.</para></listitem> |
1414 | | | 1418 | |
1415 | <listitem><para>If files are installed with special owner/group | | 1419 | <listitem><para>If files are installed with special owner/group |
1416 | use <varname>SPECIAL_PERMS</varname>.</para></listitem> | | 1420 | use <varname>SPECIAL_PERMS</varname>.</para></listitem> |
1417 | | | 1421 | |
1418 | <listitem><para>In general, packages should support | | 1422 | <listitem><para>In general, packages should support |
1419 | <varname>UNPRIVILEGED</varname> to be able to use | | 1423 | <varname>UNPRIVILEGED</varname> to be able to use |
1420 | DESTDIR.</para></listitem> | | 1424 | DESTDIR.</para></listitem> |
1421 | | | 1425 | |
1422 | </itemizedlist> | | 1426 | </itemizedlist> |
1423 | </sect2> | | 1427 | </sect2> |
1424 | | | 1428 | |
1425 | | | 1429 | |
1426 | <sect2 id="hardcoded-paths"> | | 1430 | <sect2 id="hardcoded-paths"> |
1427 | <title>Packages with hardcoded paths to other interpreters</title> | | 1431 | <title>Packages with hardcoded paths to other interpreters</title> |
1428 | | | 1432 | |
1429 | <para>Your package may also contain scripts with hardcoded paths to | | 1433 | <para>Your package may also contain scripts with hardcoded paths to |
1430 | other interpreters besides (or as well as) perl. To correct the | | 1434 | other interpreters besides (or as well as) perl. To correct the |
1431 | full pathname to the script interpreter, you need to set the | | 1435 | full pathname to the script interpreter, you need to set the |
1432 | following definitions in your <filename>Makefile</filename> (we | | 1436 | following definitions in your <filename>Makefile</filename> (we |
1433 | shall use <command>tclsh</command> in this example):</para> | | 1437 | shall use <command>tclsh</command> in this example):</para> |
1434 | | | 1438 | |
1435 | <programlisting> | | 1439 | <programlisting> |
1436 | REPLACE_INTERPRETER+= tcl | | 1440 | REPLACE_INTERPRETER+= tcl |
1437 | REPLACE.tcl.old= .*/bin/tclsh | | 1441 | REPLACE.tcl.old= .*/bin/tclsh |
1438 | REPLACE.tcl.new= ${PREFIX}/bin/tclsh | | 1442 | REPLACE.tcl.new= ${PREFIX}/bin/tclsh |
1439 | REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, | | 1443 | REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, |
1440 | # relative to ${WRKSRC}, just as in REPLACE_PERL | | 1444 | # relative to ${WRKSRC}, just as in REPLACE_PERL |
1441 | </programlisting> | | 1445 | </programlisting> |
1442 | | | 1446 | |
1443 | <note><para>Before March 2006, these variables were called | | 1447 | <note><para>Before March 2006, these variables were called |
1444 | <varname>_REPLACE.*</varname> and | | 1448 | <varname>_REPLACE.*</varname> and |
1445 | <varname>_REPLACE_FILES.*</varname>.</para></note> | | 1449 | <varname>_REPLACE_FILES.*</varname>.</para></note> |
1446 | | | 1450 | |
1447 | </sect2> | | 1451 | </sect2> |
1448 | | | 1452 | |
1449 | | | 1453 | |
1450 | <sect2 id="perl-modules"> | | 1454 | <sect2 id="perl-modules"> |
1451 | <title>Packages installing perl modules</title> | | 1455 | <title>Packages installing perl modules</title> |
1452 | | | 1456 | |
1453 | <para>Makefiles of packages providing perl5 modules should include | | 1457 | <para>Makefiles of packages providing perl5 modules should include |
1454 | the Makefile fragment | | 1458 | the Makefile fragment |
1455 | <filename>../../lang/perl5/module.mk</filename>. It provides a | | 1459 | <filename>../../lang/perl5/module.mk</filename>. It provides a |
1456 | <command>do-configure</command> target for the standard perl | | 1460 | <command>do-configure</command> target for the standard perl |
1457 | configuration for such modules as well as various hooks to tune | | 1461 | configuration for such modules as well as various hooks to tune |
1458 | this configuration. See comments in this file for | | 1462 | this configuration. See comments in this file for |
1459 | details.</para> | | 1463 | details.</para> |
1460 | | | 1464 | |
1461 | <para>Perl5 modules will install into different places depending | | 1465 | <para>Perl5 modules will install into different places depending |
1462 | on the version of perl used during the build process. To | | 1466 | on the version of perl used during the build process. To |
1463 | address this, pkgsrc will append lines to the | | 1467 | address this, pkgsrc will append lines to the |
1464 | <filename>PLIST</filename> corresponding to the files listed in | | 1468 | <filename>PLIST</filename> corresponding to the files listed in |
1465 | the installed <filename>.packlist</filename> file generated by | | 1469 | the installed <filename>.packlist</filename> file generated by |
1466 | most perl5 modules. This is invoked by defining | | 1470 | most perl5 modules. This is invoked by defining |
1467 | <varname>PERL5_PACKLIST</varname> to a space-separated list of | | 1471 | <varname>PERL5_PACKLIST</varname> to a space-separated list of |
1468 | packlist files relative to <varname>PERL5_PACKLIST_DIR</varname> | | 1472 | packlist files relative to <varname>PERL5_PACKLIST_DIR</varname> |
1469 | (<varname>PERL5_INSTALLVENDORARCH</varname> by default), | | 1473 | (<varname>PERL5_INSTALLVENDORARCH</varname> by default), |
1470 | e.g.:</para> | | 1474 | e.g.:</para> |
1471 | | | 1475 | |
1472 | <programlisting> | | 1476 | <programlisting> |
1473 | PERL5_PACKLIST= auto/Pg/.packlist | | 1477 | PERL5_PACKLIST= auto/Pg/.packlist |
1474 | </programlisting> | | 1478 | </programlisting> |
1475 | | | 1479 | |
1476 | <para>The perl5 config variables | | 1480 | <para>The perl5 config variables |
1477 | <varname>installarchlib</varname>, | | 1481 | <varname>installarchlib</varname>, |
1478 | <varname>installscript</varname>, | | 1482 | <varname>installscript</varname>, |
1479 | <varname>installvendorbin</varname>, | | 1483 | <varname>installvendorbin</varname>, |
1480 | <varname>installvendorscript</varname>, | | 1484 | <varname>installvendorscript</varname>, |
1481 | <varname>installvendorarch</varname>, | | 1485 | <varname>installvendorarch</varname>, |
1482 | <varname>installvendorlib</varname>, | | 1486 | <varname>installvendorlib</varname>, |
1483 | <varname>installvendorman1dir</varname>, and | | 1487 | <varname>installvendorman1dir</varname>, and |
1484 | <varname>installvendorman3dir</varname> represent those | | 1488 | <varname>installvendorman3dir</varname> represent those |
1485 | locations in which components of perl5 modules may be installed, | | 1489 | locations in which components of perl5 modules may be installed, |
1486 | provided as variable with uppercase and prefixed with | | 1490 | provided as variable with uppercase and prefixed with |
1487 | <varname>PERL5_</varname>, e.g. <varname>PERL5_INSTALLARCHLIB</varname> | | 1491 | <varname>PERL5_</varname>, e.g. <varname>PERL5_INSTALLARCHLIB</varname> |
1488 | and may be used by perl5 packages that don't have a packlist. | | 1492 | and may be used by perl5 packages that don't have a packlist. |
1489 | These variables are also substituted for in the | | 1493 | These variables are also substituted for in the |
1490 | <filename>PLIST</filename> as uppercase prefixed with | | 1494 | <filename>PLIST</filename> as uppercase prefixed with |
1491 | <varname>PERL5_SUB_</varname>.</para> | | 1495 | <varname>PERL5_SUB_</varname>.</para> |
1492 | </sect2> | | 1496 | </sect2> |
1493 | | | 1497 | |
1494 | | | 1498 | |
1495 | <sect2 id="faq.info-files"> | | 1499 | <sect2 id="faq.info-files"> |
1496 | <title>Packages installing info files</title> | | 1500 | <title>Packages installing info files</title> |
1497 | | | 1501 | |
1498 | <para>Some packages install info files or use the | | 1502 | <para>Some packages install info files or use the |
1499 | <quote>makeinfo</quote> or <quote>install-info</quote> | | 1503 | <quote>makeinfo</quote> or <quote>install-info</quote> |
1500 | commands. <varname>INFO_FILES</varname> should be defined in | | 1504 | commands. <varname>INFO_FILES</varname> should be defined in |
1501 | the package Makefile so that <filename>INSTALL</filename> and | | 1505 | the package Makefile so that <filename>INSTALL</filename> and |
1502 | <filename>DEINSTALL</filename> scripts will be generated to | | 1506 | <filename>DEINSTALL</filename> scripts will be generated to |
1503 | handle registration of the info files in the Info directory | | 1507 | handle registration of the info files in the Info directory |
1504 | file. The <quote>install-info</quote> command used for the info | | 1508 | file. The <quote>install-info</quote> command used for the info |
1505 | files registration is either provided by the system, or by a | | 1509 | files registration is either provided by the system, or by a |
1506 | special purpose package automatically added as dependency if | | 1510 | special purpose package automatically added as dependency if |
1507 | needed.</para> | | 1511 | needed.</para> |
1508 | | | 1512 | |
1509 | <para><varname>PKGINFODIR</varname> is the directory under | | 1513 | <para><varname>PKGINFODIR</varname> is the directory under |
1510 | <filename>${PREFIX}</filename> where info files are primarily | | 1514 | <filename>${PREFIX}</filename> where info files are primarily |
1511 | located. <varname>PKGINFODIR</varname> defaults to | | 1515 | located. <varname>PKGINFODIR</varname> defaults to |
1512 | <quote>info</quote> and can be overridden by the user.</para> | | 1516 | <quote>info</quote> and can be overridden by the user.</para> |
1513 | | | 1517 | |
1514 | <para>The info files for the package should be listed in the | | 1518 | <para>The info files for the package should be listed in the |
1515 | package <filename>PLIST</filename>; however any split info files | | 1519 | package <filename>PLIST</filename>; however any split info files |
1516 | need not be listed.</para> | | 1520 | need not be listed.</para> |
1517 | | | 1521 | |
1518 | <para>A package which needs the <quote>makeinfo</quote> command | | 1522 | <para>A package which needs the <quote>makeinfo</quote> command |
1519 | at build time must add <quote>makeinfo</quote> to | | 1523 | at build time must add <quote>makeinfo</quote> to |
1520 | <varname>USE_TOOLS</varname> in its Makefile. If a minimum | | 1524 | <varname>USE_TOOLS</varname> in its Makefile. If a minimum |
1521 | version of the <quote>makeinfo</quote> command is needed it | | 1525 | version of the <quote>makeinfo</quote> command is needed it |
1522 | should be noted with the <varname>TEXINFO_REQD</varname> | | 1526 | should be noted with the <varname>TEXINFO_REQD</varname> |
1523 | variable in the package <filename>Makefile</filename>. By | | 1527 | variable in the package <filename>Makefile</filename>. By |
1524 | default, a minimum version of 3.12 is required. If the system | | 1528 | default, a minimum version of 3.12 is required. If the system |
1525 | does not provide a <command>makeinfo</command> command or if it | | 1529 | does not provide a <command>makeinfo</command> command or if it |
1526 | does not match the required minimum, a build dependency on the | | 1530 | does not match the required minimum, a build dependency on the |
1527 | <filename role="pkg">devel/gtexinfo</filename> package will | | 1531 | <filename role="pkg">devel/gtexinfo</filename> package will |
1528 | be added automatically.</para> | | 1532 | be added automatically.</para> |
1529 | | | 1533 | |
1530 | <para>The build and installation process of the software provided | | 1534 | <para>The build and installation process of the software provided |
1531 | by the package should not use the | | 1535 | by the package should not use the |
1532 | <command>install-info</command> command as the registration of | | 1536 | <command>install-info</command> command as the registration of |
1533 | info files is the task of the package | | 1537 | info files is the task of the package |
1534 | <filename>INSTALL</filename> script, and it must use the | | 1538 | <filename>INSTALL</filename> script, and it must use the |
1535 | appropriate <command>makeinfo</command> command.</para> | | 1539 | appropriate <command>makeinfo</command> command.</para> |
1536 | | | 1540 | |
1537 | <para>To achieve this goal, the pkgsrc infrastructure creates | | 1541 | <para>To achieve this goal, the pkgsrc infrastructure creates |
1538 | overriding scripts for the <command>install-info</command> and | | 1542 | overriding scripts for the <command>install-info</command> and |
1539 | <command>makeinfo</command> commands in a directory listed early | | 1543 | <command>makeinfo</command> commands in a directory listed early |
1540 | in <varname>PATH</varname>.</para> | | 1544 | in <varname>PATH</varname>.</para> |
1541 | | | 1545 | |
1542 | <para>The script overriding <command>install-info</command> has | | 1546 | <para>The script overriding <command>install-info</command> has |
1543 | no effect except the logging of a message. The script overriding | | 1547 | no effect except the logging of a message. The script overriding |
1544 | <command>makeinfo</command> logs a message and according to the | | 1548 | <command>makeinfo</command> logs a message and according to the |
1545 | value of <varname>TEXINFO_REQD</varname> either runs the appropriate | | 1549 | value of <varname>TEXINFO_REQD</varname> either runs the appropriate |
1546 | <command>makeinfo</command> command or exit on error.</para> | | 1550 | <command>makeinfo</command> command or exit on error.</para> |
1547 | </sect2> | | 1551 | </sect2> |
1548 | | | 1552 | |
1549 | <sect2 id="manpages"> | | 1553 | <sect2 id="manpages"> |
1550 | <title>Packages installing man pages</title> | | 1554 | <title>Packages installing man pages</title> |
1551 | | | 1555 | |
1552 | <para>All packages that install manual pages should install them | | 1556 | <para>All packages that install manual pages should install them |
1553 | into the same directory, so that there is one common place to look | | 1557 | into the same directory, so that there is one common place to look |
1554 | for them. In pkgsrc, this place is | | 1558 | for them. In pkgsrc, this place is |
1555 | <literal>${PREFIX}/${PKGMANDIR}</literal>, and this expression | | 1559 | <literal>${PREFIX}/${PKGMANDIR}</literal>, and this expression |
1556 | should be used in packages. The default for | | 1560 | should be used in packages. The default for |
1557 | <varname>PKGMANDIR</varname> is | | 1561 | <varname>PKGMANDIR</varname> is |
1558 | <quote><filename>man</filename></quote>. Another often-used value | | 1562 | <quote><filename>man</filename></quote>. Another often-used value |
1559 | is <quote><filename>share/man</filename></quote>.</para> | | 1563 | is <quote><filename>share/man</filename></quote>.</para> |
1560 | | | 1564 | |
1561 | <note><para>The support for a custom <varname>PKGMANDIR</varname> | | 1565 | <note><para>The support for a custom <varname>PKGMANDIR</varname> |
1562 | is far from complete.</para></note> | | 1566 | is far from complete.</para></note> |
1563 | | | 1567 | |
1564 | <para>The <filename>PLIST</filename> files can just use | | 1568 | <para>The <filename>PLIST</filename> files can just use |
1565 | <filename>man/</filename> as the top level directory for the man | | 1569 | <filename>man/</filename> as the top level directory for the man |
1566 | page file entries, and the pkgsrc framework will convert as | | 1570 | page file entries, and the pkgsrc framework will convert as |
1567 | needed. In all other places, the correct | | 1571 | needed. In all other places, the correct |
1568 | <varname>PKGMANDIR</varname> must be used.</para> | | 1572 | <varname>PKGMANDIR</varname> must be used.</para> |
1569 | | | 1573 | |
1570 | <para>Packages that are | | 1574 | <para>Packages that are |
1571 | configured with <varname>GNU_CONFIGURE</varname> set as | | 1575 | configured with <varname>GNU_CONFIGURE</varname> set as |
1572 | <quote>yes</quote>, by default will use the | | 1576 | <quote>yes</quote>, by default will use the |
1573 | <filename>./configure</filename> | | 1577 | <filename>./configure</filename> |
1574 | --mandir switch to set where the man pages should be installed. | | 1578 | --mandir switch to set where the man pages should be installed. |
1575 | The path is <varname>GNU_CONFIGURE_MANDIR</varname> which defaults | | 1579 | The path is <varname>GNU_CONFIGURE_MANDIR</varname> which defaults |
1576 | to <varname>${PREFIX}/${PKGMANDIR}</varname>.</para> | | 1580 | to <varname>${PREFIX}/${PKGMANDIR}</varname>.</para> |
1577 | | | 1581 | |
1578 | <para>Packages that use <varname>GNU_CONFIGURE</varname> but do not | | 1582 | <para>Packages that use <varname>GNU_CONFIGURE</varname> but do not |
1579 | use --mandir, can set <varname>CONFIGURE_HAS_MANDIR</varname> | | 1583 | use --mandir, can set <varname>CONFIGURE_HAS_MANDIR</varname> |
1580 | to <quote>no</quote>. | | 1584 | to <quote>no</quote>. |
1581 | Or if the <filename>./configure</filename> script uses | | 1585 | Or if the <filename>./configure</filename> script uses |
1582 | a non-standard use of --mandir, you can set | | 1586 | a non-standard use of --mandir, you can set |
1583 | <varname>GNU_CONFIGURE_MANDIR</varname> as needed.</para> | | 1587 | <varname>GNU_CONFIGURE_MANDIR</varname> as needed.</para> |
1584 | | | 1588 | |
1585 | <para>See <xref linkend="manpage-compression"/> for | | 1589 | <para>See <xref linkend="manpage-compression"/> for |
1586 | information on installation of compressed manual pages.</para> | | 1590 | information on installation of compressed manual pages.</para> |
1587 | | | 1591 | |
1588 | </sect2> | | 1592 | </sect2> |
1589 | | | 1593 | |
1590 | <sect2 id="gconf-data-files"> | | 1594 | <sect2 id="gconf-data-files"> |
1591 | <title>Packages installing GConf data files</title> | | 1595 | <title>Packages installing GConf data files</title> |
1592 | | | 1596 | |
1593 | <para>If a package installs <filename>.schemas</filename> or | | 1597 | <para>If a package installs <filename>.schemas</filename> or |
1594 | <filename>.entries</filename> files, used by GConf, | | 1598 | <filename>.entries</filename> files, used by GConf, |
1595 | you need to take some extra steps to make sure they get registered | | 1599 | you need to take some extra steps to make sure they get registered |
1596 | in the database:</para> | | 1600 | in the database:</para> |
1597 | | | 1601 | |
1598 | <orderedlist> | | 1602 | <orderedlist> |
1599 | <listitem> | | 1603 | <listitem> |
1600 | <para>Include <filename>../../devel/GConf/schemas.mk</filename> | | 1604 | <para>Include <filename>../../devel/GConf/schemas.mk</filename> |
1601 | instead of its <filename>buildlink3.mk</filename> file. This | | 1605 | instead of its <filename>buildlink3.mk</filename> file. This |
1602 | takes care of rebuilding the GConf database at installation and | | 1606 | takes care of rebuilding the GConf database at installation and |
1603 | deinstallation time, and tells the package where to install | | 1607 | deinstallation time, and tells the package where to install |
1604 | GConf data files using some standard configure arguments. It | | 1608 | GConf data files using some standard configure arguments. It |
1605 | also disallows any access to the database directly from the | | 1609 | also disallows any access to the database directly from the |
1606 | package.</para> | | 1610 | package.</para> |
1607 | </listitem> | | 1611 | </listitem> |
1608 | | | 1612 | |
1609 | <listitem> | | 1613 | <listitem> |
1610 | <para>Ensure that the package installs its | | 1614 | <para>Ensure that the package installs its |
1611 | <filename>.schemas</filename> files under | | 1615 | <filename>.schemas</filename> files under |
1612 | <filename>${PREFIX}/share/gconf/schemas</filename>. If they get | | 1616 | <filename>${PREFIX}/share/gconf/schemas</filename>. If they get |
1613 | installed under <filename>${PREFIX}/etc</filename>, you will | | 1617 | installed under <filename>${PREFIX}/etc</filename>, you will |
1614 | need to manually patch the package.</para> | | 1618 | need to manually patch the package.</para> |
1615 | </listitem> | | 1619 | </listitem> |
1616 | | | 1620 | |
1617 | <listitem> | | 1621 | <listitem> |
1618 | <para>Check the PLIST and remove any entries under the etc/gconf | | 1622 | <para>Check the PLIST and remove any entries under the etc/gconf |
1619 | directory, as they will be handled automatically. See | | 1623 | directory, as they will be handled automatically. See |
1620 | <xref linkend="faq.conf"/> for more information.</para> | | 1624 | <xref linkend="faq.conf"/> for more information.</para> |
1621 | </listitem> | | 1625 | </listitem> |
1622 | | | 1626 | |
1623 | <listitem> | | 1627 | <listitem> |
1624 | <para>Define the <varname>GCONF_SCHEMAS</varname> variable in | | 1628 | <para>Define the <varname>GCONF_SCHEMAS</varname> variable in |
1625 | your <filename>Makefile</filename> with a list of all | | 1629 | your <filename>Makefile</filename> with a list of all |
1626 | <filename>.schemas</filename> files installed by the package, if | | 1630 | <filename>.schemas</filename> files installed by the package, if |
1627 | any. Names must not contain any directories in them.</para> | | 1631 | any. Names must not contain any directories in them.</para> |
1628 | </listitem> | | 1632 | </listitem> |
1629 | | | 1633 | |
1630 | <listitem> | | 1634 | <listitem> |
1631 | <para>Define the <varname>GCONF_ENTRIES</varname> variable in | | 1635 | <para>Define the <varname>GCONF_ENTRIES</varname> variable in |
1632 | your <filename>Makefile</filename> with a | | 1636 | your <filename>Makefile</filename> with a |
1633 | list of all <filename>.entries</filename> files installed by the | | 1637 | list of all <filename>.entries</filename> files installed by the |
1634 | package, if any. Names must not contain any directories in | | 1638 | package, if any. Names must not contain any directories in |
1635 | them.</para> | | 1639 | them.</para> |
1636 | </listitem> | | 1640 | </listitem> |
1637 | </orderedlist> | | 1641 | </orderedlist> |
1638 | </sect2> | | 1642 | </sect2> |
1639 | | | 1643 | |
1640 | | | 1644 | |
1641 | <sect2 id="scrollkeeper-data-files"> | | 1645 | <sect2 id="scrollkeeper-data-files"> |
1642 | <title>Packages installing scrollkeeper/rarian data files</title> | | 1646 | <title>Packages installing scrollkeeper/rarian data files</title> |
1643 | | | 1647 | |
1644 | <para>If a package installs <filename>.omf</filename> files, used by | | 1648 | <para>If a package installs <filename>.omf</filename> files, used by |
1645 | scrollkeeper/rarian, you need to take some extra steps to make sure they | | 1649 | scrollkeeper/rarian, you need to take some extra steps to make sure they |
1646 | get registered in the database:</para> | | 1650 | get registered in the database:</para> |
1647 | | | 1651 | |
1648 | <orderedlist> | | 1652 | <orderedlist> |
1649 | <listitem> | | 1653 | <listitem> |
1650 | <para>Include | | 1654 | <para>Include |
1651 | <filename>../../mk/omf-scrollkeeper.mk</filename> | | 1655 | <filename>../../mk/omf-scrollkeeper.mk</filename> |
1652 | instead of rarian's <filename>buildlink3.mk</filename> file. This | | 1656 | instead of rarian's <filename>buildlink3.mk</filename> file. This |
1653 | takes care of rebuilding the scrollkeeper database at | | 1657 | takes care of rebuilding the scrollkeeper database at |
1654 | installation and deinstallation time, and disallows any access | | 1658 | installation and deinstallation time, and disallows any access |
1655 | to it directly from the package.</para> | | 1659 | to it directly from the package.</para> |
1656 | </listitem> | | 1660 | </listitem> |
1657 | | | 1661 | |
1658 | <listitem> | | 1662 | <listitem> |
1659 | <para>Check the PLIST and remove any entries under the | | 1663 | <para>Check the PLIST and remove any entries under the |
1660 | <filename>libdata/scrollkeeper</filename> directory, as they | | 1664 | <filename>libdata/scrollkeeper</filename> directory, as they |
1661 | will be handled automatically.</para> | | 1665 | will be handled automatically.</para> |
1662 | </listitem> | | 1666 | </listitem> |
1663 | | | 1667 | |
1664 | <listitem> | | 1668 | <listitem> |
1665 | <para>Remove the <filename>share/omf</filename> directory from | | 1669 | <para>Remove the <filename>share/omf</filename> directory from |
1666 | the PLIST. It will be handled by rarian. (<command>make | | 1670 | the PLIST. It will be handled by rarian. (<command>make |
1667 | print-PLIST</command> does this automatically.)</para> | | 1671 | print-PLIST</command> does this automatically.)</para> |
1668 | </listitem> | | 1672 | </listitem> |
1669 | </orderedlist> | | 1673 | </orderedlist> |
1670 | </sect2> | | 1674 | </sect2> |
1671 | | | 1675 | |
1672 | | | 1676 | |
1673 | <sect2 id="x11-fonts"> | | 1677 | <sect2 id="x11-fonts"> |
1674 | <title>Packages installing X11 fonts</title> | | 1678 | <title>Packages installing X11 fonts</title> |
1675 | | | 1679 | |
1676 | <para>If a package installs font files, you will need to rebuild | | 1680 | <para>If a package installs font files, you will need to rebuild |
1677 | the fonts database in the directory where they get installed at | | 1681 | the fonts database in the directory where they get installed at |
1678 | installation and deinstallation time. This can be automatically | | 1682 | installation and deinstallation time. This can be automatically |
1679 | done by using the pkginstall framework.</para> | | 1683 | done by using the pkginstall framework.</para> |
1680 | | | 1684 | |
1681 | <para>You can list the directories where fonts are installed in the | | 1685 | <para>You can list the directories where fonts are installed in the |
1682 | <varname>FONTS_DIRS.<replaceable>type</replaceable></varname> | | 1686 | <varname>FONTS_DIRS.<replaceable>type</replaceable></varname> |
1683 | variables, where <replaceable>type</replaceable> can be one of | | 1687 | variables, where <replaceable>type</replaceable> can be one of |
1684 | <quote>ttf</quote>, <quote>type1</quote> or <quote>x11</quote>. | | 1688 | <quote>ttf</quote>, <quote>type1</quote> or <quote>x11</quote>. |
1685 | Also make sure that the database file | | 1689 | Also make sure that the database file |
1686 | <filename>fonts.dir</filename> is not listed in the PLIST.</para> | | 1690 | <filename>fonts.dir</filename> is not listed in the PLIST.</para> |
1687 | | | 1691 | |
1688 | <para>Note that you should not create new directories for fonts; | | 1692 | <para>Note that you should not create new directories for fonts; |
1689 | instead use the standard ones to avoid that the user needs to | | 1693 | instead use the standard ones to avoid that the user needs to |
1690 | manually configure his X server to find them.</para> | | 1694 | manually configure his X server to find them.</para> |
1691 | </sect2> | | 1695 | </sect2> |
1692 | | | 1696 | |
1693 | | | 1697 | |
1694 | <sect2 id="gtk2-modules"> | | 1698 | <sect2 id="gtk2-modules"> |
1695 | <title>Packages installing GTK2 modules</title> | | 1699 | <title>Packages installing GTK2 modules</title> |
1696 | | | 1700 | |
1697 | <para>If a package installs GTK2 immodules or loaders, you need to | | 1701 | <para>If a package installs GTK2 immodules or loaders, you need to |
1698 | take some extra steps to get them registered in the GTK2 database | | 1702 | take some extra steps to get them registered in the GTK2 database |
1699 | properly:</para> | | 1703 | properly:</para> |
1700 | | | 1704 | |
1701 | <orderedlist> | | 1705 | <orderedlist> |
1702 | <listitem><para>Include | | 1706 | <listitem><para>Include |
1703 | <filename>../../x11/gtk2/modules.mk</filename> instead of its | | 1707 | <filename>../../x11/gtk2/modules.mk</filename> instead of its |
1704 | <filename>buildlink3.mk</filename> file. This takes care of | | 1708 | <filename>buildlink3.mk</filename> file. This takes care of |
1705 | rebuilding the database at installation and deinstallation time.</para> | | 1709 | rebuilding the database at installation and deinstallation time.</para> |
1706 | </listitem> | | 1710 | </listitem> |
1707 | | | 1711 | |
1708 | <listitem><para>Set <varname>GTK2_IMMODULES=YES</varname> if | | 1712 | <listitem><para>Set <varname>GTK2_IMMODULES=YES</varname> if |
1709 | your package installs GTK2 immodules.</para> | | 1713 | your package installs GTK2 immodules.</para> |
1710 | </listitem> | | 1714 | </listitem> |
1711 | | | 1715 | |
1712 | <listitem><para>Set <varname>GTK2_LOADERS=YES</varname> if your package installs | | 1716 | <listitem><para>Set <varname>GTK2_LOADERS=YES</varname> if your package installs |
1713 | GTK2 loaders.</para> | | 1717 | GTK2 loaders.</para> |
1714 | </listitem> | | 1718 | </listitem> |
1715 | | | 1719 | |
1716 | <listitem><para>Patch the package to not touch any of the GTK2 | | 1720 | <listitem><para>Patch the package to not touch any of the GTK2 |
1717 | databases directly. These are:</para> | | 1721 | databases directly. These are:</para> |
1718 | | | 1722 | |
1719 | <itemizedlist> | | 1723 | <itemizedlist> |
1720 | <listitem><para><filename>libdata/gtk-2.0/gdk-pixbuf.loaders</filename></para></listitem> | | 1724 | <listitem><para><filename>libdata/gtk-2.0/gdk-pixbuf.loaders</filename></para></listitem> |
1721 | <listitem><para><filename>libdata/gtk-2.0/gtk.immodules</filename></para></listitem> | | 1725 | <listitem><para><filename>libdata/gtk-2.0/gtk.immodules</filename></para></listitem> |
1722 | </itemizedlist> | | 1726 | </itemizedlist> |
1723 | | | 1727 | |
1724 | </listitem> | | 1728 | </listitem> |
1725 | | | 1729 | |
1726 | <listitem><para>Check the <filename>PLIST</filename> and remove | | 1730 | <listitem><para>Check the <filename>PLIST</filename> and remove |
1727 | any entries under the <filename>libdata/gtk-2.0</filename> | | 1731 | any entries under the <filename>libdata/gtk-2.0</filename> |
1728 | directory, as they will be handled automatically.</para> | | 1732 | directory, as they will be handled automatically.</para> |
1729 | </listitem> | | 1733 | </listitem> |
1730 | </orderedlist> | | 1734 | </orderedlist> |
1731 | </sect2> | | 1735 | </sect2> |
1732 | | | 1736 | |
1733 | | | 1737 | |
1734 | <sect2 id="sgml-xml-data"> | | 1738 | <sect2 id="sgml-xml-data"> |
1735 | <title>Packages installing SGML or XML data</title> | | 1739 | <title>Packages installing SGML or XML data</title> |
1736 | | | 1740 | |
1737 | <para>If a package installs SGML or XML data files that need to be | | 1741 | <para>If a package installs SGML or XML data files that need to be |
1738 | registered in system-wide catalogs (like DTDs, sub-catalogs, | | 1742 | registered in system-wide catalogs (like DTDs, sub-catalogs, |
1739 | etc.), you need to take some extra steps:</para> | | 1743 | etc.), you need to take some extra steps:</para> |
1740 | | | 1744 | |
1741 | <orderedlist> | | 1745 | <orderedlist> |
1742 | <listitem> | | 1746 | <listitem> |
1743 | <para>Include | | 1747 | <para>Include |
1744 | <filename>../../textproc/xmlcatmgr/catalogs.mk</filename> in | | 1748 | <filename>../../textproc/xmlcatmgr/catalogs.mk</filename> in |
1745 | your <filename>Makefile</filename>, which takes care of | | 1749 | your <filename>Makefile</filename>, which takes care of |
1746 | registering those files in system-wide catalogs at | | 1750 | registering those files in system-wide catalogs at |
1747 | installation and deinstallation time.</para> | | 1751 | installation and deinstallation time.</para> |
1748 | </listitem> | | 1752 | </listitem> |
1749 | | | 1753 | |
1750 | <listitem> | | 1754 | <listitem> |
1751 | <para>Set <varname>SGML_CATALOGS</varname> to the full path of | | 1755 | <para>Set <varname>SGML_CATALOGS</varname> to the full path of |
1752 | any SGML catalogs installed by the package.</para> | | 1756 | any SGML catalogs installed by the package.</para> |
1753 | </listitem> | | 1757 | </listitem> |
1754 | | | 1758 | |
1755 | <listitem> | | 1759 | <listitem> |
1756 | <para>Set <varname>XML_CATALOGS</varname> to the full path of | | 1760 | <para>Set <varname>XML_CATALOGS</varname> to the full path of |
1757 | any XML catalogs installed by the package.</para> | | 1761 | any XML catalogs installed by the package.</para> |
1758 | </listitem> | | 1762 | </listitem> |
1759 | | | 1763 | |
1760 | <listitem> | | 1764 | <listitem> |
1761 | <para>Set <varname>SGML_ENTRIES</varname> to individual entries | | 1765 | <para>Set <varname>SGML_ENTRIES</varname> to individual entries |
1762 | to be added to the SGML catalog. These come in groups of | | 1766 | to be added to the SGML catalog. These come in groups of |
1763 | three strings; see xmlcatmgr(1) for more information | | 1767 | three strings; see xmlcatmgr(1) for more information |
1764 | (specifically, arguments recognized by the 'add' action). | | 1768 | (specifically, arguments recognized by the 'add' action). |
1765 | Note that you will normally not use this variable.</para> | | 1769 | Note that you will normally not use this variable.</para> |
1766 | </listitem> | | 1770 | </listitem> |
1767 | | | 1771 | |
1768 | <listitem> | | 1772 | <listitem> |
1769 | <para>Set <varname>XML_ENTRIES</varname> to individual entries | | 1773 | <para>Set <varname>XML_ENTRIES</varname> to individual entries |
1770 | to be added to the XML catalog. These come in groups of three | | 1774 | to be added to the XML catalog. These come in groups of three |
1771 | strings; see xmlcatmgr(1) for more information (specifically, | | 1775 | strings; see xmlcatmgr(1) for more information (specifically, |
1772 | arguments recognized by the 'add' action). Note that you will | | 1776 | arguments recognized by the 'add' action). Note that you will |
1773 | normally not use this variable.</para> | | 1777 | normally not use this variable.</para> |
1774 | </listitem> | | 1778 | </listitem> |
1775 | </orderedlist> | | 1779 | </orderedlist> |
1776 | </sect2> | | 1780 | </sect2> |
1777 | | | 1781 | |
1778 | | | 1782 | |
1779 | <sect2 id="mime-database"> | | 1783 | <sect2 id="mime-database"> |
1780 | <title>Packages installing extensions to the MIME database</title> | | 1784 | <title>Packages installing extensions to the MIME database</title> |
1781 | | | 1785 | |
1782 | <para>If a package provides extensions to the MIME database by | | 1786 | <para>If a package provides extensions to the MIME database by |
1783 | installing <filename>.xml</filename> files inside | | 1787 | installing <filename>.xml</filename> files inside |
1784 | <filename>${PREFIX}/share/mime/packages</filename>, you | | 1788 | <filename>${PREFIX}/share/mime/packages</filename>, you |
1785 | need to take some extra steps to ensure that the database is kept | | 1789 | need to take some extra steps to ensure that the database is kept |
1786 | consistent with respect to these new files:</para> | | 1790 | consistent with respect to these new files:</para> |
1787 | | | 1791 | |
1788 | <orderedlist> | | 1792 | <orderedlist> |
1789 | <listitem> | | 1793 | <listitem> |
1790 | <para>Include | | 1794 | <para>Include |
1791 | <filename>../../databases/shared-mime-info/mimedb.mk</filename> | | 1795 | <filename>../../databases/shared-mime-info/mimedb.mk</filename> |
1792 | (avoid using the <filename>buildlink3.mk</filename> file from | | 1796 | (avoid using the <filename>buildlink3.mk</filename> file from |
1793 | this same directory, which is reserved for inclusion from | | 1797 | this same directory, which is reserved for inclusion from |
1794 | other <filename>buildlink3.mk</filename> files). It takes | | 1798 | other <filename>buildlink3.mk</filename> files). It takes |
1795 | care of rebuilding the MIME database at installation and | | 1799 | care of rebuilding the MIME database at installation and |
1796 | deinstallation time, and disallows any access to it directly | | 1800 | deinstallation time, and disallows any access to it directly |
1797 | from the package.</para> | | 1801 | from the package.</para> |
1798 | </listitem> | | 1802 | </listitem> |
1799 | | | 1803 | |
1800 | <listitem> | | 1804 | <listitem> |
1801 | <para>Check the PLIST and remove any entries under the | | 1805 | <para>Check the PLIST and remove any entries under the |
1802 | <filename>share/mime</filename> directory, | | 1806 | <filename>share/mime</filename> directory, |
1803 | <emphasis>except</emphasis> for files saved under | | 1807 | <emphasis>except</emphasis> for files saved under |
1804 | <filename>share/mime/packages</filename>. The former are | | 1808 | <filename>share/mime/packages</filename>. The former are |
1805 | handled automatically by | | 1809 | handled automatically by |
1806 | the update-mime-database program, but the latter are | | 1810 | the update-mime-database program, but the latter are |
1807 | package-dependent and must be removed by the package that | | 1811 | package-dependent and must be removed by the package that |
1808 | installed them in the first place.</para> | | 1812 | installed them in the first place.</para> |
1809 | </listitem> | | 1813 | </listitem> |
1810 | | | 1814 | |
1811 | <listitem> | | 1815 | <listitem> |
1812 | <para>Remove any <filename>share/mime/*</filename> directories | | 1816 | <para>Remove any <filename>share/mime/*</filename> directories |
1813 | from the PLIST. They will be handled by the shared-mime-info | | 1817 | from the PLIST. They will be handled by the shared-mime-info |
1814 | package.</para> | | 1818 | package.</para> |
1815 | </listitem> | | 1819 | </listitem> |
1816 | </orderedlist> | | 1820 | </orderedlist> |
1817 | </sect2> | | 1821 | </sect2> |
1818 | | | 1822 | |
1819 | | | 1823 | |
1820 | <sect2 id="intltool"> | | 1824 | <sect2 id="intltool"> |
1821 | <title>Packages using intltool</title> | | 1825 | <title>Packages using intltool</title> |
1822 | | | 1826 | |
1823 | <para>If a package uses intltool during its build, add | | 1827 | <para>If a package uses intltool during its build, add |
1824 | <literal>intltool</literal> to the <varname>USE_TOOLS</varname>, | | 1828 | <literal>intltool</literal> to the <varname>USE_TOOLS</varname>, |
1825 | which forces it to use the intltool package provided by pkgsrc, | | 1829 | which forces it to use the intltool package provided by pkgsrc, |
1826 | instead of the one bundled with the distribution file.</para> | | 1830 | instead of the one bundled with the distribution file.</para> |
1827 | | | 1831 | |
1828 | <para>This tracks intltool's build-time dependencies and uses the | | 1832 | <para>This tracks intltool's build-time dependencies and uses the |
1829 | latest available version; this way, the package benefits of any | | 1833 | latest available version; this way, the package benefits of any |
1830 | bug fixes that may have appeared since it was released.</para> | | 1834 | bug fixes that may have appeared since it was released.</para> |
1831 | </sect2> | | 1835 | </sect2> |
1832 | | | 1836 | |
1833 | | | 1837 | |
1834 | <sect2 id="startup-scripts"> | | 1838 | <sect2 id="startup-scripts"> |
1835 | <title>Packages installing startup scripts</title> | | 1839 | <title>Packages installing startup scripts</title> |
1836 | <para>If a package contains a rc.d script, it won't be copied into | | 1840 | <para>If a package contains a rc.d script, it won't be copied into |
1837 | the startup directory by default, but you can enable it, by adding | | 1841 | the startup directory by default, but you can enable it, by adding |
1838 | the option <varname>PKG_RCD_SCRIPTS=YES</varname> in | | 1842 | the option <varname>PKG_RCD_SCRIPTS=YES</varname> in |
1839 | &mk.conf;. This option will copy the scripts | | 1843 | &mk.conf;. This option will copy the scripts |
1840 | into <filename>/etc/rc.d</filename> when a package is installed, and | | 1844 | into <filename>/etc/rc.d</filename> when a package is installed, and |
1841 | it will automatically remove the scripts when the package is | | 1845 | it will automatically remove the scripts when the package is |
1842 | deinstalled.</para> | | 1846 | deinstalled.</para> |
1843 | </sect2> | | 1847 | </sect2> |
1844 | | | 1848 | |
1845 | <sect2 id="tex-packages"> | | 1849 | <sect2 id="tex-packages"> |
1846 | <title>Packages installing TeX modules</title> | | 1850 | <title>Packages installing TeX modules</title> |
1847 | | | 1851 | |
1848 | <para>If a package installs TeX packages into the texmf tree, | | 1852 | <para>If a package installs TeX packages into the texmf tree, |
1849 | the <filename>ls-R</filename> database of the tree needs to be | | 1853 | the <filename>ls-R</filename> database of the tree needs to be |
1850 | updated.</para> | | 1854 | updated.</para> |
1851 | <note><para>Except the main TeX packages such as kpathsea, | | 1855 | <note><para>Except the main TeX packages such as kpathsea, |
1852 | packages should install files | | 1856 | packages should install files |
1853 | into <filename>${PREFIX}/share/texmf-dist</filename>, | | 1857 | into <filename>${PREFIX}/share/texmf-dist</filename>, |
1854 | not <filename>${PREFIX}/share/texmf</filename>.</para></note> | | 1858 | not <filename>${PREFIX}/share/texmf</filename>.</para></note> |
1855 | | | 1859 | |
1856 | <orderedlist> | | 1860 | <orderedlist> |
1857 | <listitem><para>Include | | 1861 | <listitem><para>Include |
1858 | <filename>../../print/kpathsea/texmf.mk</filename>. This | | 1862 | <filename>../../print/kpathsea/texmf.mk</filename>. This |
1859 | takes care of rebuilding the <filename>ls-R</filename> | | 1863 | takes care of rebuilding the <filename>ls-R</filename> |
1860 | database at installation and deinstallation time.</para> | | 1864 | database at installation and deinstallation time.</para> |
1861 | </listitem> | | 1865 | </listitem> |
1862 | | | 1866 | |
1863 | <listitem><para>If your package installs files into a texmf | | 1867 | <listitem><para>If your package installs files into a texmf |
1864 | tree other than the one | | 1868 | tree other than the one |
1865 | at <filename>${PREFIX}/share/texmf-dist</filename>, | | 1869 | at <filename>${PREFIX}/share/texmf-dist</filename>, |
1866 | set <varname>TEX_TEXMF_DIRS</varname> to the list of all texmf | | 1870 | set <varname>TEX_TEXMF_DIRS</varname> to the list of all texmf |
1867 | trees that need database update.</para> | | 1871 | trees that need database update.</para> |
1868 | <para>If your package also installs font map files that need | | 1872 | <para>If your package also installs font map files that need |
1869 | to be registered using <command>updmap</command>, | | 1873 | to be registered using <command>updmap</command>, |
1870 | include <filename>../../print/tex-tetex/map.mk</filename> and | | 1874 | include <filename>../../print/tex-tetex/map.mk</filename> and |
1871 | set <varname>TEX_MAP_FILES</varname> and/or | | 1875 | set <varname>TEX_MAP_FILES</varname> and/or |
1872 | <varname>TEX_MIXEDMAP_FILES</varname> to the list of all | | 1876 | <varname>TEX_MIXEDMAP_FILES</varname> to the list of all |
1873 | such font map files. Then <command>updmap</command> will | | 1877 | such font map files. Then <command>updmap</command> will |
1874 | be run automatically at installation/deinstallation to | | 1878 | be run automatically at installation/deinstallation to |
1875 | enable/disable font map files for TeX output | | 1879 | enable/disable font map files for TeX output |
1876 | drivers.</para> | | 1880 | drivers.</para> |
1877 | </listitem> | | 1881 | </listitem> |
1878 | | | 1882 | |
1879 | <listitem><para>Make sure that none of <filename>ls-R</filename> | | 1883 | <listitem><para>Make sure that none of <filename>ls-R</filename> |
1880 | databases are included in <filename>PLIST</filename>, as | | 1884 | databases are included in <filename>PLIST</filename>, as |
1881 | they will be removed only by the kpathsea package.</para> | | 1885 | they will be removed only by the kpathsea package.</para> |
1882 | </listitem> | | 1886 | </listitem> |
1883 | </orderedlist> | | 1887 | </orderedlist> |
1884 | </sect2> | | 1888 | </sect2> |
1885 | | | 1889 | |
1886 | <sect2 id="emulation-packages"> | | 1890 | <sect2 id="emulation-packages"> |
1887 | <title>Packages supporting running binaries in | | 1891 | <title>Packages supporting running binaries in |
1888 | emulation</title> | | 1892 | emulation</title> |
1889 | | | 1893 | |
1890 | <para>There are some packages that provide libraries and | | 1894 | <para>There are some packages that provide libraries and |
1891 | executables for running binaries from a one operating system | | 1895 | executables for running binaries from a one operating system |
1892 | on a different one (if the latter supports it). One example | | 1896 | on a different one (if the latter supports it). One example |
1893 | is running Linux binaries on NetBSD.</para> | | 1897 | is running Linux binaries on NetBSD.</para> |
1894 | | | 1898 | |
1895 | <para>The <filename role="pkg">pkgtools/rpm2pkg</filename> | | 1899 | <para>The <filename role="pkg">pkgtools/rpm2pkg</filename> |
1896 | helps in extracting and packaging Linux rpm packages.</para> | | 1900 | helps in extracting and packaging Linux rpm packages.</para> |
1897 | | | 1901 | |
1898 | <para>The <varname>CHECK_SHLIBS</varname> can be set to no to | | 1902 | <para>The <varname>CHECK_SHLIBS</varname> can be set to no to |
1899 | avoid the <command>check-shlibs</command> target, which tests | | 1903 | avoid the <command>check-shlibs</command> target, which tests |
1900 | if all libraries for each installed executable can be found by | | 1904 | if all libraries for each installed executable can be found by |
1901 | the dynamic linker. Since the standard dynamic linker is run, | | 1905 | the dynamic linker. Since the standard dynamic linker is run, |
1902 | this fails for emulation packages, because the libraries used | | 1906 | this fails for emulation packages, because the libraries used |
1903 | by the emulation are not in the standard directories.</para> | | 1907 | by the emulation are not in the standard directories.</para> |
1904 | </sect2> | | 1908 | </sect2> |
1905 | | | 1909 | |
1906 | <sect2 id="hicolor-theme"> | | 1910 | <sect2 id="hicolor-theme"> |
1907 | <title>Packages installing hicolor theme icons</title> | | 1911 | <title>Packages installing hicolor theme icons</title> |
1908 | | | 1912 | |
1909 | <para>If a package installs images under the | | 1913 | <para>If a package installs images under the |
1910 | <filename>share/icons/hicolor</filename> and/or updates the | | 1914 | <filename>share/icons/hicolor</filename> and/or updates the |
1911 | <filename>share/icons/hicolor/icon-theme.cache</filename> | | 1915 | <filename>share/icons/hicolor/icon-theme.cache</filename> |
1912 | database, you need to take some extra steps to make sure that the | | 1916 | database, you need to take some extra steps to make sure that the |
1913 | shared theme directory is handled appropriately and that the cache | | 1917 | shared theme directory is handled appropriately and that the cache |
1914 | database is rebuilt:</para> | | 1918 | database is rebuilt:</para> |
1915 | | | 1919 | |
1916 | <orderedlist> | | 1920 | <orderedlist> |
1917 | <listitem> | | 1921 | <listitem> |
1918 | <para>Include | | 1922 | <para>Include |
1919 | <filename>../../graphics/hicolor-icon-theme/buildlink3.mk</filename>.</para> | | 1923 | <filename>../../graphics/hicolor-icon-theme/buildlink3.mk</filename>.</para> |
1920 | </listitem> | | 1924 | </listitem> |
1921 | | | 1925 | |
1922 | <listitem> | | 1926 | <listitem> |
1923 | <para>Check the <filename>PLIST</filename> and remove the | | 1927 | <para>Check the <filename>PLIST</filename> and remove the |
1924 | entry that refers to the theme cache.</para> | | 1928 | entry that refers to the theme cache.</para> |
1925 | </listitem> | | 1929 | </listitem> |
1926 | | | 1930 | |
1927 | <listitem> | | 1931 | <listitem> |
1928 | <para>Ensure that the PLIST does not remove the shared icon | | 1932 | <para>Ensure that the PLIST does not remove the shared icon |
1929 | directories from the <filename>share/icons/hicolor</filename> | | 1933 | directories from the <filename>share/icons/hicolor</filename> |
1930 | hierarchy because they will be handled automatically.</para> | | 1934 | hierarchy because they will be handled automatically.</para> |
1931 | </listitem> | | 1935 | </listitem> |
1932 | </orderedlist> | | 1936 | </orderedlist> |
1933 | | | 1937 | |
1934 | <para>The best way to verify that the PLIST is correct with | | 1938 | <para>The best way to verify that the PLIST is correct with |
1935 | respect to the last two points is to regenerate it using | | 1939 | respect to the last two points is to regenerate it using |
1936 | <command>make print-PLIST</command>.</para> | | 1940 | <command>make print-PLIST</command>.</para> |
1937 | </sect2> | | 1941 | </sect2> |
1938 | | | 1942 | |
1939 | | | 1943 | |
1940 | <sect2 id="desktop-files"> | | 1944 | <sect2 id="desktop-files"> |
1941 | <title>Packages installing desktop files</title> | | 1945 | <title>Packages installing desktop files</title> |
1942 | | | 1946 | |
1943 | <para>If a package installs <filename>.desktop</filename> files | | 1947 | <para>If a package installs <filename>.desktop</filename> files |
1944 | under <filename>share/applications</filename> and these include | | 1948 | under <filename>share/applications</filename> and these include |
1945 | MIME information (MimeType key), you need to take extra steps to | | 1949 | MIME information (MimeType key), you need to take extra steps to |
1946 | ensure that they are registered into the MIME database:</para> | | 1950 | ensure that they are registered into the MIME database:</para> |
1947 | | | 1951 | |
1948 | <orderedlist> | | 1952 | <orderedlist> |
1949 | <listitem> | | 1953 | <listitem> |
1950 | <para>Include | | 1954 | <para>Include |
1951 | <filename>../../sysutils/desktop-file-utils/desktopdb.mk</filename>.</para> | | 1955 | <filename>../../sysutils/desktop-file-utils/desktopdb.mk</filename>.</para> |
1952 | </listitem> | | 1956 | </listitem> |
1953 | | | 1957 | |
1954 | <listitem> | | 1958 | <listitem> |
1955 | <para>Check the PLIST and remove the entry that refers to the | | 1959 | <para>Check the PLIST and remove the entry that refers to the |
1956 | <filename>share/applications/mimeinfo.cache</filename> file. | | 1960 | <filename>share/applications/mimeinfo.cache</filename> file. |
1957 | It will be handled automatically.</para> | | 1961 | It will be handled automatically.</para> |
1958 | </listitem> | | 1962 | </listitem> |
1959 | </orderedlist> | | 1963 | </orderedlist> |
1960 | | | 1964 | |
1961 | <para>The best way to verify that the PLIST is correct with | | 1965 | <para>The best way to verify that the PLIST is correct with |
1962 | respect to the last point is to regenerate it using <command>make | | 1966 | respect to the last point is to regenerate it using <command>make |
1963 | print-PLIST</command>.</para> | | 1967 | print-PLIST</command>.</para> |
1964 | </sect2> | | 1968 | </sect2> |
1965 | </sect1> | | 1969 | </sect1> |
1966 | | | 1970 | |
1967 | <sect1 id="punting"> | | 1971 | <sect1 id="punting"> |
1968 | <title>Marking packages as having problems</title> | | 1972 | <title>Marking packages as having problems</title> |
1969 | | | 1973 | |
1970 | <para>In some cases one does not have the time to solve a problem | | 1974 | <para>In some cases one does not have the time to solve a problem |
1971 | immediately. In this case, one can plainly mark a package as broken. For | | 1975 | immediately. In this case, one can plainly mark a package as broken. For |
1972 | this, one just sets the variable <varname>BROKEN</varname> to the | | 1976 | this, one just sets the variable <varname>BROKEN</varname> to the |
1973 | reason why the package is broken (similar to the | | 1977 | reason why the package is broken (similar to the |
1974 | <varname>RESTRICTED</varname> variable). A user trying to build | | 1978 | <varname>RESTRICTED</varname> variable). A user trying to build |
1975 | the package will immediately be shown this message, and the build | | 1979 | the package will immediately be shown this message, and the build |
1976 | will not be even tried.</para> | | 1980 | will not be even tried.</para> |
1977 | <para><varname>BROKEN</varname> packages are removed from pkgsrc in irregular | | 1981 | <para><varname>BROKEN</varname> packages are removed from pkgsrc in irregular |
1978 | intervals.</para> | | 1982 | intervals.</para> |
1979 | </sect1> | | 1983 | </sect1> |
1980 | | | 1984 | |
1981 | </chapter> | | 1985 | </chapter> |