Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pythonforandroid/recipes/audiostream/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

from pythonforandroid.toolchain import CythonRecipe, shprint, ArchAndroid, current_directory, info
import sh
import glob
from os.path import join, exists


class AudiostreamRecipe(CythonRecipe):
version = 'master'
url = 'https://github.com/kivy/audiostream/archive/{version}.zip'
name = 'audiostream'
depends = ['python2', ('sdl', 'sdl2'), 'pyjnius']

def get_recipe_env(self, arch):
if 'sdl' in self.ctx.recipe_build_order:
sdl_include = 'sdl'
sdl_mixer_include = 'sdl_mixer'
elif 'sdl2' in self.ctx.recipe_build_order:
sdl_include = 'SDL'
sdl_mixer_include = 'SDL2_mixer'

#note: audiostream library is not yet able to judge whether it is being used with sdl or with sdl2.
#this causes linking to fail against SDL2 (compiling against SDL2 works)
#need to find a way to fix this in audiostream's setup.py
raise RuntimeError('Audiostream library is not yet able to configure itself to link against SDL2. Patch on audiostream library needed - any help much appreciated!')

env = super(AudiostreamRecipe, self).get_recipe_env(arch)
env['CFLAGS'] += ' -I{jni_path}/{sdl_include}/include -I{jni_path}/{sdl_mixer_include}'.format(
jni_path = join(self.ctx.bootstrap.build_dir, 'jni'),
sdl_include = sdl_include,
sdl_mixer_include = sdl_mixer_include)
return env



recipe = AudiostreamRecipe()
41 changes: 41 additions & 0 deletions pythonforandroid/recipes/audiostream/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

VERSION_audiostream=${VERSION_audiostream:-master}
URL_audiostream=https://github.com/kivy/audiostream/archive/$VERSION_audiostream.zip
DEPS_audiostream=(python sdl pyjnius)
MD5_audiostream=
BUILD_audiostream=$BUILD_PATH/audiostream/$(get_directory $URL_audiostream)
RECIPE_audiostream=$RECIPES_PATH/audiostream

function prebuild_audiostream() {
cd $BUILD_audiostream
}

function shouldbuild_audiostream() {
if [ -d "$SITEPACKAGES_PATH/audiostream" ]; then
DO_BUILD=0
fi
}

function build_audiostream() {
cd $BUILD_audiostream

push_arm

# build python extension
export JNI_PATH=$JNI_PATH
export CFLAGS="$CFLAGS -I$JNI_PATH/sdl/include -I$JNI_PATH/sdl_mixer/"
export LDFLAGS="$LDFLAGS -lm -L$LIBS_PATH"
try cd $BUILD_audiostream
$HOSTPYTHON setup.py build_ext &>/dev/null
try find . -iname '*.pyx' -exec $CYTHON {} \;
try $HOSTPYTHON setup.py build_ext -v
try $HOSTPYTHON setup.py install -O2
try cp -a audiostream/platform/android/org $JAVACLASS_PATH

pop_arm
}

function postbuild_audiostream() {
true
}