Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | # 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 | |
| 9 | PACKAGESPLITFUNCS_prepend = " split_gstreamer10_packages " |
| 10 | PACKAGESPLITFUNCS_append = " set_gstreamer10_metapkg_rdepends " |
| 11 | |
| 12 | python 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 | |
| 27 | python 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) |
| 60 | ALLOW_EMPTY_${PN} = "1" |
| 61 | ALLOW_EMPTY_${PN}-dev = "1" |
| 62 | ALLOW_EMPTY_${PN}-staticdev = "1" |
| 63 | |
| 64 | PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib" |
| 65 | |
| 66 | FILES_${PN} = "" |
| 67 | FILES_${PN}-apps = "${bindir}" |
| 68 | FILES_${PN}-glib = "${datadir}/glib-2.0" |
| 69 | |
| 70 | RRECOMMENDS_${PN} += "${PN}-meta" |