File: building.rst

package info (click to toggle)
libgnatcoll 1.6gpl2014-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 22,760 kB
  • ctags: 10,162
  • sloc: ada: 132,013; ansic: 94,291; python: 3,762; sh: 2,781; cpp: 1,394; makefile: 342; xml: 31; sql: 6
file content (226 lines) | stat: -rw-r--r-- 9,027 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
.. _Building_the_GNAT_Reusable_Components:

*****************
Building GNATColl
*****************

The build process is extremely flexible, allowing you to choose
which modules to build, the features they should have, and
various other properties.
In the instructions detailed below, it is assumed that you have
unpacked the GNATColl package in a temporary directory and that
`installdir` is the directory in which you
would like to install the selected components.

|Important| GNATColl requires the same version of GNAT it was released with,
since it is sharing some sources with GNAT's :file:`libgnatutil` library.  If
you do not have such a compiler, please contact `info@adacore.com
<mail:sales@adacore.com>`_


.. _Configuring_the_build_environment:

Configuring the build environment
=================================

The first step is to configure the build environment. This is done by
running the `configure` command in the root directory of the
GNATColl tree.

.. index:: GNATCOLL.Projects

.. index:: projects

.. index:: gnat sources

.. index:: gnat_util

Some GNATColl components need access to a subset of the GNAT source files.
An example is the `GNATCOLL.Projects` module, which reuses
the same parser as the GNAT tools.

GNATColl will locate the needed source files in one of the following ways:

* If you have a copy of the GNAT sources, create a
  link called :file:`gnat_src` that points to the directory containing those
  sources. This link should be created in the root GNATColl
  directory.

* Otherwise, recent versions of GNAT include an additional `gnat_util.gpr`
  project file. This project contains the required
  subset of the sources. You must use the same versino of GNAT that GNATColl
  was released with, otherwise the sources might not be compatible.
  If you have an older version of GNAT, you could
  also chose to install `gnat_util` independently.

If neither of the above is satisfied, GNATColl will not include
support for `GNATCOLL.Projects`.

The `configure` command accepts a variety of arguments;
the following are likely to be the most useful:


*--prefix=`installdir`*
  This specifies the directory in which GNATColl should be installed.

*--enable-shared* and *--disable-shared*
  If neither of these switches is specified, GNATColl will try to build
  both static and shared libraries (if the latter are supported on your
  system). The compilation needs to be done twice, since the compilation options
  might not be the same in both cases.

  If you intend to always use static libraries, you can specify
  `--disable-shared`.

  When you link GNATColl with your own application, the default is
  to link with the static libraries. You can change this default, which
  becomes shared libraries if you explicitly specify `--enable-shared`.
  However, even if the default is static libraries, you can still override
  this (see below the `LIBRARY_TYPE` variable).

*--with-python=`directory`* and *--without-python*
  This specifies where GNATColl should find python. For example,
  if the python executable is in :file:`/usr/bin`, the `directory` to
  specify is :file:`/usr`. In most cases, however, `configure` will be
  able to detect this automatically, so this option is only useful 
  when python is installed some special directory. If you specify the second
  option, support for python will not be built in.

  The switch *--with-python-exec* can also be used to specify an alternative
  python executable. If you pass the value 'python3', it will force GNATCOLL
  to build with support for python3, not python2.

*--enable-shared-python*
  This specifies the location of the python library as
  `directory`/lib, which will in general be a shared library.
  By default, configure will search in a different directory of the python
  installation, and is more likely to find the static library instead (which
  makes distributing your application easier). However, whether
  shared or static libraries are used depends on how
  python was installed on your system.

*--disable-gtk*
  If this switch is specified, then no package depending on the gtk+ graphical
  toolkit will be built.

*--disable-pygtk*
  If this switch is specified, then support for pygtk
  (:ref:`The_Python_language`) will not be build. The support for this python
  module will also be automatically disabled if python was not found or if you
  configured with `--without-python`.

