blob: 9a7a1b6afe6e9313e999deceaa914487c6dcd3b6 [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
9PACKAGESPLITFUNCS_prepend = " split_gstreamer10_packages "
10PACKAGESPLITFUNCS_append = " set_gstreamer10_metapkg_rdepends "
11
12python split_gstreamer10_packages () {
13 gst_libdir = d.expand('${libdir}/gstreamer-1.0')
14 postinst = d.getVar('plugin_postinst')
15 glibdir = d.getVar('libdir')
16
17 # GStreamer libraries
18 do_split_packages(d, glibdir, r'^lib(.*)\.so\.*', 'lib%s', 'GStreamer 1.0 %s library', extra_depends='', allow_links=True)
19 # GStreamer plugin shared objects
20 do_split_packages(d, gst_libdir, r'libgst(.*)\.so$', d.expand('${PN}-%s'), 'GStreamer 1.0 plugin for %s', postinst=postinst, extra_depends='')
21 # GObject introspection files for GStreamer plugins
22 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='')
23 # Static GStreamer libraries for development
24 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')
25}
26
27python set_gstreamer10_metapkg_rdepends () {
28 import os
29 import oe.utils
30
31 # Go through all generated packages (excluding the main package and
32 # the -meta package itself) and add them to the -meta package as RDEPENDS.
33
34 pn = d.getVar('PN')
35 metapkg = pn + '-meta'
36 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
37 d.setVar('FILES_' + metapkg, "")
38 blacklist = [ pn, pn + '-meta' ]
39 metapkg_rdepends = []
40 pkgdest = d.getVar('PKGDEST')
41 for pkg in oe.utils.packages_filter_out_system(d):
42 if pkg not in blacklist and pkg not in metapkg_rdepends:
43 # See if the package is empty by looking at the contents of its PKGDEST subdirectory.
44 # If this subdirectory is empty, then the package is.
45 # Empty packages do not get added to the meta package's RDEPENDS
46 pkgdir = os.path.join(pkgdest, pkg)
47 if os.path.exists(pkgdir):
48 dir_contents = os.listdir(pkgdir) or []
49 else:
50 dir_contents = []
51 is_empty = len(dir_contents) == 0
52 if not is_empty:
53 metapkg_rdepends.append(pkg)
54 d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
55 d.setVar('DESCRIPTION_' + metapkg, pn + ' meta package')
56}
57
58# each plugin-dev depends on PN-dev, plugin-staticdev on PN-staticdev
59# so we need them even when empty (like in gst-plugins-good case)
60ALLOW_EMPTY_${PN} = "1"
61ALLOW_EMPTY_${PN}-dev = "1"
62ALLOW_EMPTY_${PN}-staticdev = "1"
63
64PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib"
65
66FILES_${PN} = ""
67FILES_${PN}-apps = "${bindir}"
68FILES_${PN}-glib = "${datadir}/glib-2.0"
69
70RRECOMMENDS_${PN} += "${PN}-meta"