gdk-pixbuf: create loader cache at build time

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>
This commit is contained in:
Gustavo Zacarias 2016-03-23 18:17:49 -03:00 committed by Thomas Petazzoni
parent a58a4ec035
commit 1696b6d14c
2 changed files with 15 additions and 26 deletions

View File

@ -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

View 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