blob: 5b80a46b40447f21d20aa53ca5d8be2e3f8d5cc0 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001# This .inc file contains functionality for automatically splitting
2# built plugins into individual packages for each plugin. A -meta
3# package is also set up that has no files of its own, but contains
4# the names of all plugin packages in its RDEPENDS list.
5#
6# This is mainly used by the gstreamer1.0-plugins-* plugin set recipes,
7# but can be used in any recipe that produces GStreamer plugins.
8
Andrew Geissler5f350902021-07-23 13:09:54 -04009# Dynamically generate packages for all enabled plugins
10PACKAGES_DYNAMIC = "^${PN}-.* ^libgst.*"
11
Andrew Geissler82c905d2020-04-13 13:39:40 -050012PACKAGESPLITFUNCS_prepend = " split_gstreamer10_packages "
13PACKAGESPLITFUNCS_append = " set_gstreamer10_metapkg_rdepends "
14
15python split_gstreamer10_packages () {
16 gst_libdir = d.expand('${libdir}/gstreamer-1.0')
17 postinst = d.getVar('plugin_postinst')
18 glibdir = d.getVar('libdir')
19
20 # GStreamer libraries
21 do_split_packages(d, glibdir, r'^lib(.*)\.so\.*', 'lib%s', 'GStreamer 1.0 %s library', extra_depends='', allow_links=True)
22 # GStreamer plugin shared objects
23 do_split_packages(d, gst_libdir, r'libgst(.*)\.so$', d.expand('${PN}-%s'), 'GStreamer 1.0 plugin for %s', postinst=postinst, extra_depends='')
24 # GObject introspection files for GStreamer plugins
25 do_split_packages(d, glibdir+'/girepository-1.0', r'Gst(.*)-1.0\.typelib$', d.expand('${PN}-%s-typelib'), 'GStreamer 1.0 typelib file for %s', postinst=postinst, extra_depends='')
26 # Static GStreamer libraries for development
27 do_split_packages(d, gst_libdir, r'libgst(.*)\.a$', d.expand('${PN}-%s-staticdev'), 'GStreamer 1.0 plugin for %s (static development files)', extra_depends='${PN}-staticdev')
28}
29
30python set_gstreamer10_metapkg_rdepends () {
31 import os
32 import oe.utils
33
34 # Go through all generated packages (excluding the main package and
35 # the -meta package itself) and add them to the -meta package as RDEPENDS.
36
37 pn = d.getVar('PN')
38 metapkg = pn + '-meta'
39 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
40 d.setVar('FILES_' + metapkg, "")
41 blacklist = [ pn, pn + '-meta' ]
42 metapkg_rdepends = []
43 pkgdest = d.getVar('PKGDEST')
44 for pkg in oe.utils.packages_filter_out_system(d):
45 if pkg not in blacklist and pkg not in metapkg_rdepends:
46 # See if the package is empty by looking at the contents of its PKGDEST subdirectory.
47 # If this subdirectory is empty, then the package is.
48 # Empty packages do not get added to the meta package's RDEPENDS
49 pkgdir = os.path.join(pkgdest, pkg)
50 if os.path.exists(pkgdir):
51 dir_contents = os.listdir(pkgdir) or []
52 else:
53 dir_contents = []
54 is_empty = len(dir_contents) == 0
55 if not is_empty:
56 metapkg_rdepends.append(pkg)
57 d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
58 d.setVar('DESCRIPTION_' + metapkg, pn + ' meta package')
59}
60
61# each plugin-dev depends on PN-dev, plugin-staticdev on PN-staticdev
62# so we need them even when empty (like in gst-plugins-good case)
63ALLOW_EMPTY_${PN} = "1"
64ALLOW_EMPTY_${PN}-dev = "1"
65ALLOW_EMPTY_${PN}-staticdev = "1"
66
67PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib"
68
69FILES_${PN} = ""
70FILES_${PN}-apps = "${bindir}"
71FILES_${PN}-glib = "${datadir}/glib-2.0"
72
73RRECOMMENDS_${PN} += "${PN}-meta"