Sat Jan 18 20:18:50 2014 UTC ()
Fix typo.


(wiz)
diff -r1.15 -r1.16 pkgsrc/doc/guide/files/creating.xml

cvs diff -r1.15 -r1.16 pkgsrc/doc/guide/files/creating.xml (switch to unified diff)

--- pkgsrc/doc/guide/files/creating.xml 2014/01/18 20:17:10 1.15
+++ pkgsrc/doc/guide/files/creating.xml 2014/01/18 20:18:50 1.16
@@ -1,449 +1,449 @@ @@ -1,449 +1,449 @@
1<!-- $NetBSD: creating.xml,v 1.15 2014/01/18 20:17:10 wiz Exp $ --> 1<!-- $NetBSD: creating.xml,v 1.16 2014/01/18 20:18:50 wiz Exp $ -->
2 2
3<chapter id="creating"> 3<chapter id="creating">
4<title>Creating a new pkgsrc package from scratch</title> 4<title>Creating a new pkgsrc package from scratch</title>
5 5
6<para>When you find a package that is not yet in pkgsrc, you 6<para>When you find a package that is not yet in pkgsrc, you
7most likely have a URL from where you can download the source 7most likely have a URL from where you can download the source
8code. Starting with this URL, creating a package involves only a 8code. Starting with this URL, creating a package involves only a
9few steps.</para> 9few steps.</para>
10 10
11<procedure> 11<procedure>
12 12
13<step><para>First, install the packages <filename 13<step><para>First, install the packages <filename
14role="pkg">pkgtools/url2pkg</filename> and <filename 14role="pkg">pkgtools/url2pkg</filename> and <filename
15role="pkg">pkgtools/pkglint</filename>.</para></step> 15role="pkg">pkgtools/pkglint</filename>.</para></step>
16 16
17<step><para>Then, choose one of the top-level directories as the 17<step><para>Then, choose one of the top-level directories as the
18category in which you want to place your package. You can also create a 18category in which you want to place your package. You can also create a
19directory of your own (maybe called <filename>local</filename>). In that 19directory of your own (maybe called <filename>local</filename>). In that
20category directory, create another directory for your package and change 20category directory, create another directory for your package and change
21into it.</para></step> 21into it.</para></step>
22 22
23<step><para>Run the program <command>url2pkg</command>, which will ask 23<step><para>Run the program <command>url2pkg</command>, which will ask
24you for a URL. Enter the URL of the distribution file (in most cases a 24you for a URL. Enter the URL of the distribution file (in most cases a
25<filename>.tar.gz</filename> file) and watch how the basic ingredients 25<filename>.tar.gz</filename> file) and watch how the basic ingredients
26of your package are created automatically. The distribution file is 26of your package are created automatically. The distribution file is
27extracted automatically to fill in some details in the 27extracted automatically to fill in some details in the
28<filename>Makefile</filename> that would otherwise have to be done 28<filename>Makefile</filename> that would otherwise have to be done
29manually.</para></step> 29manually.</para></step>
30 30
31<step><para>Examine the extracted files to determine the dependencies of 31<step><para>Examine the extracted files to determine the dependencies of
32your package. Ideally, this is mentioned in some 32your package. Ideally, this is mentioned in some
33<filename>README</filename> file, but things may differ. For each of 33<filename>README</filename> file, but things may differ. For each of
34these dependencies, look where it exists in pkgsrc, and if there is a 34these dependencies, look where it exists in pkgsrc, and if there is a
35file called <filename>buildlink3.mk</filename> in that directory, add a 35file called <filename>buildlink3.mk</filename> in that directory, add a
36line to your package <filename>Makefile</filename> which includes that 36line to your package <filename>Makefile</filename> which includes that
37file just before the last line. If the 37file just before the last line. If the
38<filename>buildlink3.mk</filename> file does not exist, it must be 38<filename>buildlink3.mk</filename> file does not exist, it must be
39created first. The <filename>buildlink3.mk</filename> file makes sure that the package's include files and libraries are provided.</para> 39created first. The <filename>buildlink3.mk</filename> file makes sure that the package's include files and libraries are provided.</para>
40 40
41<para>If you just need binaries from a package, add a 41<para>If you just need binaries from a package, add a
42<varname>DEPENDS</varname> line to the Makefile, which specifies the 42<varname>DEPENDS</varname> line to the Makefile, which specifies the
43version of the dependency and where it can be found in pkgsrc. This line 43version of the dependency and where it can be found in pkgsrc. This line
44should be placed in the third paragraph. If the dependency is only 44should be placed in the third paragraph. If the dependency is only
45needed for building the package, but not when using it, use 45needed for building the package, but not when using it, use
46<varname>BUILD_DEPENDS</varname> instead of <varname>DEPENDS</varname>. 46<varname>BUILD_DEPENDS</varname> instead of <varname>DEPENDS</varname>.
47Your package may then look like this:</para> 47Your package may then look like this:</para>
48 48
49<programlisting> 49<programlisting>
50[...] 50[...]
51 51
52BUILD_DEPENDS+= lua>=5.0:../../lang/lua 52BUILD_DEPENDS+= lua>=5.0:../../lang/lua
53DEPENDS+= screen-[0-9]*:../../misc/screen 53DEPENDS+= screen-[0-9]*:../../misc/screen
54DEPENDS+= screen>=4.0:../../misc/screen 54DEPENDS+= screen>=4.0:../../misc/screen
55 55
56[...] 56[...]
57 57
58.include "../../<replaceable>category</replaceable>/<replaceable>package</replaceable>/buildlink3.mk" 58.include "../../<replaceable>category</replaceable>/<replaceable>package</replaceable>/buildlink3.mk"
59.include "../../devel/glib2/buildlink3.mk" 59.include "../../devel/glib2/buildlink3.mk"
60.include "../../mk/bsd.pkg.mk" 60.include "../../mk/bsd.pkg.mk"
61</programlisting> 61</programlisting>
62 62
63</step> 63</step>
64 64
65<step><para>Run <command>pkglint</command> to see what things still need 65<step><para>Run <command>pkglint</command> to see what things still need
66to be done to make your package a <quote>good</quote> one. If you don't 66to be done to make your package a <quote>good</quote> one. If you don't
67know what pkglint's warnings want to tell you, try <command>pkglint 67know what pkglint's warnings want to tell you, try <command>pkglint
68--explain</command> or <command>pkglint 68--explain</command> or <command>pkglint
69-e</command>, which outputs additional 69-e</command>, which outputs additional
70explanations.</para></step> 70explanations.</para></step>
71 71
72<step><para>In many cases the package is not yet ready to build. You can 72<step><para>In many cases the package is not yet ready to build. You can
73find instructions for the most common cases in the next section, <xref 73find instructions for the most common cases in the next section, <xref
74linkend="creating.common"/>. After you have followed the instructions 74linkend="creating.common"/>. After you have followed the instructions
75over there, you can hopefully continue here.</para></step> 75over there, you can hopefully continue here.</para></step>
76 76
77<step><para>Run <command>bmake clean</command> to clean the working 77<step><para>Run <command>bmake clean</command> to clean the working
78directory from the extracted files. Besides these files, a lot of cache 78directory from the extracted files. Besides these files, a lot of cache
79files and other system information has been saved in the working 79files and other system information has been saved in the working
80directory, which may become wrong after you edited the 80directory, which may become wrong after you edited the
81<filename>Makefile</filename>.</para></step> 81<filename>Makefile</filename>.</para></step>
82 82
83<step><para>Now, run <command>bmake</command> to build the package. For 83<step><para>Now, run <command>bmake</command> to build the package. For
84the various things that can go wrong in this phase, consult <xref 84the various things that can go wrong in this phase, consult <xref
85linkend="fixes"/>.</para></step> 85linkend="fixes"/>.</para></step>
86 86
87<step><para>When the package builds fine, the next step is to install 87<step><para>When the package builds fine, the next step is to install
88the package. Run <command>bmake install</command> and hope that 88the package. Run <command>bmake install</command> and hope that
89everything works.</para></step> 89everything works.</para></step>
90 90
91<step><para>Up to now, the file <filename>PLIST</filename>, which 91<step><para>Up to now, the file <filename>PLIST</filename>, which
92contains a list of the files that are installed by the package, is 92contains a list of the files that are installed by the package, is
93nearly empty. Run <command>bmake print-PLIST 93nearly empty. Run <command>bmake print-PLIST
94&gt;PLIST</command> to generate a probably correct list. Check 94&gt;PLIST</command> to generate a probably correct list. Check
95the file using your preferred text editor to see if the list of 95the file using your preferred text editor to see if the list of
96files looks plausible.</para></step> 96files looks plausible.</para></step>
97 97
98<step><para>Run <command>pkglint</command> again to see if the generated 98<step><para>Run <command>pkglint</command> again to see if the generated
99<filename>PLIST</filename> contains garbage or not.</para></step> 99<filename>PLIST</filename> contains garbage or not.</para></step>
100 100
101<step><para>When you ran <command>bmake install</command>, the package 101<step><para>When you ran <command>bmake install</command>, the package
102has been registered in the database of installed files, but with an 102has been registered in the database of installed files, but with an
103empty list of files. To fix this, run <command>bmake deinstall</command> 103empty list of files. To fix this, run <command>bmake deinstall</command>
104and <command>bmake install</command> again. Now the package is 104and <command>bmake install</command> again. Now the package is
105registered with the list of files from 105registered with the list of files from
106<filename>PLIST</filename>.</para></step> 106<filename>PLIST</filename>.</para></step>
107 107
108<step><para>Run <command>bmake package</command> to create a binary 108<step><para>Run <command>bmake package</command> to create a binary
109package from the set of installed files.</para></step> 109package from the set of installed files.</para></step>
110 110
111</procedure> 111</procedure>
112 112
113<sect1 id="creating.common"> 113<sect1 id="creating.common">
114<title>Common types of packages</title> 114<title>Common types of packages</title>
115 115
116<sect2 id="creating.perl-module"> 116<sect2 id="creating.perl-module">
117<title>Perl modules</title> 117<title>Perl modules</title>
118 118
119<para>Simple Perl modules are handled automatically by 119<para>Simple Perl modules are handled automatically by
120<command>url2pkg</command>, including dependencies.</para> 120<command>url2pkg</command>, including dependencies.</para>
121 121
122</sect2> 122</sect2>
123 123
124<sect2 id="creating.kde-app"> 124<sect2 id="creating.kde-app">
125<title>KDE applications</title> 125<title>KDE applications</title>
126 126
127<para>KDE applications should always include 127<para>KDE applications should always include
128<filename>meta-pkgs/kde3/kde3.mk</filename>, which contains numerous 128<filename>meta-pkgs/kde3/kde3.mk</filename>, which contains numerous
129settings that are typical of KDE packages.</para> 129settings that are typical of KDE packages.</para>
130 130
131</sect2> 131</sect2>
132 132
133<sect2 id="creating.python-module"> 133<sect2 id="creating.python-module">
134<title>Python modules and programs</title> 134<title>Python modules and programs</title>
135 135
136<para>Python modules and programs packages are easily created using a 136<para>Python modules and programs packages are easily created using a
137set of predefined variables.</para> 137set of predefined variables.</para>
138 138
139<para> 139<para>
140If some Python versions are not supported by the software, set the 140If some Python versions are not supported by the software, set the
141<varname>PYTHON_VERSIONS_INCOMPATIBLE</varname> variable to the Python versions 141<varname>PYTHON_VERSIONS_INCOMPATIBLE</varname> variable to the Python versions
142that are not supported, e.g. 142that are not supported, e.g.
143<programlisting> 143<programlisting>
144PYTHON_VERSIONS_ACCEPTED= 26 144PYTHON_VERSIONS_INCOMPATIBLE= 26
145</programlisting></para> 145</programlisting></para>
146 146
147<para> 147<para>
148If the packaged software is a Python module, include 148If the packaged software is a Python module, include
149<quote><filename>../../lang/python/extension.mk</filename></quote>. 149<quote><filename>../../lang/python/extension.mk</filename></quote>.
150In this case, the package directory should be called 150In this case, the package directory should be called
151<quote>py-software</quote> and <varname>PKGNAME</varname> should be set to 151<quote>py-software</quote> and <varname>PKGNAME</varname> should be set to
152<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g. 152<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g.
153<programlisting> 153<programlisting>
154DISTNAME= foopymodule-1.2.10 154DISTNAME= foopymodule-1.2.10
155PKGNAME= ${PYPKGPREFIX}-${DISTNAME} 155PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
156</programlisting></para> 156</programlisting></para>
157 157
158<para>If it is an application, include 158<para>If it is an application, include
159<quote><filename>../../lang/python/application.mk</filename></quote>. 159<quote><filename>../../lang/python/application.mk</filename></quote>.
160In order to correctly set the path to the Python interpreter, use the 160In order to correctly set the path to the Python interpreter, use the
161<varname>REPLACE_PYTHON</varname> variable and set it to the list of files 161<varname>REPLACE_PYTHON</varname> variable and set it to the list of files
162(paths relative to <varname>WRKSRC</varname>) that must be corrected. 162(paths relative to <varname>WRKSRC</varname>) that must be corrected.
163For example: 163For example:
164<programlisting> 164<programlisting>
165REPLACE_PYTHON= *.py 165REPLACE_PYTHON= *.py
166</programlisting></para> 166</programlisting></para>
167 167
168<para>Most Python packages use either <quote>distutils</quote> or 168<para>Most Python packages use either <quote>distutils</quote> or
169easy-setup (<quote>eggs</quote>). 169easy-setup (<quote>eggs</quote>).
170If the software uses <quote>distutils</quote>, include  170If the software uses <quote>distutils</quote>, include
171<quote><filename>../../lang/python/distutils.mk</filename></quote>. 171<quote><filename>../../lang/python/distutils.mk</filename></quote>.
172so pkgsrc will use this framework. 172so pkgsrc will use this framework.
173<quote>distutils</quote> uses a script called <filename>setup.py</filename>, 173<quote>distutils</quote> uses a script called <filename>setup.py</filename>,
174if the <quote>distutils</quote> driver is not called 174if the <quote>distutils</quote> driver is not called
175<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable 175<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable
176to the name of the script.</para> 176to the name of the script.</para>
177 177
178<para>Otherwise, if the packaged software is egg-aware, you only need 178<para>Otherwise, if the packaged software is egg-aware, you only need
179to include 179to include
180<quote><filename>../../lang/python/egg.mk</filename></quote>.</para> 180<quote><filename>../../lang/python/egg.mk</filename></quote>.</para>
181 181
182<para>Some Python modules have separate distributions for Python-2.x 182<para>Some Python modules have separate distributions for Python-2.x
183and Python-3.x support. In pkgsrc this is handled by the 183and Python-3.x support. In pkgsrc this is handled by the
184<filename>versioned_dependencies.mk</filename> file. Set 184<filename>versioned_dependencies.mk</filename> file. Set
185<varname>PYTHON_VERSIONED_DEPENDENCIES</varname> to the list of 185<varname>PYTHON_VERSIONED_DEPENDENCIES</varname> to the list of
186packages that should be depended upon and include 186packages that should be depended upon and include
187<quote><filename>../../lang/python/versioned_dependencies.mk</filename></quote>, 187<quote><filename>../../lang/python/versioned_dependencies.mk</filename></quote>,
188then the pkgsrc infrastructure will depend on the appropriate package 188then the pkgsrc infrastructure will depend on the appropriate package
189version. For example: 189version. For example:
190<programlisting> 190<programlisting>
191PYTHON_VERSIONED_DEPENDENCIES=dateutil dns 191PYTHON_VERSIONED_DEPENDENCIES=dateutil dns
192</programlisting> 192</programlisting>
193Look inside <filename>versioned_dependencies.mk</filename> for a list 193Look inside <filename>versioned_dependencies.mk</filename> for a list
194of supported packages.</para> 194of supported packages.</para>
195</sect2> 195</sect2>
196 196
197</sect1> 197</sect1>
198 198
199<sect1 id="creating.examples"> 199<sect1 id="creating.examples">
200<title>Examples</title> 200<title>Examples</title>
201 201
202<sect2 id="creating.nvu"> 202<sect2 id="creating.nvu">
203<title>How the www/nvu package came into pkgsrc</title> 203<title>How the www/nvu package came into pkgsrc</title>
204 204
205<sect3 id="creating.nvu.init"> 205<sect3 id="creating.nvu.init">
206<title>The initial package</title> 206<title>The initial package</title>
207 207
208<para>Looking at the file <filename>pkgsrc/doc/TODO</filename>, I saw 208<para>Looking at the file <filename>pkgsrc/doc/TODO</filename>, I saw
209that the <quote>nvu</quote> package has not yet been imported into 209that the <quote>nvu</quote> package has not yet been imported into
210pkgsrc. As the description says it has to do with the web, the obvious 210pkgsrc. As the description says it has to do with the web, the obvious
211choice for the category is <quote>www</quote>.</para> 211choice for the category is <quote>www</quote>.</para>
212 212
213<programlisting> 213<programlisting>
214&uprompt; mkdir www/nvu 214&uprompt; mkdir www/nvu
215&uprompt; cd www/nvu 215&uprompt; cd www/nvu
216</programlisting> 216</programlisting>
217 217
218<para>The web site says that the sources are available as a tar file, so 218<para>The web site says that the sources are available as a tar file, so
219I fed that URL to the <command>url2pkg</command> program:</para> 219I fed that URL to the <command>url2pkg</command> program:</para>
220 220
221<programlisting> 221<programlisting>
222&uprompt; url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2 222&uprompt; url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
223</programlisting> 223</programlisting>
224 224
225<para>My editor popped up, and I added a <varname>PKGNAME</varname> line 225<para>My editor popped up, and I added a <varname>PKGNAME</varname> line
226below the <varname>DISTNAME</varname> line, as the package name should 226below the <varname>DISTNAME</varname> line, as the package name should
227not have the word <quote>sources</quote> in it. I also filled in the 227not have the word <quote>sources</quote> in it. I also filled in the
228<varname>MAINTAINER</varname>, <varname>HOMEPAGE</varname> and 228<varname>MAINTAINER</varname>, <varname>HOMEPAGE</varname> and
229<varname>COMMENT</varname> fields. Then the package 229<varname>COMMENT</varname> fields. Then the package
230<filename>Makefile</filename> looked like that:</para> 230<filename>Makefile</filename> looked like that:</para>
231 231
232<programlisting> 232<programlisting>
233# &#36;NetBSD&#36; 233# &#36;NetBSD&#36;
234# 234#
235 235
236DISTNAME= nvu-1.0-sources 236DISTNAME= nvu-1.0-sources
237PKGNAME= nvu-1.0 237PKGNAME= nvu-1.0
238CATEGORIES= www 238CATEGORIES= www
239MASTER_SITES= http://cvs.nvu.com/download/ 239MASTER_SITES= http://cvs.nvu.com/download/
240EXTRACT_SUFX= .tar.bz2 240EXTRACT_SUFX= .tar.bz2
241 241
242MAINTAINER= rillig@NetBSD.org 242MAINTAINER= rillig@NetBSD.org
243HOMEPAGE= http://cvs.nvu.com/ 243HOMEPAGE= http://cvs.nvu.com/
244COMMENT= Web Authoring System 244COMMENT= Web Authoring System
245 245
246# url2pkg-marker (please do not remove this line.) 246# url2pkg-marker (please do not remove this line.)
247.include "../../mk/bsd.pkg.mk" 247.include "../../mk/bsd.pkg.mk"
248</programlisting> 248</programlisting>
249 249
250<para>Then, I quit the editor and watched pkgsrc downloading a large 250<para>Then, I quit the editor and watched pkgsrc downloading a large
251source archive:</para> 251source archive:</para>
252 252
253<programlisting> 253<programlisting>
254url2pkg> Running "make makesum" ... 254url2pkg> Running "make makesum" ...
255=> Required installed package digest>=20010302: digest-20060826 found 255=> Required installed package digest>=20010302: digest-20060826 found
256=> Fetching nvu-1.0-sources.tar.bz2 256=> Fetching nvu-1.0-sources.tar.bz2
257Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2 257Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
258100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA 258100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
25929687976 bytes retrieved in 03:12 (150.77 KB/s) 25929687976 bytes retrieved in 03:12 (150.77 KB/s)
260url2pkg> Running "make extract" ... 260url2pkg> Running "make extract" ...
261=> Required installed package digest>=20010302: digest-20060826 found 261=> Required installed package digest>=20010302: digest-20060826 found
262=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2 262=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
263=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2 263=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
264work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc 264work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
265===> Installing dependencies for nvu-1.0 265===> Installing dependencies for nvu-1.0
266===> Overriding tools for nvu-1.0 266===> Overriding tools for nvu-1.0
267===> Extracting for nvu-1.0 267===> Extracting for nvu-1.0
268url2pkg> Adjusting the Makefile. 268url2pkg> Adjusting the Makefile.
269 269
270Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done! 270Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
271 271
272Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-) 272Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
273</programlisting> 273</programlisting>
274 274
275</sect3> 275</sect3>
276 276
277<sect3 id="creating.nvu.problems"> 277<sect3 id="creating.nvu.problems">
278<title>Fixing all kinds of problems to make the package work</title> 278<title>Fixing all kinds of problems to make the package work</title>
279 279
280<para>Now that the package has been extracted, let's see what's inside 280<para>Now that the package has been extracted, let's see what's inside
281it. The package has a <filename>README.txt</filename>, but that only 281it. The package has a <filename>README.txt</filename>, but that only
282says something about mozilla, so it's probably useless for seeing what 282says something about mozilla, so it's probably useless for seeing what
283dependencies this package has. But since there is a GNU configure script 283dependencies this package has. But since there is a GNU configure script
284in the package, let's hope that it will complain about everything it 284in the package, let's hope that it will complain about everything it
285needs.</para> 285needs.</para>
286 286
287<programlisting> 287<programlisting>
288&uprompt; bmake 288&uprompt; bmake
289=> Required installed package digest>=20010302: digest-20060826 found 289=> Required installed package digest>=20010302: digest-20060826 found
290=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2 290=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
291=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2 291=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
292===> Patching for nvu-1.0 292===> Patching for nvu-1.0
293===> Creating toolchain wrappers for nvu-1.0 293===> Creating toolchain wrappers for nvu-1.0
294===> Configuring for nvu-1.0 294===> Configuring for nvu-1.0
295[...] 295[...]
296configure: error: Perl 5.004 or higher is required. 296configure: error: Perl 5.004 or higher is required.
297[...] 297[...]
298WARNING: Please add USE_TOOLS+=perl to the package Makefile. 298WARNING: Please add USE_TOOLS+=perl to the package Makefile.
299[...] 299[...]
300</programlisting> 300</programlisting>
301 301
302<para>That worked quite well. So I opened the package Makefile in my 302<para>That worked quite well. So I opened the package Makefile in my
303editor, and since it already has a <varname>USE_TOOLS</varname> line, I 303editor, and since it already has a <varname>USE_TOOLS</varname> line, I
304just appended <quote>perl</quote> to it. Since the dependencies of the 304just appended <quote>perl</quote> to it. Since the dependencies of the
305package have changed now, and since a perl wrapper is automatically 305package have changed now, and since a perl wrapper is automatically
306installed in the <quote>tools</quote> phase, I need to build the package 306installed in the <quote>tools</quote> phase, I need to build the package
307from scratch.</para> 307from scratch.</para>
308 308
309<programlisting> 309<programlisting>
310&uprompt; bmake clean 310&uprompt; bmake clean
311===> Cleaning for nvu-1.0 311===> Cleaning for nvu-1.0
312&uprompt; bmake 312&uprompt; bmake
313[...] 313[...]
314*** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \ 314*** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
315GNU Make. You will not be able to build Mozilla without GNU Make. 315GNU Make. You will not be able to build Mozilla without GNU Make.
316[...] 316[...]
317</programlisting> 317</programlisting>
318 318
319<para>So I added <quote>gmake</quote> to the 319<para>So I added <quote>gmake</quote> to the
320<varname>USE_TOOLS</varname> line and tried again (from scratch).</para> 320<varname>USE_TOOLS</varname> line and tried again (from scratch).</para>
321 321
322<programlisting> 322<programlisting>
323[...] 323[...]
324checking for GTK - version >= 1.2.0... no 324checking for GTK - version >= 1.2.0... no
325*** Could not run GTK test program, checking why... 325*** Could not run GTK test program, checking why...
326[...] 326[...]
327</programlisting> 327</programlisting>
328 328
329<para>Now to the other dependencies. The first question is: Where is the 329<para>Now to the other dependencies. The first question is: Where is the
330GTK package hidden in pkgsrc?</para> 330GTK package hidden in pkgsrc?</para>
331 331
332<programlisting> 332<programlisting>
333&uprompt; echo ../../*/gtk* 333&uprompt; echo ../../*/gtk*
334[many packages ...] 334[many packages ...]
335&uprompt; echo ../../*/gtk 335&uprompt; echo ../../*/gtk
336../../x11/gtk 336../../x11/gtk
337&uprompt; echo ../../*/gtk2 337&uprompt; echo ../../*/gtk2
338../../x11/gtk2 338../../x11/gtk2
339&uprompt; echo ../../*/gtk2/bui* 339&uprompt; echo ../../*/gtk2/bui*
340../../x11/gtk2/buildlink3.mk 340../../x11/gtk2/buildlink3.mk
341</programlisting> 341</programlisting>
342 342
343<para>The first try was definitely too broad. The second one had exactly 343<para>The first try was definitely too broad. The second one had exactly
344one result, which is very good. But there is one pitfall with GNOME 344one result, which is very good. But there is one pitfall with GNOME
345packages. Before GNOME 2 had been released, there were already many 345packages. Before GNOME 2 had been released, there were already many
346GNOME 1 packages in pkgsrc. To be able to continue to use these 346GNOME 1 packages in pkgsrc. To be able to continue to use these
347packages, the GNOME 2 packages were imported as separate packages, and 347packages, the GNOME 2 packages were imported as separate packages, and
348their names usually have a <quote>2</quote> appended. So I checked 348their names usually have a <quote>2</quote> appended. So I checked
349whether this was the case here, and indeed it was.</para> 349whether this was the case here, and indeed it was.</para>
350 350
351<para>Since the GTK2 package has a <filename>buildlink3.mk</filename> 351<para>Since the GTK2 package has a <filename>buildlink3.mk</filename>
352file, adding the dependency is very easy. I just inserted an 352file, adding the dependency is very easy. I just inserted an
353<literal>.include</literal> line before the last line of the package 353<literal>.include</literal> line before the last line of the package
354<filename>Makefile</filename>, so that it now looks like this:</para> 354<filename>Makefile</filename>, so that it now looks like this:</para>
355 355
356<programlisting> 356<programlisting>
357[...] 357[...]
358.include "../../x11/gtk2/buildlink3.mk" 358.include "../../x11/gtk2/buildlink3.mk"
359.include "../../mk/bsd.pkg.mk 359.include "../../mk/bsd.pkg.mk
360</programlisting> 360</programlisting>
361 361
362<para>After another <command>bmake clean && bmake</command>, the answer 362<para>After another <command>bmake clean && bmake</command>, the answer
363was:</para> 363was:</para>
364 364
365<programlisting> 365<programlisting>
366[...] 366[...]
367checking for gtk-config... /home/roland/pkg/bin/gtk-config 367checking for gtk-config... /home/roland/pkg/bin/gtk-config
368checking for GTK - version >= 1.2.0... no 368checking for GTK - version >= 1.2.0... no
369*** Could not run GTK test program, checking why... 369*** Could not run GTK test program, checking why...
370*** The test program failed to compile or link. See the file config.log for the 370*** The test program failed to compile or link. See the file config.log for the
371*** exact error that occured. This usually means GTK was incorrectly installed 371*** exact error that occured. This usually means GTK was incorrectly installed
372*** or that you have moved GTK since it was installed. In the latter case, you 372*** or that you have moved GTK since it was installed. In the latter case, you
373*** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config 373*** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
374configure: error: Test for GTK failed. 374configure: error: Test for GTK failed.
375[...] 375[...]
376</programlisting> 376</programlisting>
377 377
378<para>In this particular case, the assumption that <quote>every package 378<para>In this particular case, the assumption that <quote>every package
379prefers GNOME 2</quote> had been wrong. The first of the lines above 379prefers GNOME 2</quote> had been wrong. The first of the lines above
380told me that this package really wanted to have the GNOME 1 version of 380told me that this package really wanted to have the GNOME 1 version of
381GTK. If the package had looked for GTK2, it would have looked for 381GTK. If the package had looked for GTK2, it would have looked for
382<command>pkg-config</command> instead of <command>gtk-config</command>. 382<command>pkg-config</command> instead of <command>gtk-config</command>.
383So I changed the <literal>x11/gtk2</literal> to 383So I changed the <literal>x11/gtk2</literal> to
384<literal>x11/gtk</literal> in the package <filename>Makefile</filename>, 384<literal>x11/gtk</literal> in the package <filename>Makefile</filename>,
385and tried again.</para> 385and tried again.</para>
386 386
387<programlisting> 387<programlisting>
388[...] 388[...]
389cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...] 389cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
390In file included from xpidl.c:42: 390In file included from xpidl.c:42:
391xpidl.h:53:24: libIDL/IDL.h: No such file or directory 391xpidl.h:53:24: libIDL/IDL.h: No such file or directory
392In file included from xpidl.c:42: 392In file included from xpidl.c:42:
393xpidl.h:132: error: parse error before "IDL_ns" 393xpidl.h:132: error: parse error before "IDL_ns"
394[...] 394[...]
395</programlisting> 395</programlisting>
396 396
397<para>The package still does not find all of its dependencies. Now the 397<para>The package still does not find all of its dependencies. Now the
398question is: Which package provides the 398question is: Which package provides the
399<filename>libIDL/IDL.h</filename> header file?</para> 399<filename>libIDL/IDL.h</filename> header file?</para>
400 400
401<programlisting> 401<programlisting>
402&uprompt; echo ../../*/*idl* 402&uprompt; echo ../../*/*idl*
403../../devel/py-idle ../../wip/idled ../../x11/acidlaunch 403../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
404&uprompt; echo ../../*/*IDL* 404&uprompt; echo ../../*/*IDL*
405../../net/libIDL 405../../net/libIDL
406</programlisting> 406</programlisting>
407 407
408<para>Let's take the one from the second try. So I included the 408<para>Let's take the one from the second try. So I included the
409<filename>../../net/libIDL/buildlink3.mk</filename> file and tried 409<filename>../../net/libIDL/buildlink3.mk</filename> file and tried
410again. But the error didn't change. After digging through some of the 410again. But the error didn't change. After digging through some of the
411code, I concluded that the build process of the package was broken and 411code, I concluded that the build process of the package was broken and
412couldn't have ever worked, but since the Mozilla source tree is quite 412couldn't have ever worked, but since the Mozilla source tree is quite
413large, I didn't want to fix it. So I added the following to the package 413large, I didn't want to fix it. So I added the following to the package
414<filename>Makefile</filename> and tried again:</para> 414<filename>Makefile</filename> and tried again:</para>
415 415
416<programlisting> 416<programlisting>
417CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0 417CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
418BUILDLINK_TRANSFORM+= -l:IDL:IDL-2 418BUILDLINK_TRANSFORM+= -l:IDL:IDL-2
419</programlisting> 419</programlisting>
420 420
421<para>The latter line is needed because the package expects the library 421<para>The latter line is needed because the package expects the library
422<filename>libIDL.so</filename>, but only 422<filename>libIDL.so</filename>, but only
423<filename>libIDL-2.so</filename> is available. So I told the compiler 423<filename>libIDL-2.so</filename> is available. So I told the compiler
424wrapper to rewrite that on the fly.</para> 424wrapper to rewrite that on the fly.</para>
425 425
426<para>The next problem was related to a recent change of the FreeType 426<para>The next problem was related to a recent change of the FreeType
427interface. I looked up in <filename role="pkg">www/seamonkey</filename> 427interface. I looked up in <filename role="pkg">www/seamonkey</filename>
428which patch files were relevant for this issue and copied them to the 428which patch files were relevant for this issue and copied them to the
429<filename>patches</filename> directory. Then I retried, fixed the 429<filename>patches</filename> directory. Then I retried, fixed the
430patches so that they applied cleanly and retried again. This time, 430patches so that they applied cleanly and retried again. This time,
431everything worked.</para> 431everything worked.</para>
432 432
433</sect3> 433</sect3>
434 434
435<sect3 id="creating.nvu.inst"> 435<sect3 id="creating.nvu.inst">
436<title>Installing the package</title> 436<title>Installing the package</title>
437 437
438<programlisting> 438<programlisting>
439&uprompt; bmake CHECK_FILES=no install 439&uprompt; bmake CHECK_FILES=no install
440[...] 440[...]
441&uprompt; bmake print-PLIST >PLIST 441&uprompt; bmake print-PLIST >PLIST
442&uprompt; bmake deinstall 442&uprompt; bmake deinstall
443&uprompt; bmake install 443&uprompt; bmake install
444</programlisting> 444</programlisting>
445 445
446</sect3> 446</sect3>
447</sect2> 447</sect2>
448</sect1> 448</sect1>
449</chapter> 449</chapter>