summaryrefslogtreecommitdiff
path: root/mate-extra/mate-utils/files/mate-utils-1.22.1-make-inkscape-optional.patch
blob: 57d984b91cc454faaac24190d40f1af347b8984f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
From 563dec11a51f4c6517509642e335a1fd64cd4ec4 Mon Sep 17 00:00:00 2001
From: rbuj <robert.buj@gmail.com>
Date: Thu, 2 May 2019 20:51:09 +0200
Subject: [PATCH] Make inkscape and rsvg-convert optional

TEST on Fedora:
inkscape, librsvg2-tools package are not installed on system: The user can build, install and distribute the package:

  $ sudo dnf remove inkscape librsvg2-tools -y
  $ ./configure --prefix=/usr
  $ make
  $ sudo make install
  $ make distcheck

logview/data/icons:

Can not run build-png-icons target if inkscape package is not installed on system:

  $ make -C logview/data/icons clean-png-icons
make: Entering directory '/home/robert/devel/mate-utils/logview/data/icons'
rm -f hicolor_apps_16x16_mate-system-log.png hicolor_apps_22x22_mate-system-log.png hicolor_apps_32x32_mate-system-log.png hicolor_apps_48x48_mate-system-log.png hicolor_apps_256x256_mate-system-log.png
make: Leaving directory '/home/robert/devel/mate-utils/logview/data/icons'
  $ make -C logview/data/icons build-png-icons
make: Entering directory '/home/robert/devel/mate-utils/logview/data/icons'
make: *** No rule to make target 'hicolor_apps_16x16_mate-system-log.png', needed by 'build-png-icons'.  Stop.
make: Leaving directory '/home/robert/devel/mate-utils/logview/data/icons'

Can run build-png-icons target if inkscape package is installed on system:

  $ sudo dnf install inkscape -y
  $ ./configure --prefix=/usr
  $ make -C logview/data/icons build-png-icons
make: Entering directory '/home/robert/devel/mate-utils/logview/data/icons'
Background RRGGBBAA: ffffff00 Area 303:65:319:81 exported to 16 x 16 pixels (96 dpi) Bitmap saved as: hicolor_apps_16x16_mate-system-log.png
Background RRGGBBAA: ffffff00 Area 303:101:325:123 exported to 22 x 22 pixels (96 dpi) Bitmap saved as: hicolor_apps_22x22_mate-system-log.png
Background RRGGBBAA: ffffff00 Area 304:142:336:174 exported to 32 x 32 pixels (96 dpi) Bitmap saved as: hicolor_apps_32x32_mate-system-log.png
Background RRGGBBAA: ffffff00 Area 296:202:344:250 exported to 48 x 48 pixels (96 dpi) Bitmap saved as: hicolor_apps_48x48_mate-system-log.png
Background RRGGBBAA: ffffff00 Area 33:11:289:267 exported to 256 x 256 pixels (96 dpi) Bitmap saved as: hicolor_apps_256x256_mate-system-log.png
make: Nothing to be done for 'build-png-icons'.
make: Leaving directory '/home/robert/devel/mate-utils/logview/data/icons'

baobab/pixmaps:

Can not run build-png-icons target if librsvg2-tools package is not installed on system:

  $ make -C baobab/pixmaps clean-png-icons
make: Entering directory '/home/robert/devel/mate-utils/baobab/pixmaps'
rm -f hicolor_apps_16x16_mate-disk-usage-analyzer.png hicolor_apps_22x22_mate-disk-usage-analyzer.png hicolor_apps_32x32_mate-disk-usage-analyzer.png hicolor_apps_48x48_mate-disk-usage-analyzer.png hicolor_apps_128x128_mate-disk-usage-analyzer.png
make: Leaving directory '/home/robert/devel/mate-utils/baobab/pixmaps'
  $ make -C baobab/pixmaps build-png-icons
make: Entering directory '/home/robert/devel/mate-utils/baobab/pixmaps'
make: *** No rule to make target 'hicolor_apps_16x16_mate-disk-usage-analyzer.png', needed by 'build-png-icons'.  Stop.
make: Leaving directory '/home/robert/devel/mate-utils/baobab/pixmaps'

Can run build-png-icons target if librsvg2-tools package is installed on system:

  $ sudo dnf install -y librsvg2-tools
  $ ./configure --prefix=/usr
  $ make -C baobab/pixmaps build-png-icons
make: Entering directory '/home/robert/devel/mate-utils/baobab/pixmaps'
/usr/bin/rsvg-convert -w 16 -h 16 hicolor_apps_scalable_mate-disk-usage-analyzer.svg -o hicolor_apps_16x16_mate-disk-usage-analyzer.png
/usr/bin/rsvg-convert -w 22 -h 22 hicolor_apps_scalable_mate-disk-usage-analyzer.svg -o hicolor_apps_22x22_mate-disk-usage-analyzer.png
/usr/bin/rsvg-convert -w 32 -h 32 hicolor_apps_scalable_mate-disk-usage-analyzer.svg -o hicolor_apps_32x32_mate-disk-usage-analyzer.png
/usr/bin/rsvg-convert -w 48 -h 48 hicolor_apps_scalable_mate-disk-usage-analyzer.svg -o hicolor_apps_48x48_mate-disk-usage-analyzer.png
/usr/bin/rsvg-convert -w 128 -h 128 hicolor_apps_scalable_mate-disk-usage-analyzer.svg -o hicolor_apps_128x128_mate-disk-usage-analyzer.png
make: Leaving directory '/home/robert/devel/mate-utils/baobab/pixmaps'

Closes #223
---
 baobab/pixmaps/Makefile.am     |  6 ++++--
 configure.ac                   |  8 ++------
 logview/data/icons/Makefile.am | 31 ++++++++++++++++++++++++-------
 3 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/baobab/pixmaps/Makefile.am b/baobab/pixmaps/Makefile.am
