Skip to content

Commit

Permalink
Fixes libglob recipe, closes #1399
Browse files Browse the repository at this point in the history
- makes sure the compiler is being used rather than ccache alone
- do not manually copy over header files
  • Loading branch information
AndreMiras committed Mar 17, 2019
1 parent 2f4cf91 commit 9160a42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
4 changes: 0 additions & 4 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class TargetPython(Enum):
'hostpython3crystax',
# https://github.com/kivy/python-for-android/issues/1354
'kiwisolver',
# https://github.com/kivy/python-for-android/issues/1399
'libglob',
'libmysqlclient',
'libsecp256k1',
'libtribler',
Expand Down Expand Up @@ -69,8 +67,6 @@ class TargetPython(Enum):
# enum34 is not compatible with Python 3.6 standard library
# https://stackoverflow.com/a/45716067/185510
'enum34',
# https://github.com/kivy/python-for-android/issues/1399
'libglob',
# build_dir = glob.glob('build/lib.*')[0]
# IndexError: list index out of range
'secp256k1',
Expand Down
26 changes: 8 additions & 18 deletions pythonforandroid/recipes/libglob/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,22 @@ def build_arch(self, arch):
if not exists(path):
info("creating {}".format(path))
shprint(sh.mkdir, '-p', path)
cli = env['CC'].split()
cc = sh.Command(cli[0])
cli = env['CC'].split()[0]
# makes sure first CC command is the compiler rather than ccache, refs:
# https://github.com/kivy/python-for-android/issues/1399
if 'ccache' in cli:
cli = env['CC'].split()[1]
cc = sh.Command(cli)

with current_directory(self.get_build_dir(arch.arch)):
cflags = env['CFLAGS'].split()
cflags.extend(['-I.', '-c', '-l.', 'glob.c', '-I.']) # , '-o', 'glob.o'])
cflags.extend(['-I.', '-c', '-l.', 'glob.c', '-I.'])
shprint(cc, *cflags, _env=env)

cflags = env['CFLAGS'].split()
srindex = cflags.index('--sysroot')
if srindex:
cflags[srindex+1] = self.ctx.ndk_platform
cflags.extend(['-shared', '-I.', 'glob.o', '-o', 'libglob.so'])
cflags.extend(env['LDFLAGS'].split())
shprint(cc, *cflags, _env=env)

shprint(sh.cp, 'libglob.so', join(self.ctx.libs_dir, arch.arch))
shprint(sh.cp, "libglob.so", join(self.ctx.get_python_install_dir(), 'lib'))
# drop header in to the Python include directory
shprint(sh.cp, "glob.h", join(self.ctx.get_python_install_dir(),
'include/python{}'.format(
self.ctx.python_recipe.version[0:3]
)
)
)
include_path = join(self.ctx.python_recipe.get_build_dir(arch.arch), 'Include')
shprint(sh.cp, "glob.h", include_path)


recipe = LibGlobRecipe()

0 comments on commit 9160a42

Please sign in to comment.