Skip to content

Commit b45d074

Browse files
titoopacam
authored andcommitted
Update OpenSSL to 1.1.1 (uses clang for compilation)
This openssl version is an LTS, supported until 11th September 2023. Important: There is now a distinction between the version we use for downloading, and the version used for creating the library: OpenSSL 1.1 now have prefix with "1.1.so". This explains why others recipes that depends on it require the "library" version. Those recipes, still not are modified to support the new version. References: #1478
1 parent e07416a commit b45d074

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

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()
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
--- openssl/Makefile 2016-01-28 17:26:49.159522273 +0100
2-
+++ b/Makefile 2016-01-28 17:26:54.358438402 +0100
3-
@@ -342,7 +342,7 @@
4-
link-shared:
5-
@ set -e; for i in $(SHLIBDIRS); do \
6-
$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
7-
- LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
8-
+ LIBNAME=$$i LIBVERSION= \
9-
LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
10-
symlink.$(SHLIB_TARGET); \
11-
libs="$$libs -l$$i"; \
12-
@@ -356,7 +356,7 @@
13-
libs="$(LIBKRB5) $$libs"; \
14-
fi; \
15-
$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
16-
- LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
17-
+ LIBNAME=$$i LIBVERSION= \
18-
LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
19-
LIBDEPS="$$libs $(EX_LIBS)" \
20-
link_a.$(SHLIB_TARGET); \
1+
--- openssl/Makefile.orig 2018-10-20 22:49:40.418310423 +0200
2+
+++ openssl/Makefile 2018-10-20 22:50:23.347322403 +0200
3+
@@ -19,7 +19,7 @@
4+
SHLIB_MAJOR=1
5+
SHLIB_MINOR=1
6+
SHLIB_TARGET=linux-shared
7+
-SHLIB_EXT=.so.$(SHLIB_VERSION_NUMBER)
8+
+SHLIB_EXT=$(SHLIB_VERSION_NUMBER).so
9+
SHLIB_EXT_SIMPLE=.so
10+
SHLIB_EXT_IMPORT=
11+

0 commit comments

Comments
 (0)