Skip to content

Commit

Permalink
Merge pull request #1619 from opacam/android-mk-absolute-paths
Browse files Browse the repository at this point in the history
Make python flags to be absolute paths for Android.mk files
  • Loading branch information
inclement authored Jan 28, 2019
2 parents 3695853 + 8ff3ef4 commit df66ff6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/$(MK_PYTHON_INCLUDE_ROOT)
-I$(PYTHON_INCLUDE_ROOT)


LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS)
Expand All @@ -38,7 +38,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/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)

LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \
for f in $(LOCAL_PATH)/../../libs/$ARCH/*.so ; do \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ LOCAL_MODULE := main
# Add your application source files here...
LOCAL_SRC_FILES := start.c pyjniusjni.c

LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS)
LOCAL_CFLAGS += -I$(PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS)

LOCAL_SHARED_LIBRARIES := python_shared

LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS)

LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)

include $(BUILD_SHARED_LIBRARY)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ LOCAL_MODULE := main
# Add your application source files here...
LOCAL_SRC_FILES := start.c pyjniusjni.c

LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS)
LOCAL_CFLAGS += -I$(PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS)

LOCAL_SHARED_LIBRARIES := python_shared

LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS)

LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)

include $(BUILD_SHARED_LIBRARY)

Expand Down
14 changes: 1 addition & 13 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,7 @@ class BootstrapNDKRecipe(Recipe):
:class:`~pythonforandroid.recipe.NDKRecipe`.
To link with python, call the method :meth:`get_recipe_env`
with the kwarg *with_python=True*. If recipe contains android's mk files
which should be linked with python, you may want to use the env variables
MK_PYTHON_INCLUDE_ROOT and MK_PYTHON_LINK_ROOT set in there.
with the kwarg *with_python=True*.
'''

dir_name = None # The name of the recipe build folder in the jni dir
Expand Down Expand Up @@ -657,16 +655,6 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=False):
self.ctx.python_recipe.major_minor_version_string)
if 'python3' in self.ctx.python_recipe.name:
env['EXTRA_LDLIBS'] += 'm'

# set some env variables that may be needed to build some bootstrap ndk
# recipes that needs linking with our python via mk files, like
# recipes: sdl2, genericndkbuild or sdl
other_builds = join(self.ctx.build_dir, 'other_builds') + '/'
env['MK_PYTHON_INCLUDE_ROOT'] = \
self.ctx.python_recipe.include_root(arch.arch)[
len(other_builds):]
env['MK_PYTHON_LINK_ROOT'] = \
self.ctx.python_recipe.link_root(arch.arch)[len(other_builds):]
return env


Expand Down

0 comments on commit df66ff6

Please sign in to comment.