def prebuild_arch(self, arch): super(VlcRecipe, self).prebuild_arch(arch) build_dir = self.get_build_dir(arch.arch) port_dir = join(build_dir, 'vlc-port-android') if self.ENV_LIBVLC_AAR in environ: self.aars[arch] = aar = environ.get(self.ENV_LIBVLC_AAR) if not exists(aar): warning("Error: libvlc-<ver>.aar bundle " \ "not found in {}".format(aar)) info("check {} environment!".format(self.ENV_LIBVLC_AAR)) exit(1) else: aar_path = join(port_dir, 'libvlc', 'build', 'outputs', 'aar') self.aars[arch] = aar = join(aar_path, 'libvlc-{}.aar'.format(self.version)) warning("HINT: set path to precompiled libvlc-<ver>.aar bundle " \ "in {} environment!".format(self.ENV_LIBVLC_AAR)) info("libvlc-<ver>.aar should build " \ "from sources at {}".format(port_dir)) if not exists(join(port_dir, 'compile.sh')): info("clone vlc port for android sources from {}".format( self.port_git)) shprint(sh.git, 'clone', self.port_git, port_dir, _tail=20, _critical=True) vlc_dir = join(port_dir, 'vlc') if not exists(join(vlc_dir, 'Makefile.am')): info("clone vlc sources from {}".format(self.vlc_git)) shprint(sh.git, 'clone', self.vlc_git, vlc_dir, _tail=20, _critical=True)
def build_armeabi(self): # AND: Should use an i386 recipe system warning('Running hostpython build. Arch is armeabi! ' 'This is naughty, need to fix the Arch system!') # AND: Fix armeabi again with current_directory(self.get_build_dir('armeabi')): if exists('hostpython'): info('hostpython already exists, skipping build') self.ctx.hostpython = join(self.get_build_dir('armeabi'), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir('armeabi'), 'hostpgen') return configure = sh.Command('./configure') shprint(configure) shprint(sh.make, '-j5') shprint(sh.mv, join('Parser', 'pgen'), 'hostpgen') if exists('python.exe'): shprint(sh.mv, 'python.exe', 'hostpython') elif exists('python'): shprint(sh.mv, 'python', 'hostpython') else: warning('Unable to find the python executable after ' 'hostpython build! Exiting.') exit(1) self.ctx.hostpython = join(self.get_build_dir('armeabi'), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir('armeabi'), 'hostpgen')
def build_arch(self, arch): with current_directory(self.get_build_dir()): if exists('hostpython'): info('hostpython already exists, skipping build') self.ctx.hostpython = join(self.get_build_dir(), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir(), 'hostpgen') return configure = sh.Command('./configure') shprint(configure) shprint(sh.make, '-j5') shprint(sh.mv, join('Parser', 'pgen'), 'hostpgen') if exists('python.exe'): shprint(sh.mv, 'python.exe', 'hostpython') elif exists('python'): shprint(sh.mv, 'python', 'hostpython') else: warning('Unable to find the python executable after ' 'hostpython build! Exiting.') exit(1) self.ctx.hostpython = join(self.get_build_dir(), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir(), 'hostpgen')
def build_arch(self, arch): # AND: Should use an i386 recipe system warning("Running hostpython build. Arch is armeabi! " "This is naughty, need to fix the Arch system!") # AND: Fix armeabi again with current_directory(self.get_build_dir(arch.arch)): if exists("hostpython"): info("hostpython already exists, skipping build") self.ctx.hostpython = join(self.get_build_dir("armeabi"), "hostpython") self.ctx.hostpgen = join(self.get_build_dir("armeabi"), "hostpgen") return configure = sh.Command("./configure") shprint(configure) shprint(sh.make, "-j5", "BUILDPYTHON=hostpython", "hostpython", "PGEN=Parser/hostpgen", "Parser/hostpgen") shprint(sh.mv, join("Parser", "hostpgen"), "hostpgen") # if exists('python.exe'): # shprint(sh.mv, 'python.exe', 'hostpython') # elif exists('python'): # shprint(sh.mv, 'python', 'hostpython') if exists("hostpython"): pass # The above commands should automatically create # the hostpython binary, unlike with python2 else: warning("Unable to find the python executable after " "hostpython build! Exiting.") exit(1) self.ctx.hostpython = join(self.get_build_dir(arch.arch), "hostpython") self.ctx.hostpgen = join(self.get_build_dir(arch.arch), "hostpgen")
def prebuild_arch(self, arch): super(NumpyRecipe, self).prebuild_arch(arch) build_dir = self.get_build_dir(arch.arch) if exists(join(build_dir, '.patched')): print('numpy already patched, skipping') return self.apply_patch('patches/fix-numpy.patch') self.apply_patch('patches/prevent_libs_check.patch') self.apply_patch('patches/ar.patch') self.apply_patch('patches/lib.patch') # AND: Fix this warning! warning('Numpy is built assuming the archiver name is ' 'arm-linux-androideabi-ar, which may not always be true!') shprint(sh.touch, join(build_dir, '.patched'))
def prebuild_arch(self, arch): super(NumpyRecipe, self).prebuild_arch(arch) build_dir = self.get_build_dir(arch.arch) if exists(join(build_dir, '.patched')): print('numpy already patched, skipping') return self.apply_patch('patches/fix-numpy.patch', arch.arch) self.apply_patch('patches/prevent_libs_check.patch', arch.arch) self.apply_patch('patches/ar.patch', arch.arch) self.apply_patch('patches/lib.patch', arch.arch) # AND: Fix this warning! warning('Numpy is built assuming the archiver name is ' 'arm-linux-androideabi-ar, which may not always be true!') shprint(sh.touch, join(build_dir, '.patched'))
def build_arch(self, arch): # AND: Should use an i386 recipe system warning('Running hostpython build. Arch is armeabi! ' 'This is naughty, need to fix the Arch system!') # AND: Fix armeabi again with current_directory(self.get_build_dir(arch.arch)): if exists('hostpython'): info('hostpython already exists, skipping build') self.ctx.hostpython = join(self.get_build_dir('armeabi'), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir('armeabi'), 'hostpgen') return configure = sh.Command('./configure') shprint(configure) shprint(sh.make, '-j5', 'BUILDPYTHON=hostpython', 'hostpython', 'PGEN=Parser/hostpgen', 'Parser/hostpgen') shprint(sh.mv, join('Parser', 'hostpgen'), 'hostpgen') # if exists('python.exe'): # shprint(sh.mv, 'python.exe', 'hostpython') # elif exists('python'): # shprint(sh.mv, 'python', 'hostpython') if exists('hostpython'): pass # The above commands should automatically create # the hostpython binary, unlike with python2 else: warning('Unable to find the python executable after ' 'hostpython build! Exiting.') exit(1) self.ctx.hostpython = join(self.get_build_dir(arch.arch), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir(arch.arch), 'hostpgen')
def build_armeabi(self): # AND: Should use an i386 recipe system warning('Running hostpython build. Arch is armeabi! ' 'This is naughty, need to fix the Arch system!') # AND: Fix armeabi again with current_directory(self.get_build_dir('armeabi')): if exists('hostpython'): info('hostpython already exists, skipping build') self.ctx.hostpython = join(self.get_build_dir('armeabi'), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir('armeabi'), 'hostpgen') return configure = sh.Command('./configure') shprint(configure) shprint(sh.make, '-j5', 'BUILDPYTHON=hostpython', 'hostpython', 'PGEN=Parser/hostpgen', 'Parser/hostpgen') shprint(sh.mv, join('Parser', 'hostpgen'), 'hostpgen') # if exists('python.exe'): # shprint(sh.mv, 'python.exe', 'hostpython') # elif exists('python'): # shprint(sh.mv, 'python', 'hostpython') if exists('hostpython'): pass # The above commands should automatically create # the hostpython binary, unlike with python2 else: warning('Unable to find the python executable after ' 'hostpython build! Exiting.') exit(1) self.ctx.hostpython = join(self.get_build_dir('armeabi'), 'hostpython') self.ctx.hostpgen = join(self.get_build_dir('armeabi'), 'hostpgen')
def run_distribute(self): info_main('# Creating Android project from build and {} bootstrap'.format( self.name)) # src_path = join(self.ctx.root_dir, 'bootstrap_templates', # self.name) src_path = join(self.bootstrap_dir, 'build') with current_directory(self.dist_dir): info('Creating initial layout') for dirname in ('assets', 'bin', 'private', 'res', 'templates'): if not exists(dirname): shprint(sh.mkdir, dirname) info('Copying default files') shprint(sh.cp, '-a', join(self.build_dir, 'project.properties'), '.') shprint(sh.cp, '-a', join(src_path, 'local.properties'), '.') shprint(sh.cp, '-a', join(src_path, 'build.py'), '.') shprint(sh.cp, '-a', join(src_path, 'buildlib'), '.') shprint(sh.cp, '-a', join(src_path, 'src'), '.') shprint(sh.cp, '-a', join(src_path, 'templates'), '.') shprint(sh.cp, '-a', join(src_path, 'res'), '.') shprint(sh.cp, '-a', join(src_path, 'blacklist.txt'), '.') shprint(sh.cp, '-a', join(src_path, 'whitelist.txt'), '.') info('Copying python distribution') hostpython = sh.Command(self.ctx.hostpython) # AND: This *doesn't* need to be in arm env? shprint(hostpython, '-OO', '-m', 'compileall', self.ctx.get_python_install_dir()) if not exists('python-install'): shprint(sh.cp, '-a', self.ctx.get_python_install_dir(), './python-install') info('Copying libs') # AND: Hardcoding armeabi - naughty! shprint(sh.mkdir, '-p', join('libs', 'armeabi')) for lib in glob.glob(join(self.build_dir, 'libs', 'armeabi', '*')): shprint(sh.cp, '-a', lib, join('libs', 'armeabi')) for lib in glob.glob(join(self.ctx.get_libs_dir('armeabi'), '*')): shprint(sh.cp, '-a', lib, join('libs', 'armeabi')) info('Copying java files') for filename in glob.glob(self.ctx.javaclass_dir): shprint(sh.cp, '-a', filename, 'src') info('Filling private directory') if not exists(join('private', 'lib')): shprint(sh.cp, '-a', join('python-install', 'lib'), 'private') shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7')) # AND: Copylibs stuff should go here shprint(sh.mv, join('libs', 'armeabi', 'libpymodules.so'), 'private/') shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/')) info('Removing some unwanted files') shprint(sh.rm, '-f', join('private', 'lib', 'libpython2.7.so')) shprint(sh.rm, '-rf', join('private', 'lib', 'pkgconfig')) with current_directory(join(self.dist_dir, 'private', 'lib', 'python2.7')): # shprint(sh.xargs, 'rm', sh.grep('-E', '*\.(py|pyx|so\.o|so\.a|so\.libs)$', sh.find('.'))) removes = [] for dirname, something, filens in walk('.'): for filename in filens: for suffix in ('py', 'pyc', 'so.o', 'so.a', 'so.libs'): if filename.endswith(suffix): removes.append(filename) shprint(sh.rm, '-f', *removes) info('Deleting some other stuff not used on android') # To quote the original distribute.sh, 'well...' # shprint(sh.rm, '-rf', 'ctypes') shprint(sh.rm, '-rf', 'lib2to3') shprint(sh.rm, '-rf', 'idlelib') for filename in glob.glob('config/libpython*.a'): shprint(sh.rm, '-f', filename) shprint(sh.rm, '-rf', 'config/python.o') shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so') shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so') info('Stripping libraries') env = ArchAndroid(self.ctx).get_env() strip = which('arm-linux-androideabi-strip', env['PATH']) if strip is None: warning('Can\'t find strip in PATH...') strip = sh.Command(strip) filens = shprint(sh.find, join(self.dist_dir, 'private'), join(self.dist_dir, 'libs'), '-iname', '*.so', _env=env).stdout.decode('utf-8') logger.info('Stripping libraries in private dir') for filen in filens.split('\n'): try: strip(filen, _env=env) except sh.ErrorReturnCode_1: logger.debug('Failed to strip ' + 'filen') super(PygameBootstrap, self).run_distribute()
def run_distribute(self): info_main( '# Creating Android project from build and {} bootstrap'.format( self.name)) info( 'This currently just copies the SDL2 build stuff straight from the build dir.' ) shprint(sh.rm, '-rf', self.dist_dir) shprint(sh.cp, '-r', self.build_dir, self.dist_dir) with current_directory(self.dist_dir): with open('local.properties', 'w') as fileh: fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir)) with current_directory(self.dist_dir): info('Copying python distribution') if not exists('private'): shprint(sh.mkdir, 'private') if not exists('assets'): shprint(sh.mkdir, 'assets') hostpython = sh.Command(self.ctx.hostpython) # AND: This *doesn't* need to be in arm env? shprint(hostpython, '-OO', '-m', 'compileall', join(self.ctx.build_dir, 'python-install')) if not exists('python-install'): shprint(sh.cp, '-a', join(self.ctx.build_dir, 'python-install'), '.') info('Copying libs') # AND: Hardcoding armeabi - naughty! shprint(sh.mkdir, '-p', join('libs', 'armeabi')) for lib in glob.glob(join(self.ctx.libs_dir, '*')): shprint(sh.cp, '-a', lib, join('libs', 'armeabi')) info('Copying java files') for filename in glob.glob(join(self.ctx.build_dir, 'java', '*')): shprint(sh.cp, '-a', filename, 'src') info('Filling private directory') if not exists(join('private', 'lib')): info('private/lib does not exist, making') shprint(sh.cp, '-a', join('python-install', 'lib'), 'private') shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7')) # AND: Copylibs stuff should go here if exists(join('libs', 'armeabi', 'libpymodules.so')): shprint(sh.mv, join('libs', 'armeabi', 'libpymodules.so'), 'private/') shprint( sh.cp, join('python-install', 'include', 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/')) info('Removing some unwanted files') shprint(sh.rm, '-f', join('private', 'lib', 'libpython2.7.so')) shprint(sh.rm, '-rf', join('private', 'lib', 'pkgconfig')) with current_directory( join(self.dist_dir, 'private', 'lib', 'python2.7')): # shprint(sh.xargs, 'rm', sh.grep('-E', '*\.(py|pyx|so\.o|so\.a|so\.libs)$', sh.find('.'))) removes = [] for dirname, something, filens in walk('.'): for filename in filens: for suffix in ('py', 'pyc', 'so.o', 'so.a', 'so.libs'): if filename.endswith(suffix): removes.append(filename) shprint(sh.rm, '-f', *removes) info('Deleting some other stuff not used on android') # To quote the original distribute.sh, 'well...' shprint(sh.rm, '-rf', 'ctypes') shprint(sh.rm, '-rf', 'lib2to3') shprint(sh.rm, '-rf', 'idlelib') for filename in glob.glob('config/libpython*.a'): shprint(sh.rm, '-f', filename) shprint(sh.rm, '-rf', 'config/python.o') shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so') shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so') info('Stripping libraries') env = ArchAndroid(self.ctx).get_env() strip = which('arm-linux-androideabi-strip', env['PATH']) if strip is None: warning('Can\'t find strip in PATH...') strip = sh.Command(strip) filens = shprint(sh.find, join(self.dist_dir, 'private'), join(self.dist_dir, 'libs'), '-iname', '*.so', _env=env).stdout.decode('utf-8') logger.info('Stripping libraries in private dir') for filen in filens.split('\n'): try: strip(filen, _env=env) except sh.ErrorReturnCode_1: logger.debug('Failed to strip ' + 'filen') super(SDL2Bootstrap, self).run_distribute()
def prebuild_arch(self, arch): super(NumpyRecipe, self).prebuild_arch(arch) # AND: Fix this warning! warning('Numpy is built assuming the archiver name is ' 'arm-linux-androideabi-ar, which may not always be true!')
def prebuild_arch(self, arch): super(NumpyRecipe, self).prebuild_arch(arch) warning('Numpy is built assuming the archiver name is ' 'arm-linux-androideabi-ar, which may not always be true!')