[PATCH -perfbook 3/8] Makefile: Allow rsvg-convert 2.52

Akira Yokosawa <[email protected]>
Newsgroups org.kernel.vger.perfbook
Message-ID <[email protected]>
rsvg-convert 2.52.5 (on Ubuntu 22.04 LTS) output PDF 1.5 by default
and is good enough for perfbook.
Add rules for using it in SVG --> PDF conversion.

rsvg-convert versions >= 2.54 and < 2.57 default to PDF 1.7 and don't
have option of --format pdf1.5.  Avoid using those interim versions
by default.

Signed-off-by: Akira Yokosawa <[email protected]>
---
 Makefile | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 9f19ce52..3844c37b 100644
--- a/Makefile
+++ b/Makefile
@@ -119,12 +119,24 @@ ifdef 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_PDFFMT_VER := 2.57
+  RSVG_CONVERT_ACCEPTABLE_VER := 2.52
   RSVG_CONVERT_GOOD := $(shell echo $(RSVG_CONVERT_VER_MINOR) $(RSVG_CONVERT_GOOD_VER) | awk '{if ($$1 >= $$2) print 1;}')
+  RSVG_CONVERT_ACCEPTABLE := $(shell echo $(RSVG_CONVERT_VER_MINOR) $(RSVG_CONVERT_ACCEPTABLE_VER) | awk '{if ($$1 == $$2) print 1;}')
+  ifeq ($(RSVG_CONVERT_ACCEPTABLE),1)
+    RSVG_CONVERT_GOOD := 1
+  endif
+  RSVG_CONVERT_PDFFMT := $(shell echo $(RSVG_CONVERT_VER_MINOR) $(RSVG_CONVERT_PDFFMT_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
+  ifeq ($(RSVG_CONVERT_PDFFMT),1)
+    RSVG_FMT_OPT := --format=pdf1.5
+  else
+    RSVG_FMT_OPT := --format=pdf
+  endif
 else
   SVG_PDF_CONVERTER = (inkscape)
 endif
@@ -503,7 +515,7 @@ ifeq ($(RECOMMEND_LIBERATIONMONO),1)
 endif
 
 ifeq ($(RSVG_CONVERT_GOOD),1)
-	@cat $<i | rsvg-convert --format=pdf1.5 > $@
+	@cat $<i | rsvg-convert $(RSVG_FMT_OPT) > $@
 else
   ifeq ($(INKSCAPE_ONE),0)
 	@inkscape --export-pdf=$@ $<i > /dev/null 2>&1
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.