| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
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 |
| @@ -126,72 +126,82 @@ package from the set of installed files. | | | @@ -126,72 +126,82 @@ package from the set of installed files. |
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 | |