From 108e09351e1386244caaa38d0db6131d89f51073 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Sat, 2 Jul 2016 17:32:11 +0100 Subject: [PATCH] Fixed python2 with pygame bootstrap The jni code wasn't checking the correct python2 build dir, so it couldn't find Python.h when python2 was built with optional dependencies. --- .../bootstraps/pygame/build/jni/application/Android.mk | 4 ++-- pythonforandroid/recipes/sdl/__init__.py | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk b/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk index 75fb5d5ff5..51109a7e19 100644 --- a/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk +++ b/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk @@ -18,7 +18,7 @@ LOCAL_CFLAGS := $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \ -I$(LOCAL_PATH)/../jpeg \ -I$(LOCAL_PATH)/../intl \ -I$(LOCAL_PATH)/.. \ - -I$(LOCAL_PATH)/../../../../other_builds/python2/$(ARCH)/python2/python-install/include/python2.7 + -I$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7 # -I$(LOCAL_PATH)/../../../../python-install/include/python2.7 # -I$(LOCAL_PATH)/../../../build/python-install/include/python2.7 @@ -40,7 +40,7 @@ LOCAL_LDLIBS := -lpython2.7 -lGLESv1_CM -ldl -llog -lz # AND: Another hardcoded path that should be templated # AND: NOT TEMPALTED! We can use $ARCH -LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/python2/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS) +LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS) LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \ for f in $(LOCAL_PATH)/../../libs/$ARCH/*.so ; do \ diff --git a/pythonforandroid/recipes/sdl/__init__.py b/pythonforandroid/recipes/sdl/__init__.py index a7de674911..be678f052a 100644 --- a/pythonforandroid/recipes/sdl/__init__.py +++ b/pythonforandroid/recipes/sdl/__init__.py @@ -15,7 +15,7 @@ def build_arch(self, arch): info('libsdl.so already exists, skipping sdl build.') return - env = arch.get_env() + env = self.get_recipe_env(arch) with current_directory(self.get_jni_dir()): shprint(sh.ndk_build, 'V=1', _env=env, _tail=20, _critical=True) @@ -27,5 +27,13 @@ def build_arch(self, arch): shprint(sh.cp, '-a', join(self.ctx.bootstrap.build_dir, 'libs', arch.arch, content), self.ctx.libs_dir) + def get_recipe_env(self, arch=None): + env = super(LibSDLRecipe, self).get_recipe_env(arch) + py2 = self.get_recipe('python2', arch.ctx) + env['PYTHON2_NAME'] = py2.get_dir_name() + if 'python2' in self.ctx.recipe_build_order: + env['EXTRA_LDLIBS'] = ' -lpython2.7' + return env + recipe = LibSDLRecipe()