From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH -perfbook 0/8] Use rsvg-convert for SVG --> PDF conversion
Date: Fri, 5 Jan 2024 18:47:31 +0900 [thread overview]
Message-ID: <3a4ea85d-643f-4fab-92db-09605ed06138@gmail.com> (raw)
In-Reply-To: <8d0ffcdc-59f9-49ef-b8e1-313e71cac913@gmail.com>
Subject: [PATCH -perfbook 1/8] Makefile: Add rules to use rsvg-convert for SVG --> PDF conversion
Recently, Inkscape has had a number of stability issues in both of
its GUI- and CLI- modes. We have experienced crashes of CLI-mode
Inkscape caused by a change in glib, which can been resolved
by an update in the GTK3 library now released in GTK 3.24.39.
Commit f307e19f2be0 ("Prevent inkscape from interacting with desktop
manager") was an ugly hack for mitigating such crashes.
There is an alternative converter called rsvg-convert.
It is a light-weight CLI-only converter.
Up until Ubuntu 20.04 LTS, rsvg-convert's coverage of SVG features
was not good enough for some of the figures in perfbook drawn by
using Inkscape.
rsvg-convert has improved since, and version 2.52.5, which is the
version on Ubuntu 22.04 LTS, and later versions do fairly good jobs
in this respect.
So let's use rsvg-convert when it is available.
For Ubuntu and Debian, rsvg-convert belongs to the librsvg2-bin
package. For Fedora, it is provided in the librsvg2-tools package.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Makefile | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 424a166c..f869862c 100644
--- a/Makefile
+++ b/Makefile
@@ -103,6 +103,8 @@ PDFTARGETS_OF_EPSOTHER := $(filter-out $(PDFTARGETS_OF_EPSORIG) $(PDFTARGETS_OF_
BIBSOURCES := bib/*.bib alphapf.bst
# required commands
+SED ?= sed
+
LATEX_CMD := $(shell $(WHICH) $(LATEX) 2>/dev/null)
DOT := $(shell $(WHICH) dot 2>/dev/null)
FIG2EPS := $(shell $(WHICH) fig2eps 2>/dev/null)
@@ -111,6 +113,13 @@ INKSCAPE := $(shell $(WHICH) inkscape 2>/dev/null)
ifdef INKSCAPE
INKSCAPE_ONE := $(shell inkscape --version 2>/dev/null | grep -c "Inkscape 1")
endif
+# rsvg-convert is preferred to inkscape in SVG --> PDF conversion
+RSVG_CONVERT := $(shell $(WHICH) rsvg-convert 2>/dev/null)
+ifdef RSVG_CONVERT
+ SVG_PDF_CONVERTER = (rsvg-convert)
+else
+ SVG_PDF_CONVERTER = (inkscape)
+endif
LATEXPAND := $(shell $(WHICH) latexpand 2>/dev/null)
QPDF := $(shell $(WHICH) qpdf 2>/dev/null)
@@ -455,12 +464,14 @@ ISOLATE_INKSCAPE ?= XDG_RUNTIME_DIR=na DBUS_SESSION_BUS_ADDRESS=na
$(PDFTARGETS_OF_SVG): $(FIXSVGFONTS)
$(PDFTARGETS_OF_SVG): %.pdf: %.svg
- @echo "$< --> $(suffix $@)"
+ @echo "$< --> $(suffix $@) $(SVG_PDF_CONVERTER)"
ifeq ($(STEELFONT),0)
$(error "Steel City Comic" font not found. See #1 in FAQ.txt)
endif
-ifndef INKSCAPE
- $(error $< --> $@ inkscape not found. Please install it)
+ifndef RSVG_CONVERT
+ ifndef INKSCAPE
+ $(error $< --> $@ inkscape nor rsvg-convert not found. Please install either one)
+ endif
endif
ifeq ($(STEELFONTID),0)
@sh $(FIXSVGFONTS) < $< | sed -e 's/Steel City Comic/Test/g' > $<i
@@ -483,10 +494,14 @@ ifeq ($(RECOMMEND_LIBERATIONMONO),1)
$(info Nice-to-have font family 'Liberation Mono' not found. See #9 in FAQ-BUILD.txt)
endif
-ifeq ($(INKSCAPE_ONE),0)
- @inkscape --export-pdf=$@ $<i > /dev/null 2>&1
+ifdef RSVG_CONVERT
+ @cat $<i | rsvg-convert --format=pdf > $@
else
+ ifeq ($(INKSCAPE_ONE),0)
+ @inkscape --export-pdf=$@ $<i > /dev/null 2>&1
+ else
@$(ISOLATE_INKSCAPE) inkscape -o $@ $<i > /dev/null 2>&1
+ endif
endif
@rm -f $<i
ifeq ($(chkpagegroup),on)
--
2.34.1
next prev parent reply other threads:[~2024-01-05 9:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 9:44 [PATCH -perfbook 0/8] Use rsvg-convert for SVG --> PDF conversion Akira Yokosawa
2024-01-05 9:47 ` Akira Yokosawa [this message]
2024-01-05 9:50 ` [PATCH -perfbook 2/8] Makefile: Don't use rsvg-convert < 2.57 Akira Yokosawa
2024-01-05 9:52 ` [PATCH -perfbook 3/8] Makefile: Allow rsvg-convert 2.52 Akira Yokosawa
2024-01-05 9:53 ` [PATCH -perfbook 4/8] Makefile: Use rsvg-convert anyway if no inkscape is found Akira Yokosawa
2024-01-05 9:54 ` [PATCH -perfbook 5/8] cartoons: Retouch r-2014-Memory-barrier.svg Akira Yokosawa
2024-01-05 9:55 ` [PATCH -perfbook 6/8] FAQ-BUILD: List package for rsvg-convert in package lists Akira Yokosawa
2024-01-05 9:57 ` [PATCH -perfbook 7/8] docker: Add packages for rsvg-convert Akira Yokosawa
2024-01-05 9:58 ` [PATCH -perfbook 8/8] gitlab-ci.yml: Install librsvg instead of inkscape Akira Yokosawa
2024-01-05 21:39 ` Leonardo Brás
2024-01-06 1:15 ` Akira Yokosawa
2024-01-06 3:37 ` Leonardo Brás
2024-01-07 21:17 ` Paul E. McKenney
2024-01-05 13:31 ` [PATCH -perfbook 0/8] Use rsvg-convert for SVG --> PDF conversion Paul E. McKenney
2024-01-05 14:51 ` Akira Yokosawa
2024-01-05 15:32 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a4ea85d-643f-4fab-92db-09605ed06138@gmail.com \
--to=akiyks@gmail.com \
--cc=paulmck@kernel.org \
--cc=perfbook@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.