~ubuntu-branches/ubuntu/wily/sip4/wily

« back to all changes in this revision

Viewing changes to sphinx/installation.rst

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2014-06-01 12:38:17 UTC
  • mfrom: (1.4.2)
  • Revision ID: package-import@ubuntu.com-20140601123817-a5egi34p5tlywago
Tags: 4.16+dfsg-1
* New upstream release.
* Bump API version to 11.1 (keep 11.0 in provided versions).
* Update debian/copyright to copyright-format 1.0.
* Add Files-Excluded field to remove HTML documentation, which
  contains sourceless minified jquery.
* Simplify debian/watch, and mangle dfsg version.
* Add get-orig-source target to debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
depending on your platform) you should then check for any ``README`` files
19
19
that relate to your platform.
20
20
 
21
 
Next you need to configure SIP by executing the ``configure.py`` script.  For
22
 
example::
 
21
Next you need to configure SIP by executing the :program:`configure.py` script.
 
22
For example::
23
23
 
24
24
    python configure.py
25
25
 
26
26
This assumes that the Python interpreter is on your path.  Something like the
27
27
following may be appropriate on Windows::
28
28
 
29
 
    c:\python32\python configure.py
 
29
    c:\python34\python configure.py
30
30
 
31
31
If you have multiple versions of Python installed then make sure you use the
32
32
interpreter for which you wish SIP to generate bindings for.
53
53
 
54
54
    The SIP code generator will be installed in the directory ``<DIR>``.
55
55
 
 
56
.. cmdoption:: --configuration <FILE>
 
57
 
 
58
    .. versionadded:: 4.16
 
59
 
 
60
    ``<FILE>`` contains the configuration of the SIP build to be used instead
 
61
    of dynamically introspecting the system and is typically used when
 
62
    cross-compiling.  See :ref:`ref-configuration-files`.
 
63
 
56
64
.. cmdoption:: -d <DIR>, --destdir <DIR>
57
65
 
58
66
    The SIP module will be installed in the directory ``<DIR>``.
73
81
.. cmdoption:: -k, --static
74
82
 
75
83
    The SIP module will be built as a static library.  This is useful when
76
 
    building the SIP module as a Python builtin (see :ref:`ref-builtin`).
 
84
    building the SIP module as a Python builtin.
77
85
 
78
86
.. cmdoption:: -n, --universal
79
87
 
82
90
    not been specified then the universal binary will include the ``i386`` and
83
91
    ``ppc`` architectures.
84
92
 
 
93
.. cmdoption:: --no-tools
 
94
 
 
95
    .. versionadded:: 4.16
 
96
 
 
97
    The SIP code generator and :mod:`sipconfig` module will not be installed.
 
98
 
85
99
.. cmdoption:: -p <PLATFORM>, --platform <PLATFORM>
86
100
 
87
101
    Explicitly specify the platform/compiler to be used by the build system,
120
134
    ``package.sub-package.module``.  See :ref:`ref-private-sip` for how to
121
135
    use this to create a private copy of the SIP module.
122
136
 
123
 
The ``configure.py`` script takes many other options that allows the build
124
 
system to be finely tuned.  These are of the form ``name=value`` or
 
137
.. cmdoption:: --sysroot <DIR>
 
138
 
 
139
    .. versionadded:: 4.16
 
140
 
 
141
    ``<DIR>`` is the name of an optional directory that replaces ``sys.prefix``
 
142
    in the names of other directories (specifically those specifying where the
 
143
    various SIP components will be installed and where the Python include
 
144
    directories can be found).  It is typically used when cross-compiling or
 
145
    when building a static version of SIP.  See :ref:`ref-configuration-files`.
 
146
 
 
147
.. cmdoption:: --target-py-version <VERSION>
 
148
 
 
149
    .. versionadded:: 4.16
 
150
 
 
151
    ``<VERSION>`` is the major and minor version (e.g. ``3.4``) of the version
 
152
    of Python being targetted.  By default the version of Python being used to
 
153
    run the :program:`configure.py` script is used.  It is typically used when
 
154
    cross-compiling.  See :ref:`ref-configuration-files`.
 
155
 
 
156
.. cmdoption:: --use-qmake
 
157
 
 
158
    .. versionadded:: 4.16
 
159
 
 
160
    Normally the :program:`configure.py` script uses SIP's own build system to
 
161
    create the Makefiles for the code generator and module.  This option causes
 
162
    project files (``.pro`` files) used by Qt's :program:`qmake` program to be
 
163
    generated instead.  :program:`qmake` should then be run to generate the
 
164
    Makefiles.  This is particularly useful when cross-compiling.
 
165
 
 
166
The :program:`configure.py` script takes many other options that allows the
 
167
build system to be finely tuned.  These are of the form ``name=value`` or
125
168
``name+=value``.  The :option:`--show-build-macros <configure.py
126
169
--show-build-macros>` option will display each supported ``name``, although not
127
170
all are applicable to all platforms.
137
180
 
138
181
    python configure.py CXXFLAGS+=-fno-exceptions
139
182
 
140
 
A pure Python module called ``sipconfig.py`` is generated by ``configure.py``.
141
 
This defines each ``name`` and its corresponding ``value``.  Looking at it will
142
 
