4
4
import packaging .version
5
5
6
6
import sh
7
- from pythonforandroid .recipe import CythonRecipe
7
+ from pythonforandroid .recipe import PyProjectRecipe
8
8
from pythonforandroid .toolchain import current_directory , shprint
9
9
10
10
11
- def is_kivy_affected_by_deadlock_issue (recipe = None , arch = None ):
12
- with current_directory (join (recipe .get_build_dir (arch .arch ), "kivy" )):
13
- kivy_version = shprint (
14
- sh .Command (sys .executable ),
15
- "-c" ,
16
- "import _version; print(_version.__version__)" ,
17
- )
18
-
19
- return packaging .version .parse (
20
- str (kivy_version )
21
- ) < packaging .version .Version ("2.2.0.dev0" )
22
-
23
-
24
- class KivyRecipe (CythonRecipe ):
25
- version = '2.3.0'
11
+ class KivyRecipe (PyProjectRecipe ):
12
+ version = 'master'
26
13
url = 'https://github.com/kivy/kivy/archive/{version}.zip'
27
- name = 'kivy'
28
-
29
- depends = ['sdl2' , 'pyjnius' , 'setuptools' ]
14
+ depends = ['sdl2' , 'pyjnius' ]
30
15
python_depends = ['certifi' , 'chardet' , 'idna' , 'requests' , 'urllib3' ]
31
-
32
- # sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.
33
- # See: https://github.com/kivy/kivy/pull/8025
34
- # WARNING: Remove this patch when a new Kivy version is released.
35
- patches = [("sdl-gl-swapwindow-nogil.patch" , is_kivy_affected_by_deadlock_issue )]
36
-
37
- def cythonize_build (self , env , build_dir = '.' ):
38
- super ().cythonize_build (env , build_dir = build_dir )
39
-
40
- if not exists (join (build_dir , 'kivy' , 'include' )):
41
- return
42
-
43
- # If kivy is new enough to use the include dir, copy it
44
- # manually to the right location as we bypass this stage of
45
- # the build
46
- with current_directory (build_dir ):
47
- build_libs_dirs = glob .glob (join ('build' , 'lib.*' ))
48
-
49
- for dirn in build_libs_dirs :
50
- shprint (sh .cp , '-r' , join ('kivy' , 'include' ),
51
- join (dirn , 'kivy' ))
52
-
53
- def cythonize_file (self , env , build_dir , filename ):
54
- # We can ignore a few files that aren't important to the
55
- # android build, and may not work on Android anyway
56
- do_not_cythonize = ['window_x11.pyx' , ]
57
- if basename (filename ) in do_not_cythonize :
58
- return
59
- super ().cythonize_file (env , build_dir , filename )
60
-
61
- def get_recipe_env (self , arch ):
62
- env = super ().get_recipe_env (arch )
16
+
17
+ def get_recipe_env (self , arch , ** kwargs ):
18
+ env = super ().get_recipe_env (arch , ** kwargs )
63
19
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
64
20
env ['NDKPLATFORM' ] = "NOTNONE"
21
+ env ['LIBLINK' ] = "NOTNONE"
65
22
if 'sdl2' in self .ctx .recipe_build_order :
66
23
env ['USE_SDL2' ] = '1'
67
24
env ['KIVY_SPLIT_EXAMPLES' ] = '1'
25
+ sdl_recipe = self .get_recipe ("sdl2" , self .ctx )
68
26
sdl2_mixer_recipe = self .get_recipe ('sdl2_mixer' , self .ctx )
69
27
sdl2_image_recipe = self .get_recipe ('sdl2_image' , self .ctx )
70
28
env ['KIVY_SDL2_PATH' ] = ':' .join ([
@@ -73,7 +31,7 @@ def get_recipe_env(self, arch):
73
31
* sdl2_mixer_recipe .get_include_dirs (arch ),
74
32
join (self .ctx .bootstrap .build_dir , 'jni' , 'SDL2_ttf' ),
75
33
])
76
-
34
+ env [ "LDFLAGS" ] += " -L" + join ( sdl_recipe . get_build_dir ( arch . arch ), "../.." , "libs" , arch . arch )
77
35
return env
78
36
79
37
0 commit comments