Rebuild for poppler-0.84.0

Don't include C++ headers in C sources.

Temporarily break circular dependency on texlive-latex (will be reverted).
This commit is contained in:
Marek Kasik 2020-01-17 21:03:50 +01:00
parent 17c631588e
commit b9d1edaff6
2 changed files with 283 additions and 2 deletions

View File

@ -0,0 +1,259 @@
--- texlive-base-20190410/source/texk/web2c/pdftexdir/pdftoepdf.cc
+++ texlive-base-20190410/source/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -26,6 +26,15 @@ The poppler should be 0.59.0 or newer ve
POPPLER_VERSION should be defined.
*/
+#ifdef POPPLER_VERSION
+#include <poppler-config.h>
+#define xpdfVersion POPPLER_VERSION
+#define xpdfString "poppler"
+#else
+#include <xpdf/config.h> /* just to get the xpdf version */
+#define xpdfString "xpdf"
+#endif
+
/* Do this early in order to avoid a conflict between
MINGW32 <rpcndr.h> defining 'boolean' as 'unsigned char' and
<kpathsea/types.h> defining Pascal's boolean as 'int'.
@@ -292,7 +292,7 @@ static void copyDictEntry(Object * obj,
Object obj1;
copyName(obj->dictGetKey(i));
pdf_puts(" ");
- obj1 = obj->dictGetValNF(i);
+ obj1 = obj->dictGetValNF(i).copy();
copyObject(&obj1);
pdf_puts("\n");
}
@@ -351,7 +351,7 @@ static void copyProcSet(Object * obj)
obj->getTypeName());
pdf_puts("/ProcSet [ ");
for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
- procset = obj->arrayGetNF(i);
+ procset = obj->arrayGetNF(i).copy();
if (!procset.isName())
pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
procset.getTypeName());
@@ -406,7 +406,7 @@ static void copyFont(const char *tag, Ob
if (fontdict.isDict()) {
subtype = fontdict.dictLookup("Subtype");
basefont = fontdict.dictLookup("BaseFont");
- fontdescRef = fontdict.dictLookupNF("FontDescriptor");
+ fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
if (fontdescRef.isRef()) {
fontdesc = fontdescRef.fetch(xref);
}
@@ -452,7 +452,7 @@ static void copyFontResources(Object * o
obj->getTypeName());
pdf_puts("/Font << ");
for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
- fontRef = obj->dictGetValNF(i);
+ fontRef = obj->dictGetValNF(i).copy();
if (fontRef.isRef())
copyFont(obj->dictGetKey(i), &fontRef);
else if (fontRef.isDict()) { // some programs generate pdf with embedded font object
@@ -595,7 +595,7 @@ static void copyObject(Object * obj)
} else if (obj->isArray()) {
pdf_puts("[");
for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
- obj1 = obj->arrayGetNF(i);
+ obj1 = obj->arrayGetNF(i).copy();
if (!obj1.isName())
pdf_puts(" ");
copyObject(&obj1);
@@ -723,7 +723,7 @@ read_pdf_info(char *image_name, char *pa
#endif
// initialize
if (!isInit) {
- globalParams = new GlobalParams();
+ globalParams = std::unique_ptr<GlobalParams>(new GlobalParams());
globalParams->setErrQuiet(false);
isInit = true;
}
@@ -761,7 +761,7 @@ read_pdf_info(char *image_name, char *pa
if (link == 0 || !link->isOk())
pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
Ref ref = link->getPageRef();
- page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
+ page_num = pdf_doc->doc->getCatalog()->findPage(ref);
if (page_num == 0)
pdftex_fail("PDF inclusion: destination is not a page <%s>",
page_name);
@@ -921,13 +921,13 @@ void write_epdf(void)
pdf_puts(stripzeros(s));
// Metadata validity check (as a stream it must be indirect)
- dictObj = pageDict->lookupNF("Metadata");
+ dictObj = pageDict->lookupNF("Metadata").copy();
if (!dictObj.isNull() && !dictObj.isRef())
pdftex_warn("PDF inclusion: /Metadata must be indirect object");
// copy selected items in Page dictionary except Resources & Group
for (i = 0; pageDictKeys[i] != NULL; i++) {
- dictObj = pageDict->lookupNF(pageDictKeys[i]);
+ dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
if (!dictObj.isNull()) {
pdf_newline();
pdf_printf("/%s ", pageDictKeys[i]);
@@ -936,7 +936,7 @@ void write_epdf(void)
}
// handle page group
- dictObj = pageDict->lookupNF("Group");
+ dictObj = pageDict->lookupNF("Group").copy();
if (!dictObj.isNull()) {
if (pdfpagegroupval == 0) {
// another pdf with page group was included earlier on the
@@ -978,7 +978,7 @@ The changes below seem to work fine.
l = dic1.getLength();
for (i = 0; i < l; i++) {
groupDict.dictAdd(dic1.getKey(i),
- dic1.getValNF(i));
+ dic1.getValNF(i).copy());
}
// end modification
pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
@@ -1108,6 +1108,6 @@ void epdf_check_mem()
delete_document(p);
}
// see above for globalParams
- delete globalParams;
+ globalParams.reset();
}
}
--- texlive-base-20190410/source/texk/web2c/pdftexdir/pdftosrc.cc
+++ texlive-base-20190410/source/texk/web2c/pdftexdir/pdftosrc.cc
@@ -24,6 +24,15 @@ by Arch Linux. The poppler should be 0.5
POPPLER_VERSION should be defined.
*/
+#ifdef POPPLER_VERSION
+#include <poppler-config.h>
+#define xpdfVersion POPPLER_VERSION
+#define xpdfString "poppler"
+#else
+#include <xpdf/config.h> /* just to get the xpdf version */
+#define xpdfString "xpdf"
+#endif
+
#include <w2c/config.h>
#include <stdlib.h>
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
exit(1);
}
fileName = new GString(argv[1]);
- globalParams = new GlobalParams();
+ globalParams = std::unique_ptr<GlobalParams>(new GlobalParams());
doc = new PDFDoc(fileName);
if (!doc->isOk()) {
fprintf(stderr, "Invalid PDF file\n");
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
if (objnum == 0) {
srcStream = catalogDict.dictLookup("SourceObject");
static char const_SourceFile[] = "SourceFile";
- if (!srcStream.isStream(const_SourceFile)) {
+ if (!(srcStream.isStream() && srcStream.getDict()->is(const_SourceFile))) {
fprintf(stderr, "No SourceObject found\n");
exit(1);
}
@@ -156,7 +156,6 @@ int main(int argc, char *argv[])
(e->type == xrefEntryFree ? "f" : "n"));
else { // e->offset is the object number of the object stream
Stream *str;
- Lexer *lexer;
Parser *parser;
Object objStr, obj1, obj2;
int nObjects, first, n;
@@ -174,8 +173,7 @@ int main(int argc, char *argv[])
// parse the header: object numbers and offsets
objStr.streamReset();
str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
- lexer = new Lexer(xref, str);
- parser = new Parser(xref, lexer, false);
+ parser = new Parser(xref, str, false);
for (n = 0; n < nObjects; ++n) {
obj1 = parser->getObj();
obj2 = parser->getObj();
@@ -207,5 +207,5 @@ int main(int argc, char *argv[])
fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
fclose(outfile);
delete doc;
- delete globalParams;
+ globalParams.reset();
}
--- texlive-base-20190410/source/texk/web2c/pdftexdir/utils.c
+++ texlive-base-20190410/source/texk/web2c/pdftexdir/utils.c
@@ -32,14 +32,6 @@ with this program. If not, see <http://
#include <zlib.h>
#include "ptexlib.h"
#include <png.h>
-#ifdef POPPLER_VERSION
-#include <poppler-config.h>
-#define xpdfVersion POPPLER_VERSION
-#define xpdfString "poppler"
-#else
-#include <xpdf/config.h> /* just to get the xpdf version */
-#define xpdfString "xpdf"
-#endif
#define check_nprintf(size_get, size_want) \
if ((unsigned)(size_get) >= (unsigned)(size_want)) \
@@ -977,12 +969,10 @@ void initversionstring(char **versions)
{
const_string fmt =
"Compiled with libpng %s; using libpng %s\n"
- "Compiled with zlib %s; using zlib %s\n"
- "Compiled with %s version %s\n";
+ "Compiled with zlib %s; using zlib %s\n";
size_t len = strlen(fmt)
+ strlen(PNG_LIBPNG_VER_STRING) + strlen(png_libpng_ver)
+ strlen(ZLIB_VERSION) + strlen(zlib_version)
- + strlen(xpdfString) + strlen(xpdfVersion)
+ 1;
/* len will be more than enough, because of the placeholder chars in fmt
@@ -990,7 +980,7 @@ void initversionstring(char **versions)
*versions = xmalloc(len);
sprintf(*versions, fmt,
PNG_LIBPNG_VER_STRING, png_libpng_ver,
- ZLIB_VERSION, zlib_version, xpdfString, xpdfVersion);
+ ZLIB_VERSION, zlib_version);
}
--- texlive-base-20190410/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ texlive-base-20190410/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -38,7 +38,6 @@ authorization from the copyright holders
#include <w2c/config.h>
-#include <poppler-config.h>
#include <png.h>
#include <zlib.h>
#include <graphite2/Font.h>
@@ -167,7 +166,6 @@ void initversionstring(char **versions)
"Compiled with Graphite2 version %d.%d.%d; using %d.%d.%d\n"
"Compiled with HarfBuzz version %s; using %s\n"
"Compiled with libpng version %s; using %s\n"
- "Compiled with poppler version %s\n"
#ifdef XETEX_MAC
"Using Mac OS X Core Text and Cocoa frameworks\n"
#else
@@ -184,7 +182,6 @@ void initversionstring(char **versions)
+ strlen(hb_version_string())
+ strlen(PNG_LIBPNG_VER_STRING)
+ strlen(png_libpng_ver)
- + strlen(POPPLER_VERSION)
#ifndef XETEX_MAC
+ 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */
#endif
@@ -214,7 +211,7 @@ void initversionstring(char **versions)
GR2_VERSION_MAJOR, GR2_VERSION_MINOR, GR2_VERSION_BUGFIX,
grMajor, grMinor, grBugfix,
HB_VERSION_STRING, hb_version_string(),
- PNG_LIBPNG_VER_STRING, png_libpng_ver, POPPLER_VERSION
+ PNG_LIBPNG_VER_STRING, png_libpng_ver
#ifndef XETEX_MAC
,
FC_VERSION / 10000, (FC_VERSION % 10000) / 100, FC_VERSION % 100,

View File

@ -17,7 +17,7 @@
Name: %{shortname}-base
Version: %{source_date}
Release: 7%{?dist}
Release: 8%{?dist}
Epoch: 7
Summary: TeX formatting system
# The only files in the base package are directories, cache, and license texts
@ -431,6 +431,7 @@ Patch20: texlive-20190410-dvisvgm-fix-libgs-detection.patch
Patch21: texlive-20190410-tlmgr-ignore-warning.patch
# Fix latex-papersize for python3 (thanks to upstream)
Patch22: texlive-base-latex-papersize-py3.patch
Patch23: texlive-base-20190410-poppler-0.84.patch
# Can't do this because it causes everything else to be noarch
@ -451,8 +452,10 @@ BuildRequires: gmp-devel mpfr-devel
# This is really for macros.
BuildRequires: python3-devel
# This is for xindy
%if 0
BuildRequires: clisp-devel
BuildRequires: texlive-cyrillic, texlive-latex, texlive-metafont, texlive-cm-super, texlive-ec
%endif
# Cleanup Provides/Obsoletes
# texlive-cjk-gs-integrate (depackaged 2018-03-09)
Provides: texlive-cjk-gs-integrate = %{epoch}:%{source_date}-%{release}
@ -6443,6 +6446,7 @@ BuildArch: noarch
%description -n %{shortname}-xindex
Unicode compatible index program for LaTeX.
%if 0
%package -n %{shortname}-xindy
Provides: tex-xindy = %{epoch}:%{source_date}-%{release}
Provides: tex-xindy-bin = %{epoch}:%{source_date}-%{release}
@ -6467,6 +6471,7 @@ Xindy can be used to process indexes for documents marked up
using (La)TeX, Nroff family and SGML-based languages. Xindy is
highly configurable, both in markup terms and in terms of the
collating order of the text being processed.
%endif
%package -n %{shortname}-xmltex
Provides: tex-xmltex = %{epoch}:%{source_date}-%{release}
@ -6548,6 +6553,7 @@ xz -dc %{SOURCE0} | tar x
%endif
%patch19 -p1 -b .shh
%patch20 -p1 -b .fix-libgs-detection
%patch23 -p1 -b .poppler-0.84
# Setup copies of the licenses
for l in `unxz -c %{SOURCE3} | tar t`; do
@ -6560,6 +6566,7 @@ done
%global mysources %{lua: for index,value in ipairs(sources) do if index >= 16 then print(value.." ") end end}
%build
%if 0
# Make texlive generate latex.fmt, so that multiple threads do not race to
# make it during the xindy build.
cat > dummy.tex << EOF
@ -6570,6 +6577,7 @@ This is a document.
EOF
latex dummy.tex
rm -f dummy.*
%endif
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Werror=format-security"
export CXXFLAGS="$RPM_OPT_FLAGS -std=c++11 -fno-strict-aliasing -Werror=format-security"
@ -6593,7 +6601,7 @@ cd work
%ifarch aarch64 %{mips} %{power64} s390 s390x
--disable-luajittex --disable-mfluajit \
%endif
--enable-xindy --disable-xindy-docs --disable-xindy-make-rules \
--disable-xindy --disable-xindy-docs --disable-xindy-make-rules \
--disable-rpath
# disable rpath
@ -6863,6 +6871,13 @@ cp -R %{buildroot}%{_texdir}/texmf-dist/doc/man %{buildroot}%{_datadir}/
find %{buildroot}%{_texdir}/texmf-dist/doc/man -type f | xargs rm -f
mv %{buildroot}%{_texdir}/texmf-dist/doc/info/* %{buildroot}%{_infodir}/
rm -rf %{buildroot}%{_mandir}/man1/xindy.1*
rm -rf %{buildroot}%{_mandir}/man1/texindy.1*
rm -rf %{buildroot}%{_mandir}/man1/tex2xindy.1*
rm -rf %{buildroot}%{_texdir}/texmf-dist/scripts/xindy
rm -rf %{buildroot}%{_texdir}/texmf-dist/xindy
rm -rf %{buildroot}%{_texdir}/texmf-dist/doc/xindy
# Remove cjk-gs-integrate files
# Yes, we probably should remove the source, but there is a possibility that we will
# re-add this subpackage at some point.
@ -9004,6 +9019,7 @@ done <<< "$list"
%{_texdir}/texmf-dist/tex/lualatex/xindex/
%doc %{_texdir}/texmf-dist/doc/lualatex/xindex/
%if 0
%files -n %{shortname}-xindy
%license gpl.txt
%{_bindir}/tex2xindy
@ -9016,6 +9032,7 @@ done <<< "$list"
%{_texdir}/texmf-dist/scripts/xindy/
%{_texdir}/texmf-dist/xindy/
%doc %{_texdir}/texmf-dist/doc/xindy/
%endif
%files -n %{shortname}-xmltex
%license lppl1.txt
@ -9033,6 +9050,11 @@ done <<< "$list"
%doc %{_texdir}/texmf-dist/doc/latex/yplan/
%changelog
* Fri Jan 17 2020 Marek Kasik <mkasik@redhat.com> - 7:20190410-8
- Rebuild for poppler-0.84.0
- Don't include C++ headers in C sources
- Temporarily break circular dependency on texlive-latex (will be reverted)
* Fri Jan 10 2020 Tom Callaway <spot@fedoraproject.org> - 7:20190410-7
- fix python3 issue with pdfbook2 (thanks to "Mildred", bz1733794)
- fix python3 issue with latex-papersize (thanks to Silas S. Brown, bz1783964)