Skip to content

Commit 40f0090

Browse files
committed
Merge pull request kivy#510 from kivy/arch_support
Arch support
2 parents 38db03e + aad5b49 commit 40f0090

File tree

32 files changed

+321
-378
lines changed

32 files changed

+321
-378
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Broad goals of the revamp project include:
2727
- (WIP) Support python3 (recipe exists but crashes on android)
2828
- (WIP) Support some kind of binary distribution, including on windows (semi-implemented, just needs finishing)
2929
- ✓ Be a standalone Pypi module (not on pypi yet but setup.py works)
30-
- Support multiple architectures
30+
- Support multiple architectures (full multiarch builds not complete, but arm and x86 with different config both work now)
3131

3232
We are currently working to stabilise all parts of the toolchain and
3333
add more features. Support for pygame-based APKs is almost feature

doc/source/commands.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ supply those that you need.
7070
``--force_build BOOL``
7171
Whether the distribution must be compiled from scratch.
7272

73+
``--arch``
74+
The architecture to build for. Currently only one architecture can be
75+
targeted at a time, and a given distribution can only include one architecture.
76+
77+
7378
.. note:: These options are preliminary. Others will include toggles
7479
for allowing downloads, and setting additional directories
7580
from which to load user dists.

doc/source/quickstart.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ correct and try to continue the build.
254254
Configuration file
255255
~~~~~~~~~~~~~~~~~~
256256

257-
python-for-android look on the current directory if there is a `.p4a`
258-
configuration file. If it found it, it adds all the lines as options
259-
to the command line. For example, you can put the options you would
260-
always write such as:
257+
python-for-android checks in the current directory for a configuration
258+
file named ``.p4a``. If found, it adds all the lines as options to the
259+
command line. For example, you can add the options you would always
260+
include such as:
261261

262262
--dist_name my_example
263263
--android_api 19

pythonforandroid/bootstraps/empty/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchAndroid, logger, info_main, which
1+
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchARM, logger, info_main, which
22
from os.path import join, exists
33
from os import walk
44
import glob

pythonforandroid/bootstraps/pygame/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchAndroid, info_main
1+
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchARM, info_main
22
from os.path import join, exists
33
from os import walk
44
import glob
@@ -19,8 +19,10 @@ def run_distribute(self):
1919
# self.name)
2020
src_path = join(self.bootstrap_dir, 'build')
2121

22-
# AND: Hardcoding armeabi - naughty!
23-
arch = ArchAndroid(self.ctx)
22+
arch = self.ctx.archs[0]
23+
if len(self.ctx.archs) > 1:
24+
raise ValueError('built for more than one arch, but bootstrap cannot handle that yet')
25+
info('Bootstrap running with arch {}'.format(arch))
2426

2527
with current_directory(self.dist_dir):
2628

@@ -58,7 +60,7 @@ def run_distribute(self):
5860
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
5961

6062
# AND: Copylibs stuff should go here
61-
shprint(sh.mv, join('libs', 'armeabi', 'libpymodules.so'), 'private/')
63+
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
6264
shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
6365

6466
info('Removing some unwanted files')

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

Lines changed: 3 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/armeabi/python2/python-install/include/python2.7
21+
-I$(LOCAL_PATH)/../../../../other_builds/python2/$(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

@@ -39,7 +39,8 @@ LOCAL_STATIC_LIBRARIES := jpeg png
3939
LOCAL_LDLIBS := -lpython2.7 -lGLESv1_CM -ldl -llog -lz
4040

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

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

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchAndroid, info_main
1+
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchARM, info_main
22
from os.path import join, exists
33
from os import walk
44
import glob
@@ -20,8 +20,10 @@ def run_distribute(self):
2020
with open('local.properties', 'w') as fileh:
2121
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
2222

23-
# AND: Hardcoding armeabi - naughty!
24-
arch = ArchAndroid(self.ctx)
23+
arch = self.ctx.archs[0]
24+
if len(self.ctx.archs) > 1:
25+
raise ValueError('built for more than one arch, but bootstrap cannot handle that yet')
26+
info('Bootstrap running with arch {}'.format(arch))
2527

2628
with current_directory(self.dist_dir):
2729
info('Copying python distribution')
@@ -32,7 +34,6 @@ def run_distribute(self):
3234
shprint(sh.mkdir, 'assets')
3335

3436
hostpython = sh.Command(self.ctx.hostpython)
35-
# AND: This *doesn't* need to be in arm env?
3637
shprint(hostpython, '-OO', '-m', 'compileall',
3738
self.ctx.get_python_install_dir(),
3839
_tail=10, _filterout="^Listing", _critical=True)
@@ -50,8 +51,8 @@ def run_distribute(self):
5051
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
5152

5253
# AND: Copylibs stuff should go here
53-
if exists(join('libs', 'armeabi', 'libpymodules.so')):
54-
shprint(sh.mv, join('libs', 'armeabi', 'libpymodules.so'), 'private/')
54+
if exists(join('libs', arch.arch, 'libpymodules.so')):
55+
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
5556
shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
5657

5758
info('Removing some unwanted files')

pythonforandroid/bootstraps/sdl2/build/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# APP_STL := stlport_static
55

66
# APP_ABI := armeabi armeabi-v7a x86
7-
APP_ABI := armeabi
7+
APP_ABI := $(ARCH)

pythonforandroid/bootstraps/sdl2/build/jni/src/Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include
1212
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \
1313
start.c
1414

15-
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../other_builds/python2/armeabi/python2/python-install/include/python2.7
15+
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../other_builds/python2/$(ARCH)/python2/python-install/include/python2.7
1616

1717
LOCAL_SHARED_LIBRARIES := SDL2
1818

1919
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog -lpython2.7
2020

21-
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/python2/armeabi/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
21+
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/python2/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
2222

2323
include $(BUILD_SHARED_LIBRARY)

pythonforandroid/bootstraps/sdl2python3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchAndroid, info_main
1+
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchARM, info_main
22
from os.path import join, exists
33
from os import walk
44
import glob
@@ -23,7 +23,7 @@ def run_distribute(self):
2323
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
2424

2525
# AND: Hardcoding armeabi - naughty!
26-
arch = ArchAndroid(self.ctx)
26+
arch = ArchARM(self.ctx)
2727

2828
with current_directory(self.dist_dir):
2929
info('Copying python distribution')

0 commit comments

Comments
 (0)