diff --git a/0001-Use-native-fig2dev-pdf-output-instead-of-epstopdf.patch b/0001-Use-native-fig2dev-pdf-output-instead-of-epstopdf.patch new file mode 100644 index 0000000..8da547c --- /dev/null +++ b/0001-Use-native-fig2dev-pdf-output-instead-of-epstopdf.patch @@ -0,0 +1,91 @@ +From d5ac48eaed1c0303df8b983d55fde064e7474c57 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Sat, 18 Mar 2023 04:43:44 +0100 +Subject: [PATCH] Use native fig2dev pdf output instead of epstopdf + +--- + fig2dev/dev/genpstex.c | 5 +---- + fig2mpdf/fig2mpdf | 35 +++++++++-------------------------- + 2 files changed, 10 insertions(+), 30 deletions(-) + +diff --git a/fig2dev/dev/genpstex.c b/fig2dev/dev/genpstex.c +index bb081fd..5999e03 100644 +--- a/fig2dev/dev/genpstex.c ++++ b/fig2dev/dev/genpstex.c +@@ -279,10 +279,7 @@ int depth; + sprintf(szFileName + iLength, "%03d", iObjectsFileNumber++); + fprintf(ptCreateFile, "if [ \"$iOptRemove\" == \"\" ]; then\n"); + if (iPdfOutputs) +- { +- fprintf(ptCreateFile, " %s -L pstex -D +%d:%d %s", prog, depth, iStartDepth, from); +- fprintf(ptCreateFile, " | epstopdf -f > %s.pdf\n", szFileName); +- } ++ fprintf(ptCreateFile, "%s -L pdftex -D +%d:%d %s %s.pdf\n", prog, depth, iStartDepth, from, szFileName); + else + fprintf(ptCreateFile, "%s -L pstex -D +%d:%d %s %s.eps\n", prog, depth, iStartDepth, from, szFileName); + fprintf(ptCreateFile, "else\n rm -f %s.", szFileName); +diff --git a/fig2mpdf/fig2mpdf b/fig2mpdf/fig2mpdf +index 39cc4aa..db6727b 100644 +--- a/fig2mpdf/fig2mpdf ++++ b/fig2mpdf/fig2mpdf +@@ -14,7 +14,6 @@ BEGIN { + cmdMv = "mv" + cmdLatex = "latex"; + cmdPdftex = "pdflatex"; +- cmdEpsToPdf = "epstopdf"; + cmdDvips = "dvips"; + cmdFig2dev = "fig2dev"; + cmdTouch = "touch"; +@@ -374,40 +373,24 @@ function fnGetDepth (iControl) + ######################################################################### + ######################################################################### + function fnDoNormalFig(szFileNameBase, szFigFile, szRangeList, iPdf, +- szEpsFile, szPdfFile, szTargetFile, szCommand) ++ szOutFile, szTargetFile, szCommand) + { + + debug("FileNameBase >%s< FigFile >%s< Pdf:%d\n", szFileNameBase, szFigFile, iPdf); + + if (iPdf) +- szEpsFile = sprintf("%s%s.eps", szTmpPrefix, szFileNameBase); ++ szOutFile = sprintf("%s.pdf", szFileNameBase); + else +- { +- szEpsFile = sprintf("%s.eps", szFileNameBase); +- szTargetFile = szEpsFile; +- } +- +- szCommand = sprintf("%s -L eps %s %s %s 2> /dev/null", cmdFig2dev, szRangeList, szFigFile, szEpsFile); +- debug("%s\n", szCommand); +- system(szCommand); ++ szOutFile = sprintf("%s.eps", szFileNameBase); ++ szTargetFile = szOutFile; + + if (iPdf) +- { +- szPdfFile = sprintf("%s.pdf", szFileNameBase); +- szTargetFile = szPdfFile; +- szCommand = sprintf("%s --outfile=%s %s", cmdEpsToPdf, szPdfFile, szEpsFile); +- debug("%s\n", szCommand); +- system(szCommand); +- +- +- if ( ! aOptions["d"]) +- { +- szCommand = sprintf("%s -f %s", cmdRm, szEpsFile); +- debug("%s\n", szCommand); +- system(szCommand); +- } +- } ++ szCommand = sprintf("%s -L pdf %s %s %s 2> /dev/null", cmdFig2dev, szRangeList, szFigFile, szOutFile); ++ else ++ szCommand = sprintf("%s -L eps %s %s %s 2> /dev/null", cmdFig2dev, szRangeList, szFigFile, szOutFile); + ++ debug("%s\n", szCommand); ++ system(szCommand); + + return (szTargetFile); + } +-- +2.39.2 + diff --git a/fig2dev-3.2.6-fig2mpdf.patch b/fig2dev-3.2.6-fig2mpdf.patch index 2dfea27..e9f100c 100644 --- a/fig2dev-3.2.6-fig2mpdf.patch +++ b/fig2dev-3.2.6-fig2mpdf.patch @@ -11,10 +11,11 @@ diff --git a/fig2dev/dev/genpstex.c b/fig2dev/dev/genpstex.c --- a/fig2dev/dev/genpstex.c +++ b/fig2dev/dev/genpstex.c -@@ -47,9 +47,12 @@ +@@ -46,9 +46,13 @@ + #include #include - #include ++#include +#include #include "fig2dev.h" diff --git a/fig2dev-3.2.6a-RGBFILE.patch b/fig2dev-3.2.6a-RGBFILE.patch deleted file mode 100644 index b0f7ec9..0000000 --- a/fig2dev-3.2.6a-RGBFILE.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Roland Rosenfeld -Subject: rgb.txt can not be located via FIG2DEV_RGBFILE environment variable. - This allows one to run the test suite without the package being - installed before. - ---- - fig2dev/colors.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - ---- a/fig2dev/colors.c -+++ b/fig2dev/colors.c 2019-10-29 11:03:32.206632962 +0000 -@@ -730,8 +730,13 @@ read_colordb(void) - FILE *fp; - #define MAX_LINE 100 - char s[MAX_LINE], s1[MAX_LINE]; -+ char *rgbfile; - -- fp = fopen(RGB_FILE, "r"); -+ rgbfile = getenv("FIG2DEV_RGBFILE"); -+ if (rgbfile == NULL) { -+ rgbfile = RGB_FILE; -+ } -+ fp = fopen(rgbfile, "r"); - if (fp == NULL) { - Xcolors = defaultXcolors; - numXcolors = sizeof(defaultXcolors) / sizeof(struct color_db); diff --git a/transfig-3.2.8.dif b/transfig-3.2.8.dif index 8f84101..02b27ed 100644 --- a/transfig-3.2.8.dif +++ b/transfig-3.2.8.dif @@ -91,32 +91,6 @@ } #endif /* I18N */ ---- fig2dev/dev/genpstex.c -+++ fig2dev/dev/genpstex.c 2021-02-12 09:17:16.360300734 +0000 -@@ -46,6 +46,7 @@ - - #include - #include -+#include - - #include "fig2dev.h" - #include "object.h" -@@ -62,10 +63,13 @@ extern void - genps_spline(F_spline *s), - genlatex_option(char opt, char *optarg), - genlatex_text(F_text *t), -- genps_text(F_text *t); -+ genps_text(F_text *t), -+ genpdf_option(char opt, char *optarg), -+ genpdf_start(F_compound *objects); - extern int - genlatex_end(void), -- genps_end(void); -+ genps_end(void), -+ genpdf_end(void); - - extern void genpdf_option(char opt, char *optarg); /* genpdf.c */ - extern void genpdf_start(F_compound *objects); /* genpdf.c */ --- fig2dev/fig2ps2tex.csh +++ fig2dev/fig2ps2tex.csh 2021-02-12 08:54:37.954704887 +0000 @@ -22,7 +22,7 @@ @@ -128,28 +102,6 @@ set bbox = `grep "^%%BoundingBox:" $1` set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc` ---- fig2dev/lib/getopt.c -+++ fig2dev/lib/getopt.c 2021-02-12 08:54:37.954704887 +0000 -@@ -42,6 +42,7 @@ - #define EMSG "" - #define ENDARGS "--" - -+#ifndef __GLIBC__ - /* - * get option letter from argument vector - */ -@@ -88,3 +89,11 @@ getopt(int nargc, char **nargv, const ch - } - return optc; /* dump back option letter */ - } -+#else -+#include -+int -+fig_getopt(int nargc, char * const nargv[], const char *ostr) -+{ -+ return getopt(nargc, nargv, ostr); -+} -+#endif --- transfig/transfig.c +++ transfig/transfig.c 2021-02-12 08:54:37.954704887 +0000 @@ -26,6 +26,8 @@ diff --git a/transfig.changes b/transfig.changes index d7ede82..6fd2f21 100644 --- a/transfig.changes +++ b/transfig.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Sat Mar 18 04:27:12 UTC 2023 - Stefan Brüns + +- Drop obsolete fig2dev-3.2.6a-RGBFILE.patch. +- Set correct path for X11 rgb.txt file (no longer in /etc), + recommend rgb package. +- Fix typo for enable-scale-pict2e option. +- Remove obsolsete hunks from transfig-3.2.8.dif, + rebase fig2dev-3.2.6-fig2mpdf.patch. +- Avoid epstopdf dependency, add + 0001-Use-native-fig2dev-pdf-output-instead-of-epstopdf.patch + This also fixes unreproducible figures created by fig2mpdf. +- Fix CFLAGS checks, -Wformat-security requires -Wformat. + ------------------------------------------------------------------- Thu Mar 9 19:39:39 UTC 2023 - Stefan Brüns diff --git a/transfig.spec b/transfig.spec index 3d50896..b780d71 100644 --- a/transfig.spec +++ b/transfig.spec @@ -31,8 +31,8 @@ Patch1: 1b09a8.patch Patch4: transfig-fix-afl.patch Patch43: fig2dev-3.2.6-fig2mpdf.patch Patch44: fig2dev-3.2.6-fig2mpdf-doc.patch -Patch45: fig2dev-3.2.6a-RGBFILE.patch Patch46: 0001-Make-ModDate-and-CreationDate-in-PDF-reproducible.patch +Patch47: 0001-Use-native-fig2dev-pdf-output-instead-of-epstopdf.patch BuildRequires: fdupes BuildRequires: libjpeg-devel BuildRequires: libpng-devel @@ -41,28 +41,20 @@ BuildRequires: sharutils #!BuildIgnore: texlive-tex4ht BuildRequires: texlive-courier BuildRequires: texlive-latex -%if 0%{?suse_version} > 1315 -BuildRequires: texlive-epstopdf -%endif BuildRequires: texlive-pdftex BuildRequires: texlive-times +BuildRequires: pkgconfig(xpm) BuildRequires: tex(8r.enc) BuildRequires: tex(beamer.cls) -%if 0%{?suse_version} > 1315 BuildRequires: tex(german.sty) -%endif -BuildRequires: pkgconfig(xpm) BuildRequires: tex(multimedia.sty) BuildRequires: tex(times.sty) BuildRequires: tex(xmpmulti.sty) Provides: fig2dev +Requires: netpbm Recommends: ghostscript-fonts-std Recommends: ghostscript-library -Requires: netpbm -Recommends: texlive-epstopdf -%if 0%{?suse_version} > 1315 -Requires: (texlive-epstopdf if texlive-latex) -%endif +Recommends: rgb %description TransFig is a set of tools for creating TeX documents with graphics @@ -82,8 +74,10 @@ find -type f -exec chmod a-x,go-w '{}' \; %patch4 -p1 -b .afl %patch43 -p1 -b .mpdf %patch44 -p1 -b .mpdfdoc -%patch45 -p1 -b .p45 %patch46 -p1 -b .pdfmark +%patch47 -p1 -b .epstopdf +# remove obsolete libc fallback implementations +rm fig2dev/lib/*.c %build ulimit -v unlimited || : @@ -110,10 +104,10 @@ ulimit -v unlimited || : ;; *) if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then - eval $var=\${$var:+\$$var\ }$flag + eval $var=\${$var:+\$$var\ }\' $flag \' fi if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then - eval $var=\${$var:+\$$var\ }$flag + eval $var=\${$var:+\$$var\ }\' $flag \' fi esac } @@ -121,12 +115,13 @@ ulimit -v unlimited || : CC=gcc CFLAGS="%{optflags} -fno-strict-aliasing -w -D_GNU_SOURCE -std=gnu99 $(getconf LFS_CFLAGS)" cflags -D_FORTIFY_SOURCE=2 CFLAGS +cflags -D_FORTIFY_SOURCE=3 CFLAGS cflags -fstack-protector CFLAGS cflags -fstack-protector-strong CFLAGS cflags -fstack-protector-all CFLAGS cflags -Wformat CFLAGS -cflags -Wformat-security CFLAGS -cflags -Werror=format-security CFLAGS +cflags "-Wformat -Wformat-security" CFLAGS +cflags "-Wformat -Werror=format-security" CFLAGS cflags -fPIE CFLAGS cflags -pie LDFLAGS cflags -Wl,-z,relro LDFLAGS @@ -136,7 +131,8 @@ chmod 755 configure %configure \ --docdir=%{_defaultdocdir}/%{name} \ --enable-transfig \ - --enable-scale-pic2t2e + --enable-scale-pict2e \ + --with-rgbfile=%{_datadir}/X11/rgb.txt %make_build CCOPTIONS="$CFLAGS" pushd transfig/doc @@ -147,12 +143,10 @@ pushd transfig/doc popd pushd fig2mpdf/doc -%if 0%{?suse_version} > 1315 make while $(grep -q -i 'rerunfilecheck.*warning' sample-presentation.log); do pdflatex sample-presentation done -%endif mkdir htmlimg (cd htmlimg; uudecode ../*.uue) popd @@ -172,9 +166,7 @@ pushd fig2mpdf/doc install -m 0644 *.{html,css,lfig} %{buildroot}%{_defaultdocdir}/%{name}/fig2mpdf/ install -m 0644 htmlimg/*.{jpg,gif,pdf} %{buildroot}%{_defaultdocdir}/%{name}/fig2mpdf/ install -m 0644 sample-presentation.tex Makefile %{buildroot}%{_defaultdocdir}/%{name}/fig2mpdf/ -%if 0%{?suse_version} > 1315 install -m 0644 sample-presentation.pdf %{buildroot}%{_defaultdocdir}/%{name}/fig2mpdf/ -%endif popd %fdupes %{buildroot}