| @@ -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 |
7 | most likely have a URL from where you can download the source | | 7 | most likely have a URL from where you can download the source |
8 | code. Starting with this URL, creating a package involves only a | | 8 | code. Starting with this URL, creating a package involves only a |
9 | few steps.</para> | | 9 | few 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 |
14 | role="pkg">pkgtools/url2pkg</filename> and <filename | | 14 | role="pkg">pkgtools/url2pkg</filename> and <filename |
15 | role="pkg">pkgtools/pkglint</filename>.</para></step> | | 15 | role="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 |
18 | category in which you want to place your package. You can also create a | | 18 | category in which you want to place your package. You can also create a |
19 | directory of your own (maybe called <filename>local</filename>). In that | | 19 | directory of your own (maybe called <filename>local</filename>). In that |
20 | category directory, create another directory for your package and change | | 20 | category directory, create another directory for your package and change |
21 | into it.</para></step> | | 21 | into 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 |
24 | you for a URL. Enter the URL of the distribution file (in most cases a | | 24 | you 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 |
26 | of your package are created automatically. The distribution file is | | 26 | of your package are created automatically. The distribution file is |
27 | extracted automatically to fill in some details in the | | 27 | extracted 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 |
29 | manually.</para></step> | | 29 | manually.</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 |
32 | your package. Ideally, this is mentioned in some | | 32 | your 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 |
34 | these dependencies, look where it exists in pkgsrc, and if there is a | | 34 | these dependencies, look where it exists in pkgsrc, and if there is a |
35 | file called <filename>buildlink3.mk</filename> in that directory, add a | | 35 | file called <filename>buildlink3.mk</filename> in that directory, add a |
36 | line to your package <filename>Makefile</filename> which includes that | | 36 | line to your package <filename>Makefile</filename> which includes that |
37 | file just before the last line. If the | | 37 | file 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 |
39 | created first. The <filename>buildlink3.mk</filename> file makes sure that the package's include files and libraries are provided.</para> | | 39 | created 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 |
43 | version of the dependency and where it can be found in pkgsrc. This line | | 43 | version of the dependency and where it can be found in pkgsrc. This line |
44 | should be placed in the third paragraph. If the dependency is only | | 44 | should be placed in the third paragraph. If the dependency is only |
45 | needed for building the package, but not when using it, use | | 45 | needed 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>. |
47 | Your package may then look like this:</para> | | 47 | Your package may then look like this:</para> |
48 | | | 48 | |
49 | <programlisting> | | 49 | <programlisting> |
50 | [...] | | 50 | [...] |
51 | | | 51 | |
52 | BUILD_DEPENDS+= lua>=5.0:../../lang/lua | | 52 | BUILD_DEPENDS+= lua>=5.0:../../lang/lua |
53 | DEPENDS+= screen-[0-9]*:../../misc/screen | | 53 | DEPENDS+= screen-[0-9]*:../../misc/screen |
54 | DEPENDS+= screen>=4.0:../../misc/screen | | 54 | DEPENDS+= 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 |
66 | to be done to make your package a <quote>good</quote> one. If you don't | | 66 | to be done to make your package a <quote>good</quote> one. If you don't |
67 | know what pkglint's warnings want to tell you, try <command>pkglint | | 67 | know 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 |
70 | explanations.</para></step> | | 70 | explanations.</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 |
73 | find instructions for the most common cases in the next section, <xref | | 73 | find instructions for the most common cases in the next section, <xref |
74 | linkend="creating.common"/>. After you have followed the instructions | | 74 | linkend="creating.common"/>. After you have followed the instructions |
75 | over there, you can hopefully continue here.</para></step> | | 75 | over 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 |
78 | directory from the extracted files. Besides these files, a lot of cache | | 78 | directory from the extracted files. Besides these files, a lot of cache |
79 | files and other system information has been saved in the working | | 79 | files and other system information has been saved in the working |
80 | directory, which may become wrong after you edited the | | 80 | directory, 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 |
84 | the various things that can go wrong in this phase, consult <xref | | 84 | the various things that can go wrong in this phase, consult <xref |
85 | linkend="fixes"/>.</para></step> | | 85 | linkend="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 |
88 | the package. Run <command>bmake install</command> and hope that | | 88 | the package. Run <command>bmake install</command> and hope that |
89 | everything works.</para></step> | | 89 | everything 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 |
92 | contains a list of the files that are installed by the package, is | | 92 | contains a list of the files that are installed by the package, is |
93 | nearly empty. Run <command>bmake print-PLIST | | 93 | nearly empty. Run <command>bmake print-PLIST |
94 | >PLIST</command> to generate a probably correct list. Check | | 94 | >PLIST</command> to generate a probably correct list. Check |
95 | the file using your preferred text editor to see if the list of | | 95 | the file using your preferred text editor to see if the list of |
96 | files looks plausible.</para></step> | | 96 | files 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 |
102 | has been registered in the database of installed files, but with an | | 102 | has been registered in the database of installed files, but with an |
103 | empty list of files. To fix this, run <command>bmake deinstall</command> | | 103 | empty list of files. To fix this, run <command>bmake deinstall</command> |
104 | and <command>bmake install</command> again. Now the package is | | 104 | and <command>bmake install</command> again. Now the package is |
105 | registered with the list of files from | | 105 | registered 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 |
109 | package from the set of installed files.</para></step> | | 109 | package 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 |
129 | settings that are typical of KDE packages.</para> | | 129 | settings 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 |
137 | set of predefined variables.</para> | | 137 | set of predefined variables.</para> |
138 | | | 138 | |
139 | <para>Most Python packages use either <quote>distutils</quote> or | | | |
140 | easy-setup (<quote>eggs</quote>). | | | |
141 | If the software uses <quote>distutils</quote>, set the | | | |
142 | <varname>PYDISTUTILSPKG</varname> variable to <quote>yes</quote> so | | | |
143 | pkgsrc will make use of this framework. | | | |
144 | <quote>distutils</quote> uses a script called <filename>setup.py</filename>, | | | |
145 | if the <quote>distutils</quote> driver is not called | | | |
146 | <filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable | | | |
147 | to the name of the script.</para> | | | |
148 | | | | |
149 | <para> | | 139 | <para> |
150 | If the default Python versions are not supported by the software, set the | | 140 | If 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 |
152 | the software is known to work with, from the most recent to the older | | 142 | that are not supported, e.g. |
153 | one, e.g. | | | |
154 | <programlisting> | | 143 | <programlisting> |
155 | PYTHON_VERSIONS_ACCEPTED= 33 27 26 | | 144 | PYTHON_VERSIONS_ACCEPTED= 26 |
156 | </programlisting></para> | | 145 | </programlisting></para> |
157 | | | 146 | |
158 | <para> | | 147 | <para> |
159 | If the packaged software is a Python module, include | | 148 | If 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>. |
161 | In this case, the package directory should be called | | 150 | In 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> |
165 | DISTNAME= foopymodule-1.2.10 | | 154 | DISTNAME= foopymodule-1.2.10 |
166 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} | | 155 | PKGNAME= ${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>. |
171 | before <quote>extension.mk</quote>.</para> | | 160 | In 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 | | | |
174 | egg-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. |
180 | For example : | | 163 | For example: |
181 | <programlisting> | | 164 | <programlisting> |
182 | REPLACE_PYTHON= *.py | | 165 | REPLACE_PYTHON= *.py |
183 | </programlisting></para> | | 166 | </programlisting></para> |
184 | | | 167 | |
| | | 168 | <para>Most Python packages use either <quote>distutils</quote> or |
| | | 169 | easy-setup (<quote>eggs</quote>). |
| | | 170 | If the software uses <quote>distutils</quote>, include |
| | | 171 | <quote><filename>../../lang/python/distutils.mk</filename></quote>. |
| | | 172 | so pkgsrc will use this framework. |
| | | 173 | <quote>distutils</quote> uses a script called <filename>setup.py</filename>, |
| | | 174 | if the <quote>distutils</quote> driver is not called |
| | | 175 | <filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable |
| | | 176 | to the name of the script.</para> |
| | | 177 | |
| | | 178 | <para>Otherwise, if the packaged software is egg-aware, you only need |
| | | 179 | to include |
| | | 180 | <quote><filename>../../lang/python/egg.mk</filename></quote>.</para> |
| | | 181 | |
| | | 182 | <para>Some Python modules have separate distributions for Python-2.x |
| | | 183 | and 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 |
| | | 186 | packages that should be depended upon and include |
| | | 187 | <quote><filename>../../lang/python/versioned_dependencies.mk</filename></quote>, |
| | | 188 | then the pkgsrc infrastructure will depend on the appropriate package |
| | | 189 | version. For example: |
| | | 190 | <programlisting> |
| | | 191 | PYTHON_VERSIONED_DEPENDENCIES=dateutil dns |
| | | 192 | </programlisting> |
| | | 193 | Look inside <filename>versioned_dependencies.mk</filename> for a list |
| | | 194 | of 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 |
199 | that the <quote>nvu</quote> package has not yet been imported into | | 209 | that the <quote>nvu</quote> package has not yet been imported into |
200 | pkgsrc. As the description says it has to do with the web, the obvious | | 210 | pkgsrc. As the description says it has to do with the web, the obvious |
201 | choice for the category is <quote>www</quote>.</para> | | 211 | choice 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 |
209 | I fed that URL to the <command>url2pkg</command> program:</para> | | 219 | I 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 |
216 | below the <varname>DISTNAME</varname> line, as the package name should | | 226 | below the <varname>DISTNAME</varname> line, as the package name should |
217 | not have the word <quote>sources</quote> in it. I also filled in the | | 227 | not 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 | # $NetBSD$ | | 233 | # $NetBSD$ |
224 | # | | 234 | # |
225 | | | 235 | |
226 | DISTNAME= nvu-1.0-sources | | 236 | DISTNAME= nvu-1.0-sources |
227 | PKGNAME= nvu-1.0 | | 237 | PKGNAME= nvu-1.0 |
228 | CATEGORIES= www | | 238 | CATEGORIES= www |
229 | MASTER_SITES= http://cvs.nvu.com/download/ | | 239 | MASTER_SITES= http://cvs.nvu.com/download/ |
230 | EXTRACT_SUFX= .tar.bz2 | | 240 | EXTRACT_SUFX= .tar.bz2 |
231 | | | 241 | |
232 | MAINTAINER= rillig@NetBSD.org | | 242 | MAINTAINER= rillig@NetBSD.org |
233 | HOMEPAGE= http://cvs.nvu.com/ | | 243 | HOMEPAGE= http://cvs.nvu.com/ |
234 | COMMENT= Web Authoring System | | 244 | COMMENT= 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 |
241 | source archive:</para> | | 251 | source archive:</para> |
242 | | | 252 | |
243 | <programlisting> | | 253 | <programlisting> |
244 | url2pkg> Running "make makesum" ... | | 254 | url2pkg> 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 |
247 | Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2 | | 257 | Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2 |
248 | 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA | | 258 | 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA |
249 | 29687976 bytes retrieved in 03:12 (150.77 KB/s) | | 259 | 29687976 bytes retrieved in 03:12 (150.77 KB/s) |
250 | url2pkg> Running "make extract" ... | | 260 | url2pkg> 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 |
254 | work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc | | 264 | work.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 |
258 | url2pkg> Adjusting the Makefile. | | 268 | url2pkg> Adjusting the Makefile. |
259 | | | 269 | |
260 | Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done! | | 270 | Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done! |
261 | | | 271 | |
262 | Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-) | | 272 | Good 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 |
271 | it. The package has a <filename>README.txt</filename>, but that only | | 281 | it. The package has a <filename>README.txt</filename>, but that only |
272 | says something about mozilla, so it's probably useless for seeing what | | 282 | says something about mozilla, so it's probably useless for seeing what |
273 | dependencies this package has. But since there is a GNU configure script | | 283 | dependencies this package has. But since there is a GNU configure script |
274 | in the package, let's hope that it will complain about everything it | | 284 | in the package, let's hope that it will complain about everything it |
275 | needs.</para> | | 285 | needs.</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 | [...] |
286 | configure: error: Perl 5.004 or higher is required. | | 296 | configure: error: Perl 5.004 or higher is required. |
287 | [...] | | 297 | [...] |
288 | WARNING: Please add USE_TOOLS+=perl to the package Makefile. | | 298 | WARNING: 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 |
293 | editor, and since it already has a <varname>USE_TOOLS</varname> line, I | | 303 | editor, and since it already has a <varname>USE_TOOLS</varname> line, I |
294 | just appended <quote>perl</quote> to it. Since the dependencies of the | | 304 | just appended <quote>perl</quote> to it. Since the dependencies of the |
295 | package have changed now, and since a perl wrapper is automatically | | 305 | package have changed now, and since a perl wrapper is automatically |
296 | installed in the <quote>tools</quote> phase, I need to build the package | | 306 | installed in the <quote>tools</quote> phase, I need to build the package |
297 | from scratch.</para> | | 307 | from 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 \ |
305 | GNU Make. You will not be able to build Mozilla without GNU Make. | | 315 | GNU 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 | [...] |
314 | checking for GTK - version >= 1.2.0... no | | 324 | checking 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 |
320 | GTK package hidden in pkgsrc?</para> | | 330 | GTK 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 |
334 | one result, which is very good. But there is one pitfall with GNOME | | 344 | one result, which is very good. But there is one pitfall with GNOME |
335 | packages. Before GNOME 2 had been released, there were already many | | 345 | packages. Before GNOME 2 had been released, there were already many |
336 | GNOME 1 packages in pkgsrc. To be able to continue to use these | | 346 | GNOME 1 packages in pkgsrc. To be able to continue to use these |
337 | packages, the GNOME 2 packages were imported as separate packages, and | | 347 | packages, the GNOME 2 packages were imported as separate packages, and |
338 | their names usually have a <quote>2</quote> appended. So I checked | | 348 | their names usually have a <quote>2</quote> appended. So I checked |
339 | whether this was the case here, and indeed it was.</para> | | 349 | whether 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> |
342 | file, adding the dependency is very easy. I just inserted an | | 352 | file, 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 |
353 | was:</para> | | 363 | was:</para> |
354 | | | 364 | |
355 | <programlisting> | | 365 | <programlisting> |
356 | [...] | | 366 | [...] |
357 | checking for gtk-config... /home/roland/pkg/bin/gtk-config | | 367 | checking for gtk-config... /home/roland/pkg/bin/gtk-config |
358 | checking for GTK - version >= 1.2.0... no | | 368 | checking 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 |
364 | configure: error: Test for GTK failed. | | 374 | configure: 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 |
369 | prefers GNOME 2</quote> had been wrong. The first of the lines above | | 379 | prefers GNOME 2</quote> had been wrong. The first of the lines above |
370 | told me that this package really wanted to have the GNOME 1 version of | | 380 | told me that this package really wanted to have the GNOME 1 version of |
371 | GTK. If the package had looked for GTK2, it would have looked for | | 381 | GTK. 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>. |
373 | So I changed the <literal>x11/gtk2</literal> to | | 383 | So 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>, |
375 | and tried again.</para> | | 385 | and tried again.</para> |
376 | | | 386 | |
377 | <programlisting> | | 387 | <programlisting> |
378 | [...] | | 388 | [...] |
379 | cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...] | | 389 | cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...] |
380 | In file included from xpidl.c:42: | | 390 | In file included from xpidl.c:42: |
381 | xpidl.h:53:24: libIDL/IDL.h: No such file or directory | | 391 | xpidl.h:53:24: libIDL/IDL.h: No such file or directory |
382 | In file included from xpidl.c:42: | | 392 | In file included from xpidl.c:42: |
383 | xpidl.h:132: error: parse error before "IDL_ns" | | 393 | xpidl.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 |
388 | question is: Which package provides the | | 398 | question 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 |
400 | again. But the error didn't change. After digging through some of the | | 410 | again. But the error didn't change. After digging through some of the |
401 | code, I concluded that the build process of the package was broken and | | 411 | code, I concluded that the build process of the package was broken and |
402 | couldn't have ever worked, but since the Mozilla source tree is quite | | 412 | couldn't have ever worked, but since the Mozilla source tree is quite |
403 | large, I didn't want to fix it. So I added the following to the package | | 413 | large, 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> |
407 | CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0 | | 417 | CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0 |
408 | BUILDLINK_TRANSFORM+= -l:IDL:IDL-2 | | 418 | BUILDLINK_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 |
414 | wrapper to rewrite that on the fly.</para> | | 424 | wrapper 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 |
417 | interface. I looked up in <filename role="pkg">www/seamonkey</filename> | | 427 | interface. I looked up in <filename role="pkg">www/seamonkey</filename> |
418 | which patch files were relevant for this issue and copied them to the | | 428 | which 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 |
420 | patches so that they applied cleanly and retried again. This time, | | 430 | patches so that they applied cleanly and retried again. This time, |
421 | everything worked.</para> | | 431 | everything 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> |