Changeset 285 for trunk/docs


Ignore:
Timestamp:
Apr 24, 2006, 1:18:21 PM (13 years ago)
Author:
cito
Message:

Made the installation instructions more clear.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/install.txt

    r270 r285  
    7777using msvcr71 instead of msvcrt as its common runtime library. So, if you are
    7878using MinGW to build PyGreSQL for Python 2.4 on a Windows system, you should
    79 edit the file "%MinGWpath%/lib/gcc/%MinGWversion%/specs" and change the entry
     79edit the file ``%MinGWpath%/lib/gcc/%MinGWversion%/specs`` and change the entry
    8080that reads ``-lmsvcrt`` to ``-lmsvcr71``. Then use the following command to
    8181build and install PyGreSQL::
     
    9595-----------
    9696
    97 * In the directory containing pgmodule.c, run the following command::
     97* In the directory containing ``pgmodule.c``, run the following command::
    9898
    99     cc -fpic -shared -o _pg.so -I[pyInc] -I[pgInc] -L[pgLib] -lpq pgmodule.c
     99    cc -fpic -shared -o _pg.so -I$PYINC -I$PGINC -I$PSINC -L$PGLIB -lpq pgmodule.c
    100100
    101   where::
     101  where you have to set::
    102102
    103     [pyInc] = path of the Python include (usually Python.h)
    104     [pgInc] = path of the PostgreSQL include (usually postgres.h)
    105     [pgLib] = path of the PostgreSQL libraries (usually libpq.so or libpq.a)
     103    PYINC = path to the Python include files
     104            (usually something like /usr/include/python)
     105    PGINC = path to the PostgreSQL client include files
     106            (something like /usr/include/pgsql or /usr/include/postgresql)
     107    PSINC = path to the PostgreSQL server include files
     108            (like /usr/include/pgsql/server or /usr/include/postgresql/server)
     109    PGLIB = path to the PostgreSQL object code libraries (usually /usr/lib)
    106110
    107   Some options may be added to this line:
     111  If you are not sure about the above paths, try something like::
     112
     113    PYINC=`find /usr -name Python.h`
     114    PGINC=`find /usr -name libpq-fe.h`
     115    PSINC=`find /usr -name postgres.h`
     116    PGLIB=`find /usr -name libpq.so`
     117
     118  If you have the ``pg_config`` tool installed, you can set::
     119
     120    PGINC=`pg_config --includedir`
     121    PSINC=`pg_config --includedir-server`
     122    PGLIB=`pg_config --libdir`
     123
     124  Some options may be added to this line::
     125
    108126    -DNO_DEF_VAR   no default variables support
    109127    -DNO_DIRECT    no direct access methods
     
    111129    -DNO_PQSOCKET  if running an older PostgreSQL
    112130
    113   On some systems you may need to include -lcrypt in the list of libraries
    114   to make it compile.
    115 
    116   Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4
     131  Define ``NO_PQSOCKET`` if you are using a version of PostgreSQL before 6.4
    117132  that does not have the PQsocket function. The other options will be
    118133  described in the next sections.
     134
     135  On some systems you may need to include ``-lcrypt`` in the list of libraries
     136  to make it compile.
    119137
    120138* Test the new module. Something like the following should work::
     
    132150    (1 row)
    133151
    134 * Finally, move the _pg.so, pg.py, and pgdb.py to a directory in your
    135   PYTHONPATH. A good place would be /usr/lib/python/site-packages if
    136   your Python modules are in /usr/lib/python.
     152* Finally, move the ``_pg.so``, ``pg.py``, and ``pgdb.py`` to a directory in
     153  your ``PYTHONPATH``. A good place would be ``/usr/lib/python/site-packages``
     154  if your Python modules are in ``/usr/lib/python``.
    137155
    138156Built-in to Python interpreter
    139157------------------------------
    140158
    141 * Find the directory where your 'Setup' file lives (usually ??/Modules) in
    142   the Python source hierarchy and copy or symlink the 'pgmodule.c' file there.
     159* Find the directory where your ``Setup`` file lives (usually in the ``Modules``
     160  subdirectory) in the Python source hierarchy and copy or symlink the
     161  ``pgmodule.c`` file there.
    143162
    144163* Add the following line to your 'Setup' file::
    145164
    146     _pg  pgmodule.c -I[pgInc] -L[pgLib] -lpq # -lcrypt # needed on some systems
     165    _pg  pgmodule.c -I$PGINC -I$PSINC -L$PGLIB -lpq
    147166
    148167  where::
    149168
    150     [pgInc] = path of PostgreSQL include (often /usr/local/include/python)
    151     [pgLib] = path of the PostgreSQL libraries (often /usr/local/lib/python)
     169    PGINC = path to the PostgreSQL client include files (see above)
     170    PSINC = path to the PostgreSQL server include files (see above)
     171    PGLIB = path to the PostgreSQL object code libraries (see above)
    152172
    153173  Some options may be added to this line:
     
    155175    -DNO_DIRECT    no direct access methods
    156176    -DNO_LARGE     no large object support
    157     -DNO_PQSOCKET  if running an older PostgreSQL
     177    -DNO_PQSOCKET  if running an older PostgreSQL (see above)
    158178
    159   Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4
    160   that does not have the PQsocket function. The other options will be
    161   described in the next sections.
     179  On some systems you may need to include ``-lcrypt`` in the list of libraries
     180  to make it compile.
    162181
    163 * If you want a shared module, make sure that the "*shared*" keyword is
     182* If you want a shared module, make sure that the ``shared`` keyword is
    164183  uncommented and add the above line below it. You used to need to install
    165184  your shared modules with ``make sharedinstall`` but this no longer seems
    166185  to be true.
    167186
    168 * Copy pg.py to the lib directory where the rest of your modules are. For
    169   example, that's /usr/local/lib/Python on my system.
     187* Copy ``pg.py`` to the lib directory where the rest of your modules are.
     188  For example, that's ``/usr/local/lib/Python`` on my system.
    170189
    171190* Rebuild Python from the root directory of the Python source hierarchy by
    172   running ``make -f Makefile.pre.in boot' and 'make && make install``.
     191  running ``make -f Makefile.pre.in boot`` and ``make && make install``.
    173192
    174 * For more details read the documentation at the top of Makefile.pre.in
     193* For more details read the documentation at the top of ``Makefile.pre.in``.
Note: See TracChangeset for help on using the changeset viewer.