sci-visualization/gnuplot: Fix building with USE="doc".
authorUlrich Müller <ulm@gentoo.org>
Sun, 19 Nov 2017 11:18:34 +0000 (12:18 +0100)
committerUlrich Müller <ulm@gentoo.org>
Sun, 19 Nov 2017 11:46:15 +0000 (12:46 +0100)
- Do not require picins.sty.
- Build documentation without figures if cairo is disabled.

Closes: https://bugs.gentoo.org/577828
Package-Manager: Portage-2.3.14, Repoman-2.3.6

sci-visualization/gnuplot/files/gnuplot-5.0.6-no-picins.patch [new file with mode: 0644]
sci-visualization/gnuplot/gnuplot-5.0.6.ebuild
sci-visualization/gnuplot/gnuplot-5.0.9999.ebuild

diff --git a/sci-visualization/gnuplot/files/gnuplot-5.0.6-no-picins.patch b/sci-visualization/gnuplot/files/gnuplot-5.0.6-no-picins.patch
new file mode 100644 (file)
index 0000000..87408ae
--- /dev/null
@@ -0,0 +1,27 @@
+Do not require picins.sty.
+https://bugs.gentoo.org/577828#c4
+
+--- gnuplot-5.0.6-orig/docs/Makefile.am
++++ gnuplot-5.0.6/docs/Makefile.am
+@@ -189,7 +189,6 @@
+         touch figures.idx ; \
+         rm -f pdffigures.tex ; \
+         ( echo "\usepackage{graphicx}" > pdffigures.tex ; \
+-          echo "\usepackage{picins}" >> pdffigures.tex ; \
+         ) ; \
+         TEXINPUTS=.:$(srcdir):$(top_srcdir):${TEXINPUTS}: $(PDFLATEX) $< ; \
+         TEXINPUTS=.:$(srcdir):$(top_srcdir):${TEXINPUTS}: $(PDFLATEX) $< ; \
+--- gnuplot-5.0.6-orig/docs/doc2tex.c
++++ gnuplot-5.0.6/docs/doc2tex.c
+@@ -170,9 +170,9 @@
+     case 'F':                 /* embedded figure */
+           if (figures) {
+               line[strlen(line)-1]=NUL;
+-              (void) fputs("\\parpic[r][rt]{\\includegraphics[width=3in,keepaspectratio]{",b);
++              (void) fputs("\\begin{figure}[htb]\n\\centering\\includegraphics[width=3in,keepaspectratio]{",b);
+               fputs(line+1, b);
+-              (void) fputs("}}\n",b);
++              (void) fputs("}\n\\end{figure}\n",b);
+           }
+           break;
index cac060cf8d00fa38f4a4a4219ba730a52e8984a6..2a7de7b82e7649be29280780ad394b08923044f3 100644 (file)
@@ -66,10 +66,10 @@ GP_VERSION="${PV%.*}"
 E_SITEFILE="lisp/50${PN}-gentoo.el"
 TEXMF="${EPREFIX}/usr/share/texmf-site"
 
-PATCHES=( "${FILESDIR}"/${PN}-5.0.1-fix-underlinking.patch )
-
 src_prepare() {
-       default
+       eapply "${FILESDIR}"/${PN}-5.0.1-fix-underlinking.patch
+       eapply "${FILESDIR}"/${PN}-5.0.6-no-picins.patch
+       eapply_user
 
        if [[ -z ${PV%%*9999} ]]; then
                local dir
@@ -162,7 +162,14 @@ src_compile() {
        if use doc; then
                # Avoid sandbox violation in epstopdf/ghostscript
                addpredict /var/cache/fontconfig
-               emake -C docs gnuplot.pdf
+               if use cairo; then
+                       emake -C docs pdf
+               else
+                       ewarn "Cannot build figures unless cairo is enabled."
+                       ewarn "Building documentation without figures."
+                       emake -C docs pdf_nofig
+                       mv docs/nofigures.pdf docs/gnuplot.pdf || die
+               fi
                emake -C tutorial pdf
        fi
 }
index e06fd330630bb6e94745288a982e664e6f63f58b..ef281474464ec58a22dd8c1269ee8e4efb0edacd 100644 (file)
@@ -66,10 +66,10 @@ GP_VERSION="${PV%.*}"
 E_SITEFILE="lisp/50${PN}-gentoo.el"
 TEXMF="${EPREFIX}/usr/share/texmf-site"
 
-PATCHES=( "${FILESDIR}"/${PN}-5.0.1-fix-underlinking.patch )
-
 src_prepare() {
-       default
+       eapply "${FILESDIR}"/${PN}-5.0.1-fix-underlinking.patch
+       eapply "${FILESDIR}"/${PN}-5.0.6-no-picins.patch
+       eapply_user
 
        if [[ -z ${PV%%*9999} ]]; then
                local dir
@@ -162,7 +162,14 @@ src_compile() {
        if use doc; then
                # Avoid sandbox violation in epstopdf/ghostscript
                addpredict /var/cache/fontconfig
-               emake -C docs gnuplot.pdf
+               if use cairo; then
+                       emake -C docs pdf
+               else
+                       ewarn "Cannot build figures unless cairo is enabled."
+                       ewarn "Building documentation without figures."
+                       emake -C docs pdf_nofig
+                       mv docs/nofigures.pdf docs/gnuplot.pdf || die
+               fi
                emake -C tutorial pdf
        fi
 }