commit:     6bff1eb8b62b9d07e1cc1098eb617f9302487907
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 03:10:18 2019 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Mon Jan 27 19:57:02 2020 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=6bff1eb8

Makefile: use rsvg-convert to generate PNGs from SVGs.

Our Makefile currently uses inkscape (via imagemagick's "convert"
wrapper) to turn SVGs into PNGs. This has a few downsides:

  * media-gfx/inkscape is a huge dependency,
  * inkscape is slow to perform the conversion,
  * installing imagemagick[svg] doesn't ensure that "convert" can
    convert an SVG to a PNG if inkscape is missing (bug 684686).

The good news is that there is another SVG -> PNG conversion tool
called rsvg-convert that is installed by gnome-base/librsvg. Compared
to inkscape, librsvg is a light dependency and rsvg-convert is
lightning-fast. Moreover, installing gnome-base/librsvg guarantees
that the latter will exist and can actually perform the conversion.

Inkscape is supposedly more powerful, but so far in the devmanual
we're only using SVG to put words in boxes. The simpler tool is
sufficient for that, and therefore preferable.

This commit updates the Makefile to use rsvg-convert.

Bug: https://bugs.gentoo.org/684686
Closes: https://bugs.gentoo.org/700904
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 9cccb38..e7131ed 100644
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ IMAGES := $(patsubst %.svg,%.png,$(SVGS))
 all: prereq validate $(HTMLS) $(IMAGES) documents.js
 
 prereq:
-       @type convert >/dev/null 2>&1 || \
-       { echo "media-gfx/imagemagick[corefonts,svg,truetype] required" >&2;\
+       @type rsvg-convert >/dev/null 2>&1 || \
+       { echo "gnome-base/librsvg required" >&2;\
           exit 1; }
        @type xsltproc >/dev/null 2>&1 || \
        { echo "dev-libs/libxslt is with python required" >&2;\
@@ -32,7 +32,7 @@ documents.js: bin/build_search_documents.py $(XMLS)
        mv _documents.js documents.js
 
 %.png : %.svg
-       convert $< $@
+       rsvg-convert --output=$@ $<
 
 # Secondary expansion allows us to use the automatic variable $@ in
 # the prerequisites. When it is used (and we have no idea when that

Reply via email to