Skip to content

Commit 7c91411

Browse files
committed
fix kivy recipe
1 parent 7183fd6 commit 7c91411

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
2020
) < packaging.version.Version("2.2.0.dev0")
2121

2222

23+
def is_kivy_less_than_3(recipe=None, arch=None):
24+
with current_directory(join(recipe.get_build_dir(arch.arch), "kivy")):
25+
kivy_version = shprint(
26+
sh.Command(sys.executable),
27+
"-c",
28+
"import _version; print(_version.__version__)",
29+
)
30+
31+
return packaging.version.parse(
32+
str(kivy_version)
33+
) < packaging.version.Version("3.0.0")
34+
35+
2336
class KivyRecipe(PyProjectRecipe):
2437
version = '2.3.1'
2538
url = 'https://github.com/kivy/kivy/archive/{version}.zip'
@@ -34,7 +47,7 @@ class KivyRecipe(PyProjectRecipe):
3447
# WARNING: Remove this patch when a new Kivy version is released.
3548
patches = [
3649
("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue),
37-
"use_cython.patch",
50+
("use_cython.patch", is_kivy_less_than_3),
3851
"no-ast-str.patch"
3952
]
4053

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

6073
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
6174
env['NDKPLATFORM'] = "NOTNONE"
75+
if not is_kivy_less_than_3(self, arch):
76+
env['KIVY_CROSS_PLATFORM'] = 'android'
77+
6278
if 'sdl2' in self.ctx.recipe_build_order:
6379
env['USE_SDL2'] = '1'
6480
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)