| @@ -1,727 +1,732 @@ | | | @@ -1,727 +1,732 @@ |
1 | <!-- $NetBSD: components.xml,v 1.60 2021/03/26 17:43:20 gdt Exp $ --> | | 1 | <!-- $NetBSD: components.xml,v 1.61 2021/06/14 22:53:02 nia Exp $ --> |
2 | | | 2 | |
3 | <chapter id="components"> <?dbhtml filename="components.html"?> | | 3 | <chapter id="components"> <?dbhtml filename="components.html"?> |
4 | <title>Package components - files, directories and contents</title> | | 4 | <title>Package components - files, directories and contents</title> |
5 | | | 5 | |
6 | <para>Whenever you're preparing a package, there are a number of | | 6 | <para>Whenever you're preparing a package, there are a number of |
7 | files involved which are described in the following | | 7 | files involved which are described in the following |
8 | sections.</para> | | 8 | sections.</para> |
9 | | | 9 | |
10 | <sect1 id="components.Makefile"> | | 10 | <sect1 id="components.Makefile"> |
11 | <title><filename>Makefile</filename></title> | | 11 | <title><filename>Makefile</filename></title> |
12 | | | 12 | |
13 | <para>Building, installation and creation of a binary package are all | | 13 | <para>Building, installation and creation of a binary package are all |
14 | controlled by the package's <filename>Makefile</filename>. | | 14 | controlled by the package's <filename>Makefile</filename>. |
15 | The <filename>Makefile</filename> describes various things about | | 15 | The <filename>Makefile</filename> describes various things about |
16 | a package, for example from where to get it, how to configure, | | 16 | a package, for example from where to get it, how to configure, |
17 | build, and install it.</para> | | 17 | build, and install it.</para> |
18 | | | 18 | |
19 | <para>A package <filename>Makefile</filename> contains several | | 19 | <para>A package <filename>Makefile</filename> contains several |
20 | sections that describe the package.</para> | | 20 | sections that describe the package.</para> |
21 | | | 21 | |
22 | <para>In the first section there are the following variables, which | | 22 | <para>In the first section there are the following variables, which |
23 | should appear exactly in the order given here. The order and | | 23 | should appear exactly in the order given here. The order and |
24 | grouping of the variables is mostly historical and has no further | | 24 | grouping of the variables is mostly historical and has no further |
25 | meaning.</para> | | 25 | meaning.</para> |
26 | <itemizedlist> | | 26 | <itemizedlist> |
27 | | | 27 | |
28 | <listitem><para><varname>DISTNAME</varname> is the basename of the | | 28 | <listitem><para><varname>DISTNAME</varname> is the basename of the |
29 | distribution file to be downloaded from the package's | | 29 | distribution file to be downloaded from the package's |
30 | website.</para></listitem> | | 30 | website.</para></listitem> |
31 | | | 31 | |
32 | <listitem><para><varname>PKGNAME</varname> is the name of the | | 32 | <listitem><para><varname>PKGNAME</varname> is the name of the |
33 | package, as used by pkgsrc. You need to provide it if | | 33 | package, as used by pkgsrc. You need to provide it if |
34 | <varname>DISTNAME</varname> (which is the default) is not a good | | 34 | <varname>DISTNAME</varname> (which is the default) is not a good |
35 | name for the package in pkgsrc or <varname>DISTNAME</varname> is not | | 35 | name for the package in pkgsrc or <varname>DISTNAME</varname> is not |
36 | provided (no distribution file is required). Usually it is the pkgsrc | | 36 | provided (no distribution file is required). Usually it is the pkgsrc |
37 | directory name together with the version number. It must match the | | 37 | directory name together with the version number. It must match the |
38 | regular expression | | 38 | regular expression |
39 | <varname>^[A-Za-z0-9][A-Za-z0-9-_.+]*$</varname>, that is, it | | 39 | <varname>^[A-Za-z0-9][A-Za-z0-9-_.+]*$</varname>, that is, it |
40 | starts with a letter or digit, and contains only letters, digits, | | 40 | starts with a letter or digit, and contains only letters, digits, |
41 | dashes, underscores, dots and plus signs.</para></listitem> | | 41 | dashes, underscores, dots and plus signs. |
| | | 42 | New packages should have entirely lower-case names, with the exception |
| | | 43 | of some that must follow pre-existing conventions |
| | | 44 | (e.g. R packages begin with <varname>R-</varname>). |
| | | 45 | You can use the <code>:tl</code> variable modifier to lower-case |
| | | 46 | the package name.</para></listitem> |
42 | | | 47 | |
43 | <listitem><para><varname>CATEGORIES</varname> is a list of categories | | 48 | <listitem><para><varname>CATEGORIES</varname> is a list of categories |
44 | which the package fits in. You can choose any of the top-level | | 49 | which the package fits in. You can choose any of the top-level |
45 | directories of pkgsrc for it.</para> | | 50 | directories of pkgsrc for it.</para> |
46 | | | 51 | |
47 | <para>Currently the following values are available for | | 52 | <para>Currently the following values are available for |
48 | <varname>CATEGORIES</varname>. If more than | | 53 | <varname>CATEGORIES</varname>. If more than |
49 | one is used, they need to be separated by spaces:</para> | | 54 | one is used, they need to be separated by spaces:</para> |
50 | | | 55 | |
51 | <programlisting> | | 56 | <programlisting> |
52 | archivers cross geography meta-pkgs security | | 57 | archivers cross geography meta-pkgs security |
53 | audio databases graphics misc shells | | 58 | audio databases graphics misc shells |
54 | benchmarks devel ham multimedia sysutils | | 59 | benchmarks devel ham multimedia sysutils |
55 | biology editors inputmethod net textproc | | 60 | biology editors inputmethod net textproc |
56 | cad emulators lang news time | | 61 | cad emulators lang news time |
57 | chat finance mail parallel wm | | 62 | chat finance mail parallel wm |
58 | comms fonts math pkgtools www | | 63 | comms fonts math pkgtools www |
59 | converters games mbone print x11 | | 64 | converters games mbone print x11 |
60 | </programlisting> | | 65 | </programlisting> |
61 | </listitem> | | 66 | </listitem> |
62 | | | 67 | |
63 | <listitem><para><varname>MASTER_SITES</varname>, | | 68 | <listitem><para><varname>MASTER_SITES</varname>, |
64 | <varname>DYNAMIC_MASTER_SITES</varname>, | | 69 | <varname>DYNAMIC_MASTER_SITES</varname>, |
65 | <varname>DIST_SUBDIR</varname>, <varname>EXTRACT_SUFX</varname> | | 70 | <varname>DIST_SUBDIR</varname>, <varname>EXTRACT_SUFX</varname> |
66 | and <varname>DISTFILES</varname> are discussed in detail in | | 71 | and <varname>DISTFILES</varname> are discussed in detail in |
67 | <xref linkend="build.fetch"/>.</para></listitem> | | 72 | <xref linkend="build.fetch"/>.</para></listitem> |
68 | | | 73 | |
69 | </itemizedlist> | | 74 | </itemizedlist> |
70 | | | 75 | |
71 | <para>The second section contains information about separately | | 76 | <para>The second section contains information about separately |
72 | downloaded patches, if any. | | 77 | downloaded patches, if any. |
73 | <itemizedlist> | | 78 | <itemizedlist> |
74 | <listitem><para><varname>PATCHFILES</varname>: | | 79 | <listitem><para><varname>PATCHFILES</varname>: |
75 | Name(s) of additional files that contain distribution patches. | | 80 | Name(s) of additional files that contain distribution patches. |
76 | There is no default. pkgsrc will look for them at | | 81 | There is no default. pkgsrc will look for them at |
77 | <varname>PATCH_SITES</varname>. | | 82 | <varname>PATCH_SITES</varname>. |
78 | They will automatically be uncompressed before patching if | | 83 | They will automatically be uncompressed before patching if |
79 | the names end with <filename>.gz</filename> or | | 84 | the names end with <filename>.gz</filename> or |
80 | <filename>.Z</filename>.</para> | | 85 | <filename>.Z</filename>.</para> |
81 | </listitem> | | 86 | </listitem> |
82 | <listitem><para><varname>PATCH_SITES</varname>: | | 87 | <listitem><para><varname>PATCH_SITES</varname>: |
83 | Primary location(s) for distribution patch files (see | | 88 | Primary location(s) for distribution patch files (see |
84 | <varname>PATCHFILES</varname> above) if not found locally.</para> | | 89 | <varname>PATCHFILES</varname> above) if not found locally.</para> |
85 | </listitem> | | 90 | </listitem> |
86 | <listitem><para><varname>PATCH_DIST_STRIP</varname>: | | 91 | <listitem><para><varname>PATCH_DIST_STRIP</varname>: |
87 | an argument to &man.patch.1; that sets the pathname strip count to | | 92 | an argument to &man.patch.1; that sets the pathname strip count to |
88 | help find the correct files to patch. It defaults to | | 93 | help find the correct files to patch. It defaults to |
89 | <command>-p0</command>.</para> | | 94 | <command>-p0</command>.</para> |
90 | </listitem> | | 95 | </listitem> |
91 | </itemizedlist></para> | | 96 | </itemizedlist></para> |
92 | <para>The third section contains the following variables. | | 97 | <para>The third section contains the following variables. |
93 | <itemizedlist> | | 98 | <itemizedlist> |
94 | | | 99 | |
95 | <listitem><para><varname>MAINTAINER</varname> is the email | | 100 | <listitem><para><varname>MAINTAINER</varname> is the email |
96 | address of the person who feels responsible for this package, | | 101 | address of the person who feels responsible for this package, |
97 | and who is most likely to look at problems or questions regarding | | 102 | and who is most likely to look at problems or questions regarding |
98 | this package which have been reported with &man.send-pr.1;. | | 103 | this package which have been reported with &man.send-pr.1;. |
99 | Other developers may contact the <varname>MAINTAINER</varname> | | 104 | Other developers may contact the <varname>MAINTAINER</varname> |
100 | before making changes to the package, but are not required to | | 105 | before making changes to the package, but are not required to |
101 | do so. When packaging a new program, set <varname>MAINTAINER</varname> | | 106 | do so. When packaging a new program, set <varname>MAINTAINER</varname> |
102 | to yourself. If you really can't maintain the package for future | | 107 | to yourself. If you really can't maintain the package for future |
103 | updates, set it to | | 108 | updates, set it to |
104 | <email>pkgsrc-users@NetBSD.org</email>.</para></listitem> | | 109 | <email>pkgsrc-users@NetBSD.org</email>.</para></listitem> |
105 | | | 110 | |
106 | <listitem><para><varname>OWNER</varname> should be used instead | | 111 | <listitem><para><varname>OWNER</varname> should be used instead |
107 | of <varname>MAINTAINER</varname> when you do not want other | | 112 | of <varname>MAINTAINER</varname> when you do not want other |
108 | developers to update or change the package without contacting | | 113 | developers to update or change the package without contacting |
109 | you first. A package Makefile should contain one of | | 114 | you first. A package Makefile should contain one of |
110 | <varname>MAINTAINER</varname> or <varname>OWNER</varname>, but | | 115 | <varname>MAINTAINER</varname> or <varname>OWNER</varname>, but |
111 | not both. </para></listitem> | | 116 | not both. </para></listitem> |
112 | | | 117 | |
113 | <listitem><para><varname>HOMEPAGE</varname> is a URL where users can | | 118 | <listitem><para><varname>HOMEPAGE</varname> is a URL where users can |
114 | find more information about the package.</para></listitem> | | 119 | find more information about the package.</para></listitem> |
115 | | | 120 | |
116 | <listitem><para><varname>COMMENT</varname> is a one-line | | 121 | <listitem><para><varname>COMMENT</varname> is a one-line |
117 | description of the package (should not include the package | | 122 | description of the package (should not include the package |
118 | name).</para></listitem> | | 123 | name).</para></listitem> |
119 | | | 124 | |
120 | <listitem><para><varname>LICENSE</varname> indicates the license(s) | | 125 | <listitem><para><varname>LICENSE</varname> indicates the license(s) |
121 | applicable for the package. See <xref | | 126 | applicable for the package. See <xref |
122 | linkend="handling-licenses"/> for further details.</para> | | 127 | linkend="handling-licenses"/> for further details.</para> |
123 | </listitem> | | 128 | </listitem> |
124 | </itemizedlist></para> | | 129 | </itemizedlist></para> |
125 | | | 130 | |
126 | <para>Other variables that affect the build: | | 131 | <para>Other variables that affect the build: |
127 | <itemizedlist> | | 132 | <itemizedlist> |
128 | | | 133 | |
129 | <listitem> | | 134 | <listitem> |
130 | <para><varname>WRKSRC</varname>: The directory where the | | 135 | <para><varname>WRKSRC</varname>: The directory where the |
131 | interesting distribution files of the package are found. The | | 136 | interesting distribution files of the package are found. The |
132 | default is <filename>${WRKDIR}/${DISTNAME}</filename>, which | | 137 | default is <filename>${WRKDIR}/${DISTNAME}</filename>, which |
133 | works for most packages.</para> | | 138 | works for most packages.</para> |
134 | | | 139 | |
135 | <para>If a package doesn't create a subdirectory for itself | | 140 | <para>If a package doesn't create a subdirectory for itself |
136 | (most GNU software does, for instance), but extracts itself in | | 141 | (most GNU software does, for instance), but extracts itself in |
137 | the current directory, you should set | | 142 | the current directory, you should set |
138 | <varname>WRKSRC=${WRKDIR}</varname>.</para> | | 143 | <varname>WRKSRC=${WRKDIR}</varname>.</para> |
139 | | | 144 | |
140 | <para>If a package doesn't create a subdirectory with the | | 145 | <para>If a package doesn't create a subdirectory with the |
141 | name of <varname>DISTNAME</varname> but some different name, | | 146 | name of <varname>DISTNAME</varname> but some different name, |
142 | set <varname>WRKSRC</varname> to point to the proper name in | | 147 | set <varname>WRKSRC</varname> to point to the proper name in |
143 | <filename>${WRKDIR}</filename>, for example | | 148 | <filename>${WRKDIR}</filename>, for example |
144 | <varname>WRKSRC=${WRKDIR}/${DISTNAME}/unix</varname>. See | | 149 | <varname>WRKSRC=${WRKDIR}/${DISTNAME}/unix</varname>. See |
145 | <filename role="pkg">lang/tcl</filename> and <filename | | 150 | <filename role="pkg">lang/tcl</filename> and <filename |
146 | role="pkg">x11/tk</filename> for other examples.</para> | | 151 | role="pkg">x11/tk</filename> for other examples.</para> |
147 | | | 152 | |
148 | <para>The name of the working directory created by pkgsrc is | | 153 | <para>The name of the working directory created by pkgsrc is |
149 | taken from the <varname>WRKDIR_BASENAME</varname> | | 154 | taken from the <varname>WRKDIR_BASENAME</varname> |
150 | variable. By default, its value is | | 155 | variable. By default, its value is |
151 | <filename>work</filename>. If you want to use the same | | 156 | <filename>work</filename>. If you want to use the same |
152 | pkgsrc tree for building different kinds of binary packages, | | 157 | pkgsrc tree for building different kinds of binary packages, |
153 | you can change the variable according to your needs. Two | | 158 | you can change the variable according to your needs. Two |
154 | other variables handle common cases of setting | | 159 | other variables handle common cases of setting |
155 | <varname>WRKDIR_BASENAME</varname> individually. If | | 160 | <varname>WRKDIR_BASENAME</varname> individually. If |
156 | <varname>OBJHOSTNAME</varname> is defined in | | 161 | <varname>OBJHOSTNAME</varname> is defined in |
157 | &mk.conf;, the first component of | | 162 | &mk.conf;, the first component of |
158 | the host's name is attached to the directory name. If | | 163 | the host's name is attached to the directory name. If |
159 | <varname>OBJMACHINE</varname> is defined, the platform name | | 164 | <varname>OBJMACHINE</varname> is defined, the platform name |
160 | is attached, which might look like | | 165 | is attached, which might look like |
161 | <filename>work.i386</filename> or | | 166 | <filename>work.i386</filename> or |
162 | <filename>work.sparc</filename>.</para> | | 167 | <filename>work.sparc</filename>.</para> |
163 | | | 168 | |
164 | </listitem> | | 169 | </listitem> |
165 | | | 170 | |
166 | </itemizedlist></para> | | 171 | </itemizedlist></para> |
167 | | | 172 | |
168 | <para>Please pay attention to the following gotchas:</para> | | 173 | <para>Please pay attention to the following gotchas:</para> |
169 | <itemizedlist> | | 174 | <itemizedlist> |
170 | <listitem> | | 175 | <listitem> |
171 | <para>Add <varname>MANCOMPRESSED</varname> if man pages are | | 176 | <para>Add <varname>MANCOMPRESSED</varname> if man pages are |
172 | installed in compressed form by the package. For packages using | | 177 | installed in compressed form by the package. For packages using |
173 | BSD-style makefiles which honor MANZ, there is | | 178 | BSD-style makefiles which honor MANZ, there is |
174 | <varname>MANCOMPRESSED_IF_MANZ</varname>.</para> | | 179 | <varname>MANCOMPRESSED_IF_MANZ</varname>.</para> |
175 | </listitem> | | 180 | </listitem> |
176 | | | 181 | |
177 | <listitem> | | 182 | <listitem> |
178 | <para>Replace <filename>/usr/local</filename> with | | 183 | <para>Replace <filename>/usr/local</filename> with |
179 | <quote>${PREFIX}</quote> in all files (see patches, | | 184 | <quote>${PREFIX}</quote> in all files (see patches, |
180 | below).</para> | | 185 | below).</para> |
181 | </listitem> | | 186 | </listitem> |
182 | | | 187 | |
183 | <listitem> | | 188 | <listitem> |
184 | <para>If the package installs any info files, see <xref | | 189 | <para>If the package installs any info files, see <xref |
185 | linkend="faq.info-files"/>.</para> | | 190 | linkend="faq.info-files"/>.</para> |
186 | </listitem> | | 191 | </listitem> |
187 | | | 192 | |
188 | </itemizedlist> | | 193 | </itemizedlist> |
189 | </sect1> | | 194 | </sect1> |
190 | | | 195 | |
191 | <sect1 id="components.distinfo"> | | 196 | <sect1 id="components.distinfo"> |
192 | <title><filename>distinfo</filename></title> | | 197 | <title><filename>distinfo</filename></title> |
193 | | | 198 | |
194 | <para>The <filename>distinfo</filename> file contains the message | | 199 | <para>The <filename>distinfo</filename> file contains the message |
195 | digest, or checksum, of each distfile needed for the package. This | | 200 | digest, or checksum, of each distfile needed for the package. This |
196 | ensures that the distfiles retrieved from the Internet have not been | | 201 | ensures that the distfiles retrieved from the Internet have not been |
197 | corrupted during transfer or altered by a malign force to introduce | | 202 | corrupted during transfer or altered by a malign force to introduce |
198 | a security hole. To provide maximum security, all distfiles are | | 203 | a security hole. To provide maximum security, all distfiles are |
199 | protected using three different message digest algorithms (SHA1, | | 204 | protected using three different message digest algorithms (SHA1, |
200 | RMD160, SHA512), as well as the file size.</para> | | 205 | RMD160, SHA512), as well as the file size.</para> |
201 | | | 206 | |
202 | <para>The <filename>distinfo</filename> file also contains the | | 207 | <para>The <filename>distinfo</filename> file also contains the |
203 | checksums for all the patches found in the | | 208 | checksums for all the patches found in the |
204 | <filename>patches</filename> directory (see <xref | | 209 | <filename>patches</filename> directory (see <xref |
205 | linkend="components.patches"/>). These checksums ensure that patches | | 210 | linkend="components.patches"/>). These checksums ensure that patches |
206 | are only applied intentionally and that they don't accidentally change, | | 211 | are only applied intentionally and that they don't accidentally change, |
207 | e.g. when merging different changes together. They also make sure that | | 212 | e.g. when merging different changes together. They also make sure that |
208 | new patches are actually added to CVS and old ones are removed. | | 213 | new patches are actually added to CVS and old ones are removed. |
209 | Too see whether the patches and the <filename>distinfo</filename> file | | 214 | Too see whether the patches and the <filename>distinfo</filename> file |
210 | match, run <command>pkglint</command> after changing the patches.</para> | | 215 | match, run <command>pkglint</command> after changing the patches.</para> |
211 | | | 216 | |
212 | <para>To regenerate the <filename>distinfo</filename> file, use the | | 217 | <para>To regenerate the <filename>distinfo</filename> file, use the |
213 | <command>make distinfo</command> command.</para> | | 218 | <command>make distinfo</command> command.</para> |
214 | | | 219 | |
215 | <para>Some packages have different sets of distfiles depending on | | 220 | <para>Some packages have different sets of distfiles depending on |
216 | the platform, for example <filename | | 221 | the platform, for example <filename |
217 | role="pkg">lang/openjdk8</filename>. These are kept in the same | | 222 | role="pkg">lang/openjdk8</filename>. These are kept in the same |
218 | <filename>distinfo</filename> file and care should be taken when | | 223 | <filename>distinfo</filename> file and care should be taken when |
219 | upgrading such a package to ensure distfile information is not | | 224 | upgrading such a package to ensure distfile information is not |
220 | lost.</para> | | 225 | lost.</para> |
221 | | | 226 | |
222 | </sect1> | | 227 | </sect1> |
223 | | | 228 | |
224 | <sect1 id="components.patches"> | | 229 | <sect1 id="components.patches"> |
225 | <title><filename>patches/*</filename></title> | | 230 | <title><filename>patches/*</filename></title> |
226 | | | 231 | |
227 | <para>Some packages don't work out-of-the box on the various | | 232 | <para>Some packages don't work out-of-the box on the various |
228 | platforms that are supported by pkgsrc. These packages need | | 233 | platforms that are supported by pkgsrc. These packages need |
229 | to be patched to make them work. The patch files can be | | 234 | to be patched to make them work. The patch files can be |
230 | found in the <filename>patches/</filename> directory.</para> | | 235 | found in the <filename>patches/</filename> directory.</para> |
231 | | | 236 | |
232 | <para>In the <emphasis>patch</emphasis> phase, these patches are | | 237 | <para>In the <emphasis>patch</emphasis> phase, these patches are |
233 | applied to the files in <varname>WRKSRC</varname> directory after | | 238 | applied to the files in <varname>WRKSRC</varname> directory after |
234 | extracting them, in alphabetic order.</para> | | 239 | extracting them, in alphabetic order.</para> |
235 | | | 240 | |
236 | <sect2 id="components.patch.structure"> | | 241 | <sect2 id="components.patch.structure"> |
237 | <title>Structure of a single patch file</title> | | 242 | <title>Structure of a single patch file</title> |
238 | | | 243 | |
239 | <para>The <filename>patch-*</filename> files should be in | | 244 | <para>The <filename>patch-*</filename> files should be in |
240 | <command>diff -bu</command> format, and apply without a fuzz to avoid | | 245 | <command>diff -bu</command> format, and apply without a fuzz to avoid |
241 | problems. (To force patches to apply with fuzz you can set | | 246 | problems. (To force patches to apply with fuzz you can set |
242 | <varname>PATCH_FUZZ_FACTOR=-F2</varname>). Furthermore, each patch | | 247 | <varname>PATCH_FUZZ_FACTOR=-F2</varname>). Furthermore, each patch |
243 | should contain only changes for a single file, and no file should be | | 248 | should contain only changes for a single file, and no file should be |
244 | patched by more than one patch file. This helps to keep future | | 249 | patched by more than one patch file. This helps to keep future |
245 | modifications simple.</para> | | 250 | modifications simple.</para> |
246 | | | 251 | |
247 | <para>Each patch file is structured as follows: In the first line, | | 252 | <para>Each patch file is structured as follows: In the first line, |
248 | there is the RCS Id of the patch itself. The second line should be | | 253 | there is the RCS Id of the patch itself. The second line should be |
249 | empty for aesthetic reasons. After that, there should be a comment for | | 254 | empty for aesthetic reasons. After that, there should be a comment for |
250 | each change that the patch does. There are a number of standard | | 255 | each change that the patch does. There are a number of standard |
251 | cases:</para> | | 256 | cases:</para> |
252 | | | 257 | |
253 | <itemizedlist> | | 258 | <itemizedlist> |
254 | | | 259 | |
255 | <listitem><para>Patches for commonly known vulnerabilities should | | 260 | <listitem><para>Patches for commonly known vulnerabilities should |
256 | mention the vulnerability ID (CAN, CVE).</para></listitem> | | 261 | mention the vulnerability ID (CAN, CVE).</para></listitem> |
257 | | | 262 | |
258 | <listitem><para>Patches that change source code should mention the | | 263 | <listitem><para>Patches that change source code should mention the |
259 | platform and other environment (for example, the compiler) that the | | 264 | platform and other environment (for example, the compiler) that the |
260 | patch is needed for.</para></listitem> | | 265 | patch is needed for.</para></listitem> |
261 | | | 266 | |
262 | </itemizedlist> | | 267 | </itemizedlist> |
263 | | | 268 | |
264 | <para>The patch should be commented so that any | | 269 | <para>The patch should be commented so that any |
265 | developer who knows the code of the application can make some use of | | 270 | developer who knows the code of the application can make some use of |
266 | the patch. Special care should be taken for the upstream developers, | | 271 | the patch. Special care should be taken for the upstream developers, |
267 | since we generally want that they accept our patches, so we have less | | 272 | since we generally want that they accept our patches, so we have less |
268 | work in the future.</para> | | 273 | work in the future.</para> |
269 | | | 274 | |
270 | </sect2> | | 275 | </sect2> |
271 | <sect2 id="components.patches.caveats"> | | 276 | <sect2 id="components.patches.caveats"> |
272 | <title>Creating patch files</title> | | 277 | <title>Creating patch files</title> |
273 | | | 278 | |
274 | <para>One important thing to mention is to pay attention that no RCS | | 279 | <para>One important thing to mention is to pay attention that no RCS |
275 | IDs get stored in the patch files, as these will cause problems when | | 280 | IDs get stored in the patch files, as these will cause problems when |
276 | later checked into the &os; CVS tree. Use the | | 281 | later checked into the &os; CVS tree. Use the |
277 | <command>pkgdiff</command> command from the <filename | | 282 | <command>pkgdiff</command> command from the <filename |
278 | role="pkg">pkgtools/pkgdiff</filename> package to avoid these | | 283 | role="pkg">pkgtools/pkgdiff</filename> package to avoid these |
279 | problems.</para> | | 284 | problems.</para> |
280 | | | 285 | |
281 | <para>For even more automation, we recommend using | | 286 | <para>For even more automation, we recommend using |
282 | <command>mkpatches</command> from the same package to make a | | 287 | <command>mkpatches</command> from the same package to make a |
283 | whole set of patches. You just have to backup files before you | | 288 | whole set of patches. You just have to backup files before you |
284 | edit them to <filename>filename.orig</filename>, e.g. with | | 289 | edit them to <filename>filename.orig</filename>, e.g. with |
285 | <command>cp -p filename filename.orig</command> or, easier, by | | 290 | <command>cp -p filename filename.orig</command> or, easier, by |
286 | using <command>pkgvi</command> again from the same package. If | | 291 | using <command>pkgvi</command> again from the same package. If |
287 | you upgrade a package this way, you can easily compare the new | | 292 | you upgrade a package this way, you can easily compare the new |
288 | set of patches with the previously existing one with | | 293 | set of patches with the previously existing one with |
289 | <command>patchdiff</command>. The files in <filename>patches</filename> | | 294 | <command>patchdiff</command>. The files in <filename>patches</filename> |
290 | are replaced by new files, so carefully check if you want to take all | | 295 | are replaced by new files, so carefully check if you want to take all |
291 | the changes.</para> | | 296 | the changes.</para> |
292 | | | 297 | |
293 | <para>When you have finished a package, remember to generate | | 298 | <para>When you have finished a package, remember to generate |
294 | the checksums for the patch files by using the <command>make | | 299 | the checksums for the patch files by using the <command>make |
295 | makepatchsum</command> command, see <xref | | 300 | makepatchsum</command> command, see <xref |
296 | linkend="components.distinfo"/>.</para> | | 301 | linkend="components.distinfo"/>.</para> |
297 | | | 302 | |
298 | <para>When adding a patch that corrects a problem in the | | 303 | <para>When adding a patch that corrects a problem in the |
299 | distfile (rather than e.g. enforcing pkgsrc's view of where | | 304 | distfile (rather than e.g. enforcing pkgsrc's view of where |
300 | man pages should go), send the patch as a bug report to the | | 305 | man pages should go), send the patch as a bug report to the |
301 | maintainer. This benefits non-pkgsrc users of the package, | | 306 | maintainer. This benefits non-pkgsrc users of the package, |
302 | and usually makes it possible to remove the patch in future | | 307 | and usually makes it possible to remove the patch in future |
303 | version.</para> | | 308 | version.</para> |
304 | | | 309 | |
305 | <para>The file names of the patch files are usually of the form | | 310 | <para>The file names of the patch files are usually of the form |
306 | <filename>patch-<replaceable>path_to_file__with__underscores.c</replaceable></filename>. | | 311 | <filename>patch-<replaceable>path_to_file__with__underscores.c</replaceable></filename>. |
307 | Many packages still use the previous convention | | 312 | Many packages still use the previous convention |
308 | <filename>patch-<replaceable>[a-z][a-z]</replaceable></filename>, | | 313 | <filename>patch-<replaceable>[a-z][a-z]</replaceable></filename>, |
309 | but new patches should be of the form containing the filename. | | 314 | but new patches should be of the form containing the filename. |
310 | <command>mkpatches</command> included in <filename | | 315 | <command>mkpatches</command> included in <filename |
311 | role="pkg">pkgtools/pkgdiff</filename> takes care of the name | | 316 | role="pkg">pkgtools/pkgdiff</filename> takes care of the name |
312 | automatically.</para> | | 317 | automatically.</para> |
313 | | | 318 | |
314 | </sect2> | | 319 | </sect2> |
315 | <sect2 id="components.patches.sources"> | | 320 | <sect2 id="components.patches.sources"> |
316 | <title>Sources where the patch files come from</title> | | 321 | <title>Sources where the patch files come from</title> |
317 | | | 322 | |
318 | <para>If you want to share patches between multiple packages | | 323 | <para>If you want to share patches between multiple packages |
319 | in pkgsrc, e.g. because they use the same distfiles, set | | 324 | in pkgsrc, e.g. because they use the same distfiles, set |
320 | <varname>PATCHDIR</varname> to the path where the patch files | | 325 | <varname>PATCHDIR</varname> to the path where the patch files |
321 | can be found, e.g.:</para> | | 326 | can be found, e.g.:</para> |
322 | <programlisting> | | 327 | <programlisting> |
323 | PATCHDIR= ../../editors/xemacs/patches | | 328 | PATCHDIR= ../../editors/xemacs/patches |
324 | </programlisting> | | 329 | </programlisting> |
325 | | | 330 | |
326 | <para>Patch files that are distributed by the author or other | | 331 | <para>Patch files that are distributed by the author or other |
327 | maintainers can be listed in | | 332 | maintainers can be listed in |
328 | <varname>PATCHFILES</varname>.</para> | | 333 | <varname>PATCHFILES</varname>.</para> |
329 | | | 334 | |
330 | <para>If it is desired to store any patches that should not be | | 335 | <para>If it is desired to store any patches that should not be |
331 | committed into pkgsrc, they can be kept outside the pkgsrc | | 336 | committed into pkgsrc, they can be kept outside the pkgsrc |
332 | tree in the <filename>$LOCALPATCHES</filename> directory. The | | 337 | tree in the <filename>$LOCALPATCHES</filename> directory. The |
333 | directory tree there is expected to have the same | | 338 | directory tree there is expected to have the same |
334 | <quote>category/package</quote> structure as pkgsrc, and | | 339 | <quote>category/package</quote> structure as pkgsrc, and |
335 | patches are expected to be stored inside these dirs (also | | 340 | patches are expected to be stored inside these dirs (also |
336 | known as <filename>$LOCALPATCHES/$PKGPATH</filename>). For | | 341 | known as <filename>$LOCALPATCHES/$PKGPATH</filename>). For |
337 | example, if you want to keep a private patch for | | 342 | example, if you want to keep a private patch for |
338 | <filename>pkgsrc/graphics/png</filename>, keep it in | | 343 | <filename>pkgsrc/graphics/png</filename>, keep it in |
339 | <filename>$LOCALPATCHES/graphics/png/mypatch</filename>. All | | 344 | <filename>$LOCALPATCHES/graphics/png/mypatch</filename>. All |
340 | files in the named directory are expected to be patch files, | | 345 | files in the named directory are expected to be patch files, |
341 | and <emphasis>they are applied after pkgsrc patches are | | 346 | and <emphasis>they are applied after pkgsrc patches are |
342 | applied</emphasis>.</para> | | 347 | applied</emphasis>.</para> |
343 | | | 348 | |
344 | </sect2> | | 349 | </sect2> |
345 | <sect2 id="components.patches.guidelines"> | | 350 | <sect2 id="components.patches.guidelines"> |
346 | <title>Patching guidelines</title> | | 351 | <title>Patching guidelines</title> |
347 | | | 352 | |
348 | <para>When fixing a portability issue in the code do not use | | 353 | <para>When fixing a portability issue in the code do not use |
349 | preprocessor magic to check for the current operating system nor | | 354 | preprocessor magic to check for the current operating system nor |
350 | platform. Doing so hurts portability to other platforms because | | 355 | platform. Doing so hurts portability to other platforms because |
351 | the OS-specific details are not abstracted appropriately.</para> | | 356 | the OS-specific details are not abstracted appropriately.</para> |
352 | | | 357 | |
353 | <para>The general rule to follow is: instead of checking for the | | 358 | <para>The general rule to follow is: instead of checking for the |
354 | operating system the application is being built on, check for the | | 359 | operating system the application is being built on, check for the |
355 | specific <emphasis>features</emphasis> you need. For example, | | 360 | specific <emphasis>features</emphasis> you need. For example, |
356 | instead of assuming that kqueue is available under NetBSD and | | 361 | instead of assuming that kqueue is available under NetBSD and |
357 | using the <varname>__NetBSD__</varname> macro to conditionalize | | 362 | using the <varname>__NetBSD__</varname> macro to conditionalize |
358 | kqueue support, add a check that detects kqueue itself — | | 363 | kqueue support, add a check that detects kqueue itself — |
359 | yes, this generally involves patching the | | 364 | yes, this generally involves patching the |
360 | <command>configure</command> script. There is absolutely nothing | | 365 | <command>configure</command> script. There is absolutely nothing |
361 | that prevents some OSes from adopting interfaces from other OSes | | 366 | that prevents some OSes from adopting interfaces from other OSes |
362 | (e.g. Linux implementing kqueue), something that the above checks | | 367 | (e.g. Linux implementing kqueue), something that the above checks |
363 | cannot take into account.</para> | | 368 | cannot take into account.</para> |
364 | | | 369 | |
365 | <para>Of course, checking for features generally involves more | | 370 | <para>Of course, checking for features generally involves more |
366 | work on the developer's side, but the resulting changes are | | 371 | work on the developer's side, but the resulting changes are |
367 | cleaner and there are chances they will work on many other | | 372 | cleaner and there are chances they will work on many other |
368 | platforms. Not to mention that there are higher chances of being | | 373 | platforms. Not to mention that there are higher chances of being |
369 | later integrated into the mainstream sources. Remember: | | 374 | later integrated into the mainstream sources. Remember: |
370 | <emphasis>It doesn't work unless it is right!</emphasis></para> | | 375 | <emphasis>It doesn't work unless it is right!</emphasis></para> |
371 | | | 376 | |
372 | <para>Some typical examples:</para> | | 377 | <para>Some typical examples:</para> |
373 | | | 378 | |
374 | <table id="patch-examples"> | | 379 | <table id="patch-examples"> |
375 | <title>Patching examples</title> | | 380 | <title>Patching examples</title> |
376 | | | 381 | |
377 | <tgroup cols="3"> | | 382 | <tgroup cols="3"> |
378 | <thead> | | 383 | <thead> |
379 | <row> | | 384 | <row> |
380 | <entry>Where</entry> | | 385 | <entry>Where</entry> |
381 | <entry>Incorrect</entry> | | 386 | <entry>Incorrect</entry> |
382 | <entry>Correct</entry> | | 387 | <entry>Correct</entry> |
383 | </row> | | 388 | </row> |
384 | </thead> | | 389 | </thead> |
385 | | | 390 | |
386 | <tbody> | | 391 | <tbody> |
387 | <row> | | 392 | <row> |
388 | <entry>configure script</entry> | | 393 | <entry>configure script</entry> |
389 | <entry> | | 394 | <entry> |
390 | <programlisting> | | 395 | <programlisting> |
391 | case ${target_os} in | | 396 | case ${target_os} in |
392 | netbsd*) have_kvm=yes ;; | | 397 | netbsd*) have_kvm=yes ;; |
393 | *) have_kvm=no ;; | | 398 | *) have_kvm=no ;; |
394 | esac | | 399 | esac |
395 | </programlisting> | | 400 | </programlisting> |
396 | </entry> | | 401 | </entry> |
397 | | | 402 | |
398 | <entry> | | 403 | <entry> |
399 | <programlisting> | | 404 | <programlisting> |
400 | AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no) | | 405 | AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no) |
401 | </programlisting> | | 406 | </programlisting> |
402 | </entry> | | 407 | </entry> |
403 | </row> | | 408 | </row> |
404 | | | 409 | |
405 | <row> | | 410 | <row> |
406 | <entry>C source file</entry> | | 411 | <entry>C source file</entry> |
407 | <entry> | | 412 | <entry> |
408 | <programlisting> | | 413 | <programlisting> |
409 | #if defined(__NetBSD__) | | 414 | #if defined(__NetBSD__) |
410 | # include <sys/event.h> | | 415 | # include <sys/event.h> |
411 | #endif | | 416 | #endif |
412 | </programlisting> | | 417 | </programlisting> |
413 | </entry> | | 418 | </entry> |
414 | <entry> | | 419 | <entry> |
415 | <programlisting> | | 420 | <programlisting> |
416 | #if defined(HAVE_SYS_EVENT_H) | | 421 | #if defined(HAVE_SYS_EVENT_H) |
417 | # include <sys/event.h> | | 422 | # include <sys/event.h> |
418 | #endif | | 423 | #endif |
419 | </programlisting> | | 424 | </programlisting> |
420 | </entry> | | 425 | </entry> |
421 | </row> | | 426 | </row> |
422 | | | 427 | |
423 | <row> | | 428 | <row> |
424 | <entry>C source file</entry> | | 429 | <entry>C source file</entry> |
425 | <entry> | | 430 | <entry> |
426 | <programlisting> | | 431 | <programlisting> |
427 | int | | 432 | int |
428 | monitor_file(...) | | 433 | monitor_file(...) |
429 | { | | 434 | { |
430 | #if defined(__NetBSD__) | | 435 | #if defined(__NetBSD__) |
431 | int fd = kqueue(); | | 436 | int fd = kqueue(); |
432 | ... | | 437 | ... |
433 | #else | | 438 | #else |
434 | ... | | 439 | ... |
435 | #endif | | 440 | #endif |
436 | } | | 441 | } |
437 | </programlisting> | | 442 | </programlisting> |
438 | </entry> | | 443 | </entry> |
439 | <entry> | | 444 | <entry> |
440 | <programlisting> | | 445 | <programlisting> |
441 | int | | 446 | int |
442 | monitor_file(...) | | 447 | monitor_file(...) |
443 | { | | 448 | { |
444 | #if defined(HAVE_KQUEUE) | | 449 | #if defined(HAVE_KQUEUE) |
445 | int fd = kqueue(); | | 450 | int fd = kqueue(); |
446 | ... | | 451 | ... |
447 | #else | | 452 | #else |
448 | ... | | 453 | ... |
449 | #endif | | 454 | #endif |
450 | } | | 455 | } |
451 | </programlisting> | | 456 | </programlisting> |
452 | </entry> | | 457 | </entry> |
453 | </row> | | 458 | </row> |
454 | </tbody> | | 459 | </tbody> |
455 | </tgroup> | | 460 | </tgroup> |
456 | </table> | | 461 | </table> |
457 | </sect2> | | 462 | </sect2> |
458 | | | 463 | |
459 | <sect2 id="components.patches.feedback"> | | 464 | <sect2 id="components.patches.feedback"> |
460 | <title>Feedback to the author</title> | | 465 | <title>Feedback to the author</title> |
461 | | | 466 | |
462 | <para>Always, always, <emphasis role="strong">always</emphasis> | | 467 | <para>Always, always, <emphasis role="strong">always</emphasis> |
463 | feed back any <emphasis>portability fixes</emphasis> or | | 468 | feed back any <emphasis>portability fixes</emphasis> or |
464 | improvements you do to a package to the mainstream developers. | | 469 | improvements you do to a package to the mainstream developers. |
465 | This is the only way to get their attention on portability issues | | 470 | This is the only way to get their attention on portability issues |
466 | and to ensure that future versions can be built out-of-the box on | | 471 | and to ensure that future versions can be built out-of-the box on |
467 | NetBSD. Furthermore, any user that gets newer distfiles will get | | 472 | NetBSD. Furthermore, any user that gets newer distfiles will get |
468 | the fixes straight from the packaged code.</para> | | 473 | the fixes straight from the packaged code.</para> |
469 | | | 474 | |
470 | <para>This generally involves cleaning up the patches | | 475 | <para>This generally involves cleaning up the patches |
471 | (because sometimes the patches that are | | 476 | (because sometimes the patches that are |
472 | added to pkgsrc are quick hacks), filing bug reports in the | | 477 | added to pkgsrc are quick hacks), filing bug reports in the |
473 | appropriate trackers for the projects and working with the | | 478 | appropriate trackers for the projects and working with the |
474 | mainstream authors to accept your changes. It is | | 479 | mainstream authors to accept your changes. It is |
475 | <emphasis>extremely important</emphasis> that you do it so that | | 480 | <emphasis>extremely important</emphasis> that you do it so that |
476 | the packages in pkgsrc are kept simple and thus further changes | | 481 | the packages in pkgsrc are kept simple and thus further changes |
477 | can be done without much hassle.</para> | | 482 | can be done without much hassle.</para> |
478 | | | 483 | |
479 | <para>When you have done this, please add a URL to the upstream | | 484 | <para>When you have done this, please add a URL to the upstream |
480 | bug report to the patch comment.</para> | | 485 | bug report to the patch comment.</para> |
481 | | | 486 | |
482 | <para>Support the idea of free software!</para> | | 487 | <para>Support the idea of free software!</para> |
483 | | | 488 | |
484 | </sect2> | | 489 | </sect2> |
485 | | | 490 | |
486 | </sect1> | | 491 | </sect1> |
487 | | | 492 | |
488 | <sect1 id="other-mandatory-files"> | | 493 | <sect1 id="other-mandatory-files"> |
489 | <title>Other mandatory files</title> | | 494 | <title>Other mandatory files</title> |
490 | | | 495 | |
491 | <variablelist> | | 496 | <variablelist> |
492 | <varlistentry> | | 497 | <varlistentry> |
493 | <term><filename>DESCR</filename></term> | | 498 | <term><filename>DESCR</filename></term> |
494 | | | 499 | |
495 | <listitem> | | 500 | <listitem> |
496 | <para>A multi-line description of the piece of software. This should include | | 501 | <para>A multi-line description of the piece of software. This should include |
497 | any credits where they are due. Please bear in mind that others do not | | 502 | any credits where they are due. Please bear in mind that others do not |
498 | share your sense of humour (or spelling idiosyncrasies), and that others | | 503 | share your sense of humour (or spelling idiosyncrasies), and that others |
499 | will read everything that you write here.</para> | | 504 | will read everything that you write here.</para> |
500 | </listitem> | | 505 | </listitem> |
501 | </varlistentry> | | 506 | </varlistentry> |
502 | | | 507 | |
503 | <varlistentry> | | 508 | <varlistentry> |
504 | <term><filename>PLIST</filename></term> | | 509 | <term><filename>PLIST</filename></term> |
505 | | | 510 | |
506 | <listitem> | | 511 | <listitem> |
507 | <para>This file governs the files that are installed on your | | 512 | <para>This file governs the files that are installed on your |
508 | system: all the binaries, manual pages, etc. There are other | | 513 | system: all the binaries, manual pages, etc. There are other |
509 | directives which may be entered in this file, to control the | | 514 | directives which may be entered in this file, to control the |
510 | creation and deletion of directories, and the location of | | 515 | creation and deletion of directories, and the location of |
511 | inserted files. See <xref linkend="plist"/> for more | | 516 | inserted files. See <xref linkend="plist"/> for more |
512 | information.</para> | | 517 | information.</para> |
513 | </listitem> | | 518 | </listitem> |
514 | </varlistentry> | | 519 | </varlistentry> |
515 | </variablelist> | | 520 | </variablelist> |
516 | </sect1> | | 521 | </sect1> |
517 | | | 522 | |
518 | <sect1 id="components.optional"> | | 523 | <sect1 id="components.optional"> |
519 | <title>Optional files</title> | | 524 | <title>Optional files</title> |
520 | | | 525 | |
521 | <sect2 id="components.optional.bin"> | | 526 | <sect2 id="components.optional.bin"> |
522 | <title>Files affecting the binary package</title> | | 527 | <title>Files affecting the binary package</title> |
523 | | | 528 | |
524 | <variablelist> | | 529 | <variablelist> |
525 | <varlistentry> | | 530 | <varlistentry> |
526 | <term><filename>INSTALL</filename></term> | | 531 | <term><filename>INSTALL</filename></term> |
527 | | | 532 | |
528 | <listitem> | | 533 | <listitem> |
529 | <para>This shell script is invoked twice by &man.pkg.add.1;. | | 534 | <para>This shell script is invoked twice by &man.pkg.add.1;. |
530 | First time after package extraction and before files are | | 535 | First time after package extraction and before files are |
531 | moved in place, the second time after the files to install | | 536 | moved in place, the second time after the files to install |
532 | are moved in place. This can be used to do any custom | | 537 | are moved in place. This can be used to do any custom |
533 | procedures not possible with @exec commands in | | 538 | procedures not possible with @exec commands in |
534 | <filename>PLIST</filename>. See &man.pkg.add.1; and | | 539 | <filename>PLIST</filename>. See &man.pkg.add.1; and |
535 | &man.pkg.create.1; for more information. See also <xref | | 540 | &man.pkg.create.1; for more information. See also <xref |
536 | linkend="files-and-dirs-outside-prefix" />. | | 541 | linkend="files-and-dirs-outside-prefix" />. |
537 | Please note that you can modify variables in it easily by using | | 542 | Please note that you can modify variables in it easily by using |
538 | <varname>FILES_SUBST</varname> in the package's | | 543 | <varname>FILES_SUBST</varname> in the package's |
539 | <filename>Makefile</filename>:</para> | | 544 | <filename>Makefile</filename>:</para> |
540 | | | 545 | |
541 | <programlisting> | | 546 | <programlisting> |
542 | FILES_SUBST+= SOMEVAR="somevalue" | | 547 | FILES_SUBST+= SOMEVAR="somevalue" |
543 | </programlisting> | | 548 | </programlisting> |
544 | | | 549 | |
545 | <para>replaces "@SOMEVAR@" with <quote>somevalue</quote> in the | | 550 | <para>replaces "@SOMEVAR@" with <quote>somevalue</quote> in the |
546 | <filename>INSTALL</filename>. By default, substitution is | | 551 | <filename>INSTALL</filename>. By default, substitution is |
547 | performed for <varname>PREFIX</varname>, | | 552 | performed for <varname>PREFIX</varname>, |
548 | <varname>LOCALBASE</varname>, <varname>X11BASE</varname>, | | 553 | <varname>LOCALBASE</varname>, <varname>X11BASE</varname>, |
549 | <varname>VARBASE</varname>, and a few others, type | | 554 | <varname>VARBASE</varname>, and a few others, type |
550 | <command>make help topic=FILES_SUBST</command> for a | | 555 | <command>make help topic=FILES_SUBST</command> for a |
551 | complete list.</para> | | 556 | complete list.</para> |
552 | </listitem> | | 557 | </listitem> |
553 | </varlistentry> | | 558 | </varlistentry> |
554 | | | 559 | |
555 | <varlistentry> | | 560 | <varlistentry> |
556 | <term><filename>DEINSTALL</filename></term> | | 561 | <term><filename>DEINSTALL</filename></term> |
557 | | | 562 | |
558 | <listitem> | | 563 | <listitem> |
559 | <para>This script is executed before and after any files are removed. It is | | 564 | <para>This script is executed before and after any files are removed. It is |
560 | this script's responsibility to clean up any additional messy details | | 565 | this script's responsibility to clean up any additional messy details |
561 | around the package's installation, since all pkg_delete knows is how to | | 566 | around the package's installation, since all pkg_delete knows is how to |
562 | delete the files created in the original distribution. | | 567 | delete the files created in the original distribution. |
563 | See &man.pkg.delete.1; | | 568 | See &man.pkg.delete.1; |
564 | and &man.pkg.create.1; for more information. | | 569 | and &man.pkg.create.1; for more information. |
565 | The same methods to replace variables can be used as for | | 570 | The same methods to replace variables can be used as for |
566 | the <filename>INSTALL</filename> file.</para> | | 571 | the <filename>INSTALL</filename> file.</para> |
567 | </listitem> | | 572 | </listitem> |
568 | </varlistentry> | | 573 | </varlistentry> |
569 | | | 574 | |
570 | <varlistentry> | | 575 | <varlistentry> |
571 | <term><filename>MESSAGE</filename></term> | | 576 | <term><filename>MESSAGE</filename></term> |
572 | | | 577 | |
573 | <listitem> | | 578 | <listitem> |
574 | <para>This file is displayed after installation of the package. | | 579 | <para>This file is displayed after installation of the package. |
575 | While this was used often in the past, it has two | | 580 | While this was used often in the past, it has two |
576 | problems: the display will be missed if many packages are | | 581 | problems: the display will be missed if many packages are |
577 | intalled at once, and the person installing the package | | 582 | intalled at once, and the person installing the package |
578 | and the one using or configuring it may be different. It | | 583 | and the one using or configuring it may be different. It |
579 | should therefore be used only in exceptional circumstances | | 584 | should therefore be used only in exceptional circumstances |
580 | where lasting negative consequences would result from | | 585 | where lasting negative consequences would result from |
581 | someone not reading it.</para> | | 586 | someone not reading it.</para> |
582 | <para>MESSAGE should not be used for:</para> | | 587 | <para>MESSAGE should not be used for:</para> |
583 | <itemizedlist> | | 588 | <itemizedlist> |
584 | <listitem><para>exhortations to read the documentation</para></listitem> | | 589 | <listitem><para>exhortations to read the documentation</para></listitem> |
585 | <listitem><para>reminders to install rc.d files and set variables</para></listitem> | | 590 | <listitem><para>reminders to install rc.d files and set variables</para></listitem> |
586 | <listitem><para>anything that should be explained in the | | 591 | <listitem><para>anything that should be explained in the |
587 | installation/configuration documentation that should | | 592 | installation/configuration documentation that should |
588 | come with the package</para></listitem> | | 593 | come with the package</para></listitem> |
589 | </itemizedlist> | | 594 | </itemizedlist> |
590 | <para>If the documentation provided by upstream needs | | 595 | <para>If the documentation provided by upstream needs |
591 | enhancing, create e.g. files/README.pkgsrc and install it | | 596 | enhancing, create e.g. files/README.pkgsrc and install it |
592 | in the package's documentation directory. | | 597 | in the package's documentation directory. |
593 | </para> | | 598 | </para> |
594 | <para>Note that MESSAGE is shown for all operating | | 599 | <para>Note that MESSAGE is shown for all operating |
595 | systems and all init systems. If a MESSAGE is necessary, | | 600 | systems and all init systems. If a MESSAGE is necessary, |
596 | it should be narrowed to only those operating systems and | | 601 | it should be narrowed to only those operating systems and |
597 | init systems to which it applies.</para> | | 602 | init systems to which it applies.</para> |
598 | <para>Note that you can modify variables in it easily by using | | 603 | <para>Note that you can modify variables in it easily by using |
599 | <varname>MESSAGE_SUBST</varname> in the package's | | 604 | <varname>MESSAGE_SUBST</varname> in the package's |
600 | <filename>Makefile</filename>:</para> | | 605 | <filename>Makefile</filename>:</para> |
601 | | | 606 | |
602 | <programlisting> | | 607 | <programlisting> |
603 | MESSAGE_SUBST+= SOMEVAR="somevalue" | | 608 | MESSAGE_SUBST+= SOMEVAR="somevalue" |
604 | </programlisting> | | 609 | </programlisting> |
605 | | | 610 | |
606 | <para>replaces "${SOMEVAR}" with <quote>somevalue</quote> in | | 611 | <para>replaces "${SOMEVAR}" with <quote>somevalue</quote> in |
607 | <filename>MESSAGE</filename>. By default, substitution is | | 612 | <filename>MESSAGE</filename>. By default, substitution is |
608 | performed for <varname>PKGNAME</varname>, | | 613 | performed for <varname>PKGNAME</varname>, |
609 | <varname>PKGBASE</varname>, <varname>PREFIX</varname>, | | 614 | <varname>PKGBASE</varname>, <varname>PREFIX</varname>, |
610 | <varname>LOCALBASE</varname>, <varname>X11BASE</varname>, | | 615 | <varname>LOCALBASE</varname>, <varname>X11BASE</varname>, |
611 | <varname>PKG_SYSCONFDIR</varname>, | | 616 | <varname>PKG_SYSCONFDIR</varname>, |
612 | <varname>ROOT_GROUP</varname>, and | | 617 | <varname>ROOT_GROUP</varname>, and |
613 | <varname>ROOT_USER</varname>.</para> | | 618 | <varname>ROOT_USER</varname>.</para> |
614 | | | 619 | |
615 | <para>You can display a different or additional files by | | 620 | <para>You can display a different or additional files by |
616 | setting the <varname>MESSAGE_SRC</varname> variable. Its | | 621 | setting the <varname>MESSAGE_SRC</varname> variable. Its |
617 | default is <filename>MESSAGE</filename>, if the file | | 622 | default is <filename>MESSAGE</filename>, if the file |
618 | exists.</para> | | 623 | exists.</para> |
619 | </listitem> | | 624 | </listitem> |
620 | </varlistentry> | | 625 | </varlistentry> |
621 | | | 626 | |
622 | <varlistentry> | | 627 | <varlistentry> |
623 | <term><filename>ALTERNATIVES</filename></term> | | 628 | <term><filename>ALTERNATIVES</filename></term> |
624 | | | 629 | |
625 | <listitem> | | 630 | <listitem> |
626 | <para>This file is used by the alternatives framework. | | 631 | <para>This file is used by the alternatives framework. |
627 | It creates, configures, and destroys generic wrappers used to | | 632 | It creates, configures, and destroys generic wrappers used to |
628 | run programs with similar interfaces. | | 633 | run programs with similar interfaces. |
629 | See pkg_alternatives(8) from pkgtools/pkg_alternatives | | 634 | See pkg_alternatives(8) from pkgtools/pkg_alternatives |
630 | for more information.</para> | | 635 | for more information.</para> |
631 | | | 636 | |
632 | <para>Each line of the file contains two filenames, first | | 637 | <para>Each line of the file contains two filenames, first |
633 | the wrapper and then the alternative provided by the package. | | 638 | the wrapper and then the alternative provided by the package. |
634 | Both paths are relative to <varname>PREFIX</varname>.</para> | | 639 | Both paths are relative to <varname>PREFIX</varname>.</para> |
635 | </listitem> | | 640 | </listitem> |
636 | </varlistentry> | | 641 | </varlistentry> |
637 | | | 642 | |
638 | </variablelist> | | 643 | </variablelist> |
639 | | | 644 | |
640 | </sect2> | | 645 | </sect2> |
641 | <sect2 id="components.optional.build"> | | 646 | <sect2 id="components.optional.build"> |
642 | <title>Files affecting the build process</title> | | 647 | <title>Files affecting the build process</title> |
643 | | | 648 | |
644 | <variablelist> | | 649 | <variablelist> |
645 | | | 650 | |
646 | <varlistentry><term><filename>Makefile.common</filename></term> | | 651 | <varlistentry><term><filename>Makefile.common</filename></term> |
647 | <listitem><para>This file contains arbitrary things that could | | 652 | <listitem><para>This file contains arbitrary things that could |
648 | also go into a <filename>Makefile</filename>, but its purpose is | | 653 | also go into a <filename>Makefile</filename>, but its purpose is |
649 | to be used by more than one package. This file should only be | | 654 | to be used by more than one package. This file should only be |
650 | used when the packages that will use the file are known in | | 655 | used when the packages that will use the file are known in |
651 | advance. For other purposes it is often better to write a | | 656 | advance. For other purposes it is often better to write a |
652 | <filename>*.mk</filename> file and give it a good name that | | 657 | <filename>*.mk</filename> file and give it a good name that |
653 | describes what it does.</para></listitem></varlistentry> | | 658 | describes what it does.</para></listitem></varlistentry> |
654 | | | 659 | |
655 | <varlistentry><term><filename>buildlink3.mk</filename></term> | | 660 | <varlistentry><term><filename>buildlink3.mk</filename></term> |
656 | <listitem><para>This file contains the dependency information | | 661 | <listitem><para>This file contains the dependency information |
657 | for the buildlink3 framework (see <xref | | 662 | for the buildlink3 framework (see <xref |
658 | linkend="buildlink"/>).</para></listitem></varlistentry> | | 663 | linkend="buildlink"/>).</para></listitem></varlistentry> |
659 | | | 664 | |
660 | <varlistentry><term><filename>hacks.mk</filename></term> | | 665 | <varlistentry><term><filename>hacks.mk</filename></term> |
661 | <listitem><para>This file contains workarounds for compiler bugs | | 666 | <listitem><para>This file contains workarounds for compiler bugs |
662 | and similar things. It is included automatically by the pkgsrc | | 667 | and similar things. It is included automatically by the pkgsrc |
663 | infrastructure, so you don't need an extra | | 668 | infrastructure, so you don't need an extra |
664 | <literal>.include</literal> line for | | 669 | <literal>.include</literal> line for |
665 | it.</para></listitem></varlistentry> | | 670 | it.</para></listitem></varlistentry> |
666 | | | 671 | |
667 | <varlistentry><term><filename>options.mk</filename></term> | | 672 | <varlistentry><term><filename>options.mk</filename></term> |
668 | <listitem><para>This file contains the code for the | | 673 | <listitem><para>This file contains the code for the |
669 | package-specific options (see <xref linkend="options"/>) that can be | | 674 | package-specific options (see <xref linkend="options"/>) that can be |
670 | selected by the user. If a package has only one or two options, | | 675 | selected by the user. If a package has only one or two options, |
671 | it is equally acceptable to put the code directly into the | | 676 | it is equally acceptable to put the code directly into the |
672 | <filename>Makefile</filename>.</para></listitem></varlistentry> | | 677 | <filename>Makefile</filename>.</para></listitem></varlistentry> |
673 | | | 678 | |
674 | </variablelist> | | 679 | </variablelist> |
675 | | | 680 | |
676 | </sect2> | | 681 | </sect2> |
677 | <sect2 id="components.optional.none"> | | 682 | <sect2 id="components.optional.none"> |
678 | <title>Files affecting nothing at all</title> | | 683 | <title>Files affecting nothing at all</title> |
679 | | | 684 | |
680 | <variablelist> | | 685 | <variablelist> |
681 | | | 686 | |
682 | <varlistentry><term><filename>README*</filename></term> | | 687 | <varlistentry><term><filename>README*</filename></term> |
683 | <listitem><para>These files do not take place in the creation of | | 688 | <listitem><para>These files do not take place in the creation of |
684 | a package and thus are purely informative to the package | | 689 | a package and thus are purely informative to the package |
685 | developer.</para></listitem></varlistentry> | | 690 | developer.</para></listitem></varlistentry> |
686 | | | 691 | |
687 | <varlistentry><term><filename>TODO</filename></term> | | 692 | <varlistentry><term><filename>TODO</filename></term> |
688 | <listitem><para>This file contains things that need to be done | | 693 | <listitem><para>This file contains things that need to be done |
689 | to make the package even | | 694 | to make the package even |
690 | better.</para></listitem></varlistentry> | | 695 | better.</para></listitem></varlistentry> |
691 | | | 696 | |
692 | </variablelist> | | 697 | </variablelist> |
693 | | | 698 | |
694 | </sect2> | | 699 | </sect2> |
695 | </sect1> | | 700 | </sect1> |
696 | | | 701 | |
697 | <sect1 id="work-dir"> | | 702 | <sect1 id="work-dir"> |
698 | <title><filename>work*</filename></title> | | 703 | <title><filename>work*</filename></title> |
699 | | | 704 | |
700 | <para>When you type <command>make</command>, the distribution files are | | 705 | <para>When you type <command>make</command>, the distribution files are |
701 | unpacked into the directory denoted by | | 706 | unpacked into the directory denoted by |
702 | <varname>WRKDIR</varname>. It can be removed by running | | 707 | <varname>WRKDIR</varname>. It can be removed by running |
703 | <command>make clean</command>. Besides the sources, this | | 708 | <command>make clean</command>. Besides the sources, this |
704 | directory is also used to keep various timestamp files. | | 709 | directory is also used to keep various timestamp files. |
705 | The directory gets <emphasis>removed completely</emphasis> on clean. | | 710 | The directory gets <emphasis>removed completely</emphasis> on clean. |
706 | The default is <filename>${.CURDIR}/work</filename> | | 711 | The default is <filename>${.CURDIR}/work</filename> |
707 | or <filename>${.CURDIR}/work.${MACHINE_ARCH}</filename> | | 712 | or <filename>${.CURDIR}/work.${MACHINE_ARCH}</filename> |
708 | if <varname>OBJMACHINE</varname> is set.</para> | | 713 | if <varname>OBJMACHINE</varname> is set.</para> |
709 | </sect1> | | 714 | </sect1> |
710 | | | 715 | |
711 | <sect1 id="files-dir"> | | 716 | <sect1 id="files-dir"> |
712 | <title><filename>files/*</filename></title> | | 717 | <title><filename>files/*</filename></title> |
713 | | | 718 | |
714 | <para>If you have any files that you wish to be placed in the package | | 719 | <para>If you have any files that you wish to be placed in the package |
715 | prior to configuration or building, you can place these files here | | 720 | prior to configuration or building, you can place these files here |
716 | and use a <command>${CP}</command> command in the | | 721 | and use a <command>${CP}</command> command in the |
717 | <quote>post-extract</quote> target to achieve this.</para> | | 722 | <quote>post-extract</quote> target to achieve this.</para> |
718 | | | 723 | |
719 | <para>If you want to share files in this way with other | | 724 | <para>If you want to share files in this way with other |
720 | packages, set the <varname>FILESDIR</varname> variable to point | | 725 | packages, set the <varname>FILESDIR</varname> variable to point |
721 | to the other package's <filename>files</filename> directory, | | 726 | to the other package's <filename>files</filename> directory, |
722 | e.g.:</para> | | 727 | e.g.:</para> |
723 | <programlisting> | | 728 | <programlisting> |
724 | FILESDIR= ../../editors/xemacs/files | | 729 | FILESDIR= ../../editors/xemacs/files |
725 | </programlisting> | | 730 | </programlisting> |
726 | </sect1> | | 731 | </sect1> |
727 | </chapter> | | 732 | </chapter> |