File: INSTALL

package info (click to toggle)
gamera 1:3.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 15,912 kB
  • sloc: xml: 122,324; cpp: 50,730; python: 35,044; ansic: 258; makefile: 114; sh: 101
file content (403 lines) | stat: -rw-r--r-- 12,979 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
==============================
Building and installing Gamera
==============================

Microsoft Windows
=================

Installing from source
----------------------

Currently, Gamera can be built using the MingW32/GNU toolset.
The "officially supported" configuration, (i.e. the one that the
Gamera developers use) is to use the MingW32 compiler
to build for the official Python.org Python. This can be done in
one of the following two ways:

- with the `standalone Mingw32`__ toolchain (easiest solution)

.. __: #mingw32

- or with the MingW32 compiler installed `inside of Cygwin`__

.. __: #cygwin

If you have success with other compilers and configurations,
please consider contributing your experiences to this documentation.

Prerequisites
`````````````

- Python 2.5.x or later
  (only the distribution from python.org has been tested)

- wxPython 2.6.x or later (wxPython 2.8.x or later recommended for
  full functionality)

.. note::

   Fixes for common problems:

    - The Python 2.6 binary from python.org requires ``libmsvcr90.a``,
      which is an erroneous in some versions of Mingw32. To fix it, you can
      recreate the file from the DLL ``msvcr90.dll`` that comes with
      Python 2.6 with pexports__ and *dlltool* (the latter is part of Mingw32)::

        pexports msvcr90.dll > msvcr90.def
        dlltool --input-def msvcr90.def --dllname msvcr90.dll --output-lib libmsvcr90.a -k

      With Python 2.7 and Mingw gcc 4.6, these changes are not necessary.

    - Recent versions of the Mingw gcc no longer support the ``-mno-cygwin``
      option, which is however passed on by the Python distutils. If you run
      into this error, you can simply remove the option from the file::

        C:\Python27\lib\distutils\cygwinccompiler.py

.. __: http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/

.. _mingw32:

Standalone Mingw32
``````````````````

Install the Mingw32 port of gcc from http://mingw.org/. Make sure
that you do not only install *gcc-core*, but also *g++* and *make*.
Add the *bin* subdirectory of your Mingw32 installation to
the environment variable ``PATH``.

Assuming you have installed Python to ``C:\Python275``, you can
then compile gamera at a DOS command prompt from the root directory
of the gamera source code with::

  C:\Python27\python setup.py build --compiler=mingw32 bdist_wininst

This will create a Windows installer, including uninstallation support,
in the *dist* subdirectory. It can be started with a double click
in the Explorer, or from the DOS command prompt with::

  start dist\gamera-*.exe


.. _cygwin:

Mingw32 inside Cygwin
`````````````````````

Use the installer from http://www.cygwin.com/ to install Cygwin,
including the ``g++-mingw32`` compiler and the ``MingW32`` libraries.
If you plan to track development of Gamera, you will probably also
want to install ``subversion``.

The important thing to note here is that we are using Cygwin's Mingw32
compiler to build for the standard (non-Cygwin) Python from
python.org.  After a clean install of Cygwin, typing 'python' will
start up Cygwin's version of Python, not the one from python.org.
Therefore, you will want to add the standard Python to your Cygwin
PATH using the command (assuming you installed Python in standard location)::

  export PATH=/cygdrive/c/Python25/:$PATH

Ensure you are using the correct Python by typing::

  which python

The result should be ``/cygdrive/c/Python25/python.exe``, not
``/usr/bin/python``.

Beware that the file ``/usr/bin/gcc`` installed by Cygwin actually
is *not* the compiler executable, but a symbolic link. Symbolic
links are not supported by MS Windows, but are a Cygwin-only
feature. This means that the Python Distutils system cannot execute
``/usr/bin/gcc`` and the build command will fail. To fix this,
replace the symbolic link with the actual compiler executable::

  cp /usr/bin/gcc-3 /usr/bin/gcc
  cp /usr/bin/g++-3 /usr/bin/g++

