pypy{27,310,311}: make CFFI builds find libsqlite3
This commit is contained in:
parent
e230878c5f
commit
e33181bc62
@ -140,8 +140,22 @@ stdenv.mkDerivation rec {
|
||||
tcl_libprefix = tcl.libPrefix;
|
||||
})
|
||||
|
||||
(replaceVars ./sqlite_paths.patch {
|
||||
# Python ctypes.util uses three different strategies to find a library (on Linux):
|
||||
# 1. /sbin/ldconfig
|
||||
# 2. cc -Wl,-t -l"$libname"; objdump -p
|
||||
# 3. ld -t (where it attaches the values in $LD_LIBRARY_PATH as -L arguments)
|
||||
# The first is disabled in Nix (and wouldn't work in the build sandbox or on NixOS anyway), and
|
||||
# the third was only introduced in Python 3.6 (see bugs.python.org/issue9998), so is not
|
||||
# available when buliding PyPy (which is built using Python/PyPy 2.7).
|
||||
# The second requires SONAME to be set for the dynamic library for the second part not to fail.
|
||||
# As libsqlite3 stopped shipping with SONAME after the switch to autosetup (>= 3.50 in Nixpkgs;
|
||||
# see https://www.sqlite.org/src/forumpost/5a3b44f510df8ded). This makes the Python CFFI module
|
||||
# unable to find the SQLite library.
|
||||
# To circumvent these issues, we hardcode the path during build.
|
||||
# For more information, see https://github.com/NixOS/nixpkgs/issues/419942.
|
||||
(replaceVars (if isPy3k then ./sqlite_paths.patch else ./sqlite_paths_2_7.patch) {
|
||||
inherit (sqlite) out dev;
|
||||
libsqlite = "${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
@ -1,7 +1,35 @@
|
||||
diff -ur a/lib_pypy/_sqlite3_build.py b/lib_pypy/_sqlite3_build.py
|
||||
--- a/lib_pypy/_sqlite3_build.py 2021-04-12 01:11:48.000000000 -0400
|
||||
+++ b/lib_pypy/_sqlite3_build.py 2021-07-14 18:08:33.000000000 -0400
|
||||
@@ -301,6 +301,8 @@
|
||||
diff --git a/lib_pypy/_sqlite3_build.py b/lib_pypy/_sqlite3_build.py
|
||||
index 2a4e573..92ab786 100644
|
||||
--- a/lib_pypy/_sqlite3_build.py
|
||||
+++ b/lib_pypy/_sqlite3_build.py
|
||||
@@ -352,7 +352,7 @@ def _has_load_extension():
|
||||
typedef ... sqlite3;
|
||||
int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
|
||||
""")
|
||||
- libname = 'sqlite3'
|
||||
+ libname = '@libsqlite@'
|
||||
if sys.platform == 'win32':
|
||||
import os
|
||||
_libname = os.path.join(os.path.dirname(sys.executable), libname)
|
||||
@@ -369,7 +369,7 @@ def _has_backup():
|
||||
typedef ... sqlite3_backup;
|
||||
sqlite3_backup* sqlite3_backup_init(sqlite3 *, const char* , sqlite3 *, const char*);
|
||||
""")
|
||||
- libname = 'sqlite3'
|
||||
+ libname = '@libsqlite@'
|
||||
if sys.platform == 'win32':
|
||||
import os
|
||||
_libname = os.path.join(os.path.dirname(sys.executable), libname)
|
||||
@@ -383,7 +383,7 @@ def _get_version():
|
||||
unverified_ffi.cdef("""
|
||||
int sqlite3_libversion_number(void);
|
||||
""")
|
||||
- libname = 'sqlite3'
|
||||
+ libname = '@libsqlite@'
|
||||
if sys.platform == 'win32':
|
||||
import os
|
||||
_libname = os.path.join(os.path.dirname(sys.executable), libname)
|
||||
@@ -554,6 +554,8 @@ if sys.platform.startswith('freebsd'):
|
||||
else:
|
||||
extra_args = dict(
|
||||
libraries=libraries,
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
diff --git a/lib_pypy/_sqlite3_build.py b/lib_pypy/_sqlite3_build.py
|
||||
index fb03aee..b3b5f39 100644
|
||||
--- a/lib_pypy/_sqlite3_build.py
|
||||
+++ b/lib_pypy/_sqlite3_build.py
|
||||
@@ -234,7 +234,7 @@ def _has_load_extension():
|
||||
typedef ... sqlite3;
|
||||
int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
|
||||
""")
|
||||
- libname = 'sqlite3'
|
||||
+ libname = '@libsqlite@'
|
||||
if sys.platform == 'win32':
|
||||
import os
|
||||
_libname = os.path.join(os.path.dirname(sys.executable), libname)
|
||||
@@ -257,6 +257,8 @@ if sys.platform.startswith('freebsd'):
|
||||
else:
|
||||
extra_args = dict(
|
||||
libraries=libraries,
|
||||
+ include_dirs=['@dev@/include'],
|
||||
+ library_dirs=['@out@/lib']
|
||||
)
|
||||
|
||||
_ffi.set_source("_sqlite3_cffi", "#include <sqlite3.h>", **extra_args)
|
||||
Loading…
x
Reference in New Issue
Block a user