blob: e906053ac0276f38676528be744f4554794f1112 [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
Patrick Williams213cb262021-08-07 19:21:33 -050012PACKAGESPLITFUNCS:prepend = " split_gstreamer10_packages "
13PACKAGESPLITFUNCS:append = " set_gstreamer10_metapkg_rdepends "
Andrew Geissler82c905d2020-04-13 13:39:40 -050014
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'
Patrick Williams213cb262021-08-07 19:21:33 -050039 d.setVar('ALLOW_EMPTY:' + metapkg, "1")
40 d.setVar('FILES:' + metapkg, "")
Andrew Geissler82c905d2020-04-13 13:39:40 -050041 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)
Patrick Williams213cb262021-08-07 19:21:33 -050057 d.setVar('RDEPENDS:' + metapkg, ' '.join(metapkg_rdepends))
58 d.setVar('DESCRIPTION:' + metapkg, pn + ' meta package')
Andrew Geissler82c905d2020-04-13 13:39:40 -050059}
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)
Patrick Williams213cb262021-08-07 19:21:33 -050063ALLOW_EMPTY:${PN} = "1"
64ALLOW_EMPTY:${PN}-dev = "1"
65ALLOW_EMPTY:${PN}-staticdev = "1"
Andrew Geissler82c905d2020-04-13 13:39:40 -050066
67PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib"
68
Patrick Williams213cb262021-08-07 19:21:33 -050069FILES:${PN} = ""
70FILES:${PN}-apps = "${bindir}"
71FILES:${PN}-glib = "${datadir}/glib-2.0"
Andrew Geissler82c905d2020-04-13 13:39:40 -050072
Patrick Williams213cb262021-08-07 19:21:33 -050073RRECOMMENDS:${PN} += "${PN}-meta"