[empathy] "Build" a local copy of the icons to be used from sources



commit 80eac7fd3c665f7960f07f9a8aaddbff8f4f9467
Author: Emanuele Aina <emanuele aina collabora com>
Date:   Mon Apr 19 12:59:16 2010 +0200

    "Build" a local copy of the icons to be used from sources
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616159

 data/.gitignore        |    1 +
 data/icons/Makefile.am |   30 ++++++++++++++++++++++++++++++
 data/icons/utils.mk    |   11 +++++++++++
 3 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/data/.gitignore b/data/.gitignore
index 2c0f332..2d4a96f 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 56ad331..4bac794 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 0000000..84b1c82
--- /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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]