parent
eacd88bf3f
commit
921f6b209d
6 changed files with 52 additions and 12 deletions
|
@ -2,9 +2,11 @@
|
|||
# Static compilation instructions for all binary modules.
|
||||
#####################################################################
|
||||
|
||||
*static*
|
||||
_asyncio _asynciomodule.c
|
||||
_bisect _bisectmodule.c
|
||||
_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
|
||||
_sqlite3 -I$(srcdir)/Modules/_sqlite -DMODULE_NAME='\"sqlite3\"' _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c
|
||||
# _bz2 _bz2module.c -I$(srcdir)/../bzip2/include -L$(srcdir)/../Support/BZip2 -lbz2
|
||||
_codecs_cn cjkcodecs/_codecs_cn.c
|
||||
_codecs_hk cjkcodecs/_codecs_hk.c
|
||||
|
@ -37,16 +39,6 @@ _sha3 _sha3/sha3module.c
|
|||
_sha256 sha256module.c
|
||||
_sha512 sha512module.c
|
||||
_socket socketmodule.c
|
||||
_sqlite3 -I$(srcdir)/Modules/_sqlite -DMODULE_NAME='\"sqlite3\"' -DSQLITE_OMIT_LOAD_EXTENSION -lsqlite3 \
|
||||
_sqlite/cache.c \
|
||||
_sqlite/connection.c \
|
||||
_sqlite/cursor.c \
|
||||
_sqlite/microprotocols.c \
|
||||
_sqlite/module.c \
|
||||
_sqlite/prepare_protocol.c \
|
||||
_sqlite/row.c \
|
||||
_sqlite/statement.c \
|
||||
_sqlite/util.c
|
||||
_ssl _ssl.c -lssl -DUSE_SSL
|
||||
_struct _struct.c
|
||||
array arraymodule.c
|
||||
|
|
|
@ -32,12 +32,39 @@ class Python3Recipe(Recipe):
|
|||
self.append_file("ModulesSetup.mobile", "Modules/Setup.local")
|
||||
self.apply_patch("xcompile.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
def postbuild_arch(self, arch):
|
||||
# include _sqlite module to .a
|
||||
py_arch = arch.arch
|
||||
if py_arch == "armv7":
|
||||
py_arch = "arm"
|
||||
elif py_arch == "arm64":
|
||||
py_arch = "aarch64"
|
||||
tmp_folder = "temp.ios-{}-3.7{}".format(py_arch, self.build_dir)
|
||||
build_env = self.get_build_env(arch)
|
||||
for o_file in [
|
||||
"cache.o",
|
||||
"cursor.o",
|
||||
"module.o",
|
||||
"row.o",
|
||||
"util.o",
|
||||
"connection.o",
|
||||
"microprotocols.o",
|
||||
"prepare_protocol.o",
|
||||
"statement.o",
|
||||
]:
|
||||
shprint(sh.Command(build_env['AR']),
|
||||
"-r",
|
||||
"{}/{}".format(self.build_dir, self.library),
|
||||
"{}/build/{}/Modules/_sqlite/{}".format(self.build_dir, tmp_folder, o_file))
|
||||
print("Added _sqlite to archive")
|
||||
|
||||
def get_build_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["PATH"] = "{}:{}".format(
|
||||
join(self.ctx.dist_dir, "hostpython3", "bin"),
|
||||
os.environ["PATH"])
|
||||
build_env["CFLAGS"] += " --sysroot={}".format(arch.sysroot)
|
||||
return build_env
|
||||
|
||||
def build_arch(self, arch):
|
||||
|
@ -105,7 +132,15 @@ class Python3Recipe(Recipe):
|
|||
_env=build_env)
|
||||
# os.execve("/bin/bash", ["/bin/bash"], os.environ)
|
||||
self.reduce_python()
|
||||
self.install_mock_modules()
|
||||
|
||||
def install_mock_modules(self):
|
||||
logger.info("Install mock modules")
|
||||
sqlite3_src = join(self.recipe_dir, 'mock_modules', '_sqlite3')
|
||||
site_packages_folder = join(
|
||||
self.ctx.dist_dir, "root", "python3", "lib", "python3.7", "site-packages", "_sqlite3")
|
||||
shutil.copytree(sqlite3_src, site_packages_folder)
|
||||
|
||||
def reduce_python(self):
|
||||
logger.info("Reduce python")
|
||||
oldpwd = os.getcwd()
|
||||
|
|
2
recipes/python3/mock_modules/_sqlite3/__init__.py
Normal file
2
recipes/python3/mock_modules/_sqlite3/__init__.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
__version__ = 'kivy-ios'
|
||||
from ._sqlite3 import *
|
|
@ -0,0 +1 @@
|
|||
|
10
recipes/python3/mock_modules/_sqlite3/_sqlite3.py
Normal file
10
recipes/python3/mock_modules/_sqlite3/_sqlite3.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
"""
|
||||
def __bootstrap__():
|
||||
global __bootstrap__, __loader__, __file__
|
||||
import sys, pkg_resources, imp
|
||||
__file__ = pkg_resources.resource_filename(__name__, '_sqlite3.cpython-37m-darwin.so')
|
||||
__loader__ = None; del __bootstrap__, __loader__
|
||||
print("demo")
|
||||
imp.load_dynamic(__name__,__file__)
|
||||
__bootstrap__()
|
||||
"""
|
|
@ -236,9 +236,9 @@ class Arch(object):
|
|||
] + include_dirs)
|
||||
env["LDFLAGS"] = " ".join([
|
||||
"-arch", self.arch,
|
||||
"--sysroot", self.sysroot,
|
||||
# "--sysroot", self.sysroot,
|
||||
"-L{}/{}".format(self.ctx.dist_dir, "lib"),
|
||||
"-lsqlite3",
|
||||
"-L{}/usr/lib".format(self.sysroot),
|
||||
self.version_min
|
||||
])
|
||||
return env
|
||||
|
|
Loading…
Reference in a new issue