Sat Jan 18 20:17:10 2014 UTC ()
Update Python section and document versioned_dependencies.mk.


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

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

--- pkgsrc/doc/guide/files/creating.xml 2014/01/12 09:43:30 1.14
+++ pkgsrc/doc/guide/files/creating.xml 2014/01/18 20:17:10 1.15
@@ -1,439 +1,449 @@ @@ -1,439 +1,449 @@
1<!-- $NetBSD: creating.xml,v 1.14 2014/01/12 09:43:30 wiz Exp $ --> 1<!-- $NetBSD: creating.xml,v 1.15 2014/01/18 20:17:10 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>Most Python packages use either <quote>distutils</quote> or 
140easy-setup (<quote>eggs</quote>). 
141If the software uses <quote>distutils</quote>, set the 
142<varname>PYDISTUTILSPKG</varname> variable to <quote>yes</quote> so 
143pkgsrc will make use of this framework. 
144<quote>distutils</quote> uses a script called <filename>setup.py</filename>, 
145if the <quote>distutils</quote> driver is not called 
146<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable 
147to the name of the script.</para> 
148 
149<para> 139<para>
150If the default Python versions are not supported by the software, set the 140If some Python versions are not supported by the software, set the
151<varname>PYTHON_VERSIONS_ACCEPTED</varname> variable to the Python versions 141<varname>PYTHON_VERSIONS_INCOMPATIBLE</varname> variable to the Python versions
152the software is known to work with, from the most recent to the older 142that are not supported, e.g.
153one, e.g. 
154<programlisting> 143<programlisting>
155PYTHON_VERSIONS_ACCEPTED= 33 27 26 144PYTHON_VERSIONS_ACCEPTED= 26
156</programlisting></para> 145</programlisting></para>
157 146
158<para> 147<para>
159If the packaged software is a Python module, include 148If the packaged software is a Python module, include
160<quote><filename>../../lang/python/extension.mk</filename></quote>. 149<quote><filename>../../lang/python/extension.mk</filename></quote>.
161In this case, the package directory should be called 150In this case, the package directory should be called
162<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
163<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g. 152<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g.
164<programlisting> 153<programlisting>
165DISTNAME= foopymodule-1.2.10 154DISTNAME= foopymodule-1.2.10
166PKGNAME= ${PYPKGPREFIX}-${DISTNAME} 155PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
167</programlisting></para> 156</programlisting></para>
168 157
169<para>If it is an application, also include 158<para>If it is an application, include
170<quote><filename>../../lang/python/application.mk</filename></quote> 159<quote><filename>../../lang/python/application.mk</filename></quote>.
171before <quote>extension.mk</quote>.</para> 160In order to correctly set the path to the Python interpreter, use the
172 
173<para>If the packaged software, either it is an application or a module, is 
174egg-aware, you only need to include 
175<quote><filename>../../lang/python/egg.mk</filename></quote>.</para> 
176 
177<para>In order to correctly set the path to the Python interpreter, use the 
178<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
179(paths relative to <varname>WRKSRC</varname>) that must be corrected. 162(paths relative to <varname>WRKSRC</varname>) that must be corrected.
180For example : 163For example:
181<programlisting> 164<programlisting>
182REPLACE_PYTHON= *.py 165REPLACE_PYTHON= *.py
183</programlisting></para> 166</programlisting></para>
184 167
 168<para>Most Python packages use either <quote>distutils</quote> or
 169easy-setup (<quote>eggs</quote>).
 170If the software uses <quote>distutils</quote>, include
 171<quote><filename>../../lang/python/distutils.mk</filename></quote>.
 172so pkgsrc will use this framework.
 173<quote>distutils</quote> uses a script called <filename>setup.py</filename>,
 174if the <quote>distutils</quote> driver is not called
 175<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable
 176to the name of the script.</para>
 177
 178<para>Otherwise, if the packaged software is egg-aware, you only need
 179to include
 180<quote><filename>../../lang/python/egg.mk</filename></quote>.</para>
 181
 182<para>Some Python modules have separate distributions for Python-2.x
 183and Python-3.x support. In pkgsrc this is handled by the
 184<filename>versioned_dependencies.mk</filename> file. Set
 185<varname>PYTHON_VERSIONED_DEPENDENCIES</varname> to the list of
 186packages that should be depended upon and include
 187<quote><filename>../../lang/python/versioned_dependencies.mk</filename></quote>,
 188then the pkgsrc infrastructure will depend on the appropriate package
 189version. For example:
 190<programlisting>
 191PYTHON_VERSIONED_DEPENDENCIES=dateutil dns
 192</programlisting>
 193Look inside <filename>versioned_dependencies.mk</filename> for a list
 194of supported packages.</para>
