Compare commits
2 commits
master
...
recipe-fix
Author | SHA1 | Date | |
---|---|---|---|
|
166ae895a0 | ||
|
4d0020cc0d |
5 changed files with 52 additions and 58 deletions
|
@ -1,23 +0,0 @@
|
||||||
# pure-python package, this can be removed when we'll support any python package
|
|
||||||
import os
|
|
||||||
import sh
|
|
||||||
from kivy_ios.toolchain import PythonRecipe, shprint
|
|
||||||
|
|
||||||
|
|
||||||
class CertifiRecipe(PythonRecipe):
|
|
||||||
version = "2020.6.20"
|
|
||||||
url = "https://pypi.python.org/packages/source/c/certifi/certifi-{version}.tar.gz"
|
|
||||||
depends = ["python"]
|
|
||||||
|
|
||||||
def install(self):
|
|
||||||
arch = list(self.filtered_archs)[0]
|
|
||||||
build_dir = self.get_build_dir(arch.arch)
|
|
||||||
os.chdir(build_dir)
|
|
||||||
hostpython = sh.Command(self.ctx.hostpython)
|
|
||||||
build_env = arch.get_env()
|
|
||||||
dest_dir = os.path.join(self.ctx.dist_dir, "root", "python3")
|
|
||||||
build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
|
||||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
|
||||||
|
|
||||||
|
|
||||||
recipe = CertifiRecipe()
|
|
|
@ -12,15 +12,8 @@ class CryptographyRecipe(CythonRecipe):
|
||||||
library = "libcryptography.a"
|
library = "libcryptography.a"
|
||||||
depends = ["host_setuptools3", "host_cffi", "cffi", "asn1crypto", "idna", "six"]
|
depends = ["host_setuptools3", "host_cffi", "cffi", "asn1crypto", "idna", "six"]
|
||||||
python_depends = ["setuptools"]
|
python_depends = ["setuptools"]
|
||||||
cythonize = False
|
cythonize = True
|
||||||
pre_build_ext = True
|
pre_build_ext = True
|
||||||
include_per_arch = True
|
|
||||||
|
|
||||||
def prebuild_arch(self, arch):
|
|
||||||
if self.has_marker("patched"):
|
|
||||||
return
|
|
||||||
self.apply_patch("osrandom.patch")
|
|
||||||
self.set_marker("patched")
|
|
||||||
|
|
||||||
def dest_dir(self):
|
def dest_dir(self):
|
||||||
return join(self.ctx.dist_dir, "root", "python3")
|
return join(self.ctx.dist_dir, "root", "python3")
|
||||||
|
@ -30,11 +23,10 @@ class CryptographyRecipe(CythonRecipe):
|
||||||
r = self.get_recipe('openssl', self.ctx)
|
r = self.get_recipe('openssl', self.ctx)
|
||||||
openssl_dir = r.get_build_dir(arch.arch)
|
openssl_dir = r.get_build_dir(arch.arch)
|
||||||
target_python = Recipe.get_recipe('python3', self.ctx).get_build_dir(arch.arch)
|
target_python = Recipe.get_recipe('python3', self.ctx).get_build_dir(arch.arch)
|
||||||
env['TOOLCHAIN_PREFIX'] = arch.triple
|
|
||||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl'
|
|
||||||
env['LDFLAGS'] += ' -L' + target_python
|
env['LDFLAGS'] += ' -L' + target_python
|
||||||
|
|
||||||
env['PYTHON_ROOT'] = join(self.ctx.dist_dir, "root", "python3")
|
env['PYTHON_ROOT'] = join(self.ctx.dist_dir, "root", "python3")
|
||||||
|
env["CC"] = "clang -Qunused-arguments -fcolor-diagnostics"
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.8' + \
|
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.8' + \
|
||||||
' -I' + join(openssl_dir, 'include') + \
|
' -I' + join(openssl_dir, 'include') + \
|
||||||
' -I' + join(self.ctx.dist_dir, "include", arch.arch, "libffi")
|
' -I' + join(self.ctx.dist_dir, "include", arch.arch, "libffi")
|
||||||
|
@ -44,8 +36,7 @@ class CryptographyRecipe(CythonRecipe):
|
||||||
' -lssl' + \
|
' -lssl' + \
|
||||||
' -lcrypto' + \
|
' -lcrypto' + \
|
||||||
' -lffi' + \
|
' -lffi' + \
|
||||||
' -lcffi ' + \
|
' -lcffi'
|
||||||
' -lz'
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
|
@ -59,21 +50,5 @@ class CryptographyRecipe(CythonRecipe):
|
||||||
with cd(build_dir):
|
with cd(build_dir):
|
||||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||||
|
|
||||||
def postbuild_arch(self, arch):
|
|
||||||
py_arch = arch.arch
|
|
||||||
if py_arch == "arm64":
|
|
||||||
py_arch = "x86_64"
|
|
||||||
build_dir = self.get_build_dir(arch.arch)
|
|
||||||
build_env = self.get_recipe_env(arch)
|
|
||||||
tmp_folder = 'build/temp.macosx-10.15-{}-3.8/build/temp.macosx-10.15-{}-3.8'.format(py_arch, py_arch)
|
|
||||||
for o_file in [
|
|
||||||
"_openssl.o",
|
|
||||||
"_padding.o",
|
|
||||||
]:
|
|
||||||
shprint(sh.Command(build_env['AR']),
|
|
||||||
"-q",
|
|
||||||
"{}/{}".format(self.build_dir, self.library),
|
|
||||||
"{}/{}/{}".format(self.build_dir, tmp_folder, o_file))
|
|
||||||
|
|
||||||
|
|
||||||
recipe = CryptographyRecipe()
|
recipe = CryptographyRecipe()
|
||||||
|
|
45
kivy_ios/recipes/cryptography/getentropy.patch
Normal file
45
kivy_ios/recipes/cryptography/getentropy.patch
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
--- a/src/_cffi_src/openssl/src/osrandom_engine.c 2019-01-22 17:41:49.000000000 +0100
|
||||||
|
+++ b/src/_cffi_src/openssl/src/osrandom_engine.c 2019-08-12 11:47:03.000000000 +0100
|
||||||
|
@@ -243,14 +243,10 @@
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS;
|
||||||
|
#else
|
||||||
|
- if (&getentropy != NULL) {
|
||||||
|
- getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS;
|
||||||
|
- } else {
|
||||||
|
- getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_FALLBACK;
|
||||||
|
- int fd = dev_urandom_fd();
|
||||||
|
- if (fd < 0) {
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_FALLBACK;
|
||||||
|
+ int fd = dev_urandom_fd();
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 1;
|
||||||
|
@@ -266,22 +262,7 @@
|
||||||
|
return dev_urandom_read(buffer, size);
|
||||||
|
#endif
|
||||||
|
case CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS:
|
||||||
|
- while (size > 0) {
|
||||||
|
- /* OpenBSD and macOS restrict maximum buffer size to 256. */
|
||||||
|
- len = size > 256 ? 256 : size;
|
||||||
|
- res = getentropy(buffer, (size_t)len);
|
||||||
|
- if (res < 0) {
|
||||||
|
- ERR_Cryptography_OSRandom_error(
|
||||||
|
- CRYPTOGRAPHY_OSRANDOM_F_RAND_BYTES,
|
||||||
|
- CRYPTOGRAPHY_OSRANDOM_R_GETENTROPY_FAILED,
|
||||||
|
- __FILE__, __LINE__
|
||||||
|
- );
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
- buffer += len;
|
||||||
|
- size -= len;
|
||||||
|
- }
|
||||||
|
- return 1;
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
|
@ -3,15 +3,13 @@ from os.path import join
|
||||||
import sh, os
|
import sh, os
|
||||||
|
|
||||||
class LbryRecipe(PythonRecipe):
|
class LbryRecipe(PythonRecipe):
|
||||||
version = "v0.82.0"
|
version = "f7eed62"
|
||||||
url = "https://github.com/lbryio/lbry/archive/{version}.tar.gz"
|
url = "https://github.com/lbryio/lbry/archive/{version}.tar.gz"
|
||||||
depends = [
|
depends = [
|
||||||
"openssl",
|
|
||||||
"python",
|
"python",
|
||||||
"ios",
|
"ios",
|
||||||
"pyobjus",
|
"pyobjus",
|
||||||
"sdl2",
|
"kivy",
|
||||||
"setuptools",
|
|
||||||
|
|
||||||
# install_requires dependencies
|
# install_requires dependencies
|
||||||
"aiohttp",
|
"aiohttp",
|
||||||
|
@ -19,7 +17,6 @@ class LbryRecipe(PythonRecipe):
|
||||||
"appdirs",
|
"appdirs",
|
||||||
"async-timeout",
|
"async-timeout",
|
||||||
"base58",
|
"base58",
|
||||||
"certifi",
|
|
||||||
"chardet",
|
"chardet",
|
||||||
"coincurve",
|
"coincurve",
|
||||||
"colorama",
|
"colorama",
|
||||||
|
|
|
@ -20,4 +20,4 @@ class SetuptoolsRecipe(PythonRecipe):
|
||||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||||
|
|
||||||
|
|
||||||
recipe = SetuptoolsRecipe()
|
recipe = ChardetRecipe()
|
||||||
|
|
Loading…
Reference in a new issue