aboutsummaryrefslogtreecommitdiffstats
path: root/data/icons
diff options
context:
space:
mode:
Diffstat (limited to 'data/icons')
-rw-r--r--data/icons/Makefile.am30
-rw-r--r--data/icons/utils.mk11
2 files changed, 41 insertions, 0 deletions
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