2017-08-13 03:24:00 +02:00
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
from pythonforandroid.recipe import CythonRecipe
|
2022-12-02 21:15:34 +01:00
|
|
|
from pythonforandroid.toolchain import shprint, current_directory, info
|
|
|
|
import sh
|
2019-03-30 21:58:45 +01:00
|
|
|
from os.path import join
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
class AudiostreamRecipe(CythonRecipe):
|
2022-12-02 21:15:34 +01:00
|
|
|
# audiostream has no tagged versions; this is the latest commit to master 2020-12-22
|
|
|
|
# it includes a fix for the dyload issue on android that was preventing use
|
|
|
|
version = '69f6b100f1ea4e3982a1acf6bbb0804e31a2cd50'
|
2017-08-13 03:24:00 +02:00
|
|
|
url = 'https://github.com/kivy/audiostream/archive/{version}.zip'
|
2022-12-02 21:15:34 +01:00
|
|
|
sha256sum = '4d415c91706fd76865d0d22f1945f87900dc42125ff5a6c8d77898ccdf613c21'
|
2017-08-13 03:24:00 +02:00
|
|
|
name = 'audiostream'
|
2022-12-02 21:15:34 +01:00
|
|
|
depends = ['python3', 'sdl2', 'pyjnius']
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def get_recipe_env(self, arch):
|
2022-12-02 21:15:34 +01:00
|
|
|
env = super().get_recipe_env(arch)
|
|
|
|
sdl_include = 'SDL2'
|
|
|
|
|
|
|
|
env['USE_SDL2'] = 'True'
|
|
|
|
env['SDL2_INCLUDE_DIR'] = join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include')
|
|
|
|
|
|
|
|
env['CFLAGS'] += ' -I{jni_path}/{sdl_include}/include'.format(
|
2019-03-30 21:58:45 +01:00
|
|
|
jni_path=join(self.ctx.bootstrap.build_dir, 'jni'),
|
2022-12-02 21:15:34 +01:00
|
|
|
sdl_include=sdl_include)
|
|
|
|
|
|
|
|
sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx)
|
|
|
|
for include_dir in sdl2_mixer_recipe.get_include_dirs(arch):
|
|
|
|
env['CFLAGS'] += ' -I{include_dir}'.format(include_dir=include_dir)
|
|
|
|
|
|
|
|
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
|
|
|
|
env['NDKPLATFORM'] = "NOTNONE"
|
2019-03-30 21:58:45 +01:00
|
|
|
env['LIBLINK'] = 'NOTNONE' # Hacky fix. Needed by audiostream setup.py
|
2017-08-13 03:24:00 +02:00
|
|
|
return env
|
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
def postbuild_arch(self, arch):
|
|
|
|
# TODO: This code was copied from pyjnius, but judging by the
|
|
|
|
# audiostream history, it looks like this step might have
|
|
|
|
# happened automatically in the past.
|
|
|
|
# Given the goal of migrating off of recipes, it would
|
|
|
|
# be good to repair or build infrastructure for doing this
|
|
|
|
# automatically, for when including a java class is
|
|
|
|
# the best solution to a problem.
|
|
|
|
super().postbuild_arch(arch)
|
|
|
|
info('Copying audiostream java files to classes build dir')
|
|
|
|
with current_directory(self.get_build_dir(arch.arch)):
|
|
|
|
shprint(sh.cp, '-a', join('audiostream', 'platform', 'android'), self.ctx.javaclass_dir)
|
|
|
|
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
recipe = AudiostreamRecipe()
|