From 5cd2be069a418f85738e385859ae7bd4ad96dec4 Mon Sep 17 00:00:00 2001 From: "Peter D. Barnes, Jr." Date: Fri, 31 May 2013 12:03:40 -0700 Subject: [PATCH] Use a common portable pdf rescaling script. --- doc/manual/Makefile | 4 +++- doc/manual/rescale-pdf.sh | 14 -------------- doc/models/Makefile | 4 +++- doc/models/rescale-pdf.sh | 14 -------------- src/antenna/doc/Makefile | 6 ++++-- src/antenna/doc/rescale-pdf.sh | 14 -------------- src/buildings/doc/Makefile | 6 ++++-- src/buildings/doc/rescale-pdf.sh | 14 -------------- src/lte/doc/rescale-pdf.sh | 14 -------------- utils/rescale-pdf.sh | 20 ++++++++++++++++++++ 10 files changed, 34 insertions(+), 76 deletions(-) delete mode 100755 doc/manual/rescale-pdf.sh delete mode 100755 doc/models/rescale-pdf.sh delete mode 100755 src/antenna/doc/rescale-pdf.sh delete mode 100755 src/buildings/doc/rescale-pdf.sh delete mode 100755 src/lte/doc/rescale-pdf.sh create mode 100755 utils/rescale-pdf.sh diff --git a/doc/manual/Makefile b/doc/manual/Makefile index 6fac507f2..5b3c6c24c 100644 --- a/doc/manual/Makefile +++ b/doc/manual/Makefile @@ -28,12 +28,14 @@ IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF) IMAGES_TO_CLEAN = $(IMAGES_PNG_CONVERTED) $(IMAGES_PDF) $(IMAGES_EPS) +RESCALE = $(shell hg root)/utils/rescale-pdf.sh + %.eps : %.dia; $(DIA) -t eps $< -e $@ %.png : %.dia; $(DIA) -t png $< -e $@ %.png : %.eps; $(CONVERT) $< $@ %.pdf : %.eps; $(EPSTOPDF) $< -o=$@ - if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi + @if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi # You can set these variables from the command line. diff --git a/doc/manual/rescale-pdf.sh b/doc/manual/rescale-pdf.sh deleted file mode 100755 index aa775893b..000000000 --- a/doc/manual/rescale-pdf.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -TMPDIR=/tmp - -TMPFILE=`mktemp` - -echo "\documentclass{book} -\usepackage{pdfpages} -\begin{document} -\includepdf[width=${1},fitpaper]{${2}} -\end{document}" >${TMPFILE}.tex -pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null -cp ${TMPFILE}.pdf ${2} -rm -f ${TMPFILE}{,.{tex,aux,log,pdf}} diff --git a/doc/models/Makefile b/doc/models/Makefile index 70adfcb74..1769b852a 100644 --- a/doc/models/Makefile +++ b/doc/models/Makefile @@ -295,12 +295,14 @@ IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf} IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF) +RESCALE = $(shell hg root)/utils/rescale-pdf.sh + %.eps : %.dia; $(DIA) -t eps $< -e $@ %.png : %.dia; $(DIA) -t png $< -e $@ %.png : %.eps; $(CONVERT) $< $@ %.pdf : %.eps $(EPSTOPDF) $< -o=$@ - if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi + @if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi # You can set these variables from the command line. SPHINXOPTS = diff --git a/doc/models/rescale-pdf.sh b/doc/models/rescale-pdf.sh deleted file mode 100755 index aa775893b..000000000 --- a/doc/models/rescale-pdf.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -TMPDIR=/tmp - -TMPFILE=`mktemp` - -echo "\documentclass{book} -\usepackage{pdfpages} -\begin{document} -\includepdf[width=${1},fitpaper]{${2}} -\end{document}" >${TMPFILE}.tex -pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null -cp ${TMPFILE}.pdf ${2} -rm -f ${TMPFILE}{,.{tex,aux,log,pdf}} diff --git a/src/antenna/doc/Makefile b/src/antenna/doc/Makefile index 39b344b52..73050dd56 100644 --- a/src/antenna/doc/Makefile +++ b/src/antenna/doc/Makefile @@ -20,12 +20,14 @@ IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf} IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF) +RESCALE = $(shell hg root)/utils/rescale-pdf.sh + %.eps : %.dia; $(DIA) -t eps $< -e $@ %.png : %.dia; $(DIA) -t png $< -e $@ %.png : %.eps; $(CONVERT) $< $@ %.pdf : %.eps $(EPSTOPDF) $< -o=$@ - if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi + @if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi GRAPHS_PNG = ${GRAPHS_EPS:.eps=.png} GRAPHS_PDF = ${GRAPHS_EPS:.eps=.pdf} @@ -35,7 +37,7 @@ GRAPHS = $(GRAPHS_EPS) $(GRAPHS_PNG) $(GRAPHS_PDF) %.png : %.eps; $(CONVERT) $< $@ %.pdf : %.eps $(EPSTOPDF) $< -o=$@ - if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi + @if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi # You can set these variables from the command line. SPHINXOPTS = diff --git a/src/antenna/doc/rescale-pdf.sh b/src/antenna/doc/rescale-pdf.sh deleted file mode 100755 index aa775893b..000000000 --- a/src/antenna/doc/rescale-pdf.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -TMPDIR=/tmp - -TMPFILE=`mktemp` - -echo "\documentclass{book} -\usepackage{pdfpages} -\begin{document} -\includepdf[width=${1},fitpaper]{${2}} -\end{document}" >${TMPFILE}.tex -pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null -cp ${TMPFILE}.pdf ${2} -rm -f ${TMPFILE}{,.{tex,aux,log,pdf}} diff --git a/src/buildings/doc/Makefile b/src/buildings/doc/Makefile index a77c0c4ea..4e2a60034 100644 --- a/src/buildings/doc/Makefile +++ b/src/buildings/doc/Makefile @@ -20,12 +20,14 @@ IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf} IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF) +RESCALE = $(shell hg root)/utils/rescale-pdf.sh + %.eps : %.dia; $(DIA) -t eps $< -e $@ %.png : %.dia; $(DIA) -t png $< -e $@ %.png : %.eps; $(CONVERT) $< $@ %.pdf : %.eps $(EPSTOPDF) $< -o=$@; - if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi + @if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi GRAPHS_PNG = ${GRAPHS_EPS:.eps=.png} GRAPHS_PDF = ${GRAPHS_EPS:.eps=.pdf} @@ -35,7 +37,7 @@ GRAPHS = $(GRAPHS_EPS) $(GRAPHS_PNG) $(GRAPHS_PDF) %.png : %.eps; $(CONVERT) $< $@ %.pdf : %.eps $(EPSTOPDF) $< -o=$@ - if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi + @if test x$($@_width) != x; then $(RESCALE) $($@_width) $@ ; fi # You can set these variables from the command line. SPHINXOPTS = diff --git a/src/buildings/doc/rescale-pdf.sh b/src/buildings/doc/rescale-pdf.sh deleted file mode 100755 index aa775893b..000000000 --- a/src/buildings/doc/rescale-pdf.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -TMPDIR=/tmp - -TMPFILE=`mktemp` - -echo "\documentclass{book} -\usepackage{pdfpages} -\begin{document} -\includepdf[width=${1},fitpaper]{${2}} -\end{document}" >${TMPFILE}.tex -pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null -cp ${TMPFILE}.pdf ${2} -rm -f ${TMPFILE}{,.{tex,aux,log,pdf}} diff --git a/src/lte/doc/rescale-pdf.sh b/src/lte/doc/rescale-pdf.sh deleted file mode 100755 index aa775893b..000000000 --- a/src/lte/doc/rescale-pdf.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -TMPDIR=/tmp - -TMPFILE=`mktemp` - -echo "\documentclass{book} -\usepackage{pdfpages} -\begin{document} -\includepdf[width=${1},fitpaper]{${2}} -\end{document}" >${TMPFILE}.tex -pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null -cp ${TMPFILE}.pdf ${2} -rm -f ${TMPFILE}{,.{tex,aux,log,pdf}} diff --git a/utils/rescale-pdf.sh b/utils/rescale-pdf.sh new file mode 100755 index 000000000..5c7f418d4 --- /dev/null +++ b/utils/rescale-pdf.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +TMPDIR=${TMPDIR:-/tmp} + +TMPFILE=`mktemp -t $(basename ${2}).XXXXXX` + +echo "Rescaling ${2} to ${1}" + +echo " +\documentclass{book} + \usepackage{pdfpages} + \begin{document} + \includepdf[width=${1},fitpaper]{${2}} + \end{document} +" \ +>${TMPFILE}.tex + +pdflatex -output-directory ${TMPDIR} ${TMPFILE}.tex >/dev/null 2>/dev/null +cp ${TMPFILE}.pdf ${2} +rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}