summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 2c0f3322..2d4a96f0 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 56ad3312..4bac794d 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 00000000..84b1c820
--- /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