mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 10:23:43 +03:00
Enabled linking to static libpq
This commit is contained in:
parent
390a9c2451
commit
9670c9eddc
|
@ -1,5 +1,8 @@
|
|||
2009-10-04 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* setup.py: applied patch from Christian Jacobsen to link to static
|
||||
version of libpq.
|
||||
|
||||
* lib/extras.py: added support for UUID arrays.
|
||||
|
||||
* psycopg/connection_int.c: applied patch from Richard Davies to avoid
|
||||
|
|
11
setup.cfg
11
setup.cfg
|
@ -9,18 +9,21 @@ define=PSYCOPG_EXTENSIONS,PSYCOPG_NEW_BOOLEAN,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3
|
|||
# PSYCOPG_OWN_QUOTING can be added, but it is deprecated (will go away in 2.1)
|
||||
# PSYCOPG_NEW_BOOLEAN to format booleans as true/false vs 't'/'f'
|
||||
|
||||
# Set to 1 to use Python datatime objects for default date/time representation
|
||||
# Set to 1 to use Python datatime objects for default date/time representation.
|
||||
use_pydatetime=1
|
||||
|
||||
# If the build system does not find the mx.DateTime headers, try
|
||||
# uncommenting the following line and setting its value to the right path.
|
||||
#mx_include_dir=
|
||||
|
||||
# For Windows only
|
||||
# Set to 1 if the PostgreSQL library was built with OpenSSL
|
||||
# Required to link in OpenSSL libraries and dependencies
|
||||
# For Windows only:
|
||||
# Set to 1 if the PostgreSQL library was built with OpenSSL.
|
||||
# Required to link in OpenSSL libraries and dependencies.
|
||||
have_ssl=0
|
||||
|
||||
# Statically link against the postgresql client library.
|
||||
#static_libpq=1
|
||||
|
||||
# "pg_config" is the preferred method to locate PostgreSQL headers and
|
||||
# libraries needed to build psycopg2. If pg_config is not in the path or
|
||||
# is installed under a different name uncomment the following option and
|
||||
|
|
16
setup.py
16
setup.py
|
@ -89,10 +89,12 @@ class psycopg_build_ext(build_ext):
|
|||
"The name of the pg_config binary and/or full path to find it"),
|
||||
('have-ssl', None,
|
||||
"Compile with OpenSSL built PostgreSQL libraries (Windows only)."),
|
||||
('static-libpq', None,
|
||||
"Statically link the PostgreSQL client library"),
|
||||
])
|
||||
|
||||
boolean_options = build_ext.boolean_options[:]
|
||||
boolean_options.extend(('use-pydatetime', 'have-ssl'))
|
||||
boolean_options.extend(('use-pydatetime', 'have-ssl', 'static-libpq'))
|
||||
|
||||
DEFAULT_PG_CONFIG = "pg_config"
|
||||
|
||||
|
@ -194,7 +196,12 @@ class psycopg_build_ext(build_ext):
|
|||
build_ext.finalize_options(self)
|
||||
|
||||
self.include_dirs.append(".")
|
||||
self.libraries.append("pq")
|
||||
if static_libpq:
|
||||
if not self.link_objects: self.link_objects = []
|
||||
self.link_objects.append(
|
||||
os.path.join(self.get_pg_config("libdir"), "libpq.a"))
|
||||
else:
|
||||
self.libraries.append("pq")
|
||||
|
||||
try:
|
||||
self.library_dirs.append(self.get_pg_config("libdir"))
|
||||
|
@ -388,6 +395,11 @@ if parser.has_option('build_ext', 'have_ssl'):
|
|||
else:
|
||||
have_ssl = 0
|
||||
|
||||
if parser.has_option('build_ext', 'static_libpq'):
|
||||
static_libpq = int(parser.get('build_ext', 'static_libpq'))
|
||||
else:
|
||||
static_libpq = 0
|
||||
|
||||
# build the extension
|
||||
|
||||
sources = map(lambda x: os.path.join('psycopg', x), sources)
|
||||
|
|
Loading…
Reference in New Issue
Block a user