Skip to content

Commit fada0ee

Browse files
committed
Changed ArchAndroid to specify arch
1 parent 3b4736b commit fada0ee

File tree

16 files changed

+39
-28
lines changed

16 files changed

+39
-28
lines changed

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, ArchAndroidARM, 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: 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, ArchAndroidARM, info_main
22
from os.path import join, exists
33
from os import walk
44
import glob
@@ -20,7 +20,7 @@ def run_distribute(self):
2020
src_path = join(self.bootstrap_dir, 'build')
2121

2222
# AND: Hardcoding armeabi - naughty!
23-
arch = ArchAndroid(self.ctx)
23+
arch = ArchAndroidARM(self.ctx)
2424

2525
with current_directory(self.dist_dir):
2626

pythonforandroid/bootstraps/sdl2/__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, ArchAndroidARM, info_main
22
from os.path import join, exists
33
from os import walk
44
import glob
@@ -21,7 +21,7 @@ def run_distribute(self):
2121
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
2222

2323
# AND: Hardcoding armeabi - naughty!
24-
arch = ArchAndroid(self.ctx)
24+
arch = ArchAndroidARM(self.ctx)
2525

2626
with current_directory(self.dist_dir):
2727
info('Copying python distribution')

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, ArchAndroidARM, 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 = ArchAndroidARM(self.ctx)
2727

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

pythonforandroid/recipes/android/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import CythonRecipe, shprint, ensure_dir, current_directory, ArchAndroid, IncludedFilesBehaviour
2+
from pythonforandroid.toolchain import CythonRecipe, shprint, ensure_dir, current_directory, ArchAndroidARM, IncludedFilesBehaviour
33
import sh
44
from os.path import exists, join
55

pythonforandroid/recipes/freetype/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroid
2+
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroidARM
33
from os.path import exists, join, realpath
44
from os import uname
55
import glob

pythonforandroid/recipes/harfbuzz/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroid
2+
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroidARM
33
from os.path import exists, join, realpath
44
from os import uname
55
import glob

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, ArchAndroid
2+
from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, ArchAndroidARM
33
from os.path import exists, join
44
import sh
55
import glob

pythonforandroid/recipes/kivysdl2python3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, ArchAndroid
2+
from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, ArchAndroidARM
33
from os.path import exists, join
44
import sh
55
import glob
@@ -35,7 +35,7 @@ def get_recipe_env(self, arch):
3535
return env
3636

3737
# def build_armeabi(self):
38-
# env = ArchAndroid(self.ctx).get_env()
38+
# env = ArchAndroidARM(self.ctx).get_env()
3939

4040
# env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format(self.ctx.libs_dir)
4141
# env['LDSHARED'] = env['LIBLINK']

pythonforandroid/recipes/pygame/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import Recipe, shprint, ArchAndroid, current_directory, debug, info, ensure_dir
2+
from pythonforandroid.toolchain import Recipe, shprint, ArchAndroidARM, current_directory, debug, info, ensure_dir
33
from os.path import exists, join
44
import sh
55
import glob
@@ -40,7 +40,7 @@ def prebuild_armeabi(self):
4040
def build_armeabi(self):
4141
# AND: I'm going to ignore any extra pythonrecipe or cythonrecipe behaviour for now
4242

43-
arch = ArchAndroid(self.ctx)
43+
arch = ArchAndroidARM(self.ctx)
4444
env = self.get_recipe_env(arch)
4545

4646
env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/png -I{jni_path}/jpeg'.format(

pythonforandroid/recipes/pyjnius/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import CythonRecipe, shprint, ArchAndroid, current_directory, info
2+
from pythonforandroid.toolchain import CythonRecipe, shprint, ArchAndroidARM, current_directory, info
33
import sh
44
import glob
55
from os.path import join, exists

pythonforandroid/recipes/pysdl2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory, ArchAndroid
2+
from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory, ArchAndroidARM
33
from os.path import exists, join
44
import sh
55
import glob

