Skip to content

Commit 11caad6

Browse files
author
Kim Rinnewitz
committed
Add pyogg, libogg, libvorbis recipes
1 parent 0b0388b commit 11caad6

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 OggRecipe(NDKRecipe):
8+
version = '1.3.3'
9+
url = 'http://downloads.xiph.org/releases/ogg/libogg-{version}.tar.gz'
10+
11+
generated_libraries = ['libogg.so']
12+
13+
def build_arch(self, arch):
14+
with current_directory(self.get_build_dir(arch.arch)):
15+
env = self.get_recipe_env(arch)
16+
flags = [
17+
'--with-sysroot=' + self.ctx.ndk_platform,
18+
'--host=' + arch.toolchain_prefix,
19+
]
20+
configure = sh.Command('./configure')
21+
shprint(configure, *flags, _env=env)
22+
shprint(sh.make, _env=env)
23+
self.install_libs(arch, join('src', '.libs', 'libogg.so'))
24+
25+
26+
recipe = OggRecipe()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from pythonforandroid.recipe import PythonRecipe
2+
from os.path import join
3+
4+
5+
class PyOggRecipe(PythonRecipe):
6+
version = '0.6.4a1'
7+
url = 'https://files.pythonhosted.org/packages/ba/44/ca94dd062fcf6b59488df6052070e0d533a618c2321cdfe991afa6e4d65a/PyOgg-{version}.tar.gz'
8+
depends = [('python2', 'python3crystax'), 'libogg', 'libvorbis', 'setuptools']
9+
patches = [join('patches', 'fix-find-lib.patch')]
10+
11+
call_hostpython_via_targetpython = False
12+
13+
14+
recipe = PyOggRecipe()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/pyogg/library_loader.py b/pyogg/library_loader.py
2+
index c2ba36c..383331a 100644
3+
--- a/pyogg/library_loader.py
4+
+++ b/pyogg/library_loader.py
5+
@@ -54,7 +54,7 @@ def load_other(name, paths = None):
6+
except:
7+
pass
8+
else:
9+
- for path in [os.getcwd(), _here]:
10+
+ for path in [os.path.join(os.environ['ANDROID_PRIVATE'], '..', 'lib')]:
11+
for style in other_styles:
12+
candidate = os.path.join(path, style.format(name))
13+
if os.path.exists(candidate):

0 commit comments

Comments
 (0)