# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python import os import shutil from cerbero.utils import shell from custom import list_gstreamer_1_0_plugins_by_category class Recipe(recipe.Recipe): name = 'gst-android-1.0' version = '0.1' licenses = [License.LGPLv2_1Plus] stype = SourceType.CUSTOM btype = BuildType.CUSTOM deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0', 'gst-plugins-ugly-1.0', 'gst-plugins-bad-1.0', 'gst-libav-1.0', 'gst-devtools-1.0', 'gst-rtsp-server-1.0', 'gst-editing-services-1.0' ] files_devel = [ 'share/gst-android/ndk-build/gstreamer_android-1.0.c.in', 'share/gst-android/ndk-build/gstreamer-1.0.mk', 'share/gst-android/ndk-build/gstreamer_prebuilt.mk', 'share/gst-android/ndk-build/tools.mk', 'share/gst-android/ndk-build/plugins.mk', 'share/gst-android/ndk-build/tools', 'share/gst-android/ndk-build/fontconfig', ] def prepare(self): if self.config.variants.rust: self.deps.append('gst-plugins-rs') async def install(self): ndk_build_dir_dst = os.path.join(self.config.prefix, 'share', 'gst-android', 'ndk-build') if not os.path.exists(ndk_build_dir_dst): os.makedirs(ndk_build_dir_dst) ndk_build_dir_src = os.path.join(self.config.data_dir, 'ndk-build') for f in self.files_devel: fname = os.path.basename(f) s = os.path.join(ndk_build_dir_src, fname) d = os.path.join(ndk_build_dir_dst, fname) if os.path.isfile(s): shutil.copy(s, d) else: shell.copy_dir(s, d) plugins = list_gstreamer_1_0_plugins_by_category(self.config) f = open(os.path.join(ndk_build_dir_dst, 'plugins.mk'), 'w') for c, p in plugins.items(): p = ' '.join(p) f.write('GSTREAMER_PLUGINS_%s := %s\n' % (c.upper(), p)) f.close()