summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--setup.cfg11
-rw-r--r--setup.py16
3 files changed, 24 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 347fc36..9a7f798 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/setup.cfg b/setup.cfg
index 6b458e0..e660c38 100644
--- a/setup.cfg
+++ b/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
diff --git a/setup.py b/setup.py
index ec1223d..b23eff5 100644
--- a/setup.py
+++ b/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)