pythonforandroid/recipes/python2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroid, info
2+
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroidARM, info
33
from os.path import exists, join, realpath
44
from os import uname
55
import glob
@@ -92,7 +92,7 @@ def do_python_build(self):
9292
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
9393
shprint(sh.cp, join(hostpython_recipe.get_recipe_dir(), 'Setup'), 'Modules')
9494

95-
env = ArchAndroid(self.ctx).get_env()
95+
env = ArchAndroidARM(self.ctx).get_env()
9696

9797
# AND: Should probably move these to get_recipe_env for
9898
# neatness, but the whole recipe needs tidying along these

pythonforandroid/recipes/python3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroid
2+
from pythonforandroid.toolchain import Recipe, shprint, get_directory, current_directory, ArchAndroidARM
33
from os.path import exists, join
44
from os import uname
55
import glob
@@ -67,7 +67,7 @@ def build_armeabi(self):
6767
hostpython_recipe = Recipe.get_recipe('hostpython3', self.ctx)
6868
# shprint(sh.cp, join(hostpython_recipe.get_recipe_dir(), 'Setup'), 'Modules')
6969

70-
env = ArchAndroid(self.ctx).get_env()
70+
env = ArchAndroidARM(self.ctx).get_env()
7171
env["LDFLAGS"] = env["LDFLAGS"] + ' -llog'
7272

7373
# AND: Should probably move these to get_recipe_env for

pythonforandroid/recipes/sdl/__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 NDKRecipe, shprint, ArchAndroid, current_directory, info
1+
from pythonforandroid.toolchain import NDKRecipe, shprint, ArchAndroidARM, current_directory, info
22
from os.path import exists, join
33
import sh
44

@@ -15,7 +15,7 @@ def build_armeabi(self):
1515
info('libsdl.so already exists, skipping sdl build.')
1616
return
1717

18-
env = ArchAndroid(self.ctx).get_env()
18+
env = ArchAndroidARM(self.ctx).get_env()
1919

2020
with current_directory(self.get_jni_dir()):
2121
shprint(sh.ndk_build, 'V=1', _env=env, _tail=20, _critical=True)

pythonforandroid/toolchain.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,13 @@ def include_dirs(self):
456456
d.format(arch=self))
457457
for d in self.ctx.include_dirs]
458458

459+
def get_env(self):
460+
raise ValueError('Tried to get_env of Arch, this needs '
461+
'a specific Arch subclass')
462+
463+
class ArchAndroidARM(Arch):
464+
arch = "armeabi"
465+
459466
def get_env(self):
460467
include_dirs = [
461468
"-I{}/{}".format(
@@ -526,9 +533,13 @@ def get_env(self):
526533

527534
return env
528535

536+
class ArchAndroidARMv7_a(ArchAndroidARM):
537+
arch = 'armeabi-v7'
529538

530-
class ArchAndroid(Arch):
531-
arch = "armeabi"
539+
def get_env(self):
540+
env = super(ArchAndroidARMv7_a, self).get_env()
541+
env['CFLAGS'] = env['CFLAGS'] + ' -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb'
542+
env['CXXFLAGS'] = env['CFLAGS']
532543

533544
# class ArchSimulator(Arch):
534545
# sdk = "iphonesimulator"
@@ -1072,7 +1083,7 @@ def __init__(self):
10721083

10731084
# AND: Currently only the Android architecture is supported
10741085
self.archs = (
1075-
ArchAndroid(self),
1086+
ArchAndroidARM(self),
10761087
)
10771088

10781089
ensure_dir(join(self.build_dir, 'bootstrap_builds'))
@@ -2446,8 +2457,8 @@ def biglink(ctx, arch):
24462457

24472458
# AND: Shouldn't hardcode ArchAndroid! In reality need separate
24482459
# build dirs for each arch
2449-
arch = ArchAndroid(ctx)
2450-
env = ArchAndroid(ctx).get_env()
2460+
arch = ArchAndroidARM(ctx)
2461+
env = ArchAndroidARM(ctx).get_env()
24512462
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format(
24522463
join(ctx.bootstrap.build_dir, 'obj', 'local', 'armeabi'))
24532464

0 commit comments

Comments
 (0)