index f36e8bf3..6804bef9 100644
--- a/baobab/pixmaps/Makefile.am
+++ b/baobab/pixmaps/Makefile.am
@@ -11,8 +11,10 @@ public_icons = \
 	hicolor_apps_scalable_mate-disk-usage-analyzer.svg \
 	$(NULL)
 
+if HAVE_RSVG_CONVERT
 hicolor_apps_%.png: hicolor_apps_scalable_mate-disk-usage-analyzer.svg
 	$(RSVG_CONVERT) -w $(word 1, $(subst x, ,$(word 1,$(subst _, ,$*)))) -h $(word 2, $(subst x, ,$(word 1,$(subst _, ,$*)))) $^ -o $@
+endif
 
 EXTRA_DIST = \
 	$(public_icons)	\
@@ -20,7 +22,7 @@ EXTRA_DIST = \
 
 ###############################################################################
 
-install-icons: $(public_icons)
+install-icons: | $(public_icons)
 	for icon in $(public_icons); do \
 		THEME=`echo $$icon | cut -d_ -f1`; \
 		CONTEXT=`echo $$icon | cut -d_ -f2`; \
@@ -57,7 +59,7 @@ update-icon-cache:
 	fi
 
 .PHONY: build-png-icons clean-png-icons
-build-png-icons: $(png_icons)
+build-png-icons: | $(png_icons)
 
 clean-png-icons:
 	rm -f $(png_icons)
diff --git a/configure.ac b/configure.ac
index d65e5b54..0907e194 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,13 +31,9 @@ AC_PATH_PROG(GLIB_MKENUMS, [glib-mkenums])
 
 dnl ICONS: convert svg to png
 AC_PATH_PROG(RSVG_CONVERT, rsvg-convert)
-if test x$RSVG_CONVERT = x ; then
-    AC_MSG_ERROR([could not locate rsvg-convert])
-fi
+AM_CONDITIONAL([HAVE_RSVG_CONVERT], [test "x$RSVG_CONVERT" != x])
 AC_PATH_PROG(INKSCAPE, inkscape)
-if test x$INKSCAPE = x ; then
-    AC_MSG_ERROR([could not locate inkscape])
-fi
+AM_CONDITIONAL([HAVE_INKSCAPE], [test "x$INKSCAPE" != x])
 
 MATE_COMPILE_WARNINGS([yes])
 
diff --git a/logview/data/icons/Makefile.am b/logview/data/icons/Makefile.am
index 9db44489..30fff904 100644
--- a/logview/data/icons/Makefile.am
+++ b/logview/data/icons/Makefile.am
@@ -17,20 +17,37 @@ public_icons = \
 	hicolor_apps_scalable_mate-system-log-symbolic.svg \
 	$(NULL)
 
+if HAVE_INKSCAPE
 hicolor_apps_16x16_mate-system-log.png: logview.svg
-	$(INKSCAPE) -z $^ --export-area=303:65:319:81 -w=16 -h=16 -e=$@
+	$(if $(wildcard $(INKSCAPE)), \
+		$(info $(shell $(INKSCAPE) -z $^ --export-area=303:65:319:81 -w=16 -h=16 -e=$@)), \
+		$(error could not locate inkscape) \
+	)
 
 hicolor_apps_22x22_mate-system-log.png: logview.svg
-	$(INKSCAPE) -z $^ --export-area=303:101:325:123 -w=22 -h=22 -e=$@
+	$(if $(wildcard $(INKSCAPE)), \
+		$(info $(shell $(INKSCAPE) -z $^ --export-area=303:101:325:123 -w=22 -h=22 -e=$@)), \
+		$(error could not locate inkscape) \
+	)
 
 hicolor_apps_32x32_mate-system-log.png: logview.svg
-	$(INKSCAPE) -z $^ --export-area=304:142:336:174 -w=32 -h=32 -e=$@
+	$(if $(wildcard $(INKSCAPE)), \
+		$(info $(shell $(INKSCAPE) -z $^ --export-area=304:142:336:174 -w=32 -h=32 -e=$@)), \
+		$(error could not locate inkscape) \
+	)
 
 hicolor_apps_48x48_mate-system-log.png: logview.svg
-	$(INKSCAPE) -z $^ --export-area=296:202:344:250 -w=48 -h=48 -e=$@
+	$(if $(wildcard $(INKSCAPE)), \
+		$(info $(shell $(INKSCAPE) -z $^ --export-area=296:202:344:250 -w=48 -h=48 -e=$@)), \
+		$(error could not locate inkscape) \
+	)
 
 hicolor_apps_256x256_mate-system-log.png: logview.svg
-	$(INKSCAPE) -z $^ --export-area=33:11:289:267 -w=256 -h=256 -e=$@
+	$(if $(wildcard $(INKSCAPE)), \
+		$(info $(shell $(INKSCAPE) -z $^ --export-area=33:11:289:267 -w=256 -h=256 -e=$@)), \
+		$(error could not locate inkscape) \
+	)
+endif
 
 noinst_DATA = \
 	logview.svg \
@@ -43,7 +60,7 @@ EXTRA_DIST = \
 
 ###############################################################################
 
-install-icons:
+install-icons: | $(public_icons)
 	for icon in $(public_icons); do \
 		THEME=`echo $$icon | cut -d_ -f1`; \
 		CONTEXT=`echo $$icon | cut -d_ -f2`; \
@@ -80,7 +97,7 @@ update-icon-cache:
 	fi
 
 .PHONY: build-png-icons clean-png-icons
-build-png-icons: $(png_icons)
+build-png-icons: | $(png_icons)
 
 clean-png-icons:
 	rm -f $(png_icons)