Skip to contentSkip to conversation

Updates of docker/ and Makefile

PATCH In review Akira Yokosawa 2 participants 5 messages Oct 17, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Updates of docker/ and Makefile

Hi Paul,

This patch set consists of updates under docker/ and Makefile.

Patch 1/3 updates Dockerfiles under docker/.
It adds a couple of font packages in Dockerfile.fedora and adds "gnuplot" and "time" commands in all three Dockerfiles.

Patch 2/3 shortens progress reports from "make".

    Old example: intro/PPGrelation.svg --> intro/PPGrelation.pdf
    New example: intro/PPGrelation.svg --> .pdf

Patch 3/3 switches the default "esp --> pdf" rules to those in epstopdf-rule.mk.

To see the effect of patches 2/3 and 3/3, a "make neatfreak" before "make" or "make -jN" is needed.

Thanks, Akira
--
Akira Yokosawa (3):
docker: Add some fonts and commands
Makefile: Shorten progress report (dir/filename.src --> .dst)
Makefile: Promote epstopdf-rule.mk as the default

 Makefile                 | 16 ++++++++--------
 a2ping-rule.mk           |  6 +++---
 docker/Dockerfile        |  8 +++++---
 docker/Dockerfile.bionic |  8 +++++---
 docker/Dockerfile.fedora | 11 ++++++++---
 epstopdf-rule.mk         |  6 +++---
 6 files changed, 32 insertions(+), 23 deletions(-)

base-commit: d28c5aa8c1dad57c76554743cc4e59a18d367303

Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 docker: Add some fonts and commands

To cover recent changes in commit cb1e3178533d ("Update on-the-fly font-substitution patterns for .eps and .svg files") and some of existing .svg figures, Dockerfile.fedora needs a couple of additional font packages.

Also add packages for "gnuplot" and "time" commands in all three Dockerfiles.

Other change:

o Use "if -- then -- fi" constructs so that redundant groupadd

    and useradd commands can be skipped when "uid == 0".
---
 docker/Dockerfile        |  8 +++++---
 docker/Dockerfile.bionic |  8 +++++---
 docker/Dockerfile.fedora | 11 ++++++++---
 3 files changed, 18 insertions(+), 9 deletions(-)
docker/Dockerfile +5 -3
index 7527e08b..3a3991bb 100644
@@ -8,11 +8,10 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y t
     rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
     texlive-publishers texlive-pstricks texlive-science texlive-fonts-extra \
