flatpak/shared-modules/gtk2/arc-gtk2-theme-Replace-Inkscape-dependency-with-rsvg-convert.patch
2024-03-07 20:28:57 -03:00

180 lines
7.5 KiB
Diff

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