diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2021-05-26 14:29:56 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2021-05-26 17:28:14 +0100 |
commit | 52cd94442c8e971d8604192acf53a7e5ba1433ed (patch) | |
tree | f27373dd15e1deda075c61b90aabf46386ca19b5 | |
parent | d116b80c5f369c73aab09376ee503ddeb5e2d5be (diff) | |
download | psycopg2-52cd94442c8e971d8604192acf53a7e5ba1433ed.tar.gz |
Add include and lib dirs from libpq --cppflags, --ldflags
They seem the right thing to fix MacOS build woes.
Inspired to #935, might close #1200.
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | scripts/build/build_macos.sh | 4 | ||||
-rw-r--r-- | setup.py | 10 |
3 files changed, 12 insertions, 4 deletions
@@ -12,6 +12,8 @@ What's new in psycopg 2.9 - Connection exceptions with sqlstate ``08XXX`` reclassified as `~psycopg2.OperationalError` (a subclass of the previously used `~psycopg2.DatabaseError`) (:ticket:`#1148`). +- Include library dirs required from libpq to work around MacOS build problems + (:ticket:`#1200`). What's new in psycopg 2.8.7 diff --git a/scripts/build/build_macos.sh b/scripts/build/build_macos.sh index 8678609..4841ee7 100755 --- a/scripts/build/build_macos.sh +++ b/scripts/build/build_macos.sh @@ -35,10 +35,6 @@ mkdir -p "$DISTDIR" # Install required python packages pip install -U pip wheel delocate -# Allow to find the libraries needed. -export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" -export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" - # Replace the package name gsed -i "s/^setup(name=\"psycopg2\"/setup(name=\"${PACKAGE_NAME}\"/" \ "${PRJDIR}/setup.py" @@ -376,6 +376,16 @@ For further information please check the 'doc/src/install.rst' file (also at self.library_dirs.append(pg_config_helper.query("libdir")) self.include_dirs.append(pg_config_helper.query("includedir")) self.include_dirs.append(pg_config_helper.query("includedir-server")) + + # add includedirs from cppflags, libdirs from ldflags + for token in pg_config_helper.query("ldflags").split(): + if token.startswith("-L"): + self.library_dirs.append(token[2:]) + + for token in pg_config_helper.query("cppflags").split(): + if token.startswith("-I"): + self.include_dirs.append(token[2:]) + pgversion = pg_config_helper.query("version").split()[1] verre = re.compile( |