11from os .path import join
2+ from multiprocessing import cpu_count
23
34from pythonforandroid .recipe import Recipe
45from pythonforandroid .util import current_directory
@@ -44,35 +45,23 @@ class OpenSSLRecipe(Recipe):
4445
4546 '''
4647
47- version = '1.1'
48- '''the major minor version used to link our recipes'''
49-
50- url_version = '1.1.1m'
51- '''the version used to download our libraries'''
52-
53- url = 'https://www.openssl.org/source/openssl-{url_version}.tar.gz'
48+ version = '3.0.18'
49+ url = 'https://www.openssl.org/source/openssl-{version}.tar.gz'
5450
5551 built_libraries = {
56- 'libcrypto{version} .so' . format ( version = version ) : '.' ,
57- 'libssl{version} .so' . format ( version = version ) : '.' ,
52+ 'libcrypto.so' : '.' ,
53+ 'libssl.so' : '.' ,
5854 }
5955
60- @property
61- def versioned_url (self ):
62- if self .url is None :
63- return None
64- return self .url .format (url_version = self .url_version )
65-
6656 def get_build_dir (self , arch ):
6757 return join (
68- self .get_build_container_dir (arch ), self .name + self .version
58+ self .get_build_container_dir (arch ), self .name + self .version [ 0 ]
6959 )
7060
7161 def include_flags (self , arch ):
7262 '''Returns a string with the include folders'''
7363 openssl_includes = join (self .get_build_dir (arch .arch ), 'include' )
7464 return (' -I' + openssl_includes +
75- ' -I' + join (openssl_includes , 'internal' ) +
7665 ' -I' + join (openssl_includes , 'openssl' ))
7766
7867 def link_dirs_flags (self , arch ):
@@ -85,7 +74,7 @@ def link_libs_flags(self):
8574 '''Returns a string with the appropriate `-l<lib>` flags to link with
8675 the openssl libs. This string is usually added to the environment
8776 variable `LIBS`'''
88- return ' -lcrypto{version} -lssl{version}' . format ( version = self . version )
77+ return ' -lcrypto -lssl'
8978
9079 def link_flags (self , arch ):
9180 '''Returns a string with the flags to link with the openssl libraries
@@ -94,10 +83,12 @@ def link_flags(self, arch):
9483
9584 def get_recipe_env (self , arch = None ):
9685 env = super ().get_recipe_env (arch )
97- env ['OPENSSL_VERSION' ] = self .version
98- env ['MAKE' ] = 'make' # This removes the '-j5', which isn't safe
86+ env ['OPENSSL_VERSION' ] = self .version [0 ]
9987 env ['CC' ] = 'clang'
100- env ['ANDROID_NDK_HOME' ] = self .ctx .ndk_dir
88+ env ['ANDROID_NDK_ROOT' ] = self .ctx .ndk_dir
89+ env ["PATH" ] = f"{ self .ctx .ndk .llvm_bin_dir } :{ env ['PATH' ]} "
90+ env ["CFLAGS" ] += " -Wno-macro-redefined"
91+ env ["MAKE" ] = "make"
10192 return env
10293
10394 def select_build_arch (self , arch ):
@@ -125,13 +116,12 @@ def build_arch(self, arch):
125116 'shared' ,
126117 'no-dso' ,
127118 'no-asm' ,
119+ 'no-tests' ,
128120 buildarch ,
129121 '-D__ANDROID_API__={}' .format (self .ctx .ndk_api ),
130122 ]
131123 shprint (perl , 'Configure' , * config_args , _env = env )
132- self .apply_patch ('disable-sover.patch' , arch .arch )
133-
134- shprint (sh .make , 'build_libs' , _env = env )
124+ shprint (sh .make , '-j' , str (cpu_count ()), _env = env )
135125
136126
137127recipe = OpenSSLRecipe ()
0 commit comments