1
1
import os
2
- from pythonforandroid .recipe import PythonRecipe
2
+ from pythonforandroid .recipe import CppCompiledComponentsPythonRecipe
3
3
4
4
5
- class Secp256k1Recipe (PythonRecipe ):
5
+ class Secp256k1Recipe (CppCompiledComponentsPythonRecipe ):
6
6
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'
8
9
9
10
call_hostpython_via_targetpython = False
10
11
@@ -17,29 +18,12 @@ class Secp256k1Recipe(PythonRecipe):
17
18
"cross_compile.patch" , "drop_setup_requires.patch" ,
18
19
"pkg-config.patch" , "find_lib.patch" , "no-download.patch" ]
19
20
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 )
24
23
libsecp256k1 = self .get_recipe ('libsecp256k1' , self .ctx )
25
24
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 )
43
27
return env
44
28
45
29
0 commit comments