mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 12:23:42 +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>
|
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.
|
* lib/extras.py: added support for UUID arrays.
|
||||||
|
|
||||||
* psycopg/connection_int.c: applied patch from Richard Davies to avoid
|
* 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_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'
|
# 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
|
use_pydatetime=1
|
||||||
|
|
||||||
# If the build system does not find the mx.DateTime headers, try
|
# If the build system does not find the mx.DateTime headers, try
|
||||||
# uncommenting the following line and setting its value to the right path.
|
# uncommenting the following line and setting its value to the right path.
|
||||||
#mx_include_dir=
|
#mx_include_dir=
|
||||||
|
|
||||||
# For Windows only
|
# For Windows only:
|
||||||
# Set to 1 if the PostgreSQL library was built with OpenSSL
|
# Set to 1 if the PostgreSQL library was built with OpenSSL.
|
||||||
# Required to link in OpenSSL libraries and dependencies
|
# Required to link in OpenSSL libraries and dependencies.
|
||||||
have_ssl=0
|
have_ssl=0
|
||||||
|
|
||||||
|
# Statically link against the postgresql client library.
|
||||||
|
#static_libpq=1
|
||||||
|
|
||||||
# "pg_config" is the preferred method to locate PostgreSQL headers and
|
# "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
|
# 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
|
# is installed under a different name uncomment the following option and
|
||||||
|
|
14
setup.py
14
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"),
|
"The name of the pg_config binary and/or full path to find it"),
|
||||||
('have-ssl', None,
|
('have-ssl', None,
|
||||||
"Compile with OpenSSL built PostgreSQL libraries (Windows only)."),
|
"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 = 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"
|
DEFAULT_PG_CONFIG = "pg_config"
|
||||||
|
|
||||||
|
@ -194,6 +196,11 @@ class psycopg_build_ext(build_ext):
|
||||||
build_ext.finalize_options(self)
|
build_ext.finalize_options(self)
|
||||||
|
|
||||||
self.include_dirs.append(".")
|
self.include_dirs.append(".")
|
||||||
|
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")
|
self.libraries.append("pq")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -388,6 +395,11 @@ if parser.has_option('build_ext', 'have_ssl'):
|
||||||
else:
|
else:
|
||||||
have_ssl = 0
|
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
|
# build the extension
|
||||||
|
|
||||||
sources = map(lambda x: os.path.join('psycopg', x), sources)
|
sources = map(lambda x: os.path.join('psycopg', x), sources)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user