aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuele Aina <emanuele.aina@collabora.com>2010-04-19 18:59:16 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-08 20:09:06 +0800
commit80eac7fd3c665f7960f07f9a8aaddbff8f4f9467 (patch)
tree9c5fe9f16ead05a81a1b3636ac11f004bf538be0
parent4c1b102df95e07a4469bbfb38fbc8ef190458a79 (diff)
downloadgsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.tar
gsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.tar.gz
gsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.tar.bz2
gsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.tar.lz
gsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.tar.xz
gsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.tar.zst
gsoc2013-empathy-80eac7fd3c665f7960f07f9a8aaddbff8f4f9467.zip
"Build" a local copy of the icons to be used from sources
https://bugzilla.gnome.org/show_bug.cgi?id=616159
-rw-r--r--data/.gitignore1
-rw-r--r--data/icons/Makefile.am30
-rw-r--r--data/icons/utils.mk11
3 files changed, 42 insertions, 0 deletions
diff --git a/data/.gitignore b/data/.gitignore
index 2c0f33226..2d4a96f0c 100644
--- a/data/.gitignore
+++ b/data/.gitignore
@@ -10,3 +10,4 @@ empathy-accounts.desktop
empathy-accounts.desktop.in
org.freedesktop.Telepathy.Client.Empathy.Auth.service
org.freedesktop.Telepathy.Client.Empathy.FileTransfer.service
+icons/local-copy/*
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index 56ad3312f..4bac794d6 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -192,6 +192,8 @@ EXTRA_DIST = \
local-xmpp.svg \
$(NULL)
+include $(srcdir)/utils.mk
+
###############################################################################
gtk_update_icon_cache = gtk-update-icon-cache -f -t
@@ -252,3 +254,31 @@ uninstall-icons:
install-data-local: install-icons update-icon-cache
uninstall-local: uninstall-icons update-icon-cache
+
+# Local copy of the "installed" icon. This is used to be able to run empathy
+# from source (see bgo #616159)
+local_icons_dir = local-copy
+
+# Generate the lists of destination paths
+public_icons_local_install_paths = $(foreach obj, $(public_icons), $(local_icons_dir)/$(subst _,/,$(call reorder,_,1 3 2 4,$(obj))))
+private_icons_local_install_paths = $(foreach obj, $(private_icons), $(local_icons_dir)/$(subst _,/,$(call reorder,_,1 3 2 4,$(obj))))
+
+# For each destination path we'll need to compute back the original icon
+# and create a rule that will ensure that the destination directory exists
+# and then copy the original file
+define icon_local_install_rule_template
+$(local_icons_dir)/$$(subst _,/,$$(call reorder,_,1 3 2 4,$1)): $1
+ $$(AM_V_GEN)mkdir -p $$(@D)
+ $$(AM_V_GEN)cp $$^ $$@
+endef
+
+# Instantiate the template above for each icon
+$(foreach icon,$(public_icons),$(eval $(call icon_local_install_rule_template,$(icon))))
+$(foreach icon,$(private_icons),$(eval $(call icon_local_install_rule_template,$(icon))))
+
+install-icons-src: $(public_icons_local_install_paths) $(private_icons_local_install_paths)
+
+all: install-icons-src
+
+clean-local:
+ -rm -rf $(local_icons_dir)
diff --git a/data/icons/utils.mk b/data/icons/utils.mk
new file mode 100644
index 000000000..84b1c8207
--- /dev/null
+++ b/data/icons/utils.mk
@@ -0,0 +1,11 @@
+# define a variable containing a single space
+blank :=
+space := $(blank) $(blank)
+# split string $3 with $1 as separator and return the token in position $2
+define token
+$(word $2, $(subst $1, ,$3))
+endef
+# split string $3 with $1 as separator and reassemble it using the indexes in $2
+define reorder
+$(subst $(space),$1,$(foreach i,$2,$(call token,$1,$i,$3)))
+endef