|
| 1 | +from pythonforandroid.recipe import NDKRecipe |
| 2 | +from pythonforandroid.toolchain import current_directory, shprint |
| 3 | +from os.path import join |
| 4 | +import sh |
| 5 | + |
| 6 | + |
| 7 | +class VorbisRecipe(NDKRecipe): |
| 8 | + version = '1.3.6' |
| 9 | + url = 'http://downloads.xiph.org/releases/vorbis/libvorbis-{version}.tar.gz' |
| 10 | + opt_depends = ['libogg'] |
| 11 | + |
| 12 | + generated_libraries = ['libvorbis.so', 'libvorbisfile.so', 'libvorbisenc.so'] |
| 13 | + |
| 14 | + def get_recipe_env(self, arch=None): |
| 15 | + env = super(VorbisRecipe, self).get_recipe_env(arch) |
| 16 | + ogg = self.get_recipe('libogg', self.ctx) |
| 17 | + env['CFLAGS'] += ' -I{}'.format(join(ogg.get_build_dir(arch.arch), 'include')) |
| 18 | + return env |
| 19 | + |
| 20 | + def build_arch(self, arch): |
| 21 | + with current_directory(self.get_build_dir(arch.arch)): |
| 22 | + env = self.get_recipe_env(arch) |
| 23 | + flags = [ |
| 24 | + '--with-sysroot=' + self.ctx.ndk_platform, |
| 25 | + '--host=' + arch.toolchain_prefix, |
| 26 | + ] |
| 27 | + configure = sh.Command('./configure') |
| 28 | + shprint(configure, *flags, _env=env) |
| 29 | + shprint(sh.make, _env=env) |
| 30 | + self.install_libs(arch, |
| 31 | + join('lib', '.libs', 'libvorbis.so'), |
| 32 | + join('lib', '.libs', 'libvorbisfile.so'), |
| 33 | + join('lib', '.libs', 'libvorbisenc.so') |
| 34 | + ) |
| 35 | + |
| 36 | + |
| 37 | +recipe = VorbisRecipe() |
0 commit comments