Skip to content

Commit d1f1654

Browse files
committed
vlc recipe procompiled aar bundle handling improved
1 parent f9b3976 commit d1f1654

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

pythonforandroid/recipes/vlc/__init__.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,42 @@ class VlcRecipe(Recipe):
1414
port_git = 'http://git.videolan.org/git/vlc-ports/android.git'
1515
vlc_git = 'http://git.videolan.org/git/vlc.git'
1616
ENV_LIBVLC_AAR = 'LIBVLC_AAR'
17+
aars = {} # for future use of multiple arch
1718

1819
def prebuild_arch(self, arch):
1920
super(VlcRecipe, self).prebuild_arch(arch)
2021
build_dir = self.get_build_dir(arch.arch)
2122
port_dir = join(build_dir, 'vlc-port-android')
22-
aar_path = join(port_dir, 'libvlc', 'build', 'outputs', 'aar')
23-
aar = environ.get(self.ENV_LIBVLC_AAR,
24-
join(aar_path, 'libvlc-{}.aar'.format(self.version)))
25-
if not exists(aar):
26-
if environ.has_key(''):
27-
warning("Error: libvlc-<ver>.aar bundle not found in {}".format(aar))
23+
if self.ENV_LIBVLC_AAR in environ:
24+
self.aars[arch] = aar = environ.get(self.ENV_LIBVLC_AAR)
25+
if not exists(aar):
26+
warning("Error: libvlc-<ver>.aar bundle " \
27+
"not found in {}".format(aar))
2828
info("check {} environment!".format(self.ENV_LIBVLC_AAR))
29-
raise Exception("vlc .aar bundle not found by path specified in {}".format(self.ENV_LIBVLC_AAR))
30-
warning("set path to precompiled libvlc-<ver>.aar bundle in {} environment!".format(self.ENV_LIBVLC_AAR))
31-
info("libvlc-<ver>.aar for android not found!")
32-
info("should build from sources at {}".format(port_dir))
29+
exit(1)
30+
else:
31+
aar_path = join(port_dir, 'libvlc', 'build', 'outputs', 'aar')
32+
self.aars[arch] = aar = join(aar_path, 'libvlc-{}.aar'.format(self.version))
33+
warning("HINT: set path to precompiled libvlc-<ver>.aar bundle " \
34+
"in {} environment!".format(self.ENV_LIBVLC_AAR))
35+
info("libvlc-<ver>.aar should build " \
36+
"from sources at {}".format(port_dir))
3337
if not exists(join(port_dir, 'compile.sh')):
34-
info("clone vlc port for android sources from {}".format(self.port_git))
35-
shprint(sh.git, 'clone', self.port_git, port_dir)
38+
info("clone vlc port for android sources from {}".format(
39+
self.port_git))
40+
shprint(sh.git, 'clone', self.port_git, port_dir,
41+
_tail=20, _critical=True)
3642
vlc_dir = join(port_dir, 'vlc')
3743
if not exists(join(vlc_dir, 'Makefile.am')):
3844
info("clone vlc sources from {}".format(self.vlc_git))
39-
shprint(sh.git, 'clone', self.vlc_git, vlc_dir)
45+
shprint(sh.git, 'clone', self.vlc_git, vlc_dir,
46+
_tail=20, _critical=True)
4047

4148
def build_arch(self, arch):
4249
super(VlcRecipe, self).build_arch(arch)
4350
build_dir = self.get_build_dir(arch.arch)
4451
port_dir = join(build_dir, 'vlc-port-android')
45-
aar_path = join(port_dir, 'libvlc', 'build', 'outputs', 'aar')
46-
aar = environ.get(self.ENV_LIBVLC_AAR,
47-
join(aar_path, 'libvlc-{}.aar'.format(self.version)))
52+
aar = self.aars[arch]
4853
if not exists(aar):
4954
with current_directory(port_dir):
5055
env = dict(environ)
@@ -55,9 +60,11 @@ def build_arch(self, arch):
5560
})
5661
info("compiling vlc from sources")
5762
debug("environment: {}".format(env))
58-
if not exists(join(port_dir, 'bin', 'VLC-debug.apk')):
59-
shprint(sh.Command('./compile.sh'), _env=env, _tail=50, _critical=True)
60-
shprint(sh.Command('./compile-libvlc.sh'), _env=env, _tail=50, _critical=True)
63+
if not exists(join('bin', 'VLC-debug.apk')):
64+
shprint(sh.Command('./compile.sh'), _env=env,
65+
_tail=50, _critical=True)
66+
shprint(sh.Command('./compile-libvlc.sh'), _env=env,
67+
_tail=50, _critical=True)
6168
shprint(sh.cp, '-a', aar, self.ctx.aars_dir)
6269

6370
recipe = VlcRecipe()

0 commit comments

Comments
 (0)