summaryrefslogtreecommitdiff
path: root/subprojects/shared-modules/gtk2/arc-gtk2-theme-Replace-Inkscape-dependency-with-rsvg-convert.patch
blob: 90e09509b1923cdfeeb3faf06b07796497269a43 (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
From d5e0034183564df5fec8e4dde1705116c7b38021 Mon Sep 17 00:00:00 2001
From: Patrick Griffis <tingping@tingping.se>
Date: Sat, 16 May 2020 18:00:36 -0700
Subject: [PATCH] Replace Inkscape dependency with rsvg-convert

rsvg-convert is a *much* smaller dependency that all systems with
a functioning GTK installation should have easy access to.
---
 common/gtk-2.0/Makefile.am     |  6 +-----
 common/gtk-2.0/render-asset.sh | 16 ++++++++--------
 common/gtk-3.0/common.am       | 12 ++----------
 common/xfwm4/Makefile.am       |  6 +-----
 common/xfwm4/render-asset.sh   | 16 ++++++++--------
 configure.ac                   |  8 ++------
 6 files changed, 22 insertions(+), 42 deletions(-)

diff --git a/common/gtk-2.0/Makefile.am b/common/gtk-2.0/Makefile.am
index 010823a..873013a 100644
--- a/common/gtk-2.0/Makefile.am
+++ b/common/gtk-2.0/Makefile.am
@@ -35,11 +35,7 @@ $(light): $(srcdir)/light/assets.svg | light/assets
 $(dark): $(srcdir)/dark/assets.svg | dark/assets
 
 $(light) $(dark):
-if INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-filename="$@" --export-id="$(basename $(notdir $@))" --export-dpi=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null
-else !INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(basename $(notdir $@))" --export-dpi=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null
-endif
+	$(RSVG_CONVERT) --format=png --output="$@" --export-id="$(basename $(notdir $@))" --dpi-x=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) --dpi-y=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null
 	$(OPTIPNG) -o7 --quiet "$@"
 
 menubar-toolbar/%-dark.png: dark/assets/%.png | menubar-toolbar
diff --git a/common/gtk-2.0/render-asset.sh b/common/gtk-2.0/render-asset.sh
index 6685414..f6198af 100755
--- a/common/gtk-2.0/render-asset.sh
+++ b/common/gtk-2.0/render-asset.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -ueo pipefail
 
-INKSCAPE="$(which inkscape)"
+RSVG_CONVERT="$(which rsvg-convert)"
 OPTIPNG="$(which optipng)"
 
 ASSETS_DIR="$1"
@@ -14,9 +14,9 @@ if [[ -f "${result_file}" ]] ; then
 	echo "${result_file} already exists."
 else
 	echo "Rendering '${result_file}'"
-	"$INKSCAPE" --export-id="$i" \
-				--export-id-only \
-				--export-png="${result_file}" "$SRC_FILE" >/dev/null \
+	"$RSVG_CONVERT" --export-id="$i" \
+                        --format=png
+                        --output="${result_file}" "$SRC_FILE" >/dev/null \
 	&& "$OPTIPNG" -o7 --quiet "${result_file}"
 fi
 
@@ -26,10 +26,10 @@ if [[ "$OPTION_GTK2_HIDPI" == "true" ]]; then
 		echo "${result_file_hidpi} already exists."
 	else
 		echo "Rendering '${result_file_hidpi}'"
-		"$INKSCAPE" --export-id="$i" \
-					--export-id-only \
-					--export-dpi=192 \
-					--export-png="${result_file_hidpi}" "$SRC_FILE" >/dev/null \
+		"$RSVG_CONVERT" --export-id="$i" \
+				--dpi-x=192 --dpi-y=192 \
+				--format=png
+			        --output="${result_file_hidpi}" "$SRC_FILE" >/dev/null \
 		&& "$OPTIPNG" -o7 --quiet "${result_file_hidpi}"
 	fi
 fi
diff --git a/common/gtk-3.0/common.am b/common/gtk-3.0/common.am
index a93d01d..9e4b102 100644
--- a/common/gtk-3.0/common.am
+++ b/common/gtk-3.0/common.am
@@ -14,19 +14,11 @@ clean:
 	rm -rf assets/ light/ dark/ darker/ lighter/
 
 $(normal): $(srcdir)/assets.svg | assets
-if INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-filename="$@" --export-id="$(basename $(notdir $@))" --export-dpi=96 "$<" >/dev/null
-else !INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(basename $(notdir $@))" --export-dpi=96 "$<" >/dev/null
-endif
+	$(RSVG_CONVERT) --format=png --output="$@" --export-id="$(basename $(notdir $@))" --dpi-y=96 --dpi-x=96 "$<" >/dev/null
 	$(OPTIPNG) -o7 --quiet "$@"
 
 $(hidpi): $(srcdir)/assets.svg | assets
