summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-12-28 16:01:52 +0000
committerRoy Marples <roy@marples.name>2020-12-28 16:01:52 +0000
commit68bc3c828038104b2d2fef1a9b83dd396a9f148e (patch)
treea052738046a836b18708ac703c15c78c47f62e28
parent7e8da683992bd2d3231394d729585054e4cdc1fc (diff)
downloaddhcpcd-ui-68bc3c828038104b2d2fef1a9b83dd396a9f148e.tar.xz
Use cairosvg rather than librsvg to convert SVG to PNG.
librsvg now uses rust which I really don't want in my build chain. cairosvg on the other hand uses python, which already is in my chain. The downside is that we need to detect the binary name as often it's based on the python version.
-rwxr-xr-xconfigure17
-rw-r--r--mk/icon.mk4
2 files changed, 19 insertions, 2 deletions
diff --git a/configure b/configure
index 0e39ea7..da9cc7c 100755
--- a/configure
+++ b/configure
@@ -366,6 +366,23 @@ echo "LIB_DHCPCD= $x" >>$CONFIG_MK
# what we actually need.
echo "LDADD+= -Wl,--as-needed" >>$CONFIG_MK
+# If building icons (we need this to make the distfile) then we need to
+# convert the SVG icons to PNG.
+# We use cairosvg for this, but the binary name is based on python version
+printf "Finding cairosvg ... "
+for _CAIROSVG in cairosvg cairosvg-py3 cairosvg3.9 cairosvg3.8; do
+ CAIROSVG=$(_which "$_CAIROSVG")
+ if [ -x "$CAIROSVG" ]; then
+ break
+ fi
+done
+if [ -x "$CAIROSVG" ]; then
+ echo "$CAIROSVG"
+ echo "CAIROSVG= $CAIROSVG" >>$CONFIG_MK
+else
+ echo "not found!"
+fi
+
_NOTIFY="$NOTIFY"
_WITH_GTK="$WITH_GTK"
if [ "$WITH_GTK" = yes -o -z "$WITH_GTK" ]; then
diff --git a/mk/icon.mk b/mk/icon.mk
index e508126..5222612 100644
--- a/mk/icon.mk
+++ b/mk/icon.mk
@@ -4,7 +4,7 @@ SIZEDIR?= ${SIZE}x${SIZE}
ICONDIR?= ${PREFIX}/share/dhcpcd/icons
IDIR= ${ICONDIR}/hicolor/${SIZEDIR}/${CATEGORY}
-RSVG_CONVERT?= rsvg-convert
+CAIROSVG?= cairosvg
ICONS+= ${SRCS:.svg=.png}
CLEANFILES+= ${SRCS:.svg=.png}
@@ -14,7 +14,7 @@ CLEANFILES+= ${SRCS:.svg=.png}
all: ${ICONS}
.svg.png:
- ${RSVG_CONVERT} -h ${SIZE} -w ${SIZE} $< >$@
+ ${CAIROSVG} -f png -H ${SIZE} -W ${SIZE} $< >$@
_iconinstall: ${ICONS}
${INSTALL} -d ${DESTDIR}${IDIR}