-    make nano vim git && \
+    make nano vim git curl gnuplot-nox time && \
     rm -rf /var/lib/apt/lists/*
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
 RUN fc-cache /usr/local/share/fonts/
-RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
 WORKDIR /opt
 RUN curl https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz -o - | tar xfz - && \
     sed -i -e 's/@LATEXPAND_VERSION@/v1.3/' latexpand-v1.3/latexpand && \
@@ -21,7 +20,10 @@ ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
 ARG group=perfbook
-RUN groupadd -g $gid $group && useradd -u $uid -g $gid -m $user
+RUN if [ $uid -ne 0 ] ; then \
+    groupadd -g $gid $group ; \
+    useradd -u $uid -g $gid -m $user ; \
+    fi
 VOLUME /work
 USER $uid:$gid
 WORKDIR /work
docker/Dockerfile.bionic +5 -3
index 56e6280e..207feca7 100644
@@ -8,11 +8,10 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y t
     rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
     texlive-publishers texlive-pstricks texlive-science texlive-fonts-extra \
-    make nano vim git && \
+    make nano vim git curl gnuplot-nox time && \
     rm -rf /var/lib/apt/lists/*
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
 RUN fc-cache /usr/local/share/fonts/
-RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
 WORKDIR /opt
 RUN curl https://mirrors.ctan.org/macros/latex/contrib/cleveref.zip -L -O && unzip cleveref.zip && \
     curl https://mirrors.ctan.org/macros/latex/contrib/epigraph.zip -L -O && unzip epigraph.zip && \
@@ -33,7 +32,10 @@ ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
 ARG group=perfbook
-RUN groupadd -g $gid $group && useradd -u $uid -g $gid -m $user
+RUN if [ $uid -ne 0 ] ; then \
+    groupadd -g $gid $group ; \
+    useradd -u $uid -g $gid -m $user ; \
+    fi
 VOLUME /work
 USER $uid:$gid
 WORKDIR /work
docker/Dockerfile.fedora +8 -3
index 33add84d..91633948 100644
@@ -1,11 +1,13 @@
 FROM fedora:latest
 
 RUN dnf -y update && dnf install -y --setopt=tsflags=nodocs \
-    fig2ps graphviz inkscape make git vim nano \
+    fig2ps graphviz inkscape make git vim nano gnuplot-minimal groff time \
+    liberation-mono-fonts liberation-sans-fonts \
+    dejavu-sans-mono-fonts \
     texlive-collection-plaingeneric texlive-collection-binextra \
     texlive-collection-latexextra texlive-epstopdf texlive-fontools \
     texlive-newtx texlive-newtxtt texlive-nimbus15 texlive-courier-scaled \
-    texlive-inconsolata texlive-newtxsf texlive-mdsymbol && \
+    texlive-inconsolata texlive-newtxsf texlive-mdsymbol texlive-gnu-freefont && \
     dnf clean all && \
     mktexlsr
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
@@ -18,7 +20,10 @@ ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
 ARG group=perfbook
-RUN groupadd -g $gid $group && useradd -u $uid -g $gid -m $user
+RUN if [ $uid -ne 0 ] ; then \
+    groupadd -g $gid $group ; \
+    useradd -u $uid -g $gid -m $user ; \
+    fi
 VOLUME /work
 USER $uid:$gid
 WORKDIR /work
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 Makefile: Shorten progress report (dir/filename.src --> .dst)

In reply to Akira Yokosawa

For brevity, instead of displaying a long and redundant report:

    intro/PPGrelation.svg --> intro/PPGrelation.pdf

, display a shorter one:

    intro/PPGrelation.svg --> .pdf

Also, for easy distinction of enabled rule, add hints in recipes of a2ping-rule.mk as follows:

    CodeSamples/count/atomic.eps --> .pdf (by a2ping)
---
 Makefile         | 14 +++++++-------
 a2ping-rule.mk   |  6 +++---
 epstopdf-rule.mk |  6 +++---
 3 files changed, 13 insertions(+), 13 deletions(-)
Makefile +7 -7
index 3202ad6f..6083cda4 100644
@@ -394,14 +394,14 @@ perfbook-a4.tex:
 # Rules related to perfbook_html are removed as of May, 2016
 
 $(EPSSOURCES_FROM_TEX): %.eps: %.tex
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 	sh utilities/mpostcheck.sh
 	@latex -output-directory=$(shell dirname $<) $< > /dev/null 2>&1
 	@dvips -Pdownload35 -E $(patsubst %.tex,%.dvi,$<) -o $@ > /dev/null 2>&1
 	@sh $(FIXANEPSFONTS) $@
 
 $(EPSSOURCES_FROM_DOT): %.eps: %.dot
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 ifndef DOT
 	$(error $< --> $@: dot not found. Please install graphviz)
 endif
@@ -409,7 +409,7 @@ endif
 	@sh $(FIXANEPSFONTS) $@
 
 $(EPSSOURCES_FROM_FIG): %.eps: %.fig
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 ifndef FIG2EPS
 	$(error $< --> $@: fig2eps not found. Please install fig2ps)
 endif
@@ -424,7 +424,7 @@ else
 endif
 
 $(PDFTARGETS_OF_SVG): %.pdf: %.svg
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 ifeq ($(STEELFONT),0)
 	$(error "Steel City Comic" font not found. See #1 in FAQ.txt)
 endif
@@ -463,17 +463,17 @@ CodeSamples/snippets.d: $(SOURCES_OF_SNIPPET) $(GEN_SNIPPET_D)
 	sh ./utilities/gen_snippet_d.sh
 
 $(FCVSNIPPETS):
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 	@utilities/fcvextract.pl $< $(subst +,\\+,$(subst @,:,$(basename $(notdir $@)))) > $@
 	@utilities/checkfcv.pl $@
 
 $(FCVSNIPPETS_VIA_LTMS):
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 	@utilities/fcvextract.pl $< $(subst +,\\+,$(subst @,:,$(basename $(notdir $@)))) > $@
 	@utilities/checkfcv.pl $@
 
 $(FCVSNIPPETS_LTMS):
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 	@utilities/reorder_ltms.pl $< > $@
 
 help-official:
a2ping-rule.mk +3 -3
index c0e170f1..2a312560 100644
@@ -30,7 +30,7 @@ ifdef A2PING
 endif
 
 $(PDFTARGETS_OF_GNUPLOT_NEEDFIXFONTS): %.pdf: %.eps
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@) (by a2ping)"
 ifndef A2PING
 	$(error $< --> $@: a2ping not found. Please install it)
 endif
@@ -43,7 +43,7 @@ endif
 	@rm -f $<i
 
 $(PDFTARGETS_OF_TEX): %.pdf: %.eps
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@) (by a2ping)"
 ifndef A2PING
 	$(error $< --> $@: a2ping not found. Please install it)
 endif
@@ -59,7 +59,7 @@ else
 endif
 
 $(PDFTARGETS_OF_EPSORIG_NOFIXFONTS) $(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@) (by a2ping)"
 ifndef A2PING
 	$(error $< --> $@: a2ping not found. Please install it)
 endif
epstopdf-rule.mk +3 -3
index 1c3a2041..8e824fbe 100644
@@ -9,7 +9,7 @@ GS_953_OR_LATER := $(shell gs --version | grep -c -E "9\.5[3-9].?")
 GS_OPT=--gsopt=-dPDFSETTINGS=/ebook
 
 $(PDFTARGETS_OF_GNUPLOT_NEEDFIXFONTS): %.pdf: %.eps
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 ifndef EPSTOPDF
 	$(error $< --> $@: epstopdf not found. Please install it)
 endif
@@ -19,7 +19,7 @@ endif
 	@rm -f $(basename $<)__.eps $(basename $<)___.eps
 
 $(PDFTARGETS_OF_TEX): %.pdf: %.eps
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 ifndef EPSTOPDF
 	$(error $< --> $@: epstopdf not found. Please install it)
 endif
@@ -33,7 +33,7 @@ endif
 	@rm -f $(basename $<)__.eps
 
 $(PDFTARGETS_OF_EPSORIG_NOFIXFONTS) $(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
-	@echo "$< --> $@"
+	@echo "$< --> $(suffix $@)"
 ifndef EPSTOPDF
 	$(error $< --> $@: epstopdf not found. Please install it)
 endif
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/3 Makefile: Promote epstopdf-rule.mk as the default

In reply to Akira Yokosawa

It turns out that recipes in epstopdf-rule.mk work reasonably well and is quicker than those in a2ping-rule.mk on most build environments tested so far.

So promote epstopdf-rule.mk as the default by inverting the conditional.

a2ping-rule.mk can still be enabled by setting a make variable "USE_A2PING" as follows:

make USE_A2PING=1

, when you need to compare the two sets of recipes.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 6083cda4..0702fdb7 100644
@@ -417,7 +417,7 @@ endif
 	@sh $(FIXANEPSFONTS) $@
 
 # .eps --> .pdf rules
-ifndef NO_A2PING
+ifdef USE_A2PING
   include a2ping-rule.mk
 else
   include epstopdf-rule.mk
Signature · 1 line
2.17.1
#4 lore raw
In reply to Akira Yokosawa
Quoted 10 lines · Akira Yokosawa

Hi Paul,

This patch set consists of updates under docker/ and Makefile.

Patch 1/3 updates Dockerfiles under docker/.
It adds a couple of font packages in Dockerfile.fedora and adds "gnuplot" and "time" commands in all three Dockerfiles.

Patch 2/3 shortens progress reports from "make".

Quoted 8 lines
    Old example: intro/PPGrelation.svg --> intro/PPGrelation.pdf
    New example: intro/PPGrelation.svg --> .pdf

Patch 3/3 switches the default "esp --> pdf" rules to those in epstopdf-rule.mk.

To see the effect of patches 2/3 and 3/3, a "make neatfreak" before "make" or "make -jN" is needed.

The shorter progress reports are nice! Queued and pushed, thank you!

Thanx, Paul

Quoted 20 lines

Thanks, Akira
--
Akira Yokosawa (3):
docker: Add some fonts and commands
Makefile: Shorten progress report (dir/filename.src --> .dst)
Makefile: Promote epstopdf-rule.mk as the default

 Makefile                 | 16 ++++++++--------
 a2ping-rule.mk           |  6 +++---
 docker/Dockerfile        |  8 +++++---
 docker/Dockerfile.bionic |  8 +++++---
 docker/Dockerfile.fedora | 11 ++++++++---
 epstopdf-rule.mk         |  6 +++---
 6 files changed, 32 insertions(+), 23 deletions(-)

base-commit: d28c5aa8c1dad57c76554743cc4e59a18d367303

Signature · 1 line
2.17.1