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 | |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 9 | # Dynamically generate packages for all enabled plugins |
| 10 | PACKAGES_DYNAMIC = "^${PN}-.* ^libgst.*" |
| 11 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 12 | PACKAGESPLITFUNCS_prepend = " split_gstreamer10_packages " |
| 13 | PACKAGESPLITFUNCS_append = " set_gstreamer10_metapkg_rdepends " |
| 14 | |
| 15 | python 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 | |
| 30 | python 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) |
| 63 | ALLOW_EMPTY_${PN} = "1" |
| 64 | ALLOW_EMPTY_${PN}-dev = "1" |
| 65 | ALLOW_EMPTY_${PN}-staticdev = "1" |
| 66 | |
| 67 | PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib" |
| 68 | |
| 69 | FILES_${PN} = "" |
| 70 | FILES_${PN}-apps = "${bindir}" |
| 71 | FILES_${PN}-glib = "${datadir}/glib-2.0" |
| 72 | |
| 73 | RRECOMMENDS_${PN} += "${PN}-meta" |