11import os
2- from pythonforandroid .recipe import PythonRecipe
2+ from pythonforandroid .recipe import CppCompiledComponentsPythonRecipe
33
44
5- class Secp256k1Recipe (PythonRecipe ):
5+ class Secp256k1Recipe (CppCompiledComponentsPythonRecipe ):
66
7- url = 'https://github.com/ludbb/secp256k1-py/archive/master.zip'
7+ version = '0.13.2.4'
8+ url = 'https://github.com/ludbb/secp256k1-py/archive/{version}.tar.gz'
89
910 call_hostpython_via_targetpython = False
1011
@@ -17,29 +18,12 @@ class Secp256k1Recipe(PythonRecipe):
1718 "cross_compile.patch" , "drop_setup_requires.patch" ,
1819 "pkg-config.patch" , "find_lib.patch" , "no-download.patch" ]
1920
20- def get_recipe_env (self , arch = None , with_flags_in_cc = True ):
21- env = super (Secp256k1Recipe , self ).get_recipe_env (arch , with_flags_in_cc )
22- # sets linker to use the correct gcc (cross compiler)
23- env ['LDSHARED' ] = env ['CC' ] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
21+ def get_recipe_env (self , arch = None ):
22+ env = super (Secp256k1Recipe , self ).get_recipe_env (arch )
2423 libsecp256k1 = self .get_recipe ('libsecp256k1' , self .ctx )
2524 libsecp256k1_dir = libsecp256k1 .get_build_dir (arch .arch )
26- env ['LDFLAGS' ] += ' -L{}' .format (libsecp256k1_dir )
27- env ['CFLAGS' ] = ' -I' + os .path .join (libsecp256k1_dir , 'include' )
28- # only keeps major.minor (discards patch)
29- python_version = self .ctx .python_recipe .version [0 :3 ]
30- # required additional library and path for Crystax
31- if self .ctx .ndk == 'crystax' :
32- ndk_dir_python = os .path .join (self .ctx .ndk_dir , 'sources/python/' , python_version )
33- env ['LDFLAGS' ] += ' -L{}' .format (os .path .join (ndk_dir_python , 'libs' , arch .arch ))
34- env ['LDFLAGS' ] += ' -lpython{}m' .format (python_version )
35- # until `pythonforandroid/archs.py` gets merged upstream:
36- # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
37- env ['CFLAGS' ] += ' -I{}/include/python/' .format (ndk_dir_python )
38- else :
39- env ['PYTHON_ROOT' ] = self .ctx .get_python_install_dir ()
40- env ['CFLAGS' ] += ' -I' + env ['PYTHON_ROOT' ] + '/include/python{}' .format (python_version )
41- env ['LDFLAGS' ] += " -lpython{}" .format (python_version )
42- env ['LDFLAGS' ] += " -lsecp256k1"
25+ env ['CFLAGS' ] += ' -I' + os .path .join (libsecp256k1_dir , 'include' )
26+ env ['LDFLAGS' ] += ' -L{} -lsecp256k1' .format (libsecp256k1_dir )
4327 return env
4428
4529
0 commit comments