Skip to content

Remove legacy version of openssl #1870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 21 additions & 52 deletions pythonforandroid/recipes/openssl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,30 @@ class OpenSSLRecipe(Recipe):
- Add ability to build a legacy version of the openssl libs when using
python2legacy or python3crystax.

.. versionchanged:: 2019.06.06.1.dev0

- Removed legacy version of openssl libraries

'''

standard_version = '1.1'
version = '1.1'
'''the major minor version used to link our recipes'''
legacy_version = '1.0'
'''the major minor version used to link our recipes when using
python2legacy or python3crystax'''

standard_url_version = '1.1.1'
url_version = '1.1.1'
'''the version used to download our libraries'''
legacy_url_version = '1.0.2q'
'''the version used to download our libraries when using python2legacy or
python3crystax'''

url = 'https://www.openssl.org/source/openssl-{url_version}.tar.gz'

@property
def use_legacy(self):
if not self.ctx.recipe_build_order:
return False
return 'python3crystax' in self.ctx.recipe_build_order

@property
def version(self):
if self.use_legacy:
return self.legacy_version
return self.standard_version

@property
def url_version(self):
if self.use_legacy:
return self.legacy_url_version
return self.standard_url_version

@property
def versioned_url(self):
if self.url is None:
return None
return self.url.format(url_version=self.url_version)

def get_build_dir(self, arch):
return join(self.get_build_container_dir(arch), self.name + self.version)
return join(
self.get_build_container_dir(arch), self.name + self.version
)

def include_flags(self, arch):
'''Returns a string with the include folders'''
Expand Down Expand Up @@ -113,22 +95,18 @@ def should_build(self, arch):
'libcrypto' + self.version + '.so')

def get_recipe_env(self, arch=None):
env = super(OpenSSLRecipe, self).get_recipe_env(arch, clang=not self.use_legacy)
env = super(OpenSSLRecipe, self).get_recipe_env(arch, clang=True)
env['OPENSSL_VERSION'] = self.version
env['MAKE'] = 'make' # This removes the '-j5', which isn't safe
if self.use_legacy:
env['CFLAGS'] += ' ' + env['LDFLAGS']
env['CC'] += ' ' + env['LDFLAGS']
else:
env['ANDROID_NDK'] = self.ctx.ndk_dir
env['ANDROID_NDK'] = self.ctx.ndk_dir
return env

def select_build_arch(self, arch):
aname = arch.arch
if 'arm64' in aname:
return 'android-arm64' if not self.use_legacy else 'linux-aarch64'
return 'android-arm64'
if 'v7a' in aname:
return 'android-arm' if not self.use_legacy else 'android-armv7'
return 'android-arm'
if 'arm' in aname:
return 'android'
if 'x86_64' in aname:
Expand All @@ -144,24 +122,15 @@ def build_arch(self, arch):
# so instead we manually run perl passing in Configure
perl = sh.Command('perl')
buildarch = self.select_build_arch(arch)
# XXX if we don't have no-asm, using clang and ndk-15c, i got:
# crypto/aes/bsaes-armv7.S:1372:14: error: immediate operand must be in the range [0,4095]
# add r8, r6, #.LREVM0SR-.LM0 @ borrow r8
# ^
# crypto/aes/bsaes-armv7.S:1434:14: error: immediate operand must be in the range [0,4095]
# sub r6, r8, #.LREVM0SR-.LSR @ pass constants
config_args = ['shared', 'no-dso', 'no-asm']
if self.use_legacy:
config_args.append('no-krb5')
config_args.append(buildarch)
if not self.use_legacy:
config_args.append('-D__ANDROID_API__={}'.format(self.ctx.ndk_api))
config_args = [
'shared',
'no-dso',
'no-asm',
buildarch,
'-D__ANDROID_API__={}'.format(self.ctx.ndk_api),
]
shprint(perl, 'Configure', *config_args, _env=env)
self.apply_patch(
'disable-sover{}.patch'.format(
'-legacy' if self.use_legacy else ''), arch.arch)
if self.use_legacy:
self.apply_patch('rename-shared-lib.patch', arch.arch)
self.apply_patch('disable-sover.patch', arch.arch)

shprint(sh.make, 'build_libs', _env=env)

Expand Down
20 changes: 0 additions & 20 deletions pythonforandroid/recipes/openssl/disable-sover-legacy.patch

This file was deleted.

16 changes: 0 additions & 16 deletions pythonforandroid/recipes/openssl/rename-shared-lib.patch

This file was deleted.