185</sect2> 195</sect2>
186 196
187</sect1> 197</sect1>
188 198
189<sect1 id="creating.examples"> 199<sect1 id="creating.examples">
190<title>Examples</title> 200<title>Examples</title>
191 201
192<sect2 id="creating.nvu"> 202<sect2 id="creating.nvu">
193<title>How the www/nvu package came into pkgsrc</title> 203<title>How the www/nvu package came into pkgsrc</title>
194 204
195<sect3 id="creating.nvu.init"> 205<sect3 id="creating.nvu.init">
196<title>The initial package</title> 206<title>The initial package</title>
197 207
198<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
199that the <quote>nvu</quote> package has not yet been imported into 209that the <quote>nvu</quote> package has not yet been imported into
200pkgsrc. 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
201choice for the category is <quote>www</quote>.</para> 211choice for the category is <quote>www</quote>.</para>
202 212
203<programlisting> 213<programlisting>
204&uprompt; mkdir www/nvu 214&uprompt; mkdir www/nvu
205&uprompt; cd www/nvu 215&uprompt; cd www/nvu
206</programlisting> 216</programlisting>
207 217
208<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
209I fed that URL to the <command>url2pkg</command> program:</para> 219I fed that URL to the <command>url2pkg</command> program:</para>
210 220
211<programlisting> 221<programlisting>
212&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
213</programlisting> 223</programlisting>
214 224
215<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
216below the <varname>DISTNAME</varname> line, as the package name should 226below the <varname>DISTNAME</varname> line, as the package name should
217not 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
218<varname>MAINTAINER</varname>, <varname>HOMEPAGE</varname> and 228<varname>MAINTAINER</varname>, <varname>HOMEPAGE</varname> and
219<varname>COMMENT</varname> fields. Then the package 229<varname>COMMENT</varname> fields. Then the package
220<filename>Makefile</filename> looked like that:</para> 230<filename>Makefile</filename> looked like that:</para>
221 231
222<programlisting> 232<programlisting>
223# &#36;NetBSD&#36; 233# &#36;NetBSD&#36;
224# 234#
225 235
226DISTNAME= nvu-1.0-sources 236DISTNAME= nvu-1.0-sources
227PKGNAME= nvu-1.0 237PKGNAME= nvu-1.0
228CATEGORIES= www 238CATEGORIES= www
229MASTER_SITES= http://cvs.nvu.com/download/ 239MASTER_SITES= http://cvs.nvu.com/download/
230EXTRACT_SUFX= .tar.bz2 240EXTRACT_SUFX= .tar.bz2
231 241
232MAINTAINER= rillig@NetBSD.org 242MAINTAINER= rillig@NetBSD.org
233HOMEPAGE= http://cvs.nvu.com/ 243HOMEPAGE= http://cvs.nvu.com/
234COMMENT= Web Authoring System 244COMMENT= Web Authoring System
235 245
236# url2pkg-marker (please do not remove this line.) 246# url2pkg-marker (please do not remove this line.)
237.include "../../mk/bsd.pkg.mk" 247.include "../../mk/bsd.pkg.mk"
238</programlisting> 248</programlisting>
239 249
240<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
241source archive:</para> 251source archive:</para>
242 252
243<programlisting> 253<programlisting>
244url2pkg> Running "make makesum" ... 254url2pkg> Running "make makesum" ...
245=> Required installed package digest>=20010302: digest-20060826 found 255=> Required installed package digest>=20010302: digest-20060826 found
246=> Fetching nvu-1.0-sources.tar.bz2 256=> Fetching nvu-1.0-sources.tar.bz2
247Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2 257Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
248100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA 258100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
24929687976 bytes retrieved in 03:12 (150.77 KB/s) 25929687976 bytes retrieved in 03:12 (150.77 KB/s)
250url2pkg> Running "make extract" ... 260url2pkg> Running "make extract" ...
251=> Required installed package digest>=20010302: digest-20060826 found 261=> Required installed package digest>=20010302: digest-20060826 found
252=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2 262=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
253=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2 263=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
254work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc 264work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
255===> Installing dependencies for nvu-1.0 265===> Installing dependencies for nvu-1.0
256===> Overriding tools for nvu-1.0 266===> Overriding tools for nvu-1.0
257===> Extracting for nvu-1.0 267===> Extracting for nvu-1.0
258url2pkg> Adjusting the Makefile. 268url2pkg> Adjusting the Makefile.
259 269
260Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done! 270Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
261 271
262Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-) 272Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
263</programlisting> 273</programlisting>
264 274
265</sect3> 275</sect3>
266 276
267<sect3 id="creating.nvu.problems"> 277<sect3 id="creating.nvu.problems">
268<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>
269 279
270<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
271it. The package has a <filename>README.txt</filename>, but that only 281it. The package has a <filename>README.txt</filename>, but that only
272says something about mozilla, so it's probably useless for seeing what 282says something about mozilla, so it's probably useless for seeing what
273dependencies this package has. But since there is a GNU configure script 283dependencies this package has. But since there is a GNU configure script
274in 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
275needs.</para> 285needs.</para>
276 286
277<programlisting> 287<programlisting>
278&uprompt; bmake 288&uprompt; bmake
279=> Required installed package digest>=20010302: digest-20060826 found 289=> Required installed package digest>=20010302: digest-20060826 found
280=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2 290=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
281=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2 291=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
282===> Patching for nvu-1.0 292===> Patching for nvu-1.0
283===> Creating toolchain wrappers for nvu-1.0 293===> Creating toolchain wrappers for nvu-1.0
284===> Configuring for nvu-1.0 294===> Configuring for nvu-1.0
285[...] 295[...]
286configure: error: Perl 5.004 or higher is required. 296configure: error: Perl 5.004 or higher is required.
287[...] 297[...]
288WARNING: Please add USE_TOOLS+=perl to the package Makefile. 298WARNING: Please add USE_TOOLS+=perl to the package Makefile.
289[...] 299[...]
290</programlisting> 300</programlisting>
291 301
292<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
293editor, 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
294just appended <quote>perl</quote> to it. Since the dependencies of the 304just appended <quote>perl</quote> to it. Since the dependencies of the
295package have changed now, and since a perl wrapper is automatically 305package have changed now, and since a perl wrapper is automatically
296installed 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
297from scratch.</para> 307from scratch.</para>
298 308
299<programlisting> 309<programlisting>
300&uprompt; bmake clean 310&uprompt; bmake clean
301===> Cleaning for nvu-1.0 311===> Cleaning for nvu-1.0
302&uprompt; bmake 312&uprompt; bmake
303[...] 313[...]
304*** /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 \
305GNU 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.
306[...] 316[...]
307</programlisting> 317</programlisting>
308 318
309<para>So I added <quote>gmake</quote> to the 319<para>So I added <quote>gmake</quote> to the
310<varname>USE_TOOLS</varname> line and tried again (from scratch).</para> 320<varname>USE_TOOLS</varname> line and tried again (from scratch).</para>
311 321
312<programlisting> 322<programlisting>
313[...] 323[...]
314checking for GTK - version >= 1.2.0... no 324checking for GTK - version >= 1.2.0... no
315*** Could not run GTK test program, checking why... 325*** Could not run GTK test program, checking why...
316[...] 326[...]
317</programlisting> 327</programlisting>
318 328
319<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
320GTK package hidden in pkgsrc?</para> 330GTK package hidden in pkgsrc?</para>
321 331
322<programlisting> 332<programlisting>
323&uprompt; echo ../../*/gtk* 333&uprompt; echo ../../*/gtk*
324[many packages ...] 334[many packages ...]
325&uprompt; echo ../../*/gtk 335&uprompt; echo ../../*/gtk
326../../x11/gtk 336../../x11/gtk
327&uprompt; echo ../../*/gtk2 337&uprompt; echo ../../*/gtk2
328../../x11/gtk2 338../../x11/gtk2
329&uprompt; echo ../../*/gtk2/bui* 339&uprompt; echo ../../*/gtk2/bui*
330../../x11/gtk2/buildlink3.mk 340../../x11/gtk2/buildlink3.mk
331</programlisting> 341</programlisting>
332 342
333<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
334one 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
335packages. Before GNOME 2 had been released, there were already many 345packages. Before GNOME 2 had been released, there were already many
336GNOME 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
337packages, the GNOME 2 packages were imported as separate packages, and 347packages, the GNOME 2 packages were imported as separate packages, and
338their names usually have a <quote>2</quote> appended. So I checked 348their names usually have a <quote>2</quote> appended. So I checked
339whether this was the case here, and indeed it was.</para> 349whether this was the case here, and indeed it was.</para>
340 350
341<para>Since the GTK2 package has a <filename>buildlink3.mk</filename> 351<para>Since the GTK2 package has a <filename>buildlink3.mk</filename>
342file, adding the dependency is very easy. I just inserted an 352file, adding the dependency is very easy. I just inserted an
343<literal>.include</literal> line before the last line of the package 353<literal>.include</literal> line before the last line of the package
344<filename>Makefile</filename>, so that it now looks like this:</para> 354<filename>Makefile</filename>, so that it now looks like this:</para>
345 355
346<programlisting> 356<programlisting>
347[...] 357[...]
348.include "../../x11/gtk2/buildlink3.mk" 358.include "../../x11/gtk2/buildlink3.mk"
349.include "../../mk/bsd.pkg.mk 359.include "../../mk/bsd.pkg.mk
350</programlisting> 360</programlisting>
351 361
352<para>After another <command>bmake clean && bmake</command>, the answer 362<para>After another <command>bmake clean && bmake</command>, the answer
353was:</para> 363was:</para>
354 364
355<programlisting> 365<programlisting>
356[...] 366[...]
357checking for gtk-config... /home/roland/pkg/bin/gtk-config 367checking for gtk-config... /home/roland/pkg/bin/gtk-config
358checking for GTK - version >= 1.2.0... no 368checking for GTK - version >= 1.2.0... no
359*** Could not run GTK test program, checking why... 369*** Could not run GTK test program, checking why...
360*** 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
361*** exact error that occured. This usually means GTK was incorrectly installed 371*** exact error that occured. This usually means GTK was incorrectly installed
362*** 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
363*** 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
364configure: error: Test for GTK failed. 374configure: error: Test for GTK failed.
365[...] 375[...]
366</programlisting> 376</programlisting>
367 377
368<para>In this particular case, the assumption that <quote>every package 378<para>In this particular case, the assumption that <quote>every package
369prefers 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
370told 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
371GTK. 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
372<command>pkg-config</command> instead of <command>gtk-config</command>. 382<command>pkg-config</command> instead of <command>gtk-config</command>.
373So I changed the <literal>x11/gtk2</literal> to 383So I changed the <literal>x11/gtk2</literal> to
374<literal>x11/gtk</literal> in the package <filename>Makefile</filename>, 384<literal>x11/gtk</literal> in the package <filename>Makefile</filename>,
375and tried again.</para> 385and tried again.</para>
376 386
377<programlisting> 387<programlisting>
378[...] 388[...]
379cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...] 389cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
380In file included from xpidl.c:42: 390In file included from xpidl.c:42:
381xpidl.h:53:24: libIDL/IDL.h: No such file or directory 391xpidl.h:53:24: libIDL/IDL.h: No such file or directory
382In file included from xpidl.c:42: 392In file included from xpidl.c:42:
383xpidl.h:132: error: parse error before "IDL_ns" 393xpidl.h:132: error: parse error before "IDL_ns"
384[...] 394[...]
385</programlisting> 395</programlisting>
386 396
387<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
388question is: Which package provides the 398question is: Which package provides the
389<filename>libIDL/IDL.h</filename> header file?</para> 399<filename>libIDL/IDL.h</filename> header file?</para>
390 400
391<programlisting> 401<programlisting>
392&uprompt; echo ../../*/*idl* 402&uprompt; echo ../../*/*idl*
393../../devel/py-idle ../../wip/idled ../../x11/acidlaunch 403../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
394&uprompt; echo ../../*/*IDL* 404&uprompt; echo ../../*/*IDL*
395../../net/libIDL 405../../net/libIDL
396</programlisting> 406</programlisting>
397 407
398<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
399<filename>../../net/libIDL/buildlink3.mk</filename> file and tried 409<filename>../../net/libIDL/buildlink3.mk</filename> file and tried
400again. 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
401code, 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
402couldn'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
403large, 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
404<filename>Makefile</filename> and tried again:</para> 414<filename>Makefile</filename> and tried again:</para>
405 415
406<programlisting> 416<programlisting>
407CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0 417CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
408BUILDLINK_TRANSFORM+= -l:IDL:IDL-2 418BUILDLINK_TRANSFORM+= -l:IDL:IDL-2
409</programlisting> 419</programlisting>
410 420
411<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
412<filename>libIDL.so</filename>, but only 422<filename>libIDL.so</filename>, but only
413<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
414wrapper to rewrite that on the fly.</para> 424wrapper to rewrite that on the fly.</para>
415 425
416<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
417interface. I looked up in <filename role="pkg">www/seamonkey</filename> 427interface. I looked up in <filename role="pkg">www/seamonkey</filename>
418which 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
419<filename>patches</filename> directory. Then I retried, fixed the 429<filename>patches</filename> directory. Then I retried, fixed the
420patches so that they applied cleanly and retried again. This time, 430patches so that they applied cleanly and retried again. This time,
421everything worked.</para> 431everything worked.</para>
422 432
423</sect3> 433</sect3>
424 434
425<sect3 id="creating.nvu.inst"> 435<sect3 id="creating.nvu.inst">
426<title>Installing the package</title> 436<title>Installing the package</title>
427 437
428<programlisting> 438<programlisting>
429&uprompt; bmake CHECK_FILES=no install 439&uprompt; bmake CHECK_FILES=no install
430[...] 440[...]
431&uprompt; bmake print-PLIST >PLIST 441&uprompt; bmake print-PLIST >PLIST
432&uprompt; bmake deinstall 442&uprompt; bmake deinstall
433&uprompt; bmake install 443&uprompt; bmake install
434</programlisting> 444</programlisting>
435 445
436</sect3> 446</sect3>
437</sect2> 447</sect2>
438</sect1> 448</sect1>
439</chapter> 449</chapter>