give you a good idea of how the build system uses the different options.  It is
143
 
covered in detail in :ref:`ref-build-system`.
 
183
A pure Python module called ``sipconfig.py`` is generated by
 
184
:program:`configure.py`.  This defines each ``name`` and its corresponding
 
185
``value``.  Looking at it will give you a good idea of how the build system
 
186
uses the different options.  It is covered in detail in
 
187
:ref:`ref-build-system`.
144
188
 
145
189
 
146
190
Configuring for MinGW
150
194
GCC.  You must use the :option:`--platform <configure.py -p>` command line
151
195
option to specify the correct platform.  For example::
152
196
 
153
 
    c:\python32\python configure.py --platform win32-g++
 
197
    c:\python34\python configure.py --platform win32-g++
154
198
 
155
199
 
156
200
Configuring for the Borland C++ Compiler
160
204
compiler.  You must use the :option:`--platform <configure.py -p>` command line
161
205
option to specify the correct platform.  For example::
162
206
 
163
 
    c:\python32\python configure.py --platform win32-borland
 
207
    c:\python34\python configure.py --platform win32-borland
164
208
 
165
209
You must also make sure you have a Borland-compatible version of the Python
166
210
library.  If you are using the standard Python distribution (built using the
167
211
Microsoft compiler) then you must convert the format of the Python library.
168
212
For example::
169
213
 
170
 
    coff2omf python32.lib python32_bcpp.lib
 
214
    coff2omf python34.lib python34_bcpp.lib
171
215
 
172
216
 
173
217
Building
185
229
(Depending on your system you may require root or administrator privileges.)
186
230
 
187
231
This will install the various SIP components.
 
232
 
 
233
 
 
234
.. _ref-configuration-files:
 
235
 
 
236
Configuring with Configuration Files
 
237
------------------------------------
 
238
 
 
239
The :program:`configure.py` script normally introspects the Python installation
 
240
of the interpreter running it in order to determine the names of the various
 
241
files and directories it needs.  This is fine for a native build of SIP but
 
242
isn't appropriate when cross-compiling.  In this case it is possible to supply
 
243
a configuration file, specified using the
 
244
:option:`--configuration <configure.py --configuration>` option, which contains
 
245
definitions of all the required values.
 
246
 
 
247
The format of a configuration file is as follows:
 
248
 
 
249
- a configuration item is a single line containing a name/value pair separated
 
250
  by ``=``
 
251
 
 
252
- a value may include another value by embedding the name of that value
 
253
  surrounded by ``%(`` and ``)``
 
254
 
 
255
- comments begin with ``#`` and continue to the end of the line
 
256
 
 
257
- blank lines are ignored.
 
258
 
 
259
:program:`configure.py` provides the following preset values for a
 
260
configuration:
 
261
 
 
262
``py_major``
 
263
    is the major version number of the target Python installation.
 
264
 
 
265
``py_minor``
 
266
    is the minor version number of the target Python installation.
 
267
 
 
268
``sysroot``
 
269
    is the name of the system root directory.  This is specified with the
 
270
    :option:`--sysroot <configure.py --sysroot>` option.
 
271
 
 
272
The following is an example configuration file::
 
273
 
 
274
    # The target Python installation.
 
275
    py_platform = linux
 
276
    py_inc_dir = %(sysroot)/usr/include/python%(py_major)%(py_minor)
 
277
 
 
278
    # Where SIP will be installed.
 
279
    sip_bin_dir = %(sysroot)/usr/bin
 
280
    sip_module_dir = %(sysroot)/usr/lib/python%(py_major)/dist-packages
 
281
 
 
282
The following values can be specified in the configuration file:
 
283
 
 
284
``py_platform``
 
285
    is the target Python platform.
 
286
 
 
287
``py_inc_dir``
 
288
    is the target Python include directory containing the ``Python.h`` file.
 
289
 
 
290
``py_conf_inc_dir``
 
291
    is the target Python include directory containing the ``pyconfig.h`` file.
 
292
    If this isn't specified then it defaults to the value of ``py_inc_dir``.
 
293
 
 
294
``py_pylib_dir``
 
295
    is the target Python library directory.
 
296
 
 
297
``sip_bin_dir``
 
298
    is the name of the target directory where the SIP code generator will be
 
299
    installed.  It can be overridden by the
 
300
    :option:`--bindir <configure.py -b>` option.
 
301
 
 
302
``sip_inc_dir``
 
303
    is the name of the target directory where the ``sip.h`` file will be
 
304
    installed.  If this isn't specified then it defaults to the value of
 
305
    ``py_inc_dir``.  It can be overridden by the
 
306
    :option:`--incdir <configure.py -e>` option.
 
307
 
 
308
``sip_module_dir``
 
309
    is the target directory where the SIP module will be installed.  It can be
 
310
    overridden by the :option:`--destdir <configure.py -d>` option.
 
311
 
 
312
``sip_sip_dir``
 
313
    is the name of the target directory where generated ``.sip`` files will be
 
314
    installed by default.  It is only used when creating the :mod:`sipconfig`
 
315
    module.  It can be overridden by the :option:`--sipdir <configure.py -v>`
 
316
    option.