From here on, you can proceed as for the standalone Mingw32 toolchain,
i.e.::

  python setup.py build --compiler=mingw32 bdist_wininst
  dist/gamera-*.exe


Linux (and other \*nix)
=======================

Prerequisites
-------------

- Python 2.3 and later are supported, though Python 2.4 or later is
  recommended.

  You will need to have the headers (but not the complete source) to
  build Gamera from source code.  Most Linux distributions include
  these as a separate package (eg. ``python-dev`` or ``python-devel``).

- wxPython 2.4.x or later (wxPython 2.8.x or later recommended for
  full functionality).

- ``gcc`` version 3.1 or later.

- libtiff 3.5.x or later

- libpng 1.2.x or later

If any of these prerequisites is installed in a non standard directory,
you can use the environment variables ``CFLAGS`` and ``LDFLAGS`` to
pass its locations to the build script, e.g.::

  CFLAGS=-I/usr/local/include
  LDFLAGS=-L/usr/local/lib
  export CFLAGS LDFLAGS


Standard Build and Install
--------------------------

Gamera is built using the Python-standard Distutils system.  Open a
terminal and type::

  python setup.py build
  sudo python setup.py install

By default, parallelization of the genetic algorithms is only compiled
into Gamera under Linux and with gcc version > 4.2, because we could only
get it running in this environment. If you are sure that you have unbroken
OpenMP support on your system, you can compile Gamera with::

  python setup.py build --openmp=yes

If Gamera is compiled with OpenMP on your system, but OpenMP does not work
on your system for some reason, you can switch it off with::

  python setup.py build --openmp=no


Installing without root privileges
----------------------------------

.. _without_root:

If you do not have root access to your machine, you can make a local
installation of Gamera.

A quick-and-easy way to do this is to use the ``virtual_python.py``
script available here__, and then follow the standard installation
instructions (without using sudo)::

  python setup.py build
  python setup.py install

.. __: http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python

Alternatively, you can set up a local installation by hand.

Make a local python module directory somewhere that you have write
privileges (such as your home directory)::

  mkdir ~/python

From the Gamera build directory, install Gamera into that directory::

  python setup.py install --home=~/python

Set up an environment variables so Python can find stuff there (you
may want to add this to your ~/.bash_profile file)::

  export PYTHONPATH=~/python/lib/python

Add the local Python scripts directory to your path::

  export PATH=~/python/bin:$PATH

Now you should be able to run the ``gamera_gui`` script from the
command line.

Running
-------

Run the ``gamera_gui`` script, which should have installed to
``/usr/local/bin``.  This file can also be copied anywhere (such as
the Desktop) and double-clicked to run Gamera.

.. note:: Running the script from the root of the source tree will not
  work, since it will not be able to find the compiled version of Gamera.

Installing without wxPython
---------------------------

When you need Gamera as a backend for document processing routines on
a server and do not need the GUI, it can save a lot of trouble to
avoid the installation of wxPython. For this case, use the option
``--nowx`` for ``setup.py``::

  python setup.py --nowx build
  sudo python setup.py --nowx install


Mac OS-X
========

Earlier versions of Gamera ran on OS-X by using X11 as an emulation of
a standard Unix environment.  The current SVN version of Gamera now
uses Cocoa, and feels much more like a standard Macintosh
application.  Please follow the instructions for *either* X11 or Cocoa
install below.


Native (Cocoa) build
--------------------

