Skip to content

Commit f189341

Browse files
committed
let cryptography use versioned openssl libraries
1 parent 1983927 commit f189341

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ protected static void addLibraryIfExists(ArrayList<String> libsList, String patt
2121
for (int i = 0; i < files.length; ++i) {
2222
File file = files[i];
2323
String name = file.getName();
24-
Log.v(TAG, "Checking pattern " + pattern + " against " + name);
2524
if (p.matcher(name).matches()) {
2625
Log.v(TAG, "Pattern " + pattern + " matched file " + name);
2726
libsList.add(name.substring(3, name.length() - 3));
@@ -41,9 +40,9 @@ protected static ArrayList<String> getLibraries(File filesDir) {
4140
libsList.add("SDL2_image");
4241
libsList.add("SDL2_mixer");
4342
libsList.add("SDL2_ttf");
44-
addLibraryIfExists(libsList, "ssl", libsDir);
45-
addLibraryIfExists(libsList, "crypto", libsDir);
4643
addLibraryIfExists(libsList, "ffi", libsDir);
44+
addLibraryIfExists(libsList, "ssl.*", libsDir);
45+
addLibraryIfExists(libsList, "crypto.*", libsDir);
4746
libsList.add("python2.7");
4847
libsList.add("python3.5m");
4948
libsList.add("main");

pythonforandroid/recipe.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -553,17 +553,13 @@ def clean_build(self, arch=None):
553553
# doesn't persist in site-packages
554554
shutil.rmtree(self.ctx.python_installs_dir)
555555

556-
def install_libs(self, arch, *libs, **links):
556+
def install_libs(self, arch, *libs):
557557
libs_dir = self.ctx.get_libs_dir(arch.arch)
558-
if links:
559-
for lib, link in links.iteritems():
560-
shprint(sh.cp, lib, join(libs_dir, link))
561-
else:
562-
if not libs:
563-
warning('install_libs called with no libraries to install!')
564-
return
565-
args = libs + (libs_dir,)
566-
shprint(sh.cp, *args)
558+
if not libs:
559+
warning('install_libs called with no libraries to install!')
560+
return
561+
args = libs + (libs_dir,)
562+
shprint(sh.cp, *args)
567563

568564
def has_libs(self, arch, *libs):
569565
return all(map(lambda l: self.ctx.has_lib(arch.arch, l), libs))

pythonforandroid/recipes/cryptography/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
88
depends = ['host_cffi', 'host_cython', 'host_setuptools', 'host_sh',
99
'idna', 'asn1crypto', 'six', 'cffi',
1010
'enum34', 'ipaddress', 'openssl']
11+
patches = ['version_openssl.patch']
1112

1213
call_hostpython_via_targetpython = False
1314

@@ -16,6 +17,7 @@ def get_recipe_env(self, arch):
1617
recipe = self.get_recipe('libffi', self.ctx)
1718
dirs = recipe.get_include_dirs(arch)
1819
recipe = self.get_recipe('openssl', self.ctx)
20+
env['OPENSSL_VERSION'] = recipe.version
1921
dirs += recipe.get_include_dirs(arch)
2022
# Required: ln -s \
2123
# ~/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi/asm/unistd-common.h \
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py
2+
index 7ec235ff..ba4f5c9d 100644
3+
--- a/src/_cffi_src/build_openssl.py
4+
+++ b/src/_cffi_src/build_openssl.py
5+
@@ -33,7 +33,8 @@ def _get_openssl_libraries(platform):
6+
# specified on the linker command-line is significant;
7+
# libssl must come before libcrypto
8+
# (http://marc.info/?l=openssl-users&m=135361825921871)
9+
- return ["ssl", "crypto"]
10+
+ version = os.environ.get("OPENSSL_VERSION", "")
11+
+ return ["ssl" + version, "crypto" + version]
12+
13+
14+
def _extra_compile_args(platform):

pythonforandroid/recipes/openssl/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def build_arch(self, arch):
6262
shprint(sh.make, 'clean', _env=env)
6363
libn = 'libssl', 'libcrypto'
6464
libs = [lib + self.version + '.so' for lib in libn]
65-
lnks = {lib + self.version + '.so': lib + '.so' for lib in libn}
66-
self.install_libs(arch, *libs, **lnks)
65+
self.install_libs(arch, *libs)
6766

6867
def get_include_dirs(self, arch):
6968
return [join(self.get_build_dir(arch.arch), 'include')]

0 commit comments

Comments
 (0)