Skip to content

Commit a07f2ed

Browse files
committed
add fixes for openssl
1 parent 039d50a commit a07f2ed

5 files changed

Lines changed: 37 additions & 35 deletions

File tree

pythonforandroid/distribution.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@ def get_distribution(cls, ctx, name=None, recipes=[],
120120

121121
assert len(possible_dists) < 2
122122

123-
# If there was a name match but we didn't already choose it,
124-
# then the existing dist is incompatible with the requested
125-
# configuration and the build cannot continue
126-
if name_match_dist is not None:
127-
error('Asked for dist with name {name} with recipes ({req_recipes}) and '
128-
'NDK API {req_ndk_api}, but a dist '
129-
'with this name already exists and has either incompatible recipes '
130-
'({dist_recipes}) or NDK API {dist_ndk_api}'.format(
131-
name=name,
132-
req_ndk_api=ndk_api,
133-
dist_ndk_api=name_match_dist.ndk_api,
134-
req_recipes=', '.join(recipes),
135-
dist_recipes=', '.join(name_match_dist.recipes)))
136-
error('No compatible dist found, so exiting.')
137-
exit(1)
123+
# # If there was a name match but we didn't already choose it,
124+
# # then the existing dist is incompatible with the requested
125+
# # configuration and the build cannot continue
126+
# if name_match_dist is not None:
127+
# error('Asked for dist with name {name} with recipes ({req_recipes}) and '
128+
# 'NDK API {req_ndk_api}, but a dist '
129+
# 'with this name already exists and has either incompatible recipes '
130+
# '({dist_recipes}) or NDK API {dist_ndk_api}'.format(
131+
# name=name,
132+
# req_ndk_api=ndk_api,
133+
# dist_ndk_api=name_match_dist.ndk_api,
134+
# req_recipes=', '.join(recipes),
135+
# dist_recipes=', '.join(name_match_dist.recipes)))
136+
# error('No compatible dist found, so exiting.')
137+
# exit(1)
138138

139139
# If we got this far, we need to build a new dist
140140
dist = Distribution(ctx)

pythonforandroid/recipes/libcurl/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class LibcurlRecipe(Recipe):
1010
depends = ['openssl']
1111

1212
def should_build(self, arch):
13-
return True
1413
super(LibcurlRecipe, self).should_build(arch)
1514
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libcurl.so'))
1615

pythonforandroid/recipes/openssl/__init__.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66

77
class OpenSSLRecipe(Recipe):
8-
version = '1.0.2h'
8+
version = '1.1.1'
9+
lib_version = '1.1'
910
url = 'https://www.openssl.org/source/openssl-{version}.tar.gz'
1011

1112
def should_build(self, arch):
12-
return not self.has_libs(arch, 'libssl' + self.version + '.so',
13-
'libcrypto' + self.version + '.so')
13+
return not self.has_libs(arch, 'libssl' + self.lib_version + '.so',
14+
'libcrypto' + self.lib_version + '.so')
1415

1516
def check_symbol(self, env, sofile, symbol):
1617
nm = env.get('NM', 'nm')
@@ -22,19 +23,18 @@ def check_symbol(self, env, sofile, symbol):
2223
return False
2324

2425
def get_recipe_env(self, arch=None):
25-
env = super(OpenSSLRecipe, self).get_recipe_env(arch)
26-
env['OPENSSL_VERSION'] = self.version
27-
env['CFLAGS'] += ' ' + env['LDFLAGS']
28-
env['CC'] += ' ' + env['LDFLAGS']
26+
env = super(OpenSSLRecipe, self).get_recipe_env(arch, clang=True)
27+
env['OPENSSL_VERSION'] = self.lib_version
2928
env['MAKE'] = 'make' # This removes the '-j5', which isn't safe
29+
env['ANDROID_NDK'] = self.ctx.ndk_dir
3030
return env
3131

3232
def select_build_arch(self, arch):
3333
aname = arch.arch
3434
if 'arm64' in aname:
3535
return 'linux-aarch64'
3636
if 'v7a' in aname:
37-
return 'android-armv7'
37+
return 'android-arm'
3838
if 'arm' in aname:
3939
return 'android'
4040
if 'x86' in aname:
@@ -48,20 +48,27 @@ def build_arch(self, arch):
4848
# so instead we manually run perl passing in Configure
4949
perl = sh.Command('perl')
5050
buildarch = self.select_build_arch(arch)
51-
shprint(perl, 'Configure', 'shared', 'no-dso', 'no-krb5', buildarch, _env=env)
51+
# XXX if we don't have no-asm, using clang and ndk-15c, i got:
52+
# crypto/aes/bsaes-armv7.S:1372:14: error: immediate operand must be in the range [0,4095]
53+
# add r8, r6, #.LREVM0SR-.LM0 @ borrow r8
54+
# ^
55+
# crypto/aes/bsaes-armv7.S:1434:14: error: immediate operand must be in the range [0,4095]
56+
# sub r6, r8, #.LREVM0SR-.LSR @ pass constants
57+
shprint(perl, 'Configure', 'shared', 'no-dso', 'no-asm', buildarch, _env=env)
5258
self.apply_patch('disable-sover.patch', arch.arch)
53-
self.apply_patch('rename-shared-lib.patch', arch.arch)
5459

5560
# check_ssl = partial(self.check_symbol, env, 'libssl' + self.version + '.so')
56-
check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.version + '.so')
61+
check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.lib_version + '.so')
5762
while True:
5863
shprint(sh.make, 'build_libs', _env=env)
59-
if all(map(check_crypto, ('SSLeay', 'MD5_Transform', 'MD4_Init'))):
64+
if all(map(check_crypto, ('MD5_Transform', 'MD4_Init'))):
6065
break
66+
import time
67+
time.sleep(3)
6168
shprint(sh.make, 'clean', _env=env)
6269

63-
self.install_libs(arch, 'libssl' + self.version + '.so',
64-
'libcrypto' + self.version + '.so')
70+
self.install_libs(arch, 'libssl' + self.lib_version + '.so',
71+
'libcrypto' + self.lib_version + '.so')
6572

6673

6774
recipe = OpenSSLRecipe()

pythonforandroid/recipes/python3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pythonforandroid.recipe import TargetPythonRecipe
1+
from pythonforandroid.recipe import TargetPythonRecipe, Recipe
22
from pythonforandroid.toolchain import shprint, current_directory
33
from pythonforandroid.logger import logger, info
44
from pythonforandroid.util import ensure_dir, walk_valid_filens

pythonforandroid/recipes/requests/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
class RequestsRecipe(PythonRecipe):
55
version = '2.13.0'
66
url = 'https://github.com/kennethreitz/requests/archive/v{version}.tar.gz'
7-
<<<<<<< Updated upstream
87
depends = [('hostpython2', 'hostpython3', 'hostpython3crystax'), 'setuptools']
9-
=======
10-
depends = [('hostpython2', 'hostpython3crystax', 'hostpython3'), 'setuptools']
11-
>>>>>>> Stashed changes
128
site_packages_name = 'requests'
139
call_hostpython_via_targetpython = False
1410

0 commit comments

Comments
 (0)