[poky] [PATCH] meta: Add support for GTK+-3.0 static libraries

David Freitag DFreitag at environics.com
Wed Jul 5 13:31:25 PDT 2017


Add necessary lines to gtk+3.inc file so that the static libs for GTK+3 are
shipped. Otherwise trying to statically-compile with --enable-static fails with
fatal QA errors (fatal: <lib>.a is present but not shipped).

This has the added benefit of being able to add 

IMAGE_INSTALL_append = " gtk+3-staticdev"

to local.conf with no-static-libs.inc disabled instead of having to hack the
gtk+3.inc file. 

This is admittedly a little fragile due to the fact that disabling static
generation (the default) relies on the fact that no-static-libs.inc appends
--disable-static to the end of EXTRA_OECONF thus negating the --enable-static
in this patch (eg you get configure ... --enable-static ... --disable-static).
Although to my (albeit limited) knowledge, there isn't a cleaner way to do this
without always forcing static generation.

If gtk+3-staticdev is appended to IMAGE_INSTALL while no-static-libs.inc is
included, bitbake will error because the gtk+3-staticdev rpm isn't generated
because there were no static libs to be packaged.

Signed-off-by: David Freitag <dfreitag at environics.com>
---
 meta/recipes-gnome/gtk+/gtk+3.inc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-gnome/gtk+/gtk+3.inc b/meta/recipes-gnome/gtk+/gtk+3.inc
index 27da844..3b23a2e 100644
--- a/meta/recipes-gnome/gtk+/gtk+3.inc
+++ b/meta/recipes-gnome/gtk+/gtk+3.inc
@@ -29,6 +29,7 @@ EXTRA_OECONF += " \
                  --disable-glibtest \
                  --disable-xinerama \
                  --enable-modules \
+                 --enable-static \
                  --disable-cups \
                  --disable-colord \
                  WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT} \
@@ -90,6 +91,11 @@ FILES_${PN}-dev += " \
                     ${bindir}/gtk-query-settings \
                     "
 
+FILES_${PN}-staticdev = " \
+                        ${libdir}/*.a \
+                        ${libdir}/gtk-3.0/${LIBV}/immodules/*.a \
+                        ${libdir}/gtk-3.0/${LIBV}/printbackends/*.a"
+
 GTKBASE_RRECOMMENDS ?= "liberation-fonts \
                         gdk-pixbuf-loader-png \
                         gdk-pixbuf-loader-jpeg \
@@ -117,11 +123,11 @@ python populate_packages_prepend () {
     immodules_root = os.path.join(gtk_libdir, 'immodules')
     printmodules_root = os.path.join(gtk_libdir, 'printbackends');
 
-    immodules = do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk3-immodule-%s', 'GTK input module for %s')
+    immodules = do_split_packages(d, immodules_root, '^im-(.*)\.(?:so|a)$', 'gtk3-immodule-%s', 'GTK input module for %s')
     if immodules:
         d.setVar("GTKIMMODULES_PACKAGES", " ".join(immodules))
 
-    do_split_packages(d, printmodules_root, '^libprintbackend-(.*)\.so$', 'gtk3-printbackend-%s', 'GTK printbackend module for %s')
+    do_split_packages(d, printmodules_root, '^libprintbackend-(.*)\.(?:so|a)$', 'gtk3-printbackend-%s', 'GTK printbackend module for %s')
 
     if (d.getVar('DEBIAN_NAMES')):
         d.setVar(d.expand('PKG_${PN}'), '${MLPREFIX}libgtk-3.0')
-- 
2.9.3



More information about the poky mailing list