All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: "Дмитрий Дьяченко" <dimhen@gmail.com>,
	"Felipe Balbi" <balbi@kernel.org>,
	perfbook@vger.kernel.org, "Akira Yokosawa" <akiyks@gmail.com>
Subject: [PATCH v2 -perfbook] Makefile: Cope with GhostScript 9.53.0 or later
Date: Mon, 4 Jan 2021 08:38:35 +0900	[thread overview]
Message-ID: <4f0c7f49-474d-01e7-fa73-673d5f146633@gmail.com> (raw)
In-Reply-To: <29de25dd-09e4-cd0b-a743-6e5a7c8dfb36@gmail.com>

From d48155e896265c1a26985fe26f9bf8c5fbcfd22e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Mon, 4 Jan 2021 07:58:18 +0900
Subject: [PATCH v2 -perfbook] Makefile: Cope with GhostScript 9.53.0 or later
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Combination of GhostScript 9.53.x and pstricks-base 3.01 requires
an additional option of "gs" to enable transparency.

Current version of a2ping can not cope with this change.

Instead, use the pair of commands "ps2pdf" and "pdfcrop" for .eps
files originated from .tex sources if a new version of gs is detected.

Note:
Due to the use of a deprecated command in pstricks.pro (boilerplate
prologue code), gs 9.53.x emits repetitive warnings of:

   **** WARNING: .setopacityalpha is deprecated (as of 9.53.0) and will be removed in a future release
   **** See .setfillconstantalpha/.setalphaisshape for the improved solution

I'll silence them once I'm sure the stability of new commands in
Makefile.

Reported-by: Дмитрий Дьяченко <dimhen@gmail.com>
Reported-by: Felipe Balbi <balbi@kernel.org>
Tested-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Hi,

I thought I didn't redirect the warnings at all, but pdfcrop's stderr
was redirected in v1.
I removed the redirection in v2.

Changes v1 -> v2:
  o Add Felipe's Tested-by
  o Mention warnings from gs in commit log's note.
  o Remove ineffective redirection at the end of pipeline.

        Thanks, Akira
--
Makefile | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 56ce62bf..0c58f1a0 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,8 @@ EPSSOURCES_FROM_TEX := \
 	SMPdesign/DiningPhilosopher4part-b.eps \
 	SMPdesign/DiningPhilosopher5PEM.eps
 
+PDFTARGETS_OF_TEX := $(EPSSOURCES_FROM_TEX:%.eps=%.pdf)
+
 DOTSOURCES := $(wildcard */*.dot)
 
 EPSSOURCES_FROM_DOT := $(DOTSOURCES:%.dot=%.eps)
@@ -70,7 +72,7 @@ EPSORIGIN := $(filter-out $(EPSSOURCES_FROM_TEX) $(EPSSOURCES_FROM_DOT) $(EPSSOU
 
 PDFTARGETS_OF_EPSORIG := $(EPSORIGIN:%.eps=%.pdf)
 
-PDFTARGETS_OF_EPSOTHER := $(filter-out $(PDFTARGETS_OF_EPSORIG),$(PDFTARGETS_OF_EPS))
+PDFTARGETS_OF_EPSOTHER := $(filter-out $(PDFTARGETS_OF_EPSORIG) $(PDFTARGETS_OF_TEX),$(PDFTARGETS_OF_EPS))
 
 BIBSOURCES := bib/*.bib alphapf.bst
 
@@ -124,19 +126,23 @@ ifdef A2PING
   GS_950_OR_LATER := $(shell gs --version | grep -c -E "9\.[5-9].?")
   A2PING_277P := $(shell a2ping --help 2>&1 | grep -c "2.77p,")
   A2PING_283P := $(shell a2ping --help 2>&1 | grep -c "2.83p,")
+  GS_953_OR_LATER := $(shell gs --version | grep -c -E "9\.5[3-9].?")
   ifeq ($(A2PING_277P),1)
-    A2PING_GSCNFL := 1
+    A2PING_GSCNFL = 1
   else
     ifeq ($(A2PING_283P),1)
       ifeq ($(GS_950_OR_LATER),1)
-        A2PING_GSCNFL := 1
+        A2PING_GSCNFL = 1
       else
-        A2PING_GSCNFL := 0
+        A2PING_GSCNFL = 0
       endif
     else
-      A2PING_GSCNFL := 0
+      A2PING_GSCNFL = 0
     endif
   endif
+  ifeq ($(GS_953_OR_LATER),1)
+    A2PING_GSCNFL = 2
+  endif
 endif
 
 LINELABEL_ENV_BEGIN := $(shell grep -l -F '\begin{linelabel}' $(LATEXSOURCES))
@@ -395,6 +401,20 @@ endif
 	@a2ping --below --hires --bboxfrom=compute-gs $<i $@ > /dev/null 2>&1
 	@rm -f $<i
 
+$(PDFTARGETS_OF_TEX): %.pdf: %.eps
+	@echo "$< --> $@"
+ifndef A2PING
+	$(error $< --> $@: a2ping not found. Please install it)
+endif
+ifeq ($(A2PING_GSCNFL),1)
+	$(error a2ping version conflict. See #7 in FAQ-BUILD.txt)
+endif
+ifeq ($(A2PING_GSCNFL),2)
+	@ps2pdf -dALLOWPSTRANSPARENCY -dNOSAFER $< - | pdfcrop -hires - $@
+else
+	@a2ping --below --hires --bboxfrom=compute-gs $< $@ > /dev/null 2>&1
+endif
+
 $(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
 	@echo "$< --> $@"
 ifndef A2PING
-- 
2.17.1




  parent reply	other threads:[~2021-01-03 23:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 11:23 [PATCH -perfbook] Makefile: Cope with GhostScript 9.53.0 or later Akira Yokosawa
2021-01-03 14:47 ` Felipe Balbi
2021-01-03 15:13   ` Akira Yokosawa
2021-01-03 23:38 ` Akira Yokosawa [this message]
2021-01-04  0:44   ` [PATCH v2 " Paul E. McKenney
2021-01-04 13:22   ` Дмитрий Дьяченко

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=4f0c7f49-474d-01e7-fa73-673d5f146633@gmail.com \
    --to=akiyks@gmail.com \
    --cc=balbi@kernel.org \
    --cc=dimhen@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.