in builder/imports/libcrypto.py [0:0]
def install(self, env):
if self.installed:
return
sh = env.shell
install_dir = os.path.join(env.deps_dir, self.name)
def _use_libcrypto(path):
if not self.installed:
os.symlink(path, install_dir, True)
self.installed = True
# If path to libcrypto is going to be relative, it has to be relative to the
# source directory
self.prefix = str(Path(install_dir).relative_to(env.root_dir))
env.variables['libcrypto_path'] = self.prefix
parser = argparse.ArgumentParser()
parser.add_argument('--libcrypto', default=None)
args = parser.parse_known_args(env.args.args)[0]
if args.libcrypto:
print('Using custom libcrypto: {}'.format(args.libcrypto))
return _use_libcrypto(args.libcrypto)
# AL2012 has a pre-built libcrypto, since its linker is from another world
if current_host() == 'al2012':
print('Using image libcrypto: /opt/openssl')
return _use_libcrypto('/opt/openssl')
print('Installing pre-built libcrypto binaries for {}-{} to {}'.format(
env.spec.target, env.spec.arch, install_dir))
lib_version = '1.1.1'
lib_os = env.spec.target
if current_host() == 'manylinux' and env.spec.arch != 'armv8':
lib_os = 'manylinux'
lib_version = '1.0.2'
url = self.url.format(version=lib_version,
os=lib_os, arch=env.spec.arch)
filename = '{}/libcrypto.tar.gz'.format(install_dir)
print('Downloading {}'.format(url))
fetch_and_extract(url, filename, install_dir)
print('Extracted {} to {}'.format(filename, install_dir))
self.installed = True
return _use_libcrypto(install_dir)