mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -04:00
Added progress checks on android compile script
This commit is contained in:
parent
f7c69ad39b
commit
c22b88c386
@ -211,6 +211,11 @@ def change_env(values):
|
|||||||
os.environ[k] = v
|
os.environ[k] = v
|
||||||
syscall('export %s="%s"' % (k, v), shell=True, with_print=False)
|
syscall('export %s="%s"' % (k, v), shell=True, with_print=False)
|
||||||
|
|
||||||
|
|
||||||
|
def failed_on_step(error_msg):
|
||||||
|
print('[ERROR] %s. Aborting.' % error_msg)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# check that required paths are in place before we start
|
# check that required paths are in place before we start
|
||||||
for path in REQUIRED_PATHS:
|
for path in REQUIRED_PATHS:
|
||||||
fail_on_missing(path)
|
fail_on_missing(path)
|
||||||
@ -221,7 +226,6 @@ for arch in ARCHS:
|
|||||||
arch_short = ARCHS_SHORT_NAMES.get(arch)
|
arch_short = ARCHS_SHORT_NAMES.get(arch)
|
||||||
|
|
||||||
# store where we are so we can go back
|
# store where we are so we can go back
|
||||||
|
|
||||||
curdir = os.getcwd()
|
curdir = os.getcwd()
|
||||||
|
|
||||||
# platform contains the toolchain
|
# platform contains the toolchain
|
||||||
@ -260,6 +264,15 @@ for arch in ARCHS:
|
|||||||
syscall('ln -sf %(src)s %(dest)s/'
|
syscall('ln -sf %(src)s %(dest)s/'
|
||||||
% {'src': ln_src, 'dest': dest})
|
% {'src': ln_src, 'dest': dest})
|
||||||
|
|
||||||
|
# check that the step went well
|
||||||
|
if CREATE_TOOLCHAIN or COMPILE_LIBLZMA or COMPILE_LIBZIM or \
|
||||||
|
COMPILE_LIBKIWIX or STRIP_LIBKIWIX:
|
||||||
|
if (not os.path.exists(os.path.join(platform, arch_full, 'bin', 'gcc'))
|
||||||
|
or not os.path.exists(os.path.join(platform,
|
||||||
|
arch_full, 'libexec'))):
|
||||||
|
failed_on_step('The toolchain was not '
|
||||||
|
'copied properly and is not present.')
|
||||||
|
|
||||||
# change the PATH for compilation to use proper tools
|
# change the PATH for compilation to use proper tools
|
||||||
new_environ = {'PATH': ('%(platform)s/bin:%(platform)s/%(arch_full)s'
|
new_environ = {'PATH': ('%(platform)s/bin:%(platform)s/%(arch_full)s'
|
||||||
'/bin:%(platform)s/libexec/gcc/%(arch_full)s/'
|
'/bin:%(platform)s/libexec/gcc/%(arch_full)s/'
|
||||||
@ -275,6 +288,10 @@ for arch in ARCHS:
|
|||||||
change_env(new_environ)
|
change_env(new_environ)
|
||||||
change_env(OPTIMIZATION_ENV)
|
change_env(OPTIMIZATION_ENV)
|
||||||
|
|
||||||
|
# check that the path has been changed
|
||||||
|
if not platform in os.environ.get('PATH'):
|
||||||
|
failed_on_step('The PATH environment variable was not set properly.')
|
||||||
|
|
||||||
# compile liblzma.a, liblzma.so
|
# compile liblzma.a, liblzma.so
|
||||||
os.chdir(LIBLZMA_SRC)
|
os.chdir(LIBLZMA_SRC)
|
||||||
configure_cmd = ('./configure --host=%(arch)s --prefix=%(platform)s '
|
configure_cmd = ('./configure --host=%(arch)s --prefix=%(platform)s '
|
||||||
@ -290,9 +307,14 @@ for arch in ARCHS:
|
|||||||
syscall('make clean')
|
syscall('make clean')
|
||||||
syscall('make')
|
syscall('make')
|
||||||
syscall('make install')
|
syscall('make install')
|
||||||
syscall('echo $PATH', shell=True)
|
|
||||||
syscall('make clean')
|
syscall('make clean')
|
||||||
|
|
||||||
|
# check that the step went well
|
||||||
|
if COMPILE_LIBLZMA or COMPILE_LIBZIM or COMPILE_LIBKIWIX:
|
||||||
|
if not os.path.exists(os.path.join(platform, 'lib', 'liblzma.a')):
|
||||||
|
failed_on_step('The liblzma.a archive file has not been created '
|
||||||
|
'and is not present.')
|
||||||
|
|
||||||
# create libzim.a
|
# create libzim.a
|
||||||
os.chdir(curdir)
|
os.chdir(curdir)
|
||||||
platform_includes = ['%(platform)s/include/c++/%(gccver)s/'
|
platform_includes = ['%(platform)s/include/c++/%(gccver)s/'
|
||||||
@ -349,6 +371,12 @@ for arch in ARCHS:
|
|||||||
for src in LIBZIM_SOURCE_FILES:
|
for src in LIBZIM_SOURCE_FILES:
|
||||||
os.remove(src.replace('.cpp', '.o'))
|
os.remove(src.replace('.cpp', '.o'))
|
||||||
|
|
||||||
|
# check that the step went well
|
||||||
|
if COMPILE_LIBZIM or COMPILE_LIBKIWIX:
|
||||||
|
if not os.path.exists(os.path.join(platform, 'lib', 'libzim.a')):
|
||||||
|
failed_on_step('The libzim.a archive file has not been created '
|
||||||
|
'and is not present.')
|
||||||
|
|
||||||
# create libkiwix.so
|
# create libkiwix.so
|
||||||
os.chdir(curdir)
|
os.chdir(curdir)
|
||||||
compile_cmd = ('g++ -fPIC -c -B%(platform)s/sysroot '
|
compile_cmd = ('g++ -fPIC -c -B%(platform)s/sysroot '
|
||||||
@ -399,6 +427,7 @@ for arch in ARCHS:
|
|||||||
syscall('javac JNIKiwix.java')
|
syscall('javac JNIKiwix.java')
|
||||||
os.chdir(os.path.join(curdir, 'src'))
|
os.chdir(os.path.join(curdir, 'src'))
|
||||||
syscall('javah -jni org.kiwix.kiwixmobile.JNIKiwix')
|
syscall('javah -jni org.kiwix.kiwixmobile.JNIKiwix')
|
||||||
|
os.chdir(curdir)
|
||||||
|
|
||||||
syscall(compile_cmd)
|
syscall(compile_cmd)
|
||||||
syscall(link_cmd)
|
syscall(link_cmd)
|
||||||
@ -407,6 +436,12 @@ for arch in ARCHS:
|
|||||||
'src/org_kiwix_kiwixmobile_JNIKiwix.h'):
|
'src/org_kiwix_kiwixmobile_JNIKiwix.h'):
|
||||||
os.remove(obj)
|
os.remove(obj)
|
||||||
|
|
||||||
|
# check that the step went well
|
||||||
|
if COMPILE_LIBKIWIX or STRIP_LIBKIWIX or COMPILE_APK:
|
||||||
|
if not os.path.exists(os.path.join('libs', arch_short, 'libkiwix.so')):
|
||||||
|
failed_on_step('The libkiwix.so shared lib has not been created '
|
||||||
|
'and is not present.')
|
||||||
|
|
||||||
if STRIP_LIBKIWIX:
|
if STRIP_LIBKIWIX:
|
||||||
syscall('%(platform)s/%(arch_full)s/bin/strip '
|
syscall('%(platform)s/%(arch_full)s/bin/strip '
|
||||||
'%(curdir)s/libs/%(arch_short)s/libkiwix.so'
|
'%(curdir)s/libs/%(arch_short)s/libkiwix.so'
|
||||||
@ -419,5 +454,12 @@ for arch in ARCHS:
|
|||||||
change_env(ORIGINAL_ENVIRON)
|
change_env(ORIGINAL_ENVIRON)
|
||||||
|
|
||||||
if COMPILE_APK:
|
if COMPILE_APK:
|
||||||
|
syscall('rm -f bin/*.apk', shell=True)
|
||||||
syscall('ant debug')
|
syscall('ant debug')
|
||||||
syscall('ls -lh bin/*.apk', shell=True)
|
syscall('ls -lh bin/*.apk', shell=True)
|
||||||
|
|
||||||
|
# check that the step went well
|
||||||
|
if COMPILE_APK:
|
||||||
|
if not os.path.exists(os.path.join('bin', 'Kiwix-debug.apk')):
|
||||||
|
failed_on_step('The Kiwix-debug.apk package has not been created '
|
||||||
|
'and is not present.')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user