Skip to content

Commit 8dccd95

Browse files
committed
fix kivy recipe
1 parent 7183fd6 commit 8dccd95

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@
77
from pythonforandroid.toolchain import current_directory, shprint
88

99

10-
def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
10+
def get_kivy_version(recipe, arch):
1111
with current_directory(join(recipe.get_build_dir(arch.arch), "kivy")):
12-
kivy_version = shprint(
12+
return shprint(
1313
sh.Command(sys.executable),
1414
"-c",
1515
"import _version; print(_version.__version__)",
1616
)
1717

18-
return packaging.version.parse(
19-
str(kivy_version)
20-
) < packaging.version.Version("2.2.0.dev0")
18+
19+
def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
20+
return packaging.version.parse(
21+
str(get_kivy_version(recipe, arch))
22+
) < packaging.version.Version("2.2.0.dev0")
23+
24+
25+
def is_kivy_less_than_3(recipe=None, arch=None):
26+
return packaging.version.parse(
27+
str(get_kivy_version(recipe, arch))
28+
) < packaging.version.Version("3.0.0")
2129

2230

2331
class KivyRecipe(PyProjectRecipe):
@@ -34,7 +42,7 @@ class KivyRecipe(PyProjectRecipe):
3442
# WARNING: Remove this patch when a new Kivy version is released.
3543
patches = [
3644
("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue),
37-
"use_cython.patch",
45+
("use_cython.patch", is_kivy_less_than_3),
3846
"no-ast-str.patch"
3947
]
4048

@@ -59,6 +67,9 @@ def get_recipe_env(self, arch, **kwargs):
5967

6068
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
6169
env['NDKPLATFORM'] = "NOTNONE"
70+
if not is_kivy_less_than_3(self, arch):
71+
env['KIVY_CROSS_PLATFORM'] = 'android'
72+
6273
if 'sdl2' in self.ctx.recipe_build_order:
6374
env['USE_SDL2'] = '1'
6475
env['KIVY_SPLIT_EXAMPLES'] = '1'
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
diff -Naur SDL2_image.orig/Android.mk SDL2_image/Android.mk
2-
--- SDL2_image.orig/Android.mk 2022-10-03 20:51:52.000000000 +0200
3-
+++ SDL2_image/Android.mk 2022-10-03 20:52:48.000000000 +0200
4-
@@ -32,7 +32,7 @@
1+
--- a/Android.mk
2+
+++ b/Android.mk
3+
@@ -33,8 +33,8 @@
54

65
# Enable this if you want to support loading WebP images
76
# The library path should be a relative path to this directory.
87
-SUPPORT_WEBP ?= false
8+
-SUPPORT_SAVE_WEBP ?= true
99
+SUPPORT_WEBP := true
10+
+SUPPORT_SAVE_WEBP := true
1011
WEBP_LIBRARY_PATH := external/libwebp
1112

1213

14+
@@ -160,7 +160,7 @@
15+
ifeq ($(SUPPORT_WEBP),true)
16+
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/src
17+
LOCAL_CFLAGS += -DLOAD_WEBP
18+
- LOCAL_STATIC_LIBRARIES += webpdemux
19+
+ LOCAL_STATIC_LIBRARIES += webpmux webpdemux
20+
LOCAL_STATIC_LIBRARIES += webp
21+
ifeq ($(SUPPORT_SAVE_WEBP),true)
22+
LOCAL_CFLAGS += -DSAVE_WEBP=1

0 commit comments

Comments
 (0)