This repository has been archived by the owner on Sep 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom gevent recipe to fix broken arm64-v8a build
- Loading branch information
1 parent
8a06b5c
commit 4cfaa39
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import re | ||
|
||
from pythonforandroid.logger import info | ||
from pythonforandroid.recipe import CythonRecipe | ||
|
||
|
||
class GeventRecipe(CythonRecipe): | ||
version = '1.4.0' | ||
url = ( | ||
'https://pypi.python.org/packages/source/g/gevent/' | ||
'gevent-{version}.tar.gz' | ||
) | ||
depends = ['librt', 'greenlet'] | ||
patches = ["cross_compiling.patch"] | ||
|
||
def get_recipe_env(self, arch=None, with_flags_in_cc=True): | ||
""" | ||
- Moves all -I<inc> -D<macro> from CFLAGS to CPPFLAGS environment. | ||
- Moves all -l<lib> from LDFLAGS to LIBS environment. | ||
- Copies all -l<lib> from LDLIBS to LIBS environment. | ||
- Fixes linker name (use cross compiler) and flags (appends LIBS) | ||
""" | ||
env = super().get_recipe_env(arch, with_flags_in_cc) | ||
# CFLAGS may only be used to specify C compiler flags, | ||
# for macro definitions use CPPFLAGS | ||
regex = re.compile(r'(?:\s|^)-[DI][\S]+') | ||
env['CPPFLAGS'] = ''.join(re.findall(regex, env['CFLAGS'])).strip() | ||
env['CFLAGS'] = re.sub(regex, '', env['CFLAGS']) | ||
info('Moved "{}" from CFLAGS to CPPFLAGS.'.format(env['CPPFLAGS'])) | ||
# LDFLAGS may only be used to specify linker flags, | ||
# for libraries use LIBS | ||
regex = re.compile(r'(?:\s|^)-l[\w\.]+') | ||
env['LIBS'] = ''.join(re.findall(regex, env['LDFLAGS'])).strip() | ||
env['LIBS'] += ' {}'.format( | ||
''.join(re.findall(regex, env['LDLIBS'])).strip()) | ||
env['LDFLAGS'] = re.sub(regex, '', env['LDFLAGS']) | ||
info('Moved "{}" from LDFLAGS to LIBS.'.format(env['LIBS'])) | ||
return env | ||
|
||
|
||
recipe = GeventRecipe() |
26 changes: 26 additions & 0 deletions
26
src/python-for-android/recipes/gevent/cross_compiling.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/_setupares.py b/_setupares.py | ||
index dd184de6..bb16bebe 100644 | ||
--- a/_setupares.py | ||
+++ b/_setupares.py | ||
@@ -43,7 +43,7 @@ else: | ||
ares_configure_command = ' '.join([ | ||
"(cd ", quoted_dep_abspath('c-ares'), | ||
" && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi ", | ||
- " && sh ./configure --disable-dependency-tracking " + _m32 + "CONFIG_COMMANDS= ", | ||
+ " && sh ./configure --host={} --disable-dependency-tracking ".format(os.environ['TOOLCHAIN_PREFIX']) + _m32 + "CONFIG_COMMANDS= ", | ||
" && cp ares_config.h ares_build.h \"$OLDPWD\" ", | ||
" && cat ares_build.h ", | ||
" && if [ -r ares_build.h.orig ]; then mv ares_build.h.orig ares_build.h; fi)", | ||
diff --git a/_setuplibev.py b/_setuplibev.py | ||
index 2a5841bf..b6433c94 100644 | ||
--- a/_setuplibev.py | ||
+++ b/_setuplibev.py | ||
@@ -31,7 +31,7 @@ LIBEV_EMBED = should_embed('libev') | ||
# and the PyPy branch will clean it up. | ||
libev_configure_command = ' '.join([ | ||
"(cd ", quoted_dep_abspath('libev'), | ||
- " && sh ./configure ", | ||
+ " && sh ./configure --host={} ".format(os.environ['TOOLCHAIN_PREFIX']), | ||
" && cp config.h \"$OLDPWD\"", | ||
")", | ||
'> configure-output.txt' |