|
| 1 | + |
| 2 | +from pythonforandroid.toolchain import CythonRecipe, shprint, ArchAndroid, current_directory, info |
| 3 | +import sh |
| 4 | +import glob |
| 5 | +from os.path import join, exists |
| 6 | + |
| 7 | + |
| 8 | +class AudiostreamRecipe(CythonRecipe): |
| 9 | + version = 'master' |
| 10 | + url = 'https://github.com/kivy/audiostream/archive/{version}.zip' |
| 11 | + name = 'audiostream' |
| 12 | + depends = ['python2', ('sdl', 'sdl2'), 'pyjnius'] |
| 13 | + |
| 14 | + def get_recipe_env(self, arch): |
| 15 | + if 'sdl' in self.ctx.recipe_build_order: |
| 16 | + sdl_include = 'sdl' |
| 17 | + sdl_mixer_include = 'sdl_mixer' |
| 18 | + elif 'sdl2' in self.ctx.recipe_build_order: |
| 19 | + sdl_include = 'SDL' |
| 20 | + sdl_mixer_include = 'SDL2_mixer' |
| 21 | + |
| 22 | + #note: audiostream library is not yet able to judge whether it is being used with sdl or with sdl2. |
| 23 | + #this causes linking to fail against SDL2 (compiling against SDL2 works) |
| 24 | + #need to find a way to fix this in audiostream's setup.py |
| 25 | + raise RuntimeError('Audiostream library is not yet able to configure itself to link against SDL2. Patch on audiostream library needed - any help much appreciated!') |
| 26 | + |
| 27 | + env = super(AudiostreamRecipe, self).get_recipe_env(arch) |
| 28 | + env['CFLAGS'] += ' -I{jni_path}/{sdl_include}/include -I{jni_path}/{sdl_mixer_include}'.format( |
| 29 | + jni_path = join(self.ctx.bootstrap.build_dir, 'jni'), |
| 30 | + sdl_include = sdl_include, |
| 31 | + sdl_mixer_include = sdl_mixer_include) |
| 32 | + return env |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +recipe = AudiostreamRecipe() |
0 commit comments