Skip to contentSkip to conversation

Don't build gtk+-native

PATCH In review Ross Burton 2 participants 7 messages Mar 4, 2013 – Mar 6, 2013

lore
Share & tools
lore
#0 lore raw

cover Don't build gtk+-native

Hi,

We're building gtk+-native (so the X stack, freetype, fontconfig, etc etc) just to run gtk-update-icon-cache on the host when building the rootfs.

This series adds a recipe that builds just that binary from a GTK+ tarball using a bit of hackery.

For a benchmark of building sato-icon-theme from nothing (no sstate or tmp):

master takes 13:25 to run 1037 tasks.
ross/gtk takes 9:26 to run 629 tasks.

So that's a four minute gain and 400 less tasks.

Ross

The following changes since commit 226c4384643da635fb668cdf0ccd32fea943875d:

btrfs-tools: added PV to git package recipe (2013-03-04 10:04:27 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib ross/gtk

for you to fetch changes up to 1c10f4983ce9470f80083d3f943a095df6bbc9bb:

gtk-icon-cache: use virtual/gtk-update-icon-cache-native instead of gtk+-native (2013-03-04 12:39:19 +0000)

----------------------------------------------------------------
Ross Burton (4):
gtk-update-icon-cache-native: add
default-providers: add default virtual provider for gtk-update-icon-cache gtk+: mark as provider of virtual/gtk-update-icon-cache-native
gtk-icon-cache: use virtual/gtk-update-icon-cache-native instead of gtk+-native

 meta/classes/gtk-icon-cache.bbclass                |    2 +-
 meta/conf/distro/include/default-providers.inc     |    1 +
 meta/recipes-gnome/gtk+/gtk+.inc                   |    2 +
 .../gtk+/gtk-update-icon-cache-native_3.4.4.bb     |   44 ++++++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb

Ross Burton (4):
gtk-update-icon-cache-native: add
default-providers: add default virtual provider for
gtk-update-icon-cache
gtk+: mark as provider of virtual/gtk-update-icon-cache-native
gtk-icon-cache: use virtual/gtk-update-icon-cache-native instead of
gtk+-native

 meta/classes/gtk-icon-cache.bbclass                |    2 +-
 meta/conf/distro/include/default-providers.inc     |    1 +
 meta/recipes-gnome/gtk+/gtk+.inc                   |    2 +
 .../gtk+/gtk-update-icon-cache-native_3.4.4.bb     |   44 ++++++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/4 gtk-update-icon-cache-native: add

This recipe builds natively just the gtk-update-icon-cache binary that is required to run the gtk-icon-cache.bbclass postinstall scripts.

The advantage of doing this is it means running 400 less tasks which takes four minutes on my machine, as the alternative is building GTK+ natively (and so libX11, freetype, fontconfig...).

---
 .../gtk+/gtk-update-icon-cache-native_3.4.4.bb     |   44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb
meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb new file +44 -0
new file mode 100644
index 0000000..5941bbd
@@ -0,0 +1,44 @@
+SUMMARY = "gtk-update-icon-cache built natively"
+DESCRIPTION = "Just gtk-update-icon-cache built from GTK+ natively, for on-host postinst script execution."
+SECTION = "libs"
+
+PROVIDES = "virtual/gtk-update-icon-cache-native"
+
+DEPENDS = "gdk-pixbuf-native"
+
+LICENSE = "LGPLv2 & LGPLv2+ & LGPLv2.1+"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
+                    file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \
+                    file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \
+                    file://tests/testgtk.c;endline=25;md5=cb732daee1d82af7a2bf953cf3cf26f1"
+
+SRC_URI = "http://download.gnome.org/sources/gtk+/3.4/gtk+-${PV}.tar.xz"
+SRC_URI[md5sum] = "1b2cf29502a6394e8d4b30f7f5bb9131"
+SRC_URI[sha256sum] = "f154e460075034da4c0ce89c320025dcd459da2a1fdf32d92a09522eaca242c7"
+
+S = "${WORKDIR}/gtk+-${PV}"
+
+inherit pkgconfig native
+
+PKG_CONFIG_FOR_BUILD = "${STAGING_BINDIR_NATIVE}/pkg-config-native"
+
+do_configure() {
+	# Quite ugly but defines enough to compile the tool.
+	if ! test -f gtk/config.h; then
+		echo "#define GETTEXT_PACKAGE \"gtk30\"" >> gtk/config.h
+		echo "#define HAVE_UNISTD_H 1" >> gtk/config.h
+		echo "#define HAVE_FTW_H 1" >> gtk/config.h
+
+	fi
+}
+
+do_compile() {
+	${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} $(${PKG_CONFIG_FOR_BUILD} --cflags --libs gdk-pixbuf-2.0) \
+		-o gtk-update-icon-cache ${S}/gtk/updateiconcache.c
+}
+
+do_install() {
+	install -d ${D}${bindir}
+        install -m 0755 ${B}/gtk-update-icon-cache ${D}${bindir}
+}
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 1/4] gtk-update-icon-cache-native: add

Quoted 47 lines · Ross Burton

This recipe builds natively just the gtk-update-icon-cache binary that is required to run the gtk-icon-cache.bbclass postinstall scripts.

The advantage of doing this is it means running 400 less tasks which takes four minutes on my machine, as the alternative is building GTK+ natively (and so libX11, freetype, fontconfig...).

---
 .../gtk+/gtk-update-icon-cache-native_3.4.4.bb     |   44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb
meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb new file +28 -0
new file mode 100644
index 0000000..5941bbd
@@ -0,0 +1,44 @@
+SUMMARY = "gtk-update-icon-cache built natively"
+DESCRIPTION = "Just gtk-update-icon-cache built from GTK+ natively, for on-host postinst script execution."
+SECTION = "libs"
+
+PROVIDES = "virtual/gtk-update-icon-cache-native"
+
+DEPENDS = "gdk-pixbuf-native"
+
+LICENSE = "LGPLv2 & LGPLv2+ & LGPLv2.1+"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
+                    file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \
+                    file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \
+                    file://tests/testgtk.c;endline=25;md5=cb732daee1d82af7a2bf953cf3cf26f1"
+
+SRC_URI = "http://download.gnome.org/sources/gtk+/3.4/gtk+-${PV}.tar.xz"
+SRC_URI[md5sum] = "1b2cf29502a6394e8d4b30f7f5bb9131"
+SRC_URI[sha256sum] = "f154e460075034da4c0ce89c320025dcd459da2a1fdf32d92a09522eaca242c7"
+
+S = "${WORKDIR}/gtk+-${PV}"
+
+inherit pkgconfig native
+
+PKG_CONFIG_FOR_BUILD = "${STAGING_BINDIR_NATIVE}/pkg-config-native"
+
+do_configure() {
+	# Quite ugly but defines enough to compile the tool.
+	if ! test -f gtk/config.h; then

meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb line 38

Quoted 10 lines
meta/recipes-gnome/gtk+/gtk-update-icon-cache-native_3.4.4.bb new file +10 -0
+		echo "#define GETTEXT_PACKAGE \"gtk30\"" >> gtk/config.h
+		echo "#define HAVE_UNISTD_H 1" >> gtk/config.h
+		echo "#define HAVE_FTW_H 1" >> gtk/config.h
+
+	fi
+}
+
+do_compile() {
+	${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} $(${PKG_CONFIG_FOR_BUILD} --cflags --libs gdk-pixbuf-2.0) \
+		-o gtk-update-icon-cache ${S}/gtk/updateiconcache.c

I saw failures when building locally for this, I think its down to linker order. Moving ${S}/gtk/updateiconcache.c before the pkg-config libs made it work...

Cheers,

Richard

#3 lore raw

PATCH 2/4 default-providers: add default virtual provider for gtk-update-icon-cache

In reply to Ross Burton

Use a virtual provider instead of a hard dependency so that if gtk+-native is required in some configuration, this provider can be changed and then gtk+-native and gtk-update-icon-cache-native won't be both built and conflict in the sysroot.

---
 meta/conf/distro/include/default-providers.inc |    1 +
 1 file changed, 1 insertion(+)
meta/conf/distro/include/default-providers.inc +1 -0
index 444176c..ebf2a09 100644
@@ -12,6 +12,7 @@ PREFERRED_PROVIDER_virtual/update-alternatives ?= "opkg"
 PREFERRED_PROVIDER_virtual/update-alternatives-native ?= "opkg-native"
 PREFERRED_PROVIDER_virtual/libx11 ?= "libx11"
 PREFERRED_PROVIDER_xf86-video-intel ?= "xf86-video-intel"
+PREFERRED_PROVIDER_virtual/gtk-update-icon-cache-native ?= "gtk-update-icon-cache-native"
 
 #
 # Default virtual runtime providers
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 3/4 gtk+: mark as provider of virtual/gtk-update-icon-cache-native

In reply to Ross Burton
---
 meta/recipes-gnome/gtk+/gtk+.inc |    2 ++
 1 file changed, 2 insertions(+)
meta/recipes-gnome/gtk+/gtk+.inc +2 -0
index 8c2b977..f05838a 100644
@@ -10,6 +10,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7"
 
 SECTION = "libs"
 
+PROVIDES_class-native = "virtual/gtk-update-icon-cache-native"
+
 X11DEPENDS = "virtual/libx11 libxext libxcursor libxrandr libxdamage libxrender libxcomposite"
 DEPENDS = "glib-2.0 pango atk jpeg libpng gdk-pixbuf-native docbook-utils-native \
  libgcrypt cairo gdk-pixbuf"
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 4/4 gtk-icon-cache: use virtual/gtk-update-icon-cache-native instead of gtk+-native

In reply to Ross Burton
---
 meta/classes/gtk-icon-cache.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/gtk-icon-cache.bbclass +1 -1
index 223a280..a5d642c 100644
@@ -1,6 +1,6 @@
 FILES_${PN} += "${datadir}/icons/hicolor"
 
-DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+-native"
+DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} virtual/gtk-update-icon-cache-native"
 
 #
 # On host, the postinstall MUST return 1 because we do not know if the intercept
Signature · 1 line
1.7.10.4
#6 lore raw
In reply to Ross Burton
Quoted 6 lines · Ross Burton

We're building gtk+-native (so the X stack, freetype, fontconfig, etc etc) just to run gtk-update-icon-cache on the host when building the rootfs.

This series adds a recipe that builds just that binary from a GTK+ tarball using a bit of hackery.

Quoted 6 lines

For a benchmark of building sato-icon-theme from nothing (no sstate or tmp):

master takes 13:25 to run 1037 tasks.
ross/gtk takes 9:26 to run 629 tasks.

So that's a four minute gain and 400 less tasks.

Here, my core-image-sato build from populated DL_DIR time fell by about 2.5 minutes due to this changeset (46:59 to 44:17 mins) so a 5% speedup. Nice! :)

It would seemingly make around six seconds on "bitbake core-image-sato -c rootfs" from sstate too (5m25 ish).

Cheers,

Richard