gdk-pixbuf: create loader cache at build time
authorGustavo Zacarias <gustavo@zacarias.com.ar>
Wed, 23 Mar 2016 21:17:49 +0000 (18:17 -0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 24 Mar 2016 21:44:52 +0000 (22:44 +0100)
Create the gdk pixbuf loaders cache file at build time rather than run
time, since the root filesytem can be read-only.
We also didn't cater for systemd-based systems, so this solves two
issues at once.

The only side-effect is that we must now pull host-gdk-pixbuf into
target gdk-pixbuf dependencies, but generally users will have gdk-pixbuf
selected if they use libgtk2/3 which already pull in host-gdk-pixbuf.

And remove initscript correspondingly.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/gdk-pixbuf/S26gdk-pixbuf [deleted file]
package/gdk-pixbuf/gdk-pixbuf.mk

diff --git a/package/gdk-pixbuf/S26gdk-pixbuf b/package/gdk-pixbuf/S26gdk-pixbuf
deleted file mode 100644 (file)
index 82b7944..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-#
-# run gdk-pixbuf-query-loaders if needed
-
-FILE=/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
-
-case "$1" in
-    start|"")
-       if [ ! -f "$FILE" ] ; then
-           /usr/bin/gdk-pixbuf-query-loaders --update-cache
-       fi
-       ;;
-    stop)
-       ;;
-    *)
-       echo "Usage: $0 {start|stop}" >&2
-       exit 1
-       ;;
-esac
index be79e11c5df3a4729a3777a30cb01fba1870550c..02c4aa98c2ecf1cd9bbc821d3131ddec6a6d31a2 100644 (file)
@@ -11,6 +11,9 @@ GDK_PIXBUF_SITE = http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/$(GDK_PIXBUF
 GDK_PIXBUF_LICENSE = LGPLv2+
 GDK_PIXBUF_LICENSE_FILES = COPYING
 GDK_PIXBUF_INSTALL_STAGING = YES
+GDK_PIXBUF_DEPENDENCIES = \
+       host-gdk-pixbuf host-libglib2 host-pkgconf \
+       $(if $(BR2_ENABLE_LOCALE),,libiconv)
 
 GDK_PIXBUF_CONF_ENV = \
        ac_cv_path_GLIB_GENMARSHAL=$(LIBGLIB2_HOST_BINARY) \
@@ -43,14 +46,19 @@ GDK_PIXBUF_CONF_OPTS += --with-x11
 GDK_PIXBUF_DEPENDENCIES += xlib_libX11
 endif
 
-GDK_PIXBUF_DEPENDENCIES += \
-       $(if $(BR2_ENABLE_LOCALE),,libiconv) \
-       host-pkgconf libglib2
-
-define GDK_PIXBUF_INSTALL_INIT_SYSV
-       $(INSTALL) -m 755 -D package/gdk-pixbuf/S26gdk-pixbuf \
-               $(TARGET_DIR)/etc/init.d/S26gdk-pixbuf
+# gdk-pixbuf requires the loaders.cache file populated to work properly
+# Rather than doing so at runtime, since the fs can be read-only, do so
+# here after building and installing to target.
+# And since the cache file will contain absolute target directory names
+# we need to sanitize (strip) them.
+define GDK_PIXBUF_UPDATE_CACHE
+       GDK_PIXBUF_MODULEDIR=$(TARGET_DIR)/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders \
+               $(HOST_DIR)/usr/bin/gdk-pixbuf-query-loaders \
+               > $(TARGET_DIR)/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
+       $(SED) "s,$(TARGET_DIR),,g" \
+               $(TARGET_DIR)/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
 endef
+GDK_PIXBUF_POST_INSTALL_TARGET_HOOKS += GDK_PIXBUF_UPDATE_CACHE
 
 # Tests don't build correctly with uClibc
 define GDK_PIXBUF_DISABLE_TESTS