Skip to content

Commit 108e093

Browse files
committed
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.
1 parent 209c49f commit 108e093

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LOCAL_CFLAGS := $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \
1818
-I$(LOCAL_PATH)/../jpeg \
1919
-I$(LOCAL_PATH)/../intl \
2020
-I$(LOCAL_PATH)/.. \
21-
-I$(LOCAL_PATH)/../../../../other_builds/python2/$(ARCH)/python2/python-install/include/python2.7
21+
-I$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7
2222
# -I$(LOCAL_PATH)/../../../../python-install/include/python2.7
2323
# -I$(LOCAL_PATH)/../../../build/python-install/include/python2.7
2424

@@ -40,7 +40,7 @@ LOCAL_LDLIBS := -lpython2.7 -lGLESv1_CM -ldl -llog -lz
4040

4141
# AND: Another hardcoded path that should be templated
4242
# AND: NOT TEMPALTED! We can use $ARCH
43-
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/python2/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
43+
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
4444

4545
LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \
4646
for f in $(LOCAL_PATH)/../../libs/$ARCH/*.so ; do \

pythonforandroid/recipes/sdl/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def build_arch(self, arch):
1515
info('libsdl.so already exists, skipping sdl build.')
1616
return
1717

18-
env = arch.get_env()
18+
env = self.get_recipe_env(arch)
1919

2020
with current_directory(self.get_jni_dir()):
2121
shprint(sh.ndk_build, 'V=1', _env=env, _tail=20, _critical=True)
@@ -27,5 +27,13 @@ def build_arch(self, arch):
2727
shprint(sh.cp, '-a', join(self.ctx.bootstrap.build_dir, 'libs', arch.arch, content),
2828
self.ctx.libs_dir)
2929

30+
def get_recipe_env(self, arch=None):
31+
env = super(LibSDLRecipe, self).get_recipe_env(arch)
32+
py2 = self.get_recipe('python2', arch.ctx)
33+
env['PYTHON2_NAME'] = py2.get_dir_name()
34+
if 'python2' in self.ctx.recipe_build_order:
35+
env['EXTRA_LDLIBS'] = ' -lpython2.7'
36+
return env
37+
3038

3139
recipe = LibSDLRecipe()

0 commit comments

Comments
 (0)