Skip to content

Commit cbad638

Browse files
authored
Merge pull request kivy#1251 from AndreMiras/feature/gevent_crystax_python3
Gevent Crystax/Python3 support
2 parents 405934e + 5e268d2 commit cbad638

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

pythonforandroid/recipes/gevent/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe
23

34

@@ -7,4 +8,21 @@ class GeventRecipe(CompiledComponentsPythonRecipe):
78
depends = [('python2', 'python3crystax'), 'greenlet']
89
patches = ["gevent.patch"]
910

11+
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
12+
env = super(GeventRecipe, self).get_recipe_env(arch, with_flags_in_cc)
13+
# sets linker to use the correct gcc (cross compiler)
14+
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
15+
# CFLAGS may only be used to specify C compiler flags, for macro definitions use CPPFLAGS
16+
env['CPPFLAGS'] = env['CFLAGS'] + ' -I{}/sources/python/3.5/include/python/'.format(self.ctx.ndk_dir)
17+
env['CFLAGS'] = ''
18+
# LDFLAGS may only be used to specify linker flags, for libraries use LIBS
19+
env['LDFLAGS'] = env['LDFLAGS'].replace('-lm', '').replace('-lcrystax', '')
20+
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))
21+
env['LIBS'] = ' -lm'
22+
if self.ctx.ndk == 'crystax':
23+
env['LIBS'] += ' -lcrystax -lpython{}m'.format(self.ctx.python_recipe.version[0:3])
24+
env['LDSHARED'] += env['LIBS']
25+
return env
26+
27+
1028
recipe = GeventRecipe()

pythonforandroid/recipes/gevent/gevent.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ diff -Naur gevent-1.1.1/setup.py gevent-1.1.1_diff/setup.py
1515
ares_configure_command = ' '.join(["(cd ", _quoted_abspath('c-ares/'),
1616
" && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi ",
1717
- " && /bin/sh ./configure " + _m32 + "CONFIG_COMMANDS= CONFIG_FILES= ",
18-
+ " && /bin/sh ./configure --host={} ".format(os.environ['TOOLCHAIN_PREFIX']) + "CFLAGS= LDFLAGS= CONFIG_COMMANDS= CONFIG_FILES= ",
18+
+ " && /bin/sh ./configure --host={} ".format(os.environ['TOOLCHAIN_PREFIX']) + "CONFIG_COMMANDS= CONFIG_FILES= ",
1919
" && cp ares_config.h ares_build.h \"$OLDPWD\" ",
2020
" && mv ares_build.h.orig ares_build.h)",
2121
"> configure-output.txt"])

0 commit comments

Comments
 (0)