Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions pythonforandroid/archs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def include_dirs(self):
d.format(arch=self))
for d in self.ctx.include_dirs]

def get_env(self):
def get_env(self, with_flags_in_cc=True):
env = {}

env["CFLAGS"] = " ".join([
Expand Down Expand Up @@ -72,14 +72,22 @@ def get_env(self):
'installed. Exiting.')
exit(1)

env['CC'] = '{ccache}{command_prefix}-gcc {cflags}'.format(
command_prefix=command_prefix,
ccache=ccache,
cflags=env['CFLAGS'])
env['CXX'] = '{ccache}{command_prefix}-g++ {cxxflags}'.format(
command_prefix=command_prefix,
ccache=ccache,
cxxflags=env['CXXFLAGS'])
if with_flags_in_cc:
env['CC'] = '{ccache}{command_prefix}-gcc {cflags}'.format(
command_prefix=command_prefix,
ccache=ccache,
cflags=env['CFLAGS'])
env['CXX'] = '{ccache}{command_prefix}-g++ {cxxflags}'.format(
command_prefix=command_prefix,
ccache=ccache,
cxxflags=env['CXXFLAGS'])
else:
env['CC'] = '{ccache}{command_prefix}-gcc'.format(
command_prefix=command_prefix,
ccache=ccache)
env['CXX'] = '{ccache}{command_prefix}-g++'.format(
command_prefix=command_prefix,
ccache=ccache)

env['AR'] = '{}-ar'.format(command_prefix)
env['RANLIB'] = '{}-ranlib'.format(command_prefix)
Expand Down Expand Up @@ -118,8 +126,8 @@ class ArchARM(Arch):
class ArchARMv7_a(ArchARM):
arch = 'armeabi-v7a'

def get_env(self):
env = super(ArchARMv7_a, self).get_env()
def get_env(self, with_flags_in_cc=True):
env = super(ArchARMv7_a, self).get_env(with_flags_in_cc)
env['CFLAGS'] = (env['CFLAGS'] +
(' -march=armv7-a -mfloat-abi=softfp '
'-mfpu=vfp -mthumb'))
Expand All @@ -133,8 +141,8 @@ class Archx86(Arch):
command_prefix = 'i686-linux-android'
platform_dir = 'arch-x86'

def get_env(self):
env = super(Archx86, self).get_env()
def get_env(self, with_flags_in_cc=True):
env = super(Archx86, self).get_env(with_flags_in_cc)
env['CFLAGS'] = (env['CFLAGS'] +
' -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32')
env['CXXFLAGS'] = env['CFLAGS']
Expand All @@ -147,8 +155,8 @@ class Archx86_64(Arch):
command_prefix = 'x86_64-linux-android'
platform_dir = 'arch-x86'

def get_env(self):
env = super(Archx86_64, self).get_env()
def get_env(self, with_flags_in_cc=True):
env = super(Archx86_64, self).get_env(with_flags_in_cc)
env['CFLAGS'] = (env['CFLAGS'] +
' -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel')
env['CXXFLAGS'] = env['CFLAGS']
Expand Down
8 changes: 4 additions & 4 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ def unpack(self, arch):
else:
info('{} is already unpacked, skipping'.format(self.name))

def get_recipe_env(self, arch=None):
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
"""Return the env specialized for the recipe
"""
if arch is None:
arch = self.filtered_archs[0]
return arch.get_env()
return arch.get_env(with_flags_in_cc=with_flags_in_cc)

def prebuild_arch(self, arch):
'''Run any pre-build tasks for the Recipe. By default, this checks if
Expand Down Expand Up @@ -896,8 +896,8 @@ def build_cython_components(self, arch):
# for filename in fnmatch.filter(filenames, "*.pyx"):
# self.cythonize_file(join(root, filename))

def get_recipe_env(self, arch):
env = super(CythonRecipe, self).get_recipe_env(arch)
def get_recipe_env(self, arch, with_flags_in_cc=True):
env = super(CythonRecipe, self).get_recipe_env(arch, with_flags_in_cc)
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{} '.format(
self.ctx.get_libs_dir(arch.arch) +
' -L{} '.format(self.ctx.libs_dir))
Expand Down