# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.utils import shell class Recipe(recipe.Recipe): name = 'gst-ffmpeg' version = '0.10.13' # TODO - check license - plugin is certainly LGPLv2+, but need to check # the linked libs licenses = [License.LGPLv2Plus] config_sh = 'sh ./autogen.sh --noconfigure && ./configure' configure_options = "--enable-lgpl --disable-examples --with-package-origin='http://www.gstreamer.com' --with-package-name='GStreamer FFMPEG Plugins (GStreamer SDK)' " remotes = {'upstream': 'git://anongit.freedesktop.org/gstreamer/gst-ffmpeg'} deps = ['gstreamer', 'gst-plugins-base', 'bzip2', 'zlib' ] files_plugins_codecs_restricted = ['lib/gstreamer-0.10/libgstffmpeg%(mext)s'] def prepare(self): if self.config.target_platform != Platform.LINUX: self.configure_options += ' --disable-gtk-doc' if self.config.target_platform == Platform.DARWIN: if self.config.target_arch == Architecture.X86_64: asflags = ' -arch x86_64 -m64' elif self.config.target_arch == Architecture.X86: asflags = ' -arch i386 -m32' elif self.config.target_arch == Architecture.PPC: asflags = ' -arch ppc' self.configure_options += ' ASFLAGS="%s"' % asflags def configure(self): opts = None if self.config.target_platform == Platform.WINDOWS: opts = '--cross-prefix=%s- --target-os=mingw32 --arch=%s --enable-w32threads' %\ (self.config.host, self.config.target_arch) if self.config.target_platform == Platform.ANDROID: if self.config.target_arch == Architecture.X86: opts = '--extra-cflags=-mincoming-stack-boundary=4' if self.config.target_platform == Platform.IOS: opts = "--enable-cross-compile --target-os=darwin --cross-prefix='' --arch=%s "\ "--cc='$CC' --ar='$AR' --nm='$NM' --extra-cflags='$CFLAGS'" % self.config.target_arch if self.config.target_arch == Architecture.X86: opts += ' --as=$AS' else: opts += " --as='$GAS'" if opts: opts_file = os.path.join(self.build_dir, 'ffmpeg_extra_configure_options') with open(opts_file, 'w+') as f: f.write(opts) super(recipe.Recipe, self).configure() libav_path = os.path.join(self.build_dir, 'gst-libs', 'ext', 'libav') replacements = {} if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: if self.config.target_arch == Architecture.X86: replacements['HAVE_EBX_AVAILABLE=yes'] = 'HAVE_EBX_AVAILABLE=no' replacements['HAVE_EBX_AVAILABLE 1'] = 'HAVE_EBX_AVAILABLE 0' # log2 and log2f are not provided by bionic, but they are not checked # properly if self.config.target_platform == Platform.ANDROID: replacements['HAVE_LOG2 1'] = 'HAVE_LOG2 0' replacements['HAVE_LOG2F 1'] = 'HAVE_LOG2F 0' if replacements: shell.replace(os.path.join(libav_path, 'config.mak'), replacements) shell.replace(os.path.join(libav_path, 'config.h'), replacements)