Prerequisites
`````````````

Gamera installs out of the box on Mac OS-X 10.4 (Tiger) and 10.5 (Leopard).
The only prerequisite is to install XCode, which is shipped with the
OS-X installation DVD, but is not installed by default.

It should be noted that OS-X 10.4 comes with the unstable branch 2.5 of
wxPython. So far we have not yet encountered any problems with this
version, but if you have any problems, please consider to install
wxPython 2.6 instead. This is *not* possible from the binary
installers from http://www.wxpython.org/, because there is none for
Python 2.3, and the other Python versions require a particular prerelease
of Xcode to build extensions, that is no longer available.
So if you decide to upgrade wxPython on OS-X 10.4, you must do it from
the source release of wxPython 2.6.

Standard Build and Install
``````````````````````````

Gamera is built using the Python-standard Distutils system.

To build Gamera, open a terminal and type::

  python setup.py build

and then to install (you'll need to have admin privileges)::

  sudo pythonw setup.py install

On OS-X 10.4, you must do the installation with ``pythonw`` rather than
with ``python``, because ``gamera_gui`` is a GUI application. On OS-X 10.5
this distinction is no longer necessary, but using ``pythonw`` also works.

On OS-X 10.5, the script ``gamera_gui`` is installed to ``/usr/local/bin``,
which is also in the default search PATH for programs.
Prior to OS-X 10.5, the script ``gamera_gui`` was installed to 
``/System/Library/Frameworks/Python.framework/Versions/2.?/bin``, which
is not in the default search PATH. You can either add this directory
to your search PATH, or install the scripts to ``/usr/bin`` with::

  sudo pythonw setup.py install_scripts -d /usr/bin

.. note::
  In its default configuration, the Python distutils on MacOS X
  build fat binaries. You can speedup the compilation time
  by a factor two by removing the unnecessary architecture from
  your distutils build settings.

  The critical part are the architecture options "-arch ppc" and
  "-arch i386". When you do not want to redistribute the compiled
  binaries, you can simply remove one of the architectures.
  Depending on the OSX/Python version, this is done in
  ``/Library/Framework/Python.framework/Versions/2.?/lib/python2.?/config/Makefile``,
  or in
  ``/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/sysconfig.py``


Installing without root privileges
``````````````````````````````````

The instructions for `installing without root (administrator)
privileges`__ can also be used on Mac OS-X.

__ without_root_

Running
```````

Start the Terminal application and run the ``gamera_gui`` script.

.. note:: Running the script from the root of the source tree will not
  work, since it will not be able to find the compiled version of
  Gamera.


X11 build
---------

Please note that this build is no longer maintained by the Gamera developers.
So use it only when the Cocoa build is not possible for some reason (e.g. on a 
legacy OS-X 10.3 system).

Prerequisites
`````````````

- Mac OS-X 10.3 (Panther) or presumably later

- Python 2.3 (including the version included).

- wxPython-GTK 2.4.x or later

  Since there is no official build of the Gtk+/X11 version for Mac
  OS-X, I have made one available in the Gamera SourceForge Files
  section.

- XCode.  The version of XCode that shipped on the Tiger installation
  DVD will not work if you plan to use a newer version of Python
  downloaded from python.org.  XCode 2.4.1, may be downloaded from
  http://developer.apple.com/tools/xcode .

- X11.  This is available on the Tiger installation DVD.  You should
  also use Software Update to update X11 to the latest version.

Standard Build and Install
``````````````````````````

Download and install the unofficial wxPython-Gtk-X11 distribution from
the Gamera Files section on SourceForge.

  Alternatively, you can install fink and then build the package
  wxPython-Py23, which is currently in the unstable branch, (and its
  dependencies) from source.  You will then need to use the fink
  version of Python (not the one that Apple provides) to carry out the
  instructions below.

Gamera is built using the Python-standard Distutils system.

To build Gamera, open a X11 terminal and type::

  python setup.py build

and then to install (you'll need to have admin privileges)::

  sudo python setup.py install

The scripts can be installed by::

  sudo python setup.py install_scripts -d /usr/bin

.. note:: The ``-d /usr/bin/`` installs the scripts in a reasonable
  place on the PATH.  If you do not specify it, the scripts are by
  default installed to
  ``/System/Library/Frameworks/Python.framework/Versions/2.3/bin``.

Installing without root privileges
``````````````````````````````````

The instructions for `installing without root (administrator)
priviledges`__ can also be used on Mac OS-X.

__ without_root_

Running
```````

Start an X11 terminal and run the ``gamera_gui`` script.

.. note:: Running the script from the root of the source tree will not
  work, since it will not be able to find the compiled version of
  Gamera.