From 769c9fbcc83c303519058e1fd18a3575b746c339 Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Fri, 7 Dec 2007 17:01:22 +0000 Subject: [PATCH] Better icon conversion code with new rule. Added rule for icon theme installation. --- build/Svg.jam | 3 +++ datas/Jamfile | 5 +--- datas/icon-themes/Jamfile | 55 ++++++++++++++++++++++++++++++--------- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/build/Svg.jam b/build/Svg.jam index d9a4805..6573443 100644 --- a/build/Svg.jam +++ b/build/Svg.jam @@ -62,6 +62,9 @@ rule SvgToPngDirectory SvgToPng $(target) : $(source) : $(3) : $(3) ; } + + # let 'jam clean' removes created directory + CleandirSafe clean : [ FDirName $(SUBDIR) $(1) ] ; } actions SvgToPng1 diff --git a/datas/Jamfile b/datas/Jamfile index 3301cca..751a918 100644 --- a/datas/Jamfile +++ b/datas/Jamfile @@ -21,7 +21,4 @@ InstallEdeIcons icons-48 : $(ICONS48) ; InstallEdeConfigFiles $(CONFS) ; InstallEdeDesktopFiles $(PLINKS) ; -# For building icon themes -if $(BUILD_ICON_THEMES) = 1 { - SubInclude TOP datas icon-themes ; -} +SubInclude TOP datas icon-themes ; diff --git a/datas/icon-themes/Jamfile b/datas/icon-themes/Jamfile index 0bff6ff..cd9b9b2 100644 --- a/datas/icon-themes/Jamfile +++ b/datas/icon-themes/Jamfile @@ -10,17 +10,48 @@ SubDir TOP datas icon-themes ; -# Icon theme conversion code -# jam don't like nested loops so every subdirectory is specified -ICON_SIZES = 16 22 32 48 64 128 ; +# ConvertIconTheme [icon-theme-name] : [icon-sizes] : [icon-categories] ; +# Mass conversion of scalable (.svg) icon theme to .png one. Make sure directory +# that will be converted contains 'scalable' directory with .svg icons +rule ConvertIconTheme +{ + local size category ; + for size in $(2) { + for category in $(3) { + SvgToPngDirectory [ FDirName $(1) $(size) $(category) ] : [ FDirName $(1) scalable $(category) ] : $(size) ; + } -for size in $(ICON_SIZES) { - SvgToPngDirectory [ FDirName edeneu $(size) actions ] : [ FDirName edeneu scalable actions ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) apps ] : [ FDirName edeneu scalable apps ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) categories ] : [ FDirName edeneu scalable categories ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) devices ] : [ FDirName edeneu scalable devices ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) emblems ] : [ FDirName edeneu scalable emblems ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) mimetypes ] : [ FDirName edeneu scalable mimetypes ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) places ] : [ FDirName edeneu scalable places ] : $(size) ; - SvgToPngDirectory [ FDirName edeneu $(size) status ] : [ FDirName edeneu scalable status ] : $(size) ; + # let 'jam clean' removes created directories since SvgToPngDirectory will remove + # only deepest, e.g. '16/actions' will be removed only 'actions'; here '16' will be removed too + CleandirSafe clean : [ FDirName $(1) $(size) ] ; + } } + +# InstallIconTheme [icon-theme-name] : [icon-sizes] : [icon-categories] ; +# Installs icon theme +rule InstallIconTheme +{ + local size category icon_list directory ; + + for size in $(2) { + for category in $(3) { + directory = [ FDirName $(1) $(size) $(category) ] ; + icon_list = [ Wildcard $(directory) : *.png : $(directory) ] ; + InstallEdeIcons $(directory) : $(icon_list) ; + } + } + + # install index.theme + InstallData [ FDirName $(EDEICONDIR) $(1) ] : [ FFileName $(1) index.theme ] ; +} + +ICON_SIZES = 16 22 32 48 64 128 ; +ICON_CATEGORIES = actions apps categories devices emblems mimetypes places status ; + +# only convert them when jam -sBUILD_ICON_THEMES=1 is given +# this will reduce jam's startup time +if $(BUILD_ICON_THEMES) = 1 { + ConvertIconTheme "edeneu" : $(ICON_SIZES) : $(ICON_CATEGORIES) ; +} + +InstallIconTheme "edeneu" : $(ICON_SIZES) : $(ICON_CATEGORIES) ;