44import packaging .version
55
66import sh
7- from pythonforandroid .recipe import CythonRecipe
7+ from pythonforandroid .recipe import PyProjectRecipe
88from pythonforandroid .toolchain import current_directory , shprint
99
1010
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'
2613 url = 'https://github.com/kivy/kivy/archive/{version}.zip'
27- name = 'kivy'
28-
29- depends = ['sdl2' , 'pyjnius' , 'setuptools' ]
14+ depends = ['sdl2' , 'pyjnius' ]
3015 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 )
6319 # NDKPLATFORM is our switch for detecting Android platform, so can't be None
6420 env ['NDKPLATFORM' ] = "NOTNONE"
21+ env ['LIBLINK' ] = "NOTNONE"
6522 if 'sdl2' in self .ctx .recipe_build_order :
6623 env ['USE_SDL2' ] = '1'
6724 env ['KIVY_SPLIT_EXAMPLES' ] = '1'
25+ sdl_recipe = self .get_recipe ("sdl2" , self .ctx )
6826 sdl2_mixer_recipe = self .get_recipe ('sdl2_mixer' , self .ctx )
6927 sdl2_image_recipe = self .get_recipe ('sdl2_image' , self .ctx )
7028 env ['KIVY_SDL2_PATH' ] = ':' .join ([
@@ -73,7 +31,7 @@ def get_recipe_env(self, arch):
7331 * sdl2_mixer_recipe .get_include_dirs (arch ),
7432 join (self .ctx .bootstrap .build_dir , 'jni' , 'SDL2_ttf' ),
7533 ])
76-
34+ env [ "LDFLAGS" ] += " -L" + join ( sdl_recipe . get_build_dir ( arch . arch ), "../.." , "libs" , arch . arch )
7735 return env
7836
7937
0 commit comments