summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-03-10 09:30:28 +0530
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-03-11 09:50:23 +0000
commit6ba0fa2dcb1ca3b3b8efc8e4fad355fd63e51016 (patch)
tree50bcdd85f729af6332d680bcaa89b3a2bff8cddd /recipes
parentb75cf2d970bb100af50c99491430cc6534892fa4 (diff)
Fix packaging of rust plugins on Android
Also fix codepaths for iOS, but iOS is untested. * Cargo is only building static archives, but we don't care about that for now so just encode that into the recipe. * Add Rust plugins to plugins.mk * Dynamically add files_plugins_*_devel instead of files_plugins_* when building for Android or iOS Fixes https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/419 Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1138>
Diffstat (limited to 'recipes')
-rw-r--r--recipes/custom.py63
-rw-r--r--recipes/gst-android-1.0.recipe22
-rw-r--r--recipes/gst-plugins-rs.recipe91
-rw-r--r--recipes/gstreamer-ios-templates.recipe8
4 files changed, 90 insertions, 94 deletions
diff --git a/recipes/custom.py b/recipes/custom.py
index af67e1b0..6dbf9dbc 100644
--- a/recipes/custom.py
+++ b/recipes/custom.py
@@ -132,35 +132,36 @@ class GStreamer(recipe.Recipe):
def list_gstreamer_1_0_plugins_by_category(config):
- cookbook = CookBook(config)
- plugins = defaultdict(list)
- for r in ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0',
- 'gst-plugins-bad-1.0', 'gst-plugins-ugly-1.0', 'libnice',
- 'gst-libav-1.0', 'gst-editing-services-1.0', 'gst-rtsp-server-1.0']:
- r = cookbook.get_recipe(r)
- for attr_name in dir(r):
- if attr_name.startswith('files_plugins_'):
- cat_name = attr_name[len('files_plugins_'):]
- plugins_list = getattr(r, attr_name)
- elif attr_name.startswith('platform_files_plugins_'):
- cat_name = attr_name[len('platform_files_plugins_'):]
- plugins_dict = getattr(r, attr_name)
- plugins_list = plugins_dict.get(config.target_platform, [])
- else:
+ cookbook = CookBook(config)
+ plugins = defaultdict(list)
+ recipes = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0',
+ 'gst-plugins-bad-1.0', 'gst-plugins-ugly-1.0', 'libnice',
+ 'gst-libav-1.0', 'gst-editing-services-1.0', 'gst-rtsp-server-1.0'
+ ]
+ if config.variants.rust:
+ recipes.append('gst-plugins-rs')
+ for r in recipes:
+ r = cookbook.get_recipe(r)
+ for attr_name in dir(r):
+ if attr_name.startswith('files_plugins_') and attr_name.endswith('devel'):
+ cat_name = attr_name[len('files_plugins_'):-len('_devel')]
+ plugins_list = getattr(r, attr_name)
+ elif attr_name.startswith('platform_files_plugins_') and attr_name.endswith('devel'):
+ cat_name = attr_name[len('platform_files_plugins_'):-len('_devel')]
+ plugins_dict = getattr(r, attr_name)
+ plugins_list = plugins_dict.get(config.target_platform, [])
+ else:
+ continue
+ for e in plugins_list:
+ if not e.startswith('lib/gstreamer-'):
+ continue
+ e = os.path.basename(e)
+ # Only pick static libs
+ if not e.endswith('.a'):
continue
- for e in plugins_list:
- if not e.startswith('lib/gstreamer-'):
- continue
- c = e.split('/')
- if len(c) != 3:
- continue
- e = c[2]
- # we only care about files with the replaceable %(mext)s extension
- if not e.endswith ('%(mext)s'):
- continue
- if e.startswith('libgst'):
- e = e[6:-8]
- else:
- e = e[3:-8]
- plugins[cat_name].append(e)
- return plugins
+ if e.startswith('libgst'):
+ e = e[6:-2]
+ else:
+ e = e[3:-2]
+ plugins[cat_name].append(e)
+ return plugins
diff --git a/recipes/gst-android-1.0.recipe b/recipes/gst-android-1.0.recipe
index 010a5838..c4df6bf8 100644
--- a/recipes/gst-android-1.0.recipe
+++ b/recipes/gst-android-1.0.recipe
@@ -16,14 +16,18 @@ class Recipe(recipe.Recipe):
]
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',
- ]
+ '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')
@@ -45,5 +49,3 @@ class Recipe(recipe.Recipe):
p = ' '.join(p)
f.write('GSTREAMER_PLUGINS_%s := %s\n' % (c.upper(), p))
f.close()
-
-
diff --git a/recipes/gst-plugins-rs.recipe b/recipes/gst-plugins-rs.recipe
index 3b3c2e4f..8ec33da1 100644
--- a/recipes/gst-plugins-rs.recipe
+++ b/recipes/gst-plugins-rs.recipe
@@ -55,66 +55,55 @@ class Recipe(recipe.Recipe):
'webrtchttp',
]
- # See "static plugins" bullet point in phase 2 at
- # https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/381
- library_type = LibraryType.SHARED
-
# Needed for openssl
use_system_libs = True
deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'pango', 'cairo',
'gst-plugins-bad-1.0', 'dav1d']
- files_plugins_core = [
- 'lib/gstreamer-1.0/libgstfallbackswitch%(mext)s',
- 'lib/gstreamer-1.0/libgstlivesync%(mext)s',
- 'lib/gstreamer-1.0/libgstthreadshare%(mext)s',
- 'lib/gstreamer-1.0/libgsttogglerecord%(mext)s',
- 'lib/gstreamer-1.0/libgstrstracers%(mext)s',
- ]
-
- files_plugins_net = [
- 'lib/gstreamer-1.0/libgstaws%(mext)s',
- 'lib/gstreamer-1.0/libgsthlssink3%(mext)s',
- 'lib/gstreamer-1.0/libgstndi%(mext)s',
- 'lib/gstreamer-1.0/libgstrsonvif%(mext)s',
- 'lib/gstreamer-1.0/libgstraptorq%(mext)s',
- 'lib/gstreamer-1.0/libgstrsrtp%(mext)s',
- 'lib/gstreamer-1.0/libgstreqwest%(mext)s',
- 'lib/gstreamer-1.0/libgstwebrtchttp%(mext)s',
- 'lib/gstreamer-1.0/libgstrswebrtc%(mext)s',
- ]
-
- files_plugins_effects = [
- 'lib/gstreamer-1.0/libgstrsaudiofx%(mext)s',
- 'lib/gstreamer-1.0/libgstrsvideofx%(mext)s',
- ]
-
- files_plugins_codecs = [
- 'lib/gstreamer-1.0/libgstcdg%(mext)s',
- 'lib/gstreamer-1.0/libgstclaxon%(mext)s',
- 'lib/gstreamer-1.0/libgstdav1d%(mext)s',
- 'lib/gstreamer-1.0/libgstrsclosedcaption%(mext)s',
- 'lib/gstreamer-1.0/libgstffv1%(mext)s',
- 'lib/gstreamer-1.0/libgstfmp4%(mext)s',
- 'lib/gstreamer-1.0/libgstmp4%(mext)s',
- 'lib/gstreamer-1.0/libgstgif%(mext)s',
- 'lib/gstreamer-1.0/libgsthsv%(mext)s',
- 'lib/gstreamer-1.0/libgstlewton%(mext)s',
- 'lib/gstreamer-1.0/libgstrav1e%(mext)s',
- 'lib/gstreamer-1.0/libgstjson%(mext)s',
- 'lib/gstreamer-1.0/libgstrspng%(mext)s',
- 'lib/gstreamer-1.0/libgstregex%(mext)s',
- 'lib/gstreamer-1.0/libgsttextwrap%(mext)s',
- 'lib/gstreamer-1.0/libgsttextahead%(mext)s',
- ]
-
- files_plugins_playback = [
- 'lib/gstreamer-1.0/libgsturiplaylistbin%(mext)s',
- ]
+ def enable_plugin(self, name, category):
+ if LibraryType.SHARED in self.library_type:
+ attr = f'files_plugins_{category}'
+ if not hasattr(self, attr):
+ setattr(self, attr, [])
+ self.update_categories()
+ f = getattr(self, attr)
+ f += [f'lib/gstreamer-1.0/libgst{name}%(mext)s']
+ if LibraryType.STATIC in self.library_type:
+ attr = f'files_plugins_{category}_devel'
+ if not hasattr(self, attr):
+ setattr(self, attr, [])
+ d = getattr(self, attr)
+ d += [
+ f'lib/gstreamer-1.0/libgst{name}.a',
+ f'lib/gstreamer-1.0/libgst{name}.la',
+ ]
def prepare(self):
+ # See "static plugins" bullet point in phase 2 at
+ # https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/381
+ if self.config.target_platform in (Platform.IOS, Platform.ANDROID):
+ self.library_type = LibraryType.STATIC
+ else:
+ self.library_type = LibraryType.SHARED
+
if self.config.target_platform != Platform.LINUX or self.config.cross_compiling():
self.deps.append('openssl')
+
+ plugin_files = {
+ 'core': ('fallbackswitch', 'livesync', 'threadshare',
+ 'togglerecord', 'rstracers'),
+ 'net': ('aws', 'hlssink3', 'ndi', 'rsonvif', 'raptorq', 'rsrtp',
+ 'reqwest', 'webrtchttp', 'rswebrtc'),
+ 'effects': ('rsaudiofx', 'rsvideofx'),
+ 'codecs': ('cdg', 'claxon', 'dav1d', 'rsclosedcaption', 'ffv1',
+ 'fmp4', 'mp4', 'gif', 'hsv', 'lewton', 'rav1e', 'json',
+ 'rspng', 'regex', 'textwrap', 'textahead'),
+ 'playback': ('uriplaylistbin',),
+ }
+ for category, names in plugin_files.items():
+ for name in names:
+ self.enable_plugin(name, category)
+
self.cargoc_packages = [f'gst-plugin-{pkg}' for pkg in self.cargoc_packages]
# Build with Cerbero's latest glib version as minimum version
self.cargo_features += ['glib/v2_74', 'gio/v2_74']
diff --git a/recipes/gstreamer-ios-templates.recipe b/recipes/gstreamer-ios-templates.recipe
index ec3d3cdd..571dd341 100644
--- a/recipes/gstreamer-ios-templates.recipe
+++ b/recipes/gstreamer-ios-templates.recipe
@@ -23,8 +23,12 @@ class Recipe(recipe.Recipe):
]
files_devel = [
- 'share/xcode/templates/ios/',
- ]
+ 'share/xcode/templates/ios/',
+ ]
+
+ def prepare(self):
+ if self.config.variants.rust:
+ self.deps.append('gst-plugins-rs')
async def install(self):
share_dir = os.path.join(self.config.prefix, 'share', 'xcode',