perfbook.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH -perfbook 2/8] Makefile: Don't use rsvg-convert < 2.57
Date: Fri, 5 Jan 2024 18:50:45 +0900	[thread overview]
Message-ID: <9a613659-9b48-4dc6-8ca6-46765676f7b5@gmail.com> (raw)
In-Reply-To: <8d0ffcdc-59f9-49ef-b8e1-313e71cac913@gmail.com>

rsvg-convert versions prior to 2.57 doesn't recognize options for
specifying output PDF version.  Default PDF output version depends
on the version of rsvg-convert.  Version 2.57's default is PDF 1.7.

For the moment, don't use younger versions of rsvg-convert.  Use
inkscape as a fallback.

For rsvg-convert >= 2.57, specify --format=pdf1.5, which matches
inkscape's default behavior.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 Makefile | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index f869862c..9f19ce52 100644
--- a/Makefile
+++ b/Makefile
@@ -116,7 +116,15 @@ 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)
+  RSVG_CONVERT_VER := $(shell rsvg-convert --version | $(SED) -e 's/rsvg-convert version //')
+  RSVG_CONVERT_VER_MINOR := $(shell echo $(RSVG_CONVERT_VER) | $(SED) -E -e 's/^([0-9]+\.[0-9]+).*/\1/')
+  RSVG_CONVERT_GOOD_VER ?= 2.57
+  RSVG_CONVERT_GOOD := $(shell echo $(RSVG_CONVERT_VER_MINOR) $(RSVG_CONVERT_GOOD_VER) | awk '{if ($$1 >= $$2) print 1;}')
+  ifeq ($(RSVG_CONVERT_GOOD),1)
+    SVG_PDF_CONVERTER = (rsvg-convert v$(RSVG_CONVERT_VER))
+  else
+    SVG_PDF_CONVERTER = (inkscape)
+  endif
 else
   SVG_PDF_CONVERTER = (inkscape)
 endif
@@ -468,7 +476,7 @@ $(PDFTARGETS_OF_SVG): %.pdf: %.svg
 ifeq ($(STEELFONT),0)
 	$(error "Steel City Comic" font not found. See #1 in FAQ.txt)
 endif
-ifndef RSVG_CONVERT
+ifneq ($(RSVG_CONVERT_GOOD),1)
   ifndef INKSCAPE
 	$(error $< --> $@ inkscape nor rsvg-convert not found. Please install either one)
   endif
@@ -494,8 +502,8 @@ ifeq ($(RECOMMEND_LIBERATIONMONO),1)
 	$(info Nice-to-have font family 'Liberation Mono' not found. See #9 in FAQ-BUILD.txt)
 endif
 
-ifdef RSVG_CONVERT
-	@cat $<i | rsvg-convert --format=pdf > $@
+ifeq ($(RSVG_CONVERT_GOOD),1)
+	@cat $<i | rsvg-convert --format=pdf1.5 > $@
 else
   ifeq ($(INKSCAPE_ONE),0)
 	@inkscape --export-pdf=$@ $<i > /dev/null 2>&1
-- 
2.34.1




  parent reply	other threads:[~2024-01-05  9:50 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
2024-01-05  9:50 ` Akira Yokosawa [this message]
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=9a613659-9b48-4dc6-8ca6-46765676f7b5@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).