add support for copying libraries for armeabi, armeabi-v7a, x86, mips. closes #63

This commit is contained in:
Mathieu Virbel 2014-04-21 14:17:13 +02:00
parent 4ad75994d7
commit fbab0f2163
3 changed files with 29 additions and 13 deletions

View file

@ -535,6 +535,16 @@ class Buildozer(object):
self.debug('Remove directory and subdirectory {}'.format(dn))
rmtree(dn)
def file_matches(self, patterns):
from glob import glob
result = []
for pattern in patterns:
matches = glob(expanduser(pattern.strip()))
if not matches:
return
result.extend(matches)
return result
def file_exists(self, *args):
return exists(join(*args))

View file

@ -113,6 +113,9 @@ fullscreen = 1
# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so
# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True

View file

@ -450,19 +450,22 @@ class TargetAndroid(Target):
version = self.buildozer.get_version()
# add extra libs/armeabi files in dist/default/libs/armeabi
# XXX to the same for x86 and v7a
add_libs_armeabi = config.getlist('app', 'android.add_libs_armeabi', [])
for pattern in add_libs_armeabi:
matches = glob(expanduser(pattern.strip()))
if matches:
for fn in matches:
self.buildozer.file_copy(
join(self.buildozer.root_dir, fn),
join(dist_dir, 'libs', 'armeabi', basename(fn)))
else:
raise SystemError(
'Failed to find libs_armeabi files: {}'.format(
pattern))
# (same for armeabi-v7a, x86, mips)
for config_key, lib_dir in (
('android.add_libs_armeabi', 'armeabi'),
('android.add_libs_armeabi_v7a', 'armeabi-v7a'),
('android.add_libs_x86', 'x86'),
('android.add_libs_mips', 'mips')):
patterns = config.getlist('app', config_key, [])
if not patterns:
continue
self.debug('Search and copy libs for {}'.format(lib_dir))
for fn in self.buildozer.file_matches(patterns):
self.buildozer.file_copy(
join(self.buildozer.root_dir, fn),
join(dist_dir, 'libs', lib_dir, basename(fn)))
# update the project.properties libraries references
self._update_libraries_references(dist_dir)