-if INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-filename="$@" --export-id="$(patsubst %@2,%,$(basename $(notdir $@)))" --export-dpi=192 "$<" >/dev/null
-else !INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(patsubst %@2,%,$(basename $(notdir $@)))" --export-dpi=192 "$<" >/dev/null
-endif
+	$(RSVG_CONVERT) --format=png --output="$@" --export-id="$(patsubst %@2,%,$(basename $(notdir $@)))" --dpi-y=192 --dpi-x=192 "$<" >/dev/null
 	$(OPTIPNG) -o7 --quiet "$@"
 
 .PHONY: normal hidpi clean
diff --git a/common/xfwm4/Makefile.am b/common/xfwm4/Makefile.am
index e5fbdc5..1f21183 100644
--- a/common/xfwm4/Makefile.am
+++ b/common/xfwm4/Makefile.am
@@ -17,11 +17,7 @@ $(light): $(srcdir)/light/assets.svg | light/assets
 $(dark): $(srcdir)/dark/assets.svg | dark/assets
 
 $(light) $(dark):
-if INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-filename="$@" --export-id="$(basename $(notdir $@))" --export-dpi=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null
-else !INKSCAPE_1_0_OR_NEWER
-	$(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(basename $(notdir $@))" --export-dpi=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null
-endif
+	$(RSVG_CONVERT) --format=png --output="$@" --export-id="$(basename $(notdir $@))" --dpi-y=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) --dpi-x=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null
 	$(OPTIPNG) -o7 --quiet "$@"
 
 .PHONY: light dark clean
diff --git a/common/xfwm4/render-asset.sh b/common/xfwm4/render-asset.sh
index 6685414..f6198af 100755
--- a/common/xfwm4/render-asset.sh
+++ b/common/xfwm4/render-asset.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -ueo pipefail
 
-INKSCAPE="$(which inkscape)"
+RSVG_CONVERT="$(which rsvg-convert)"
 OPTIPNG="$(which optipng)"
 
 ASSETS_DIR="$1"
@@ -14,9 +14,9 @@ if [[ -f "${result_file}" ]] ; then
 	echo "${result_file} already exists."
 else
 	echo "Rendering '${result_file}'"
-	"$INKSCAPE" --export-id="$i" \
-				--export-id-only \
-				--export-png="${result_file}" "$SRC_FILE" >/dev/null \
+	"$RSVG_CONVERT" --export-id="$i" \
+                        --format=png
+                        --output="${result_file}" "$SRC_FILE" >/dev/null \
 	&& "$OPTIPNG" -o7 --quiet "${result_file}"
 fi
 
@@ -26,10 +26,10 @@ if [[ "$OPTION_GTK2_HIDPI" == "true" ]]; then
 		echo "${result_file_hidpi} already exists."
 	else
 		echo "Rendering '${result_file_hidpi}'"
-		"$INKSCAPE" --export-id="$i" \
-					--export-id-only \
-					--export-dpi=192 \
-					--export-png="${result_file_hidpi}" "$SRC_FILE" >/dev/null \
+		"$RSVG_CONVERT" --export-id="$i" \
+				--dpi-x=192 --dpi-y=192 \
+				--format=png
+			        --output="${result_file_hidpi}" "$SRC_FILE" >/dev/null \
 		&& "$OPTIPNG" -o7 --quiet "${result_file_hidpi}"
 	fi
 fi
diff --git a/configure.ac b/configure.ac
index f0725f1..1a52cc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,12 +48,8 @@ AM_CONDITIONAL([GNOME_SHELL_3_32_OR_NEWER], [test "0$GNOME_SHELL_VERSMNR" -ge 31
 AS_IF([test "x$ENABLE_CINNAMON" != xno], [ARC_CINNAMON])
 
 AS_IF([test "x$ENABLE_GTK2" != xno -o "x$ENABLE_GTK3" != xno -o "x$ENABLE_XFWM" != xno], [
-    AC_PATH_PROG([INKSCAPE], [inkscape])
-    AS_IF([test "x$ac_cv_path_INKSCAPE" = x], [AC_MSG_ERROR([inkscape not found])])
-    AS_IF([test "x$ac_cv_path_INKSCAPE" != x],
-        [INKSCAPE_VERSMJR=`inkscape --version 2> /dev/null | cut -d' ' -f2 | cut -d'.' -f1`]
-        AM_CONDITIONAL([INKSCAPE_1_0_OR_NEWER], [test "x$INKSCAPE_VERSMJR" = x1])
-    )
+    AC_PATH_PROG([RSVG_CONVERT], [rsvg-convert])
+    AS_IF([test "x$ac_cv_path_RSVG_CONVERT" = x], [AC_MSG_ERROR([rsvg-convert not found])])
     AC_PATH_PROG([OPTIPNG], [optipng])
     AS_IF([test "x$ac_cv_path_OPTIPNG" = x], [AC_MSG_ERROR([optipng not found])])
 ])
-- 
2.26.0