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