*--disable-syslog*
  If this switch is specified, then support for syslog
  (:ref:`Logging_to_syslog`) will not be build. This support allows sending the
  traces from all or part of your application to the system logger, rather than
  to files or `stdout`.

*--with-postgresql=<dir>* and *--without-postgresql*
  GNATColl embeds a set of packages to query a database engine.
  The `configure` command attempts to find which systems are installed on your
  system, and then builds the needed support. But you can also explicitly
  disable such support.

  If the directory in which PostgreSQL is installed contains spaces, you
  should use a syntax like::

    ./configure --with-postgres="/Program Files/PostgreSQL/8.4"
    
  Generally speaking, we do not recommend using paths with spaces, since such
  a setup often introduces complications.

*--with-sqlite=<dir>* and *--without-sqlite*
  GNATCOLL embeds a set of packages to access sqlite database. This requires
  a fairly recent version of sqlite. These switches can be used to point to
  the sqlite install on your system. By default, GNATCOLL will recompile its
  own embedded version of sqlite and link statically with it, which avoids
  issues with shared libraries and makes sure the version is compatible with
  GNATCOLL's needs.

*--enable-gpl*
  GNATCOLL provides interfaces to libraries that are licensed under the
  Full GNU Public License. This means that, should you choose to distribute
  your application to anyone, it must be free software and have a
  GPL-compatible license.
  
  To avoid ambiguities, these interfaces are disabled by default, unless
  you provide the `--enable-gpl` switch to configure.

  This currently only impacts `GNATCOLL.Readline`.

Special support exists in GNATColl for the gtk+ graphical toolkit.
The `configure` command will attempt to find the installation directory for
this toolkit by using the `pkg-config` command, which must therefore be
available through your `PATH` environment variable. It also needs to
find the :file:`gtkada.gpr` project file either because it is part of the
implicit search path for project files, or because you have put the
corresponding directory in the environment variable `GPR_PROJECT_PATH`.
If either of these two requirements fail, the modules of GNATColl
that depend on GtkAda will not be built::

  ./configure --prefix=/usr/local/gnatcoll --without-python
  
If all goes well (i.e. all required dependencies are found on the system),
configure will generate a number of files, including :file:`Makefile`,
:file:`Makefile.conf` and :file:`gnatcoll_shared.gpr`.

.. _Building_GNATColl:

Building GNATColl
=================

If `configure` has run successfully, it generates a `Makefile`
to allow you to build the rest of GNATColl.
This is done by simply typing the following command::

  make
  
Depending on the switches passed to `configure`, this will either
build both static and shared libraries, or static only (see the
`--disable-shared` configure switch).

Optionally, you can also build the examples and/or the automatic test suite,
with the following commands::

  make examples
  make test

The latter will do a local installation of gnatcoll in a subdirectory called
:file:`local_install`, and use this to run the tests. This checks whether the
installation of gnatcoll was successful.

.. _Installing_GNATColl:

Installing GNATColl
===================

Installing the library is done with the following command::

  make install
  
Note that this command does not try to recompile GNATColl,
so you must build it first.
This command will install both the shared and the static libraries if both
were built.

As mentioned in the description of the `configure` switches, your
application will by default be linked with the static library, unless
you specified the `--enable-shared` switch.

However, you can always choose later which kind of library to use for
GNATColl by setting the environment variable `LIBRARY_TYPE`
to either `"relocatable"` or `"static"`.

Your application can now use the GNATColl code through a project file, by
adding a ``with`` clause to :file:`gnatcoll.gpr`, :file:`gnatcoll_gtk.gpr` or
:file:`gnatcoll_python.gpr`.  The second one will also force your application
to be linked with the gtk+ libraries, but provides additional capabilities as
documented in each of the modules.

If you wish to install in a different location than was specified at
configure time, you can override the "prefix" variable from the command line,
for instance::

    make prefix=/alternate/directory install

This